Forums

"Random" Circuit Needed.

Started by Jim Thompson April 1, 2015
On Wed, 01 Apr 2015 12:08:34 -0700, Jim Thompson  
<To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote:

>> ...snip... > > "For a simulation situation..." ;-) > > John F and Lasse have provided how to do it. > > ...Jim Thompson
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.
On Thu, 02 Apr 2015 05:14:13 +1000, Jim Thompson  
<To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote:

> On Wed, 01 Apr 2015 15:07:54 -0400, Phil Hobbs > <pcdhSpamMeSenseless@electrooptical.net> wrote: > >> On 04/01/2015 02:00 PM, Jim Thompson wrote: >>> 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 >>> >> >> 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 > > I just need semi-random enough to test a fast AGC. > > ...Jim Thompson
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.
On Wed, 01 Apr 2015 14:07:40 -0700, RobertMacy
<robert.a.macy@gmail.com> wrote:

>On Wed, 01 Apr 2015 12:08:34 -0700, Jim Thompson ><To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote: > >>> ...snip... >> >> "For a simulation situation..." ;-) >> >> John F and Lasse have provided how to do it. >> >> ...Jim Thompson > > >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.
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.
On Thu, 02 Apr 2015 07:26:29 +1000, "David Eather" <eather@tpg.com.au>
wrote:

>On Thu, 02 Apr 2015 05:14:13 +1000, Jim Thompson ><To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote: > >> On Wed, 01 Apr 2015 15:07:54 -0400, Phil Hobbs >> <pcdhSpamMeSenseless@electrooptical.net> wrote: >> >>> On 04/01/2015 02:00 PM, Jim Thompson wrote: >>>> 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 >>>> >>> >>> 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 >> >> I just need semi-random enough to test a fast AGC. >> >> ...Jim Thompson > >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 was wondering about that myself... I'll see if there's a cure. ...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.
On 4/1/2015 6:31 PM, Jim Thompson wrote:
> On Thu, 02 Apr 2015 07:26:29 +1000, "David Eather" <eather@tpg.com.au> > wrote: > >> On Thu, 02 Apr 2015 05:14:13 +1000, Jim Thompson >> <To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote: >> >>> On Wed, 01 Apr 2015 15:07:54 -0400, Phil Hobbs >>> <pcdhSpamMeSenseless@electrooptical.net> wrote: >>> >>>> On 04/01/2015 02:00 PM, Jim Thompson wrote: >>>>> 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 >>>>> >>>> >>>> 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 >>> >>> I just need semi-random enough to test a fast AGC. >>> >>> ...Jim Thompson >> >> 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 was wondering about that myself... I'll see if there's a cure.
Do a search on the Xilinx web site for app notes on LFSR. Peter Alfke published one which adds a few gates to specifically inject the zero state.... or you can just use a much larger LFSR so that the small bias is in the noise. If you use a short sequence LFSR you may see the artifacts in your signal anyway. Remember this is only pseudo-random. Is 255 length sequence long enough for your needs? -- Rick
On Thu, 02 Apr 2015 09:24:29 +1000, rickman <gnuarm@gmail.com> wrote:

> On 4/1/2015 6:31 PM, Jim Thompson wrote: >> On Thu, 02 Apr 2015 07:26:29 +1000, "David Eather" <eather@tpg.com.au> >> wrote: >> >>> On Thu, 02 Apr 2015 05:14:13 +1000, Jim Thompson >>> <To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote: >>> >>>> On Wed, 01 Apr 2015 15:07:54 -0400, Phil Hobbs >>>> <pcdhSpamMeSenseless@electrooptical.net> wrote: >>>> >>>>> On 04/01/2015 02:00 PM, Jim Thompson wrote: >>>>>> 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 >>>>>> >>>>> >>>>> 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 >>>> >>>> I just need semi-random enough to test a fast AGC. >>>> >>>> ...Jim Thompson >>> >>> 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 was wondering about that myself... I'll see if there's a cure. > > Do a search on the Xilinx web site for app notes on LFSR. Peter Alfke > published one which adds a few gates to specifically inject the zero > state.... or you can just use a much larger LFSR so that the small bias > is in the noise. If you use a short sequence LFSR you may see the > artifacts in your signal anyway. Remember this is only pseudo-random. > Is 255 length sequence long enough for your needs? >
longer lfsr would get my vote
On 2.4.15 01:31, Jim Thompson wrote:
> On Thu, 02 Apr 2015 07:26:29 +1000, "David Eather" <eather@tpg.com.au> > wrote: > >> On Thu, 02 Apr 2015 05:14:13 +1000, Jim Thompson >> <To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote: >> >>> On Wed, 01 Apr 2015 15:07:54 -0400, Phil Hobbs >>> <pcdhSpamMeSenseless@electrooptical.net> wrote: >>> >>>> On 04/01/2015 02:00 PM, Jim Thompson wrote: >>>>> 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 >>>>> >>>> >>>> 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 >>> >>> I just need semi-random enough to test a fast AGC. >>> >>> ...Jim Thompson >> >> 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 was wondering about that myself... I'll see if there's a cure. > > ...Jim Thompson
A longer LFSR is the simplest cure. 20 bits will give you a bias of one per million. Another possibility is to use a congruential generator, but it needs quite a lot of arithmetic, one multiply and one add. -- -Tauno Voipio
On 2015-04-01, Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:
> On Thu, 02 Apr 2015 07:26:29 +1000, "David Eather" <eather@tpg.com.au> > wrote: > >>On Thu, 02 Apr 2015 05:14:13 +1000, Jim Thompson >><To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote: >> >>> On Wed, 01 Apr 2015 15:07:54 -0400, Phil Hobbs >>> <pcdhSpamMeSenseless@electrooptical.net> wrote: >>> >>>> On 04/01/2015 02:00 PM, Jim Thompson wrote: >>>>> 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 >>>>> >>>> >>>> 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 >>> >>> I just need semi-random enough to test a fast AGC. >>> >>> ...Jim Thompson >> >>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 was wondering about that myself... I'll see if there's a cure.
r=(75*r+74)%65537 visits 0-65535 with no gaps. not that i'd want to build it using 74LS logic. -- umop apisdn
On 2015-04-01, rickman <gnuarm@gmail.com> wrote:
> On 4/1/2015 6:31 PM, Jim Thompson wrote: > > Do a search on the Xilinx web site for app notes on LFSR. Peter Alfke > published one which adds a few gates to specifically inject the zero > state....
yeah, but no LFSR visits all states. -- umop apisdn
On Wed, 01 Apr 2015 12:14:13 -0700, Jim Thompson  
<To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote:

> On Wed, 01 Apr 2015 15:07:54 -0400, Phil Hobbs > <pcdhSpamMeSenseless@electrooptical.net> wrote: >> ...snip.... >> >> 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 > > I just need semi-random enough to test a fast AGC. > > ...Jim Thompson
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'.