Random in time register read -SV

Hello Everyone,

I have requirement to do polling i.e, i should do random register read of the interrupt register. How do i randomly do register read in random time. Any pointers do i need to use rand or any suggestions.

PS: I have task READ_REG(INTR) which reads the interrupt register, how do i do this read in random time

Thanks,
Tejas

In reply to tejasakulu:
Randomize an int variable and Delay that variable. Randomize the reg number.


 import uvm_pkg::*; `include "uvm_macros.svh" 
module top;      
    event e; // for debug  
    function void READ_REG(int q) ;
        -> e; 
    endfunction 

 initial begin 
        int v, r; 
        repeat(200) begin  
            if (!randomize(v, r)  with 
            { v < 40 && v > 10; 
              r < 16 && r >= 0; 
        }) `uvm_error("MYERR", "This is a randomize error");
        #v; 
        READ_REG(r);
        end 
        $stop; 
   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