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.

How to creat a random data in verilog!

Status
Not open for further replies.

test_out

Advanced Member level 4
Joined
Feb 10, 2006
Messages
103
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,298
Activity points
1,959
Hi,

I wouldlike to check my design, and I want to creat a random data stream 36 bit. How can I do?
Thanks
 

insert
$random
in your testbench
 

    test_out

    Points: 2
    Helpful Answer Positive Rating
hi,

The system task, $random, it can generates random number. It is a good practice to use it in the testbench to detect any hidden bugs in the design.

Ex.
// ur testbench
always @(posedge clock)
addr = $random(r_seed);

// r_seed is optional and is used to ensure the same random number sequence each time the test is run.

For more info, please refer to this book:
Verilog® HDL: A Guide to Digital Design and Synthesis
by Samir Palnitkar.

I think u can download this book from Edaboard.

Enjoy..

-no_mad
 

    test_out

    Points: 2
    Helpful Answer Positive Rating
$random, the verilog LRM or IEEE standard should be the best reference
 

i'm not sure how u can generate a 36-bit random value. $random provides only 32 bit max value. what you could probably do is, concatenate it with a 4-bit counter
 

to sree205,
you can use two random and combine them!!
 

    test_out

    Points: 2
    Helpful Answer Positive Rating
Hi, jjww110

Can you explain more detail, how can I combine two random to form 36_bit random value?

Added after 19 minutes:

ah, I got it, thanks you!!
 

use $random%(see_d) function
it will generate values betwwen -(see_d-1) to +(see_d -1)
To constraint to +ve values only
use {$random}%(see_d) so the values generated will be in the range 0 to (se_d -1)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top