# Random clock Generation with unequal 1s and 0s distribution?

We need a pseudo-random clock with a length N, in such a way that out of every N clock pulses, M of them should randomly made zero (M<<N). What we want to do is to sample a signal in a random fashion. Meaning that, out of every N sample points (from Nyquist grid) we need to take M samples. Then through some processing and assumptions about signal structure, other un-sampled (N-M samples) points are recovered. Now I am using Linear Shift Registers, something like below: simulate this circuit – Schematic created using CircuitLab

It works good, however, I do not want equal distribution for 1s and 0s, I mean I want something like 20% of clock cycles to be 1 and 80% to be zero. To achieve that, I made to AND output of two circuits like above to change probability from 50% for both 1s and zeros to 25% for 1s and 75% for zeros (in figure below, with different seeds). simulate this circuit

It is good at the cost of doubling the power and chip area:( . I am seeking a way to make the system work with only 1 random clock generator circuit, not two.

• Is possible through implanting some special initial seed change probability distribution of 1s and 0s in output sequence ?
• Is there any power-area efficient method to accomplish this?

I was thinking to store a random binary sequence (with length of N) in a ROM and then And its output with the clock to make a random clock.

• Depends how random it needs to be. If storing a sequence in a ROM is not an issue, then you could also use an LFSR to make a pseudo-random sequence. A bit more info on the application would help. – Tom Carpenter Aug 14 '16 at 17:46
• I second the lfsr. look for "irreducible polynomial" and pick which one gives the variations you want – b degnan Aug 14 '16 at 17:56
• The clock frequency is up to 1Mhz – MimSaad Aug 14 '16 at 18:03
• explain "M of them should randomly made zero " random edge, what min max time range and coherent with 1MHz? Random phase? – Tony Stewart EE75 Aug 14 '16 at 18:44
• Wouldn't it be easier to simply take all of the samples at the full clock rate and then randomly discard some of them? – Dave Tweed Aug 14 '16 at 23:11

## 1 Answer

Think of the contents of the N-bit LFSR as an N-bit integer. This number will have a uniform distribution of values from 1 to 2N - 1. You can generate a variable density of mask bits by comparing this number to a threshold that you also vary from 1 to 2N - 1. The output of this comparator is the clock mask you seek.

• This method is flexible in changing distribution, so when I want like 17% of 1s, I'll set the threshold to 0.17*(2^N-1). I'll check to figure out if it is area and power efficient too. – MimSaad Aug 15 '16 at 17:35
• The answer is great and provides flexible distribution, however it stills requires an Comparator. I am researching to find out if I only use a few bits of N bit random generator and compare it to a threshold can acviehve good performance. – MimSaad Aug 17 '16 at 14:24
• Yes, of course. Any subset of M bits from the N-bit LFSR will contain a uniform distribution of values from 0 to 2^M - 1. So if you only need one part in 2^M resolution in your threshold settings, you can just use an M-bit comparator. – Dave Tweed Aug 17 '16 at 20:51