Jump to content

Siarhei

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by Siarhei


  1. It is possible to set RNG seed for each process in a module (always_.., initial, etc.). To do this it is necessary to have a process handler:

    module dut();
    
       int i;
       process P1;
    
       initial begin
          P1 = process::self();
          #2;
          i = $urandom_range(0, 500);
          $display("The value of i is %1d", i);
       end
    
    endmodule // dut

    Now you can set seed for each process individually:

    module top_tb;
    
       initial begin
          #1;  // Wait process handlers to be created
    
          // Set seeds
          dut_a.P1.srandom($urandom);
          dut_b.P1.srandom($urandom);
          dut_c.P1.srandom($urandom);
       end
    
       dut dut_a();
       dut dut_b();
       dut dut_c();
    
    endmodule

     

×
×
  • Create New...