欧美性猛交xxxx免费看_牛牛在线视频国产免费_天堂草原电视剧在线观看免费_国产粉嫩高清在线观看_国产欧美日本亚洲精品一5区

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會員中心
創(chuàng)作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示

UVM Sequences 復用程度的3大準則

jf_78858299 ? 來源:芯片驗證工程師 ? 作者:驗證哥布林 ? 2023-03-21 11:31 ? 次閱讀

就我個人而言,我覺得編寫sequence是在驗證任何IP時最具挑戰(zhàn)性的部分。 首先需要仔細構想場景,然后coding。如果沒有任何程度的復用,我們需要從頭為每個場景編寫一個sequence,這使得sequence難以維護和調試。

sequence的編寫和調試是非常體現(xiàn)驗證工程師編碼能力的地方之一,如果每一個sequnce都有著完全不同的工作模式,那么維護起來非常痛苦。

網(wǎng)絡上有一個段子,程序員最討厭4件事情:

1、寫文檔

2、別人不寫文檔

3、寫注釋

4、別人不寫注釋

想象一下,如果你驗證同事離職,交接給你上百個定向且詭異的測試用例或者sequence?你會不會立馬想去重構。

sequences 由多個事務激勵組成,在UVM中其繼承自 參數(shù)化類uvm_sequence 。通過這些事務觸發(fā)一些驗證工程師希望觸及的場景,而sequence的分層會創(chuàng)建一些更加復雜的場景激勵。驗證空間隨著設計規(guī)模指數(shù)級上升,驗證激勵自然也會越來越復雜。

|

class usb_simple_sequence extends uvm_sequence #(usb_transfer);
rand int unsigned sequence_length;
constraint reasonable_seq_len { sequence_length < 10 };
//Constructor
function new(string name=”usb_simple_bulk_sequence”);
super.new(name);
endfunction
//Register with factory
`uvm_object_utils(usb_simple_bulk_sequence)
//the body() task is the actual logic of the sequence
virtual task body();
repeat(sequence_length)
`uvm_do_with(req,  {
//Setting the device_id to 2
req.device_id == 8’d2;
//Setting transfer type to BULK
req.type == usb_transfer::BULK_TRANSFER;
})
endtask : body
endclass

在上面的sequence 中,我們試圖將發(fā)送多次id為2的事務,在uvm_test中將該sequence指定為default sequence即可。

|

class usb_simple_bulk_test extends uvm_test;
…
virtual function void build_phase(uvm_phase phase );
…
uvm_config_db#(uvm_object_wrapper)::set(this, "sequencer_obj.
main_phase","default_sequence", usb_simple_sequence::type_id::get());
…
endfunction : build_phase
endclass

到目前為止,sequence看起來既簡單又直接。但是 直接的代碼往往意味著麻煩的堆疊。 為了確保sequence在更復雜的場景中重用,我們必須遵循一些準則或者說代碼規(guī)范。

1、只在base sequence 類中的pre_start和post_start任務中raising objections和 dropping objections來管理測試用例的開始和結束。 通過這種方式,能夠減少每一個sequence子類中的相關phase控制代碼。

|

task pre_start()
if(starting_phase != null)
starting_phase.raise_objection(this);
endtask : pre_start
task post_start()
if(starting_phase != null)
starting_phase.drop_objection(this);
endtask : post_start

需要注意的是,只有被定義為default sequence才會自動執(zhí)行starting_phase,否則就需要手動調用了。

|

class usb_simple_bulk_test extends uvm_test;
usb_simple_sequence seq;
…
virtual function void main_phase(uvm_phase phase );
…
//User need to set the starting_phase as sequence start method
is explicitly called to invoke the sequence
seq.starting_phase = phase;
seq.start();
…
endfunction : main_phase
endclass

2、使用UVM configurations 機制從測試用例中獲取值。 在上面的示例中,沒有給出控制sequence的按鈕,一些都靠sequence自身的隨機,這對于擴展用例非常不友好。我們可以對sequence做如下的修改,以 提供更加精確的激勵控制 。

|

class usb_simple_sequence extends uvm_sequence #(usb_transfer);
rand int unsigned sequence_length;
constraint reasonable_seq_len { sequence_length < 10 };
…
virtual task body();
usb_transfer::type_enum local_type;
bit[7:0] local_device_id;
//Get the values for the variables in case toplevel
//test/sequence sets it.
uvm_config_db#(int unsigned)::get(null, get_full_name(),
“sequence_length”, sequence_length);
uvm_config_db#(usb_transfer::type_enum)::get(null,
get_full_name(), “l(fā)ocal_type”, local_type);
uvm_config_db#(bit[7:0])::get(null, get_full_name(),?
“l(fā)ocal_device_id”, local_device_id);
repeat(sequence_length)
`uvm_do_with(req, {
req.device_id == local_device_id;
req.type == local_type;
})
endtask : body
endclass

通過上述修改,我們對測試用例進行了控制,以配置device_id、sequence_length和type。

這里需要注意的是:

uvm_config_db#()::set

中使用的參數(shù)類型和字符串(第三個參數(shù))應該與

uvm_config_db#()::get

中使用的類型相匹配,否則將無法正確配置。**這個地方如果出錯會非常痛苦,但好在不需要經(jīng)常修改,痛苦一次就好。**另外,這幾個配置項是隨機類型,相應的配置值也需要滿足約束范圍。

3、在創(chuàng)建復雜sequence的時候盡量去復用簡單的sequence。 例如,在下面的sequence 中順序發(fā)送不同的sequnce (層次化和模塊化,永遠是編碼規(guī)范之一)

|

class usb_complex_sequence extends uvm_sequence #(usb_transfer);
//Object of simple sequence used for sending bulk transfer
usb_simple_sequence simp_seq_bulk;
//Object of simple sequence used for sending interrupt transfer
usb_simple_sequence simp_seq_int;
…
virtual task body();
//Variable for getting device_id for bulk transfer
bit[7:0] local_device_id_bulk;
//Variable for getting device_id for interrupt transfer
bit[7:0] local_device_id_int;
//Variable for getting sequence length for bulk
int unsigned local_seq_len_bulk;
//Variable for getting sequence length for interrupt
int unsigned local_seq_len_int;
//Get the values for the variables in case top level
//test/sequence sets it.
uvm_config_db#(int unsigned)::get(null, get_full_name(),
“l(fā)ocal_seq_len_bulk”,local_seq_len_bulk);
uvm_config_db#(int unsigned)::get(null, get_full_name(),
“l(fā)ocal_seq_len_int”,local_seq_len_int);
uvm_config_db#(bit[7:0])::get(null, get_full_name(),
“l(fā)ocal_device_id_bulk”,local_device_id_bulk);
uvm_config_db#(bit[7:0])::get(null, get_full_name(),
“l(fā)ocal_device_id_int”,local_device_id_int);
//Set the values for the variables to the lowerlevel
//sequence/sequence item, which we got from
//above uvm_config_db::get.
//Setting the values for bulk sequence
uvm_config_db#(int unsigned)::set(null, {get_full_name(),”.”,
”simp_seq_bulk”}, “sequence_length”,local_seq_len_bulk);
uvm_config_db#(usb_transfer::type_enum)::set(null, {get_full_name(),
“.”,“simp_seq_bulk”} , “l(fā)ocal_type”,usb_transfer::BULK_TRANSFER);
uvm_config_db#(bit[7:0])::set(null, {get_full_name(), “.”,
”simp_seq_bulk”}, “l(fā)ocal_device_id”,local_device_id_bulk);
//Setting the values for interrupt sequence
uvm_config_db#(int unsigned)::set(null, {get_full_name(),”.”,
”simp_seq_int”}, “sequence_length”,local_ seq_len_int);
uvm_config_db#(usb_transfer::type_enum)::set(null, {get_full_name(),
“.”,“simp_seq_int”} , “l(fā)ocal_type”,usb_transfer::INT_TRANSFER);
uvm_config_db#(bit[7:0])::set(null,{get_full_name(),“.”,
”simp_seq_bulk”},“l(fā)ocal_device_id”,local_device_id_int);
`uvm_do(simp_seq_bulk)
simp_seq_bulk.get_response();
`uvm_send(simp_seq_int)
simp_seq_int.get_response();
endtask : body
endclass
聲明:本文內容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權轉載。文章觀點僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場。文章及其配圖僅供工程師學習之用,如有內容侵權或者其他違規(guī)問題,請聯(lián)系本站處理。 舉報投訴
  • UVM
    UVM
    +關注

    關注

    0

    文章

    182

    瀏覽量

    19236
  • 代碼
    +關注

    關注

    30

    文章

    4841

    瀏覽量

    69146
  • Coding
    +關注

    關注

    0

    文章

    6

    瀏覽量

    6452
收藏 人收藏

    評論

    相關推薦

    什么是3σ準則

    。當上述理由不明確時,可用相關標準規(guī)定的方法。 3σ準則是建立在正態(tài)分布的等精度重復測量基礎上的一種常用手段。假設一組數(shù)據(jù)只含有隨機誤差,對其進行計算處理得到標準偏差,按一定概率確定一個區(qū)間,認為凡超過
    發(fā)表于 09-08 07:49

    數(shù)字IC驗證之“什么是UVM”“UVM的特點”“UVM提供哪些資源”(2)連載中...

    原文鏈接:https://zhuanlan.zhihu.com/p/345775995大家好,我是一哥,上章內容主要講述兩個內容,芯片驗證以及驗證計劃。那本章我們主要講述的內容有介紹什么是uvm
    發(fā)表于 01-21 16:00

    什么是uvm?uvm的特點有哪些呢

    大家好,我是一哥,上章內容我們介紹什么是uvm?uvm的特點以及uvm為用戶提供了哪些資源?本章內容我們來看一看一個典型的uvm驗證平臺應該是什么樣子的,來看一個典型的
    發(fā)表于 02-14 06:46

    請問一下在UVM中的UVMsequences是什么意思啊

    UVM方法學中,UVMsequences 是壽命有限的對象。UVM sequencesuvm_sequence_item基類擴展得到,uvm
    發(fā)表于 04-11 16:43

    談談UVM中的uvm_info打印

    _severity  {  UVM_INFO,  UVM_WARNING,  UVM_ERROR,  UVM_FATAL  } uvm_se
    發(fā)表于 03-17 16:41

    UVM中seq.start()和default_sequence執(zhí)行順序

      1. 問題  假如用以下兩種方式啟動sequence,方法1用sequence的start()方法啟動seq1,方法2用UVM的default_sequence機制啟動seq2。那么seq1
    發(fā)表于 04-04 17:15

    Programming Sequences and Tips

    software programming sequences are crucial during the TSC initialization and data reading and are also helpful during the TSC mode cha
    發(fā)表于 06-10 10:53 ?37次下載

    集成級的UVM寄存器模型

    UVM使得驗證測試平臺的結構得以標準化,各種復用策略及標準對于提高驗證質量、縮短項目周期都非常有效。垂直重用是常見的復用策略之一,即同一項目測試平臺復用于不同驗證層次。驗證中常將最底層
    發(fā)表于 09-15 11:49 ?16次下載
    集成級的<b class='flag-5'>UVM</b>寄存器模型

    UVM驗證平臺執(zhí)行硬件加速

    UVM已經(jīng)成為了一種高效率的、從模塊級到系統(tǒng)級完整驗證環(huán)境開發(fā)標準,其中一個關鍵的原則是UVM可以開發(fā)出可重用的驗證組件。獲得重用動力的一個方面表現(xiàn)為標準的仿真器和硬件加速之間的驗證組件和環(huán)境的復用
    發(fā)表于 09-15 17:08 ?14次下載
    <b class='flag-5'>UVM</b>驗證平臺執(zhí)行硬件加速

    UVM學習筆記(一)

    driver應該派生自uvm_driver,而uvm_driver派生自uvm_component。
    的頭像 發(fā)表于 05-26 14:38 ?1461次閱讀
    <b class='flag-5'>UVM</b>學習筆記(一)

    UVM里的6個常見參數(shù)介紹分析

    UVM預先定義了六個詳細程度; UVM_NONE到UVM_DEBUG。這些級別只不過是整數(shù)枚舉值
    的頭像 發(fā)表于 06-06 12:33 ?4696次閱讀
    <b class='flag-5'>UVM</b>里的6個常見參數(shù)介紹分析

    UVMuvm_config_db機制背后的大功臣

    本次講一下UVM中的uvm_config_db,在UVM中提供了一個內部數(shù)據(jù)庫,可以在其中存儲給定名稱下的值,之后可以由其它TB組件去檢索。
    的頭像 發(fā)表于 06-20 17:28 ?1553次閱讀

    UVMuvm_config_db機制背后的大功臣

    本次講一下UVM中的uvm_config_db,在UVM中提供了一個內部數(shù)據(jù)庫,可以在其中存儲給定名稱下的值,之后可以由其它TB組件去檢索。
    的頭像 發(fā)表于 06-29 16:57 ?1401次閱讀

    一文詳解UVM設計模式

    本篇是對UVM設計模式 ( 二 ) 參數(shù)化類、靜態(tài)變量/方法/類、單例模式、UVM_ROOT、工廠模式、UVM_FACTORY[1]中單例模式的補充,分析靜態(tài)類的使用,UVM中資源池的
    的頭像 發(fā)表于 08-06 10:38 ?2139次閱讀
    一文詳解<b class='flag-5'>UVM</b>設計模式

    如何將sequences類型添加或注冊到sequence library里呢?

    uvm_sequence_library是從uvm_sequence擴展而來的,它是一個容納了一系列其它sequences類型的容器,在啟動時,它會根據(jù)模式從這系列sequences
    的頭像 發(fā)表于 09-08 15:06 ?701次閱讀
    如何將<b class='flag-5'>sequences</b>類型添加或注冊到sequence library里呢?