Randomization in verilog

Status
Not open for further replies.

joc

Newbie level 2
Joined
Apr 19, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,295
Hi,

I have a testcase in verilog to program different register using randomization.
The value is given to a register as below:

initial begin
repeat(100) begin
reg[19:14] = $urandom_range(0,48);
end
end
so reg is getting assigned with values between 0 and 48.I want the reg to be assigned with all values between 0 and 48 like randc in system verilog.This to achieve full toggle coverage.
Can anybody help me?

thanks in advance,
Joc
 

Put the values 0 -48 in an array, and then call array.shuffle(). You might want to declare the array as a queue so you can push the values in order, shuffle, then pop them off the queue.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…