Random Bit Generator

Oct 20, 2010 78 Replies

Thanks! WHAT! No 8-input-NOR available, like a 74HC4078 ?:-) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Unlabeled gate below....

My 'HC164 has A, B as inputs, which I assumed were your D1, D2 inputs until I noticed the unlabeled device.

[snip]

WHAT IS THIS ===> | | | | | |

...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Smoke if you got 'em! ;)

Sorry about that, it's one of the gates in an HC86.

OK. Thanks! ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Knuth's "Art of Computer Programming" Vol 2 (iirc) has everything you'd ever want to know about PRBSes as well as other sorts of RNGs, such as linear congruential generators. Knuth goes all the way from number theory to cookbook tables.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal ElectroOptical Innovations 55 Orchard Rd Briarcliff Manor NY 10510 845-480-2058 email: hobbs (atsign) electrooptical (period) net http://electrooptical.net

rs

formatting link

ends with a list of possible taps for 3 to 168 bit maximum length LFSRs

-Lasse

I posted some pages of Applied Cryptography here:

formatting link

The pages contain the information you need to build dozens of different LFSR's of maximum period using a couple of 74... series. IIRC you can replace the XOR function with NXOR and get a maximal period LSFR that will self start (the all zero startup state becomes a valid state for the LSFR)

I'm only getting 52 before a repeat :-(

(I'm looking at the serial stream.) ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Jim,

Look at the pages I just posted. They will give you the taps for the maximum length sequence (should be 4,3,2,0)

Link times out :-( ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Send PM - I'll PM the zip file (0.5 Mb)

Get rid of that reset kludgery.

LFSRs with the right taps will cycle through 2^N-1 states. The other state is stable.

The stable state is all 0s or all 1s. You can switch to the other one with an inverter.

These are my opinions, not necessarily my employer's. I hate spam.

I did :-)

...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

It will click when you see it. The key idea is Finite State Machine. With N flip-flops, the best you can do is 2^N states. A counter gets them all, but it's not random.

A LFSR with the right taps gets 2^N-1, and they happen to be a "nice" random pattern. They are widely used in gear for testing communication links.

Horowitz and Hill, Art of Electronics, has a nice section starting on page 655. It's only 3 pages, no hairy math.

The Wikipedia article on LFSRs is good:

formatting link

These are my opinions, not necessarily my employer's. I hate spam.

OK. Got it working. Repeats at 255.

What was confusing me was the double-talk about numbering the shift-register stages. Must be Physics majors who still have their direction of current reversed ;-)

Thanks again, David! ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Yep, That's a good one. Thanks! ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Strange. Those taps are supposed to yield a maximal length sequence (2^n-1), and the pulse-stuffer is supposed to force the sequence to include the lockup state, yielding 2^n states between repeats. I'll get on it tomorrow and, hopefully, find where the problem lies. In the meantime, I apologize for the inconvenience.

No problem. "Breadboarded" instantly in PSpice ;-)

I'm currently running with taps at 8,4,3,2 and getting a 255-long sequence. ...Jim Thompson

| James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I can see November from my house :-)

Nah - it's a digital nerd thing - Typically, for a binary output, Q0, Q1, ... Qn, the bit position corresponds to that power of two. As far as which way you shift, there's a holy war between little-endian and big-endian, but ssentially, it's a coin toss. :-)

Cheers! Rich

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required