⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d_h_bfm.sv

📁 VMM 文档加源码, synopsys公司很好的验证资料
💻 SV
字号:
//// Template for VMM-compliant half-duplex physical-level transactor//// <XACT>       Name of transactor// <IF>         Name of physical interface// <master>     Name of modport in physical interface// <TR>         Name of input transaction descriptor class//`ifndef XACT__SV`define XACT__SV`include "vmm.sv"`include "IF.sv"`include "TR.sv"typedef class XACT;class XACT_callbacks extends vmm_xactor_callbacks;  // ToDo: Add additional relevant callbacks  // ToDo: Use "function void" if callbacks cannot be blocking   // Called before a transaction is executed   virtual task pre_trans(XACT xactor,                          TR tr,                          bit drop);   endtask: pre_trans   // Called after a transaction has been executed   virtual task post_trans(XACT xactor,                           TR tr);   endtask: post_transendclass:XACT_callbacksclass XACT_cfg;   // ToDo: Add transactor configuration class properties   rand int mode;endclass:XACT_cfgclass XACT extends vmm_xactor;   int EXECUTING;   protected XACT_cfg cfg;   local     XACT_cfg reset_cfg;   TR_channel in_chan;   virtual IF.master sigs;   extern function new(string             inst,                       int                stream_id,                       virtual IF.master  sigs,                       XACT_cfg           cfg = null,                       TR_channel         in_chan = null);     extern virtual function void reconfigure(XACT_cfg cfg);   extern virtual function void reset_xactor(reset_e rst_type = SOFT_RST);   extern protected virtual task main();endclass:XACTfunction XACT::new(string             inst,                   int                stream_id,                   virtual IF.master  sigs,                   XACT_cfg           cfg,                   TR_channel         in_chan);   super.new("XACT Transactor", inst, stream_id);   this.EXECUTING = this.notify.configure(-1, vmm_notify::ON_OFF);   this.sigs = sigs;   if (cfg == null) cfg = new;   this.cfg = cfg;   this.reset_cfg = cfg;   if (in_chan == null) in_chan = new("XACT Input Channel", inst);   this.in_chan = in_chan;endfunction: newfunction void XACT::reconfigure(XACT_cfg cfg);   if (!this.notify.is_on(XACTOR_IDLE)) begin      `vmm_warning(this.log, "Transactor should be reconfigured only when IDLE");   end   this.cfg = cfg;      // ToDo: Notify any running threads of the new configurationendfunction: reconfigurefunction void XACT::reset_xactor(reset_e rst_type);   super.reset_xactor(rst_type);   // ToDo: Reset output signals   this.sigs.mck1.sync_txd <= 0;   this.sigs.mck1.sync_dat <= 'z;   this.sigs.async_en      <= 0;   this.in_chan.flush();   // ToDo: Reset other state information   if (rst_type != SOFT_RST) begin      // ToDo: Reset state if FIRM or above   end   if (rst_type == PROTOCOL_RST) begin      // ToDo: Reset state if PROTOCOL   end      if (rst_type == HARD_RST) begin      // ToDo: Reset state if HARD or above      this.cfg = this.reset_cfg;   endendfunction: reset_xactortask XACT::main();   super.main();   forever begin      TR tr;      bit drop;      // ToDo: Set output signals to their idle state      this.sigs.mck1.sync_txd <= 0;      this.sigs.mck1.sync_dat <= 'z;      this.sigs.async_en      <= 0;            this.wait_if_stopped_or_empty(this.in_chan);      this.in_chan.activate(tr);      drop = 0;      `vmm_callback(XACT_callbacks,                    pre_trans(this, tr, drop));      if (drop) begin         this.in_chan.remove();         continue;      end            this.in_chan.start();      this.notify.indicate(this.EXECUTING, tr);      `vmm_trace(this.log, "Starting transaction...");      `vmm_debug(this.log, tr.psdisplay("   "));      case (tr.kind)          TR::READ: begin            // ToDo: Implement READ transaction         end         TR::WRITE: begin            // ToDo: Implement READ transaction         end      endcase      this.notify.reset(this.EXECUTING);      this.in_chan.complete();      `vmm_trace(this.log, "Completed transaction...");      `vmm_debug(this.log, tr.psdisplay("   "));      `vmm_callback(XACT_callbacks,                    post_trans(this, tr));      this.in_chan.remove();   endendtask: main`endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -