Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Randomization in verilog

Status
Not open for further replies.

joc

Newbie level 2
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top