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.

Random Numbers Generator

Status
Not open for further replies.

StevieChalmers

Newbie level 1
Joined
Dec 14, 2005
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
I need a random number generator
written in VHDL to generate natural numbers
from 0 to 15. Does anyone have anything
similar to it (like any natural numbers
generator) ?

Any help would be much appreciated.
Thanks in advance.
 

tarkyss

Full Member level 6
Joined
Aug 1, 2005
Messages
340
Helped
26
Reputation
52
Reaction score
8
Trophy points
1,298
Location
China
Activity points
4,162
**broken link removed**
This library has functions for generating good quality random numbers in a VHDL testbench environment. The functions will NOT synthesize.
 

leongch

Member level 2
Joined
Dec 22, 2005
Messages
44
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,692
hi, if the functions are not synthesizable mean we cant download it onto the fpga and realize it? I want to confirm because my frenz's final year project may require random number generator as part of his project and the project must at the end able to be download into the FPGA and reliaze it... thanks
 

Iouri

Advanced Member level 2
Joined
Aug 17, 2005
Messages
678
Helped
87
Reputation
174
Reaction score
8
Trophy points
1,298
Activity points
4,814
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;

ENTITY psp IS
PORT( clk : in std_logic;
reset : in std_logic;
init_value : in std_logic_vector(8 downto 0);
dout : out std_logic);
END psp;

ARCHITECTURE rus OF psp IS

SIGNAL reg: std_logic_vector(8 downto 0);

BEGIN

process(clk, reset, init_value)
begin
if reset = '1' then
reg <= init_value;
elsif rising_edge(clk) then
reg <= (reg(4) xor reg(0)) & reg(8 downto 1);
end if;
end process;

dout <= reg(0);

END rus;
 

moorthi

Member level 1
Joined
Aug 29, 2005
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,600
Hi use a 4-Stage de-bruijn sequence generator and take all the four bits as output.
To about de-bruijn genenerator type "de bruijn sequence" in google search.
 

ahmad_abdulghany

Advanced Member level 4
Joined
Apr 12, 2005
Messages
1,206
Helped
102
Reputation
206
Reaction score
22
Trophy points
1,318
Location
San Jose, California, USA
Activity points
11,769
you can simply use any number of D-FF (depending on the word length you need to generate in your random number as number of Flip flops equal to number of bits per word) cascade these FFs with output of last stage connected to the input of first stage after XNOR or XOR gates.. this will generate random numbers of n-bits.. you can then simply use VHDL to get the required code of it..

I hope that helpls..
Ahmad,
 

vomit

Full Member level 2
Joined
Jun 14, 2002
Messages
148
Helped
14
Reputation
28
Reaction score
4
Trophy points
1,298
Activity points
1,527
This is a frequently asked question:
See section 4.10 of **broken link removed**

For something synthesizable: look here
**broken link removed**
 

janovetz

Newbie level 2
Joined
Sep 21, 2003
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
16
The HDL code posted above will work, but I would recommend using a longer shift register. Longer registers repeat less frequenty.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top