1
\$\begingroup\$

I have a need to generate a 448-bit value that appears random, for use in a test circuit. The "randomness" of the values is not overly important; the size of the generator hardware is. I am using an FPGA and I have a budget of ~32 logic elements (in Altera lingo, a LE is a LUT plus an FF).

One possible solution that comes to mind would be to make a 32-bit LFSR, and then use some logic functions/combinations of those bits to generate the 448-bit output.

Is there any other clever solution?

Edit: I'm adding some detail because some have pointed out that it is not possible to create a circuit with 448 output bits using only 32 logic elements.

The block I'll be feeding the "random" values does register all 448 bits at its input port. Though I can't touch the VHDL code of that block, the LUTs that feed those registers can be used for combinational logic by the synthesizer. So though it is true I can't create a circuit with 448 output bits using only 32 LUTs, this is not a problem in this particular case, because only the number of registers is a hard limit.

\$\endgroup\$
  • \$\begingroup\$ Add some noisy analog sensor, convert to digital and just output it's LSB over time.. (if it is not too much hardware) \$\endgroup\$ – Eugene Sh. Jan 23 '15 at 16:56
  • \$\begingroup\$ Or run two counters with different top values and different frequencies and output, say, xored value of them. \$\endgroup\$ – Eugene Sh. Jan 23 '15 at 16:59
  • \$\begingroup\$ Your budget seems unrealistic. Won't you need 448 flip-flops just to store the value? Or if you have a 32-bit value and generate 448 "random-like" results with combinatorial logic, you'll need 448 LUTs to do that. \$\endgroup\$ – The Photon Jan 23 '15 at 17:08
  • \$\begingroup\$ @ThePhoton, the value will be stored internally by the circuit that uses the random values as an input. Therefore, it should be ok to generate only 32 "true random" bits, and use combinational logic for the rest, so it should be possible to generate a 448-bit output using only 32 flip-flops. But you are right, the LUTs would be counted as part of the LEs of the circuit under test. \$\endgroup\$ – rick Jan 23 '15 at 17:31
  • 1
    \$\begingroup\$ Ring oscillator? That's how I've seen people do it alterawiki.com/wiki/Ring_Oscillator \$\endgroup\$ – Some Hardware Guy Jan 23 '15 at 19:30
3
\$\begingroup\$

Is there any other clever solution?

If you are limited to 32 registers then you can only have 32 bits of state in your random numbers. Therefore the only thing you can do to expand it out is use some combinational logic to produce the 448 bits that you need.

Generating the 32 bits is (as you surmise) probably most efficiently done using an LFSR.

I would suggest that using some kind of hash function of those bits would be your best bet to getting the least pattern passing through to the 448 bits output, but that might take up too much logic in your destination. It's not clear to me what constraints you have there.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.