Closed BorisDosen closed 10 years ago
nice graph!
I don't have time to look right now, but if you put that question on this forum
http://www.edaboard.com/forum30.html
an answer shall arrive swiftly. Let me know if you get a solution, just incase I start trying to work it out :+1:
Just a thought though, if l_r8 is fine, I imagine that truncating a random number may not necessarily result in a random number. Especially with the 0000 and 1111 limit.
Something a bit strange here! In a peusdo-random binary sequence produced by a shift register, zero should never appear - think about how the shift register works to convince yourself that this is true. However, the maximum value should appear as often as any other. I notice that if you add the zeros to the 15s you would get the expected result - is this just a bug!
Phil
From: Danny Nicholls notifications@github.com Sent: 21 February 2014 20:21 To: DannyNicholls/NetEmulation Subject: Re: [NetEmulation] Random number distribution (#13)
Just a thought though, if l_r8 is fine, I imagine that truncating a random number may not necessarily result in a random number. Especially with the 0000 and 1111 limit.
Reply to this email directly or view it on GitHubhttps://github.com/DannyNicholls/NetEmulation/issues/13#issuecomment-35769550.
Boris, have you tried taking the first 4 most significant bits instead of the last 4 ones? I'm not sure if this will make any difference but maybe taking the 4 least significant bits of an 8-bit vector is what causing 0000 to appear.
There is a LFSR for random numbers in the altera cookbook, could you just use that?
http://www.altera.com/literature/manual/stx_cookbook.pdf
They also propose a random number generation from a ring oscillator which looks interesting.
I started googling to see how these work and found an in depth explanation here, and decided to go to bed instead lol.
http://www.ovro.caltech.edu/~dwh/correlator/pdf/lfsr_tutorial.pdf
I've been looking into distribution of the pseudo random number generated by this code
logic [7:0] l+r8; logic [(log2AndRoundUp(`PORTS))-1:0] l_temp; //'PORTS=10, making l_temp 4bit
For some reason number 0000 and 1111 are not generated as often as all the other numbers. Strange, as the distribution of l_r8 looks fine! Any ideas?
Here is the graph: