日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁(yè) > > 芯片驗(yàn)證工程師
[導(dǎo)讀]UVM?factory的目的是允許將一種類型的對(duì)象替換為派生類型的對(duì)象,而不需要更改testbench的結(jié)構(gòu)或代碼(實(shí)例替換或者類替換),此功能對(duì)于更改sequence或組件非常有用。任何要替換的組件都必須具有多態(tài)兼容性,這包括具有所有相同的TLM接口句柄并且TLM對(duì)象必須由新的...

UVM?factory 的目的是允許將一種類型的對(duì)象替換為派生類型的對(duì)象,而不需要更改testbench 的結(jié)構(gòu)或代碼(實(shí)例替換或者類替換),此功能對(duì)于更改sequence或組件非常有用。


任何要替換的組件都必須具有多態(tài)兼容性,這包括具有所有相同的TLM接口句柄并且TLM對(duì)象必須由新的替換組件創(chuàng)建。此外,為了利用UVM Factory機(jī)制,需要遵循某些編碼約定。

?

1、注冊(cè)??

組件或?qū)ο舐暶鞔a中包括:

1、一個(gè)uvm_component_registry?wrapper,被宏定義為type_id

2、一個(gè)用來獲取type_id的靜態(tài)函數(shù)

3、一個(gè)用來獲取類型名稱的函數(shù)

class my_component extends uvm_component;typedef uvm_component_registry #(my_component, "my_component") type_id;static function type_id get_type();return type_id::get();endfunction function string get_type_name();return "my_component";endfunction...endclass: my_component組件或?qū)ο?/span>注冊(cè)代碼可以使用四個(gè)factory 注冊(cè)宏生成:

// For a componentclass my_component extends uvm_component;`uvm_component_utils(my_component)
// For a parameterised componentclass my_param_component #(int ADD_WIDTH=20, int DATA_WIDTH=23) extends uvm_component;typedef my_param_component #(ADD_WIDTH, DATA_WIDTH) this_t;`uvm_component_param_utils(this_t) // For a class derived from an object (uvm_object, uvm_transaction, uvm_sequence_item, uvm_sequence etc)class my_item extends uvm_sequence_item;`uvm_object_utils(my_item) // For a parameterised object classclass my_item #(int ADD_WIDTH=20, int DATA_WIDHT=20) extends uvm_sequence_item;typedef my_item #(ADD_WIDTH, DATA_WIDTH) this_t`uvm_object_param_utils(this_t)2、默認(rèn)構(gòu)造函數(shù)

uvm_component和uvm_object構(gòu)造函數(shù)是虛擬方法,這意味著用戶必須遵循它們的原型模板。

// For a component:class my_component extends uvm_component;function new(string name = "my_component", uvm_component parent = null);super.new(name, parent);endfunction// For an objectclass my_item extends uvm_sequence_item;function new(string name = "my_item");super.new(name);endfunction3、組件和對(duì)象的創(chuàng)建

Testbench在build phase使用uvm_component_registry中的create方法創(chuàng)建組件。首先構(gòu)造class,然后將類的指針賦值到Testbench 中的聲明句柄。

class env extends uvm_env;my_component m_my_component;my_param_component?#(.ADDR_WIDTH(32),?.DATA_WIDTH(32))?m_my_p_component;function void build_phase( uvm_phase phase );m_my_component = my_component::type_id::create("m_my_component", this);m_my_p_component = my_param_component #(32, 32)::type_id::create("m_my_p_component", this);endfunction: build task run_phase( uvm_phase phase );my_seq test_seq;my_param_seq #(.ADDR_WIDTH(32), .DATA_WIDTH(32)) p_test_seq;test_seq = my_seq::type_id::create("test_seq");p_test_seq = my_param_seq #(32,32)::type_id::create("p_test_seq");// ....endtask: run

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉