RegisterLogin  
Update Profile
   
You are here: Forum  
Minimize 
SVUG Community Forum
Subject: random seed
Prev Next
You are not authorized to post a reply.

Author Messages
LINUser is Offline

Posts:1

10/15/2008 10:16 PM  
Hi *
if I run a random case, I will get the same result everytime, so it means the random seed is not base of the time.
what is the random seed base of ?
how can I get the different result in the random case?

thanks
ANSHUMANUser is Offline

Posts:3

10/16/2008 12:07 PM  
Generally seed is passed from the simulator down to the classes.
You can change the see in a variety of ways:

1) In a class, in your new overloaded function, do the following:

void function new (int seed)
this.srandom(seed);
endfunction

This will manually set the seed fot this class.

2) You can set the process base seed. In your top initial-begin code, add:

process::self.random();

Change seed to any integer value and all underlying classes, etc will treat this as base seed for generating their own seed.

3) Pass the seed from the simulator. For eg: in modelsim, you can pass the base seed as an option while running the simulation:

vsim -sv_seed

4) For most sophisticated seeding options, you can use set_randstate() and get_randstate() functions.

Hope that helps,

Anshuman
You are not authorized to post a reply.



ActiveForums 3.7
  

 Copyright 2008 by SystemVerilog User Group Contact Us    Privacy Statement