hoheiho
- 43
- 0
Homework Statement
Hi, I would like to generate a random delay time and value in testbench. This is what I did:
Code:
for(i=0;i<300;i=i+30)
begin
j = i + {$random} % (300 - i) // MIN + {$random} % (MAX - MIN )
#j b = {$random} %3;
#3ns b = 3'b000;
end
I want to generate random value in random time. int i give me the range of random time. j is the actual random delay timing and b is the random value.
What I want to do here is generate a range -> generate delay time-> use value b in the the generated delay time -> recover value b after 3ns.
But it comes out error with:
**near "#": syntax error, unexpected '#', expecting ';'
Is that mean I can only use a actual value for the delay? Like #30, #20...but not a unknown value #j ? I have google it but cannot find any useful information about my problem..
Thank you very much for the help
Ivan
Last edited: