systemC的仿真平台书写

测试平台的功能一般为:
(1) 产生激励信号驱动dut(design  under   test)
(2) 记录信号的输出,并与期望值进行比较

Screenshot from 2018-07-07 09-48-16.png

main.cpp文件的格式:

include headfiles
int sc_main(int argc ,char * argv[]){
    *** Statements of signals *** //  for connections of the instances 
    
    *** Statemenst of the clk *** //  module generated or use sc_clock
    
    *** Statemenst of the MONITOR and DUT ***
    
    *** Create trace files ***
    ***  add vars to trace ***
    
    ***  start simulation ***
    
    ***  close the vcd file ***
    
    return 0 ;
}



仿真语句控制语句
    sc_clock :   声明为一个标准的时钟,可改变周期,占空比,开始时间,时钟初始值
    sc_trace :   声明记录文件所需记录的变量与其变量名
    sc_create_vcd_trace_file :   建立vcd格式的记录文件
    sc_close_vcd_trace_file   :   关闭vcd格式的记录文件
    sc_set_vcd_time_uint       :   设置仿真的单位时间大小
    delta_cycles                         :   设置是否仿真记录时间的延迟,vcd_fp->delta_cycles(true or false)
    sc_start                                  :   开始仿真,可设置仿真时间
    sc_stop                                  :   结束仿真
    sc_time_stamp                    :   返回带仿真时间单位的字符串
    sc_simulation_time            :   返回仿真的时间,返回类型为double
    sc_cycle ,  sc_initialize       :   节拍周期仿真方式
    sc_time                                  :   设置仿真的时间变量
    sc_set_time_resolution     :   设置仿真的时间精度

           

猜你喜欢

转载自blog.51cto.com/13824643/2137442