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.

Generation of N bit random bit stream in verilog

Status
Not open for further replies.

envyh123

Newbie level 3
Joined
Mar 25, 2015
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
30
I dont want to generate it using LFSR, i want to use $random function of verilog to generate a random 8 bit data stream. I have generated random integer from 0 to 255 using the following code.
Can anyone suggest methods to convert this into 8 bits
My code :


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
initial
begin
integer num;
repeat(100) @(posedge clock)
begin
#2;
num<=$urandom_range(255,0);
end
end

 
Last edited by a moderator:

hi,

" $urandom " system verilog not verilog.

.you can put something like this

value <= num[7:0];
so first 8 bits will be stored into value.

regards
 

Did you mean to ask how to serialize an 8-bit value into a stream of 1-bit values?

Code:
bit signal;

initial repeat (100)
           begin
             bit [0:7] num;
             num = $urandom;
             for(int i=0;i<8;i++)
              @(posedge clock)
                 signal <= num[i];
           end
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top