第一種:start啟動(dòng)
最簡(jiǎn)單粗暴的一種方式,只需要在某個(gè)component,如my_sequencer、my_env甚至base_test的main_phase中啟動(dòng)。
task fish_env::main_phase(uvm_phase phase);
fish_sequence seq; //創(chuàng)建seq實(shí)例
phase.raise_objection(this);
seq = fish_sequence::type_id::create("seq");
seq.start(fish_agt.sqr); //將seq發(fā)送給對(duì)應(yīng)的sequencer
phase.drop_objection(this);
endtask
注:
- 如果在sequencer中啟動(dòng),唯一的區(qū)別就是start的參數(shù)變?yōu)閠his,即seq.start(this);
- 通常sequence不會(huì)直接發(fā)送給sequencer,而是通過(guò)virtual_sequence和virtual_sequencer;
- raise_objection和drop_objection往往伴隨sequence的啟動(dòng);
第二種:default_sequence
采用default_sequence啟動(dòng),實(shí)際上還是調(diào)用了start任務(wù),
uvm_config_db#(uvm_object_wrapper)::set(this,
"env.fish_agt.sqr.main_phase",
"default_sequence",
case0_sequence::type_id::get());
)
或者先例化,再采用default_sequence啟動(dòng):
function void fish_case0::build_phase(uvm_phase phase);
case0_sequence cseq;
super.build_phase(phase);
cseq = new("cseq");
uvm_config_db#(uvm_sequence_base)::set(this,
"env.fish_agt.sqr.main_phase",
"default_sequence",
cseq);
endfunction
第三種:`uvm_do系列宏啟動(dòng)
`uvm_do(SEQ_OR_ITEM)o
`uvm_do_pri(SEQ_OR_ITEM, PRIORITY)
`uvm_do_with(SEQ_OR_ITEM, CONSTRAINTS)
`uvm_do_pri_with(SEQ_OR_ITEM, PRIORITY, CONSTRAINTS)
`uvm_do_on(SEQ_OR_ITEM, SEQR)
`uvm_do_on_pri(SEQ_OR_ITEM, SEQR, PRIORITY)
`uvm_do_on_with(SEQ_OR_ITEM, SEQR, CONSTRAINTS)
`uvm_do_on_pri_with(SEQ_OR_ITEM, SEQR, PRIORITY, CONSTRAINTS)
uvm_do的宏有多種,根據(jù)實(shí)際情況選擇合適的宏。實(shí)際工作當(dāng)中,使用較多的就是
uvm_do_on(SEQ_OR_ITEM, SEQR),第一個(gè)參數(shù)表示要發(fā)送的sequence或者item,第二個(gè)參數(shù)表示要將此sequence或者item發(fā)送給哪個(gè)sequencer。工作中有多個(gè)seq,為了實(shí)現(xiàn)seq的統(tǒng)一調(diào)度,就會(huì)使用virtual_sequence/sequencer,在vitrual_sequence 的body中例化多個(gè)sequence,使用uvm_do_on將sequencer掛載到指定sequencer上。
`uvm_declare_p_sequencer(fish_virtual_sequencer)
task fish_virtal_seq::body();
fish_sequence_1 fish_seq_1;
fish_sequence_2 fish_seq_2;
...
fish_sequence_n fish_seq_n
`uvm_do_on(fish_seq_1, p_sequencer.sqr_1);
`uvm_do_on(fish_seq_2, p_sequencer.sqr_2);
...
`uvm_do_on(fish_seq_n,p_sequencer.sqr_n);
end_task:body
如此一來(lái),fish_seq就掛載到了fish_virtual_sequencer中某個(gè)具體的sequencer上,這是最通用的做法。但UVM的用法太靈活了,最近在工作中,我遇到,seq不會(huì)掛載到某個(gè)具體的sqr的情況,也疑惑了很久,下次和你們分享。歡迎持續(xù)關(guān)注。
第四種:uvm_create和
uvm_send
class case0_sequence extends uvm_sequence #(fish_transaction)
...
task case0_sequence::body()
`uvm_create(f_trans)
...//對(duì)transaction做處理
`uvm_send(f_trans)
endtask
uvm_create宏的作用就是實(shí)例化transaction,實(shí)例化之后,可以對(duì)其做更多的處理,處理完畢再使用`uvm_send宏發(fā)送出去。
-
UVM
+關(guān)注
關(guān)注
0文章
182瀏覽量
19167 -
sequence
+關(guān)注
關(guān)注
0文章
23瀏覽量
2840
發(fā)布評(píng)論請(qǐng)先 登錄
相關(guān)推薦
評(píng)論