async_fifo_tb_rd.sv

来自「system verilog fifo env」· SV 代码 · 共 85 行

SV
85
字号
`include "async_fifo_defines.v"class async_fifo_tb_rd;  virtual async_fifo_if async_fifo_inf;  rand integer rinc_wait;  rand integer rinc_wait_rand;  rand integer rinc_wait1;  FAST_WRD fast_wrd;  constraint rinc_wait1_c {                               rinc_wait1 dist {                                                 0 :/90,                                                 1 :/10,                                                 [2:10] :/ 1                                               };                          }  constraint rinc_wait_c {                            rinc_wait                                       dist {                                               ((fast_wrd==RD) ? (1<<ASIZE)*wrd_ratio : rinc_wait1) :/90,                                              rinc_wait1 :/ 10                                              };                         }  constraint rinc_wait_rand_c {                            rinc_wait_rand                                       dist {                                               //((fast_wrd==RD) ? (1<<ASIZE)*wrd_ratio_rand : rinc_wait1) :/90,                                              rinc_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;      this.fast_wrd = fast_wrd;      fork      begin         async_fifo_tb_rddata;      end      join_none      async_fifo_inf.rinc  = 1'b0;  endfunction : new  task async_fifo_tb_rddata();       bit randomize_result;       wait (async_fifo_inf.rrst_n);`ifdef FIFO_RD_DATA_OPT              repeat (10) @(posedge async_fifo_inf.rclk);`endif       while (1'b1)       begin           if (~async_fifo_inf_U.rempty)           begin              async_fifo_inf.rinc  = 1'b1;           end           else           begin              async_fifo_inf.rinc  = 1'b0;           end           repeat (1) @(posedge async_fifo_inf.rclk);           async_fifo_inf.rinc  = 1'b0;           //repeat ($urandom_range(30,0)) @(posedge async_fifo_inf.rclk);           randomize_result = this.randomize();           if (async_fifo_inf_U.wfull)           begin              repeat (rinc_wait1) @(posedge async_fifo_inf.rclk);           end           else           begin              repeat (rinc_wait_rand) @(posedge async_fifo_inf.rclk);           end       end  endtask : async_fifo_tb_rddataendclass

⌨️ 快捷键说明

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