"Random" Circuit Needed.

Apr 01, 2015 66 Replies

For a simulation situation I need a random number generator with a twist...



What I need to simulate is a "random" selection of one-of-16 outputs.



Clock "speed" is 12.5kHz ;-)



Built of 74HCxx parts is preferred... I have a full ensemble of those device in my PSpice library.



Thanks in advance. ...Jim Thompson



-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.


What about a maximal-length PRBS generator using shift register and feedback taps? Clock it at 12.5*4 = 50 KHz and take any 4 bits.

Den onsdag den 1. april 2015 kl. 20.00.38 UTC+2 skrev Jim Thompson:

lfsr and 4-16 decoder ?

list of feedback taps in this:

formatting link

with some sizes just a single xor

-Lasse

If you use something like an HC154 with an LFSR driving its address inputs to generate random one-hots on its outputs, will that work for you?

John,

What are you saying... take the outputs of the LFSR broadside to drive the address lines of the 'HC154?

I think that would do it.

Thanks also to Lasse for the same suggestion. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Do you want to build hardware, or just Spice this?

LT Spice has random signal generators. You could quantize one of them, and drive a decoder.

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

How random? You could use a 16-bit PRBS made from two HC299 and an HC86. Feed back Q14 XOR Q13, and tap out four stages to a HC154 demux. If you need better randomness, use four PRBSes of different length.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

"For a simulation situation..." ;-)

John F and Lasse have provided how to do it. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

I was puzzling over how to get 0000, but then it dawned... just use an

8-bit LFSR and use the last 4-bits. ...Jim Thompson
| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

I just need semi-random enough to test a fast AGC. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

There's really nothing quite like that thrilling flash of discovery, is there? If you need 0000 out and you only want to use a 4 bit LFSR, then use XNOR feedback to force the lockup state to 1111 instead of 0000 and you'll magically jump over 1111 once per cycle. If you need an LFSR with a maximal length of 2^n instead of 2^n-1, then a pulse-stuffer is called for. If there's any interest I'll post a schematic.

Den onsdag den 1. april 2015 kl. 21.10.36 UTC+2 skrev Jim Thompson:

you'd want to use an lfsr of more than 4 bit anyways so the sequence isn't just the same 16 steps repeating

-Lasse

For simulation I'd use the built-in rand() function of LTspice, if you want gaussian instead of uniform distribution, use five rand()'s summed appropriately. You said you like to use PSpice only, so create a text file to use in a PWL type thingy THEN you can get completel control, likw distribution and the elusive 1/f etc, any type statistics you want.

For Hardware to not have to go buy much, use the Soundcard and run it directly with either a repeating pattern of random values, or from a random number generator to get very long runs. The method of converting FROM the audio output [BW is 10Hz to approx 100kHz] is left to the 'student'] The point here is that you can get repeatable random sequences that are completely under your control.

there is a bias with the 8-bit just use the last 4 bit idea. With 255 'clocks' all states but 0000 will occur 16 times while 0000 will only appear 15 - the cycle then repeats. The lack of the extra 0000 may cause the bias point to continually drift high.

I'm after "random" as in numbers 1-16, which will turn on specific I/Q components of a modulation "constellation", such as 16-QAM... building a carrier extractor with AGC and needed a stimulus ;-) ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

yeah, but no LFSR visits all states.

umop apisdn

Uniform distribution sounds like a great 'first' test.

However, often modulators are not always set up to 'scramble' the data to create uniform distribution. Does that mean you should also check some weird distributions reflecting fixed/sloppy modulation? Especially if the

16 level space has any type of one to one relationship, like text, mime format, or images which have repeating patterns [don't they?]

Anyway, just to be sure, you may want to try some weird distributions just to make certain the AGC doesn't respond to these 'patterns'.

You haven't seen the app note. Why can't it include the zero state with modification?

Rick

--- That's not true, but I've heard that position defended on semantic grounds because a "Linear Feedback Shift Register" can only include EXOR feedback.

My position is that that's bogus, since by changing the name to "Pseudo Random Sequence Generator" and employing the same additional logic in the LFSR's feedback path, both circuits will be topologically identical and each will visit all states.

John Fields

Join the Discussion

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

Didn't find your answer?

Ask the community — no account required