VMM學習-vmm_log

來源:互聯網
上載者:User

標籤:style   blog   color   使用   io   art   

功能類似verilog裡的$display函數,在vmm裡做了強化,可以在模擬過程中看到整個平台的運行資訊,用來調試模擬平台。

函數原型在vmm.sv裡(class vmm_log;),其建構函式為extern function new(string name,string inst,vmm_log under=null),name表示包含vmm_log的類的名稱,inst是包含vmm_log的類的例化名字,vmm的驗證組件(test/generator/driver,etc)都包含vmm_log的隱式例化,在編寫驗證組件時不需要再次例化,對於transaction則不同,因為在驗證期間,transcation往往會被例化很多次,這時的vmm_log往往需要在編寫驗證組件時單獨例化,例化為靜態函數,可以讓transactions一直使用,比如:

class wb_spi_trans extends vmm_data;    static vmm_log log = new("wb_spi_trans","WB_SPI_TRANS");    ...
  function new();
    super.new(this.log);
    ‘vmm_note(this,log,"Create an object");
  endfunction: newendclass : wb_spi_trans

這樣在例化wb_spi_trans時就會輸出資訊“Normal[NOTE] on wb_spi_trans(WB_SPI_TRANS) at 0

Create an object”,參數name的作用在於告訴你是哪個組件輸出的資訊,參數inst的作用在於告訴你這個組件在整個驗證環境中的層次(例化名稱)。VMM通過參數化的宏定義輸出資訊,比如上面的‘vmm_note,展開後:

do    if(log.start_msg(vmm_log::NOTE_TYP)) begin        ‘void(log.text("Create an object"));    log.end_msg();    endwhile(0)

log.start_msg函數輸出”Normal[NOTE] on wb_spi_trans(WB_SPI_TRANS) at 0",log.test輸出"Create an object",log.end_msg結束輸出。vmm_log關鍵的屬性有資訊種類types_e(枚舉類型:FAILURE_TYP/NOTE_TYP/DEBUG_TYP/REPORT_TYP/NOTIFY_TYP...),資訊等級(枚舉類型:FATAL_SEV/ERROR_SEV/WARNING_SEV/NORMAL_SEV/TRACE_SEV/DEBUG_SEV...),函數根據這兩個變數來決定是否將資訊輸出,start_msg根據這兩個變數決定是否輸出資訊,根據name和inst決定是哪個組件在輸出資訊。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.