




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 1 advanced functional verification using systemc presented by: raghu ardeishar technical marketing engineer design verification and test modelmodelsim sim copyright 2001-2003, model tec
2、hnology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 2 ntechnology overview nbasic systemc nscv (systemc verification library) nsystemc support in modelsim ndemo agenda copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc supp
3、ort in modelsim 3 what is systemc? nhigh level hardware verification language models designs at high level of abstraction (algorithmic) ndesigns modeled in untimed manner for fast execution nideal for proof of concept sc_module(adder) .; is a systemc macro for class adder: public sc_module .; copyri
4、ght 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 7 ndefine set of methods (functions) method signatures only not implementation of methods channels implement interfaces different implementation for same interface possible nderived from syst
5、emc base class sc_interface nbuilt-in interface examples: sc_signal_in_if, sc_fifo_in_if, etc. interfaces class simple_rw_if: public sc_interface public: void read(unsigned addr, char*data); void write(unsigned addr, char*data); ; copyright 2001-2003, model technology copyright 1999-2004, mentor gra
6、phics corporation systemc support in modelsim 8 nused by modules to communicate with surroundings naccess channels through interfaces what a port can do (read, write, etc.) is restricted to the methods defined in the associated interface(s) ports can only be used with channels that implement the ass
7、ociated interfaces nderived from systemc base class sc_port usage: sc_port port_name; ports sc_in a; is a short-hand for sc_portsc_signal_in_if a; a is an input port of type int that can access methods defined in sc_signal_in_if. sc_module(adder) sc_in a; sc_in b; sc_out c; / processes, etc. sc_ctor
8、(adder) / body of constructor / process declaration, sensitivities, etc. ; copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 9 nused to store example: sc_fifo fifo_a; nports are bound to channels through interfaces channels copyright 2
9、001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 10 interfaces, ports, channels port a interface a_if method_c() method_d() method_c() implementation method_d() implementation port b interface b_if method_e() method_f() method_e() implementation
10、 method_f() implementation module portinterfacechannel channel channel_a channel channel_b a-method_c() legal a-method_f() illegal copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 11 nfunctions to describe module functionality concurr
11、ently nnot hierarchical nconstructor used to register member functions as systemc processes (sc_method, sc_thread) ninvoked based on static sc_in b; sc_out c; void compute() c=a+b; sc_ctor(adder) sc_method(compute); sensitive a b; ; copyright 2001-2003, model technology copyright 1999-2004, mentor g
12、raphics corporation systemc support in modelsim 12 nalways execute function body from start to end no suspension (no wait() ) inside sc_method nsupport static sensitivity execute when signals on sensitivity list change example: sensitive a b; nsupport dynamic sensitivity with next_trigger() executio
13、n continues to the end next_trigger(e1 | e2); next_trigger(e1 next_trigger(100, sc_ns); next_trigger(100, sc_ns, e1); copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 13 nmay suspend execution with wait() statements are executed until
14、 wait() is encountered at wait() , process execution is suspended until an event it is sensitive to occurs continue to execute from where it was suspended nsupport static sensitivity execute when signals on sensitivity list change example: sensitive a b; nsupport dynamic sensitivity with wait() thre
15、ad processes (sc_thread) wait(e1); wait(e1 | e2); wait(e1 wait(100, sc_ns); wait(100, sc_ns, e1); sc_module(adder) sc_in a; sc_in b; sc_out c; void compute() while(1) wait(100, sc_ps); c=a+b; sc_ctor(adder) sc_thread(compute); sensitive a b; ; copyright 2001-2003, model technology copyright 1999-200
16、4, mentor graphics corporation systemc support in modelsim 14 nbasic synchronization objects of class sc_event used to synchronize nto trigger an explicit event, use event_name.notify(args) example: sc_event e1; e1.notify(); causes e1 to be made immediately ready to run events copyright 2001-2003, m
17、odel technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 15 nimmediate notification causes processes which are sensitive to the event to be made immediately ready to run example: e1.notify(); / current delta cycle ndelayed notification causes processes which are s
18、ensitive to the event to be made immediately ready to run in the next evaluation phase (a delta cycle later) example: e1.notify(sc_zero_time); / next delta cycle ntimed notification causes processes which are sensitive to the event to be made immediately ready to run at a specified time in the futur
19、e example: e1.notify(10, sc_ns); / 10ns delay events copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 16 nturn off process imitialization use dont_initialize() after its sc_method or sc_thread declaration inside the constructor ngener
20、ate clock signals e.g: sc_clock clk (clk, 10, sc_ns, 0.2, 5, sc_ns, false); default period = 1ns, duty cycle = 50%, initial value = true nstart simulation osci uses sc_start(10, sc_ps); use run command in modelsim nstop simulation example: sc_stop(); simulation control copyright 2001-2003, model tec
21、hnology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 17 nsupported formats: vcd (value change dump) wif (waveform interchange format) isdb (integrated signal data base) nstep 1: create trace file syntax: sc_trace_file * = sc_create_trace_file(); nstep 2: specify signa
22、ls to save syntax: sc_trace(, , ); nstep 3: close file vcd: sc_close_vcd_trace_file(); wif: sc_close_wif_trace_file(); isdb: sc_close_isdb_trace_file(); waveform export sc_trace_file *tf = sc_create_vcd_trace_file(myvcd); sc_trace(tf, clock, clock); sc_trace(tf, reset, reset); sc_close_vcd_trace_fil
23、e(tf); copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 18 ntechnology overview nbasic systemc ntestbench automation nscv (systemc verification library) nsystemc support in modelsim ndemo agenda copyright 2001-2003, model technology c
24、opyright 1999-2004, mentor graphics corporation systemc support in modelsim 19 nscaffolding around the design nall the stuff you need to build and verify a design software programming-centric view of the intent nspecified in the verification plan ncan cost as much or more than the design itself neff
25、iciency, reuse, etc are important tba is all about infrastructure verification engineers copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 20 building infrastructures ncollections of verification components ncomponents that participate
26、 in the simulation, but are not part of the design nbuild reusable modular components to the extent possible copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 21 building a testbench basics intent is captured in test and scoreboard cop
27、yright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 22 ngenerate more efficient verification reduce time per test nobject-oriented programming objects, abstraction, encapsulation, inheritance, etc. reusable test components nautomated stimul
28、us generation constrained sequence, control and data randomization. ntest bench infrastructure sampling of stable test values nclean interface between systemc and hdl systemc testbench automation copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support i
29、n modelsim 23 classes nencapsulate model behaviour properties hold data values methods implement processing nreusable test components extensible provide an object-oriented inheritance paradigm class ether_packet public: sc_uint preamble; sc_uint sfd; sc_uint dest; sc_uint src; sc_uint len; ; copyrig
30、ht 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 24 stimulus generation methodologies directed randomconstrained-random nverifies specific scenarios nother scenarios left untested nlabor expensive nimpossible to cover the verification space
31、nbroader coverage neasy to write tests nnot deep sequences required to penetrate nnot efficient redundant tests nbroad and deep neasy to write ntests are more productive nlet the tool find unforeseen corner cases ndirected tests is a highly constrained random test copyright 2001-2003, model technolo
32、gy copyright 1999-2004, mentor graphics corporation systemc support in modelsim 25 constrained random saves time signoff quality time functionality verified constrained random testing directed testing time savings copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation
33、 systemc support in modelsim 26 systemc testbench automation using systemc verification library (scv) nc+ class library stimulus generators, monitors, checkers, transactors. nmodeling scv_smart_ptr num2 (“num2”); num1-next(); - randomizes num1 cout get_name() *num1 *num1 endl ; copyright 2001-2003,
34、model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 30 introspection for simple types nfor simple types eg, int, float as shown below you inherit from scv_constraint_base to randomize data. class men_constr public: scv_smart_ptr scv_smart_ptr scv_constraint_
35、ctor(men_constr) scv_constraint(num1() = 1 : public scv_constraint_base use scv_constraint_ctor macro and bind each element with scv_constraint macro. int num1; float num2; ; copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 31 simple
36、types #include systemc.h #include scv.h class men_constr : public scv_constraint_base public: scv_smart_ptr num1; scv_smart_ptr num2; scv_constraint_ctor(men_constr) scv_constraint(num1() = 1 ; sc_module(mytop) sc_signal inn; men_constr a; void randomis(); sc_ctor(mytop) :inn(inn),a(a) sc_thread(ran
37、domis); sensitive inn; ; void mytop: randomis() for (int i=0; i 10; i+) a.next(); cout *a.num1 *a.num2 endl; sc_module_export(mytop); copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 32 introspection for user defined types nfor user d
38、efined types eg, structs, classes a template needs to be provided based on the scv_extensions class. class my_pkt public: int num1; float num2; ; struct my_pkt int num1; float num2; ; or name of the class or struct elements in the class copyright 2001-2003, model technology copyright 1999-2004, ment
39、or graphics corporation systemc support in modelsim 33 introspection for user defined types nfor user defined types eg, structs, classes a template needs to be provided based on the scv_extensions class. class public: template scv_extensions scv_extensions scv_extensions scv_extensions_ctor(my_pkt)
40、scv_field(num1); scv_field(num2); : public scv_extensions_base use scv_extensions_ctor macro and wrap each element with scv_field macro. my_pkt int num1; float num2; ; copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 34 user defined d
41、ata types nbut wait. nsome operators need to be overloaded before you proceed class my_pkt public: int num1; float num2; ; bool operator = (const my_pkt ; ostream os p.num2 endl; return os; copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in mode
42、lsim 35 randomization nscv_smart_ptr can have its data randomized nthe seed is set by default. to change use the method: scv_random:set_global_seed(unsigned long long) nuse the call to the next() method to randomize data nbut before you randomize it would be a good idea to constrain the elements in
43、your class/struct to get a directed random stimulus copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 36 constraints nconstraints allow you to control the parameters to bound the generation of data ninherit from scv_constraint_base nus
44、e scv_constraint_ctor constructor nuse scv_constraint macro to bind elements of class/struct. class men_constr : public scv_constraint_base public: scv_smart_ptr pkt; scv_constraint_ctor(men_constr) scv_constraint(pkt-num1() = 1 ; / num1 is bound between 1 and 99,num2 between 100 and 200 / the sum o
45、f num1 and num2 cannot exceed 200 copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 37 full example #include systemc.h #include scv.h class my_pkt public: int num1; int num2; bool operator = (const my_pkt ; ; ostream os p.num1 endl; os
46、 p.num2 endl; os end endl; return os; template class scv_extensions : public scv_extensions_base public: scv_extensions num1; scv_extensions num2; scv_extensions_ctor(my_pkt) scv_field(num1); scv_field(num2); ; class men_constr : public scv_constraint_base public: scv_smart_ptr pkt; scv_constraint_c
47、tor(men_constr) scv_constraint(pkt-num1() = 1 ; sc_module(mytop_mypkt) sc_signal inn; men_constr a; void randomis(); sc_ctor(mytop_mypkt) :inn(inn),a(a) sc_thread(randomis); sensitive inn; ; void mytop_mypkt: randomis() for (int i=0; i 10; i+) a.next(); cout *a.pkt endl; sc_module_export(mytop_mypkt
48、); copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 38 introspection for enum types enum color red = 0, green = 2 , blue = 4, orange = 6, black = 8, pewter = 16 ; use scv_enum_ctor macro and wrap each element with scv_enum macro. temp
49、late class scv_extensions : public scv_enum_base public: (red); (green); (blue); (orange); (black); (pewter); ; scv_enum_ctor(color) scv_enum scv_enum scv_enum scv_enum scv_enum scv_enum copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsi
50、m 39 introspection for enum types nfor enum types scv_enum_base needs to be provided before the scv_extensions class. struct / struct implies a class with public elements template scv_extensions scv_extensions scv_extensions scv_extensions_ctor(data_t) scv_field(col); scv_field(num); : public scv_ex
51、tensions_base use scv_extensions_ctor macro and wrap each element with scv_field macro. data_t color col; int num; ; copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 40 example of ethernet packet class ether_packet public: sc_uint pre
52、amble; sc_uint sfd; sc_uint dest; sc_uint src; sc_uint len; ; enum packet_type send_mp3, send_noise ; enum ifg_gaps normal_ifg, short_ifg, long_ifg, random_ifg; copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 41 scv extensions of eth
53、ernet packet enum packet_type send_mp3, send_noise; template class scv_extensions : public scv_enum_base public: scv_enum_ctor(packet_type) scv_enum(send_mp3); scv_enum(send_noise); ; template class scv_extensions : public scv_enum_base public: scv_enum_ctor(ifg_gaps) scv_enum(normal_ifg); scv_enum(
54、short_ifg); scv_enum(long_ifg); scv_enum(random_ifg); ; enum ifg_gaps normal_ifg, short_ifg, long_ifg, random_ifg; is extended to is extended to copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 42 scv extensions of ethernet packet tem
55、plate class scv_extensions : public scv_extensions_base public: scv_extensionssc_uint preamble; scv_extensionssc_uint sfd; scv_extensionssc_uint dest; scv_extensionssc_uint src; scv_extensionssc_uint len; scv_extensions_ctor(ether_packet) /must be in order scv_field(preamble); scv_field(sfd); scv_fi
56、eld(dest); scv_field(src); scv_field(len); ; class ether_packet public: sc_uint preamble; sc_uint sfd; sc_uint dest; sc_uint src; sc_uint len; ; is extended to copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 43 weighted randomization
57、 ncontrol the distribution of values by creating a “bag” nrelative number of items in the “bag” will determine what you pick from it / define the data types enum color red = 0, green = 2 , blue = 4; color_dist.add(red,1); struct data_t color col; int num; ; scv_smart_ptr a; / create a bag to put the
58、 colors scv_bag color_dist; / put the colors in the bag color_dist.add(red,1); color_dist.add(green,1); color_dist.add(blue,100); a-col.set_mode(color_dist); a-next(); the bag color_dist has 1 red, 1 green and 100 blue. so the probability of getting the blue is accordingly that much higher associate
59、 bag(color_dist)with element(col) in struct(“a”) copyright 2001-2003, model technology copyright 1999-2004, mentor graphics corporation systemc support in modelsim 44 example with enum #include #include enum color red = 0, green = 2 , blue = 4 ; struct data_t color col; int num; bool operator = (con
60、st data_t ; / not a complete = operator ; template class scv_extensions : public scv_enum_base public: scv_enum_ctor(color) scv_enum(red); scv_enum(green); scv_enum(blue); ; template class scv_extensions : public scv_extensions_base public: scv_extensions col; scv_extensions num; scv_extensions_ctor
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 粮食仓储企业绿色评价体系考核试卷
- 硅冶炼过程中的热效率分析与改进考核试卷
- 纤维原料的产销模式和渠道建设考核试卷
- 2023-2024学年广东省佛山市名校高二下学期期中联考语文试题(解析版)
- 硕士生求职攻略
- 吉林省四平市铁西区重点中学2024-2025学年初三下-(期中)物理试题试卷含解析
- 宁夏民族职业技术学院《外国文学作品原著》2023-2024学年第二学期期末试卷
- 九江职业大学《机器学习与模式识别I(双语)》2023-2024学年第二学期期末试卷
- 私立华联学院《游戏中的数学》2023-2024学年第一学期期末试卷
- 四川省成都市崇州市2025届四年级数学第二学期期末综合测试试题含解析
- 小水滴的诉说省公开课一等奖新名师优质课比赛一等奖课件
- 人体生物医学研究伦理审查PPT幻灯片
- 详解 强基计划
- 餐饮场所消防安全培训
- 乡村卫生室服务一体化管理工作制度
- 制作自然发酵酸奶的方法
- 《肖申克的救赎》中英双语剧本
- 护士长管理能力培训讲义课件
- 第六章电力系统自动低频减载装置
- 2022年黑龙江省乡村医生招聘笔试试题及答案解析
- 济南市海绵城市建设建筑与小区改造项目案例-山东省经济技术开发中心宿舍-2
评论
0/150
提交评论