Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > How to generate serial random data pattern ?

Reply
Thread Tools

How to generate serial random data pattern ?

 
 
C T
Guest
Posts: n/a
 
      03-01-2004
For the testbench, I would like to send a serial random data pattern
(16-bit words, 10MHz clock) via a FPGA to a 512K16 RAM and then later
on read the data back for verification.

Please let me know what the best approach in VHDL coding to come up
with the pattern generation and verification should be.

Thanks.

Calvin
 
Reply With Quote
 
 
 
 
Amontec Team
Guest
Posts: n/a
 
      03-02-2004
C T wrote:
> For the testbench, I would like to send a serial random data pattern
> (16-bit words, 10MHz clock) via a FPGA to a 512K16 RAM and then later
> on read the data back for verification.
>
> Please let me know what the best approach in VHDL coding to come up
> with the pattern generation and verification should be.
>
> Thanks.
>
> Calvin


Use pseudo-random -> a shift register and an XOR in the MSB-LSB feedback.

Laurent www.amontec.com

 
Reply With Quote
 
 
 
 
Cameron, Charles B.
Guest
Posts: n/a
 
      03-02-2004


C T wrote:

>For the testbench, I would like to send a serial random data pattern
>(16-bit words, 10MHz clock) via a FPGA to a 512K16 RAM and then later
>on read the data back for verification.
>
>Please let me know what the best approach in VHDL coding to come up
>with the pattern generation and verification should be.
>
>Thanks.
>
>Calvin
>


There's a good description of linear feedback shift registers at


http://www.newwaveinstruments.com/re...ister_lfsr.htm

Charles B. Cameron

 
Reply With Quote
 
Charles M. Elias
Guest
Posts: n/a
 
      03-05-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (C T) wrote in message news:<(E-Mail Removed). com>...
> For the testbench, I would like to send a serial random data pattern
> (16-bit words, 10MHz clock) via a FPGA to a 512K16 RAM and then later
> on read the data back for verification.
>
> Please let me know what the best approach in VHDL coding to come up
> with the pattern generation and verification should be.
>
> Thanks.
>
> Calvin


Calvin

Ben Cohen's website has a very nice package that allows you to create
linear-feedback shift registers (LFSRs) of many lengths. These
generate a pseudorandom sequence that may work for you.

http://members.aol.com/vhdlcohen/vhdl is the link.

I have used LFSRs in testbenches and in designs. For simulations I
have also used a random number generation procedure which produces an
integer which I then convert to std_logic_vector or unsigned or
whatever:

signal Seed_s : natural := 17654; --you may pick other values for the
seed

procedure RandUnsigned( Size : in natural;
signal Seed : inout natural;
signal RandVec : out unsigned ) is

variable Modulus : integer := ( 2 ** Size ) - 1;
constant Multiplier_c : INTEGER := 25173;
constant Increment_c : INTEGER := 13849;

begin
Seed <= ( Multiplier_c * Seed + INCREMENT_c ) mod Modulus;
RandVec <= To_Unsigned( Seed, Size );
end procedure RandUnsigned;

procedure RandSLV( Size : in natural;
signal Seed : inout natural;
signal RandVec : out std_logic_vector )
is

variable Modulus : integer := ( 2 ** Size ) - 1;
constant Multiplier_c : INTEGER := 25173;
constant Increment_c : INTEGER := 13849;

begin
Seed <= ( Multiplier_c * Seed + INCREMENT_c ) mod Modulus;
RandVec <= std_logic_vector(To_Unsigned( Seed, Size ));
end procedure RandSLV;

Each time you call the procedure the vector output takes on a new
"random" value.

Charles
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generate random string matching specific pattern and length Kevin Ruby 7 05-17-2011 02:47 AM
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
How to generate a serial random number Li Chen Ruby 5 01-16-2008 05:27 PM
how to generate random data for a normal distribution Yudan YI \(OSU\) C++ 5 02-25-2005 10:07 AM



Advertisments