J
Jonathan Bromley
Guest
On Fri, 25 Jan 2008 10:40:11 -0800,
Dwayne Dilbeck wrote:
clock cycle.... but the 64-bit words are painfully strongly
correlated from one cycle to the next. You need to clock
your N-bit LFSR for at least N cycles before pulling the
next N-bit value from it.
Even then, the random numbers aren't brilliantly random
(or at least that's what I am led to understand - I don't
have a particularly good grip on the somewhat scary math)
but LFSRs are indeed a good source of quasi-random stuff
for non-critical applications. Just remember to clock
them enough times!
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
Dwayne Dilbeck wrote:
aaargh.... note that this gives you one pseudo-random BIT perI usually use a maximal LFSR to obtain psuedo random numbers.
The following link will give you some good information.
www.xilinx.com/ipcenter/catalog/logicore/docs/lfsr.pdf
I like Appendix B wich lists the tap points up to 168bits for a maximal
length LFSR.
The following would generate psudeo random 64 bit numbers starting with seed
value 1.
entity generator is
port (
clk:in bit;
aut bit_vector(63 downto 0));
end;
achitecture processflow of generator is
begin
CLKEDrocess
variable temp:bit_vector(63 downto 0) :=
X"0000_0000_0000_0001";
begin
temp := temp(63 downto 0 ) & (temp(63) xor temp(62) );
a <= temp;
wait until (clk = '0');
end process
end
clock cycle.... but the 64-bit words are painfully strongly
correlated from one cycle to the next. You need to clock
your N-bit LFSR for at least N cycles before pulling the
next N-bit value from it.
Even then, the random numbers aren't brilliantly random
(or at least that's what I am led to understand - I don't
have a particularly good grip on the somewhat scary math)
but LFSRs are indeed a good source of quasi-random stuff
for non-critical applications. Just remember to clock
them enough times!
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.