欢迎来到天天文库
浏览记录
ID:27970889
大小:76.00 KB
页数:6页
时间:2018-12-07
《1.2. For Windows.doc》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、1.2.ForWindows 要在Windows环境下使用SystemC,需要标准的C++编译器。在这里,我们统一使用VC++6.0。以下的操作都本地已经安装了VC++6.0。1、进入SystemC安装目录下的msvc60SystemC子目录,如:C:systemc-2.1.v1msvc60SystemC2、双击SystemC.dsw,VC++6.0会自动运行3、点击或按ctrl+F5,开始编译SytemC.lib。编译过程的最后会询问exe文件的名字,选择Cancel。 经过以上的步骤,在syste
2、mc-2.1.v1msvc60SystemCDebug目录下,会生成SytemC.lib这个文件。安装完成。2.SystemCDesignExample2.1.ModuleDesign 本文以AMBA协议中AHB上的ResetController的设计为例子,具体说明SystemC的设计流程。2.1.1.IntroductiontoResetController 当外部复位指示POReset信号到来时,Resetcontroller产生系统的复位信号。其结构如下图:2.1.2.SignalDescri
3、ptions2.1.3.Functionandoperations POReset是个异步复位的指示信号。HRESETn对POReset打了三拍以消除亚稳态。以下是时序示意图: 在这里,我们用一个状态机来完成打三拍的操作,状态机状态转换示意图如下: 下图是ResetController的电路示意图:2.1.4.SystemCSourceCode/******************************************************Filename:rst_ctrl.hAuth
4、er:Richeal.LiDate:2006-09-08******************************************************/#include"systemc.h"SC_MODULE(rst_ctrl){sc_inHCLK;sc_inPOReset;sc_outHRESETn;enumstate_type{ST_POR=0x1,ST_INI1=0x2,ST_INI2=0x3,ST_RUN=0x4};sc_signal5、pe>rst_state;voidprc_rst_ctrl();SC_CTOR(rst_ctrl){ SC_METHOD(prc_rst_ctrl); sensitive_pos<6、*******************************/#include"rst_ctrl.h"voidrst_ctrl::prc_rst_ctrl(){if(!POReset.read()){rst_state=ST_POR;HRESETn=0;}elseswitch(rst_state){caseST_POR:HRESETn=0;rst_state=ST_INI1;break;caseST_INI1:HRESETn=0;rst_state=ST_INI2;break;caseST_INI2:HRE7、SETn=0;rst_state=ST_RUN;break;caseST_RUN:HRESETn=1;rst_state=ST_RUN;break;default:HRESETn=1;rst_state=ST_RUN;break;}}2.2.TestbenchDesign为了验证设计的正确性,我们还需要编写Testbench。因为设计非常简单,这里的Testbench只做以下两件事情:1、产生激励;2、保存波形2.2.1.GeneratePOReset/****************************8、**************************Filename:gen_poreset.hAuther:Richeal.LiDate:2006-09-08******************************************************/#include"systemc.h"SC_MODULE(gen_poreset){sc_outPOReset;void
5、pe>rst_state;voidprc_rst_ctrl();SC_CTOR(rst_ctrl){ SC_METHOD(prc_rst_ctrl); sensitive_pos<6、*******************************/#include"rst_ctrl.h"voidrst_ctrl::prc_rst_ctrl(){if(!POReset.read()){rst_state=ST_POR;HRESETn=0;}elseswitch(rst_state){caseST_POR:HRESETn=0;rst_state=ST_INI1;break;caseST_INI1:HRESETn=0;rst_state=ST_INI2;break;caseST_INI2:HRE7、SETn=0;rst_state=ST_RUN;break;caseST_RUN:HRESETn=1;rst_state=ST_RUN;break;default:HRESETn=1;rst_state=ST_RUN;break;}}2.2.TestbenchDesign为了验证设计的正确性,我们还需要编写Testbench。因为设计非常简单,这里的Testbench只做以下两件事情:1、产生激励;2、保存波形2.2.1.GeneratePOReset/****************************8、**************************Filename:gen_poreset.hAuther:Richeal.LiDate:2006-09-08******************************************************/#include"systemc.h"SC_MODULE(gen_poreset){sc_outPOReset;void
6、*******************************/#include"rst_ctrl.h"voidrst_ctrl::prc_rst_ctrl(){if(!POReset.read()){rst_state=ST_POR;HRESETn=0;}elseswitch(rst_state){caseST_POR:HRESETn=0;rst_state=ST_INI1;break;caseST_INI1:HRESETn=0;rst_state=ST_INI2;break;caseST_INI2:HRE
7、SETn=0;rst_state=ST_RUN;break;caseST_RUN:HRESETn=1;rst_state=ST_RUN;break;default:HRESETn=1;rst_state=ST_RUN;break;}}2.2.TestbenchDesign为了验证设计的正确性,我们还需要编写Testbench。因为设计非常简单,这里的Testbench只做以下两件事情:1、产生激励;2、保存波形2.2.1.GeneratePOReset/****************************
8、**************************Filename:gen_poreset.hAuther:Richeal.LiDate:2006-09-08******************************************************/#include"systemc.h"SC_MODULE(gen_poreset){sc_outPOReset;void
此文档下载收益归作者所有