📄 async_fifo_tb_wr.sv
字号:
`include "async_fifo_defines.v"class async_fifo_tb_wr; virtual async_fifo_if async_fifo_inf; rand integer winc_wait; rand integer winc_wait_rand; rand integer winc_wait1; FAST_WRD fast_wrd; constraint winc_wait1_c { winc_wait1 dist { 0 :/90, 1 :/10, [2:10] :/ 1 }; } constraint winc_wait_c { winc_wait dist { ((fast_wrd==WR) ? (1<<ASIZE)*wrd_ratio : winc_wait1) :/90, winc_wait1 :/ 10 }; } constraint winc_wait_rand_c { winc_wait_rand dist { //((fast_wrd==WR) ? (1<<ASIZE)*wrd_ratio_rand : winc_wait1) :/90, winc_wait1 :/ 90, [3:10] :/ 10 }; } function new ( virtual async_fifo_if async_fifo_inf, FAST_WRD fast_wrd); this.async_fifo_inf = async_fifo_inf; $display("WRD_RATIO = %d",wrd_ratio); this.fast_wrd = fast_wrd; fork begin async_fifo_tb_wrdata; end join_none async_fifo_inf.winc = 1'b0; async_fifo_inf.wdata = $random; endfunction : new task async_fifo_tb_wrdata(); bit randomize_result; wait (async_fifo_inf.wrst_n);`ifdef FIFO_RD_DATA_OPT repeat (10) @(posedge async_fifo_inf.rclk);`endif while (1'b1) begin if (~async_fifo_inf.wfull) begin async_fifo_inf.winc = 1'b1; async_fifo_inf.wdata = $random; end else begin async_fifo_inf.winc = 1'b0; end repeat (1) @(posedge async_fifo_inf.wclk); async_fifo_inf.winc = 1'b0; //repeat ($urandom_range(20,0)) @(posedge async_fifo_inf.wclk); randomize_result = this.randomize(); if (async_fifo_inf_U.rempty) begin repeat (winc_wait1) @(posedge async_fifo_inf.wclk); end else begin repeat (winc_wait_rand) @(posedge async_fifo_inf.wclk); end end endtask : async_fifo_tb_wrdataendclass
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -