当前位置: 简表范文网 > 专题范文 > 公文范文 >

uvm实战-学习笔记

| 来源:网友投稿

下面是小编为大家整理的uvm实战-学习笔记,供大家参考。

uvm实战-学习笔记

 

 ? ?UVM 实战〔卷 1 〕? ? 学习笔记

 看了第 1/2/3/4/5/6/8/9.1 这几个章节. 第一章是综述,第二章是一个具体的例子,学习笔记从第三章相关内容开始. 我个人觉得 UVM 重要的局部〔特点的局部〕:

 1〕 factory 机制〔override config_db〕 2〕TLM 传递 3)

 phase 机制 4)

 sequence-sequencer 以及 virtual seq/sqr 内容中的截图根本来自于 UVM 源代码、书自带的例子和?uvm1.1 应用指南及源代码分析? 这个 PDF 里的. 需要结合书〔?UVM 实战〔卷 1〕?第 1 版〕来看这个笔记. 第 第 3 章 章 UVM 根底 3.1 uvm_component 和 和

 uvm_object 常用的类名字:

 这个图是从作者张强的?uvm1.1 应用指南及源代码分析?里截得,不如书上 3.1.1 里的图好. uvm_sequencer 也是代码里必须有的,所以我加了 uvm_sequencer

  在 src/base/uvm_misc.svh 中定义: virtual c 1 ass uvnri_\/oid endclass 红框的是我们搭 testbench 的时候用的比拟多的基类. 的 常用的 uvm_object 派生类: : sequencer 给 driver 的 transaction 要 派生 自 uvm_sequence_item, 不 要派生 自 uvm_transaction 所有的 sequence 要派生自 uvm_sequence 或者 uvm_sequence 的派生类,可以理解为 sequence 是 sequence_item 的组合〔集合〕. driver 向 sequencer 索要 item,sequencer 检查 是否有 sequence 要发送 item,当发现有 item 待发送时,就把这个 item 发给 driver. 的 常用的 uvm_component 派生类:

 所有的 driver 要派生自 uvm_driver. driver 用来把 sequence_item 中的信息驱动到 DUT 端口上,从 transaction-level 向 signal-level 的转换.uvm_driver 需要参数(REQ RSP), 比 uvm_component 增加 了 几个成员.重要的是 seq_item_port 和 req/rsp. (src/comps/uvm_driver.svh) uvm_void 是一一个空的虚类.

 monitor/scoreboard 派生自 uvm_monitor 和 uvm_scoreboard, 但是 uvm_monitor 和 uvm_scoreboard 并没有在 uvm_component 根底上做扩展. src/comps/uvm_monitor.svh virtu.al class uvrn_mun L tor extends uyn_cornponent 〃

 Function* new Z/ Cr&atcs and 白门 instance G -F thio class using the normal 7/ conetructor arguments Por <uvjn_coinponent> :

 is the nainQ of the 7/ ins-tanc@, and ^parant^ is ths handle to the hierarchical parent, if any« Functian new .string name, uyn_camponent parent); eu.per . new (. name 3

 pa pent ।

 ; endPuinct L

 on izonut static string type_nani9 x/i 「二 UIN I -Puinction string get_type_name (J; ret j.rn t.yp&_name : endPuinct L

 on endclass sequencer 要派生自 uvm_sequencer. sequencer 做了很多扩展,但是如果我们自己写的 sequencer 里没有增加成员的话,可以直接写如下代码:

 typedef uvm_sequencer #〔传递的 sequence_item 类名 〕

 sequencer 类名 ; 由于 sequencer 在 agent 中例化,所以一般写在 agent 类文件里. reference_model 派生自 uvm_component. agent 要派生自 uvm_agent. uvm_agent 里多了一个 is_active 的成员.一般根据这个 active 来决定是否实例化 driver 和 sequencer. is_active 变量的数值需要在 env 的 build_phase 里设 置完成〔可以直接设置,也可以用 uvm_config_db#〔int〕::set〕. env 要派生 自 uvm_env. uvm_env 没有对 uvm_component 扩展. src/comps/uvm_env.svh vir tLial c la:=1:=1 u"i/rii_env extends uvm_Dorriponent; // Functi on :

 new 〃 // Creates and initializes an instance o-F this class using the rwrmal 7/ constructor arguments -Por <uviiii_coijipm«t.> :

 ^name~ Is the :

 name &F 工 he // instance f

 and ""p 白 rent" is the handle to the hiersrcfiical parent, i? any* T unct i □ n nci-.i 〔string na me- ,, u-"---"" 1

 u.vni_corii po ne nt parent-null ]; super.new name 3 parenti; endFLKCti on conEt static "= :

 t-ing type_name 1 「 tu.si 4"u.net L □ n stving get_ty pe_n.ariie 「 Et LT 广门 ty pe_nanie ; endFunction

 endclase 所有的 test 都要派生自 uvm_test 或者它的派生类.uvm_test 也没扩展 src/comps/uvm_test.svh ■/irtual clasc u.vrn_test extends ULVTII _ C □mponent // Function; new X/ // Creates and initializes an instance of this class using the normal // constructor argtiments For < uwiKii_compor>ent.> :

 is the name of the // instance, 白 rtd ""pareniU™ is the handle to th@ hi^rardnlcal parent, i-P any fu.net Lon new i "= :

 tring n.ame 】

 uvni_conponent parent〕; super .neujt name n

 parent j ; end-TunctiDri const static string type_name = 1

 virtual function string get_type_nsme 〔\ ; retLi.rn type_name ; end-Punct i on en du last :

 uvm_object 和

 uvm_component 的

 macro macro 非常重要,事关把这些类的对象注册到 factory 机制中去. uvm_object macro 1〕对于 uvm_sequence_item 就统一用〔假设不用 parameter〕:

 "uvm_object_utils_begin〔item 类名〕 ….field_automation... "uvm_object_utils_end 2〕对于 uvm_sequence,要加上 "uvm_object_utils〔sequence 类名 〕 可能还需要"uvm_declare_p_sequencer〔sequencer 类名〕的声明 uvm_component macro 对于 driver monitor reference_model scoreboard sequencer case agent env^^ uvm_component 派生类都要加上:

 "uvm_component_utils(类名 ) uvm_component 里的成员也可以像 uvm_object 里成员一样,用 field_automation 机制. "

 \ TVUL

 comp ,二七二二 m beci_r:,{my diivei} "JLvnL_f iel(pr r

 UVM_ALL_OM} " avnL_caiiLpoE.ent-_.;tiL3_end field_automation 机制:

 对于 uvm_object 派生类来说,field_automation 机制让对象自动有的 copy compare print pack unpack 等函数,简化了实现 uvm_component 派生类里一些 function/task 的工作量 对于 uvm_component 派生类来说,field_automation 机制最重要的是 可以在 build_phase 中

 自动获取 uvm_config_db#()::set()的数值( 必须加

 super.build_phase(phase)) ----也就是不用 写 uvm_config_db#()::get() 注意:

 field_automation 的 macro 的类型要和 uvm_config_db 的参数类型一致:

 如下例如代码,field_int vs uvm_config_db#(bit[47:0])这个时候 super.build_phase()是不起 作用的. class my_sequencer extends uvm-sequencer my_transaction bit -47:0] dmac; bit ; 47:0] smac //int dmac; //int smac; " uvm_component._LJiti ls_begin (my_sequencer ) " u , v , m_-Field_int (dmac , 、 uvm_-Field_int (smac , " uvm_component._uit i ls_end Q-i L

 .Lun iu my_c3eeC build_phast uvffl_phase phase ■=ur 」 ir, juilcLphaet ahase uvn_config_dbt jj i :

 set Ji 二 ■= :

 ni L :

 口 j :

 :

 emt :■=:> 一二一\ , 43 卜自 1 二上三 1 ; 想要起作用的话,需要用 Furct 1 on nid my_caseO build_phase u.vm.phasE- phase); ou.pn-r- bnild_phase phase); //uv™_conFig.cJb#(bit[47 :

 0] 1 :

 isetCthiSi "env.i-agt*3qr M

 3

 "dmac" B , 48"WF9765); /H LIVUI

 .conf ig_<Jbt(bit[47 :

 0] ) :

 ai env.i-agt*3qr w

 3

 fi, smac ,b , 4sh89F23); uvm.config_db#C int ।

 :

 sett this 3

 匚:口 nfiE_db#i ;

 int ।

 :

 三 5=1 三 t "三 n 闩厂 ."j 43 8

 - r r3) ; clone = new + copy 源代码中可以看到 clone 函数一上来会做一次 create,然后调 copy 函数 src/base/uvm_object.svh

 function uun_abjcct uvin_otij tc t uJcirw uvm_nb.jrct trip: tmp this .crwrt!? i-f" tnp null uyn-repcrrt-Marnins elw tffi 口 copy this reiiirn tnp sfidfLinctlan 〃

 -capij //

 Function void u"H"m.object c:opy uvn.ahject rtia „Fo 「 cycle -chwklng Bt-wtic int depth i-T- rhe null ^ uyn_Elob(sl_DDpu_nan ETt If (Thia nu.ll) bsgLn uvm„rfflpDTrt_idaT i n Lng mtiirn; and uvm_gLabaL_cnpy_iiHp.set rhs . this : depth: __m_uvnuFiolcL/WJitonwtion 小事 dcuGDpj rhs : deptn. if :deptJi te^ln UyiTi_g] Qb=il_C^y _jViap _C ] AT 广 and d-TuHOtlan 3.2 UVM 的树形结构

 uvm_component 的 new/create 要注意第一个参数是名字,第二个参数是 parent 指针. UVM 真正的树根是“uvm_top〞 .根据上面这个树结构,可以看出一个个 component 的parent 是什么.uvm_top 的 parent 是 null.当一个 component 在实例化的时候,如果 parent 参数设成 null,那么 parent 参数会被仿真器自动设置成 uvm_root 的实例 uvm_top. 在 6.6.1 章节里也提到了,sequence 在 uvm_config_db#〔〕:

 :

 get〔〕的时候,第一个参 数设成“null",实际就是 uvm_root::get〔〕3.5.1 章节也提到了这个 层次结构函数: : get_parent() get_child(string name)这两个分别获取 parent 指针和指定名字的 child 指针. rho null be-sin

 get_children(ref uvm_component children[$])获取所有的 child 指针 get_num_children()获取 child 个数 get_first_child(ref string name) get_next_child(ref string name)获取 child 的名字(反映至 U string name 上),返回值是 0/1 两种情况 应用参考代码如下(改动的 2.5.2 例子中的 my_agent.sv):

 function void ny_aEont connnc:t_phjEci uvn_phjEBi phasiD ijivm-component children 3 uum-component child string child_narie supsr . cnnnoE t_pha=c-1 ph, if (is.active . beein dru 5eq_itpm_port connect sqr 5&q_itpri-i_e^pc!r-t ; end ap = fton.ap :

 .thi E

 g.Qt_-Ru.ll_namc- thi-= . 301 .parent. this .ffet_num_ch i Idren()); thig get-chi 1dren 1

 chiIdren :

 ■Poreach 1

 children i begin ..rhle .ger_Fu 1 L_n 加 E

 1,1,ct _ i11 di^en" 1 ] get_ranre 1

 chiIdren [1] .g et_ -Fu l l_n.3ne(1); ond child this eet-child if chi10null. begin .this g_9t_fUlL_H3me end else b>?gin 0nd if thia-set.First_chiId 1 child_namebeEin - - Sj

 this get-PulLnarie .chilcLrar"5, uhile 1 this.get_ne^t_child"chiLd_name "begin j.rhls . eet_ru :

 Ll_nam&!) .chi Id-nane und ond i?13F beein this get^-full-namE ))] end end-Function 注意:上述代码是在 connet_phase 中实现的. 上述代码的打印结果如下:

 my_agent"s name is uvm_test_top.env.i_agt, parent"s full path is uvm_test_top.env, children num is3 uvm_test_top.env.i_agt0 child: drv --> full path:uvm_test_top.env.i_agt.drv uvm_test_top.env.i_agt1 child: mon --> full path:uvm_test_top.env.i_agt.mon uvm_test_top.env.i_agt2 child: sqr --> full path:uvm_test_top.env.i_agt.sqr This should be i_agt. my_agent"s name is uvm_test_top.env.i_agt uvm_test_top.env.i_agt first child name is drv uvm_test_top.env.i_agt next child name is mon uvm_test_top.env.i_agt next child name is sqr my_agent"s name is uvm_test_top.env.o_agt, parent"s full path is uvm_test_top.env, children num is1 uvm_test_top.env.o_agt0 child: mon --> full path:uvm_test_top.env.o_agt.mon UVM_WARNING /tools/synopsys/vcs/G-2021.09/etc/uvm/src/base/uvm_component.svh(1846) @ 0: uvm_test_top.env.o_agt [NOCHILD] Component with name "drv" is not a child of component "uvm_test_top.env.o_agt" This should be o_agt. my_agent"s name is uvm_test_top.env.o_agt uvm_test_top.env.o_agt first child name is mon 3.3 field automation 机制 注意数组类型的 field macro 比一般的要少 real 和 event 的 macro. 一般的对于 enum 类型有

 3 个参数,而数组的只有 2 个参数.联合数组的 macro 比拟多 常用函数需要注意 pack unpack pack_bytes unpack_bytes pack_ints unpack_ints 返回值都是 bit 个数. field-automation 标记位 17bit 中 bit0 3 copy bit1 3 no_copy bit2 3 compare bit3 3 no_compare bit4 — print bit5 3 no_print bit6 3 record bit7 3 no_record bit8 — pack bit9 3 no_pack UVM_ALL_ON 是 ‘b000000101010101 UVM_ALL_ON|UVM_NO_PACK 这样就会忽略掉 pack bit field-automation 的 macro 可以和 if 结合起来,参考 3.3.4 的代码 "uvm_object_utils_begin(my_transaction) "uvm_field_int(dmac, UVM_ALL_ON) "uvm_field_int(smac, UVM_ALL_ON) if(is_vlan)begin "uvm_field_int(vlan_info1, UVM_ALL_ON) "uvm_field_int(vlan_info2, UVM_ALL_ON) "uvm_field_int(vlan_info3, UVM_ALL_ON...

推荐访问:uvm实战-学习笔记 学习笔记 实战 uvm

热门文章

《********大宣讲特别节目》直播观后感

最近发表了一篇名为《2022《********大宣讲特别节目》直播观后感【精选】》的范文,感觉写的不错,希望对您有帮助,希望对网友有用。,安全,在学校里,在校外,安全这个词恐怕是再熟悉不过了吧,让将安全铭记心中,时进刻刻都做到安全,让父母不再操心,让长辈不再担心,让安全从我做起,从身边

追梦筑梦圆梦演讲稿

最近发表了一篇名为《追梦筑梦圆梦演讲稿》的范文,感觉很有用处,这里给大家转摘到。演讲稿特别注重结构清楚,层次简明。在日新月异的现代社会中,在很多情况下需要用到演讲稿,如何写一份恰当的演讲稿呢?下面是小编为大家整理的追梦筑梦圆梦演讲稿,希望能够帮助到大家!追梦筑梦圆梦演讲稿1尊敬的

2022年度享受读书快乐作文800字议论文优秀(完整)

本页是最新发布的《享受读书的快乐作文800字议论文优秀》的详细范文参考文章,觉得应该跟大家分享,重新编辑了一下发到。书,是无声的老师;书,是我们最真诚的玩伴;书,教会了我们做人的道理;书,让我们从无知的幼童,变成了如今的莘莘学子。下面是小编为大家收集整理的关于的800字议论文优秀

小学品德教师期末工作总结范本合集

最近发表了一篇名为《小学品德教师期末工作总结范文》的范文,感觉很有用处,重新整理了一下发到这里[http: www fwwang cn]。时光飞逝,如梭之日,回顾这段时间的工作,一定有许多的艰难困苦,是时候在工作总结中好好总结过去的成绩了。下面小编在这里为大家精心整理了几篇小学教师期

以小见大作文500字范本(范文推荐)

最近发表了一篇名为《以小见大作文500字范文【精选】》的范文,感觉写的不错,希望对您有帮助,重新编辑了一下发到。一件事情的发生,离不开时间、地点、人物、事情的起因、经过和结果这六方面,即常说的六要素,只有交待清楚这几方面,才能使读者对所叙述的事,有个清楚、全面的了解。这里小编

建团百周年活动策划

《2022建团百周年活动策划【精选】》是一篇好的范文,感觉很有用处,希望大家能有所收获。党的领导是共青团顺利发展的关键所在,无论是中国早期青年团的建立,还是中国共青团的正式成立,都离不开党的领导。下面小编为大家整理了2022建团百周年策划【精选】的相关内容,以供参考,希望给大家带来帮助!20

2022年大学生档案自我鉴定300字10篇

2022年普通大学生个人社会实践实习报告精选服务社会做好思想准备和业务准备,公司内部电脑系统都是统一英文系统,就要求自己以职场……[详细]2022年党员思想汇报例文两篇【完整版】所以在以后的学习和生活中,经历过苦难的中国,工作以及生活中,特别是通过学习党章党纪……[详细]企业员工服务意识培训心得体会

2022不期而遇作文600字初中记叙文

《不期而遇作文600字初中记叙文》是一篇好的范文,感觉很有用处,希望对网友有用。,美词,像是袭袭的寒风慢慢轻掠大地,刺刺的,一缕****的阳光下有一小缕的橘红色静静的生长。下面是小编为大家收集整理的关于不期而遇600字初中记叙文,一起来看看吧!不期而遇作文600字篇一苏轼有语人间有味是清欢,或许正是

2022年度有关安全学习心得合集(2022年)

本页是最新发布的《有关安全学习心得》的详细范文参考文章,感觉很有用处,看完如果觉得有帮助请记得(CTRL+D)收藏本页。有了一些收获以后,可以记录在心得体会中,这么做能够提升的书面表达能力。相信许多人会觉得心得体会很难写吧,下面是小编为大家收集的有关学习心得,供大家参考借鉴,希望可以帮

2022员工培训学习心得体会范本合集(范文推荐)

最近发表了一篇名为《员工培训学习心得体会范文》的范文,感觉写的不错,希望对您有帮助,为了方便大家的阅读。培训能让员工不断的提高,并清楚的意识到自己的缺点。经过员工培训,你一定有许多的收获,不妨来写一篇员工培训心得。你是否在找正准备撰写“员工培训心得体会范文”,下面小编收集了相关的素材,

2022年度中考优秀作文素材别样美三篇

最近发表了一篇名为《中考优秀作文素材别样的美精选三篇》的范文,好的范文应该跟大家分享,看完如果觉得有帮助请记得(CTRL+D)收藏本页。雨过天晴,花坛边上,几只蜗牛缓缓的爬行着,留下一道彩虹般的痕迹,那柔软的外面,是坚硬的外壳,那也是一道的美丽。下面是小编为大家收集整理的关于素材别样的美精

2022年度幼儿园清明节主题活动总结范本

《2022幼儿园清明节主题活动总结范文【精选】》是一篇好的范文,感觉很有用处,为了方便大家的阅读。,又称踏青节、行清节、三月节、祭祖节等,节期在仲春与暮春之交。清明节源自上古时代的祖先信仰与春祭礼俗,以下是小编整理的2022园清明节主题总结,希望可以提供给大家进行参考和借鉴。2022幼儿园清明节