How to write a Verilog or SV code to model this delay btw read and read signal in memory controller?

I want to model a controller where after one read to another read there should be 3 clk cycles delay. From read to write 6 clk delays. How to introduce these delays!

In reply to Sv-hustler:
Model is for read-to-read and write-to-write. Modify as needed.
Use automatic tasks with the fork join_none. See my paper SVA in a UVM Class-based Environment (link in my signature below).


    bit clk, rd, rd_cntlr, wr, wr_cntlr; 
    task automatic rd4cntlr(int delay, bit value);
        repeat(delay-1'b1) @(posedge clk); 
        rd_cntlr <= value;
    endtask //automatic

    task automatic wr4cntlr(int delay, bit value);
        repeat(delay-1'b1) @(posedge clk); 
        wr_cntlr <= value;
    endtask //automatic

    always_ff @(posedge clk) begin
        fork
            rd4cntlr(3, rd);
            wr4cntlr(6, wr);    
        join_none      
    end 

testbench


import uvm_pkg::*; `include "uvm_macros.svh" 
module top; 
    bit clk, rd, rd_cntlr, wr, wr_cntlr;  
    default clocking @(posedge clk); 
    endclocking
    initial forever #10 clk=!clk;   
    
    task automatic rd4cntlr(int delay, bit value);
        repeat(delay-1'b1) @(posedge clk); 
        rd_cntlr <= value;
    endtask //automatic

    task automatic wr4cntlr(int delay, bit value);
        repeat(delay-1'b1) @(posedge clk); 
        wr_cntlr <= value;
    endtask //automatic

    always_ff @(posedge clk) begin
        fork
            rd4cntlr(3, rd);
            wr4cntlr(6, wr);    
        join_none      
    end
    
    ap_rd1: assert property(@ (posedge clk) rd |-> ##3 rd_cntlr); 
    ap_rd0: assert property(@ (posedge clk) !rd |-> ##3 !rd_cntlr); 
    ap_wr1: assert property(@ (posedge clk) wr |-> ##6 wr_cntlr); 
    ap_wr0: assert property(@ (posedge clk) !wr |-> ##6 !wr_cntlr); 




    initial begin 
        repeat(200) begin 
            @(posedge clk);  #1; 
            if (!randomize(rd, wr)  with 
            { rd dist {1'b1:=1, 1'b0:=3};
              wr dist {1'b1:=1, 1'b0:=4};          
        }) `uvm_error("MYERR", "This is a randomize error")
    end 
    $finish; 
end 
endmodule   

Ben Cohen
http://www.systemverilog.us/ ben@systemverilog.us
For training, consulting, services: contact Home - My cvcblr


  1. SVA Alternative for Complex Assertions
    Verification Horizons - March 2018 Issue | Verification Academy
  2. SVA: Package for dynamic and range delays and repeats | Verification Academy
  3. SVA in a UVM Class-based Environment
    SVA in a UVM Class-based Environment | Verification Horizons | Verification Academy