1
\$\begingroup\$

Forgive the breadth of my question, but from understanding of basic digital circuits, an integer PRNG outputs a random number by using the XOR of certain bits of a LSFR. using an XOR tap into bits to perform the random bit output. Based on understanding of the concept from a definition as such, how does floating point PRNG work, or get implemented as far as blocks of digital circuits. Or at the very least from a mathematical standpoint using bits of representation of the value to work on. Is this concept covered in a computer arithmetic course, or more broadly in a VLSI course?

\$\endgroup\$
19
  • 1
    \$\begingroup\$ My apologies for the extended discussion and hesitancy to google, I will dive deeper, thank you for the resource provided \$\endgroup\$
    – Vahe
    Commented Sep 9, 2021 at 3:12
  • 1
    \$\begingroup\$ @Vahe Best wishes. I do think it is your responsibility to at least survey the existing literature. If for no other reason, than to tell us what you've already found. Better, would be that you skimmed the material enough to find out what is missing from what you feel you need. That would go a long way in clarifying a question like yours. And I think you'd be in a much better position, besides. Again, best wishes on this. Next you write here, perhaps you will teach us a little while asking for our imaginations to help out. That would be good for all, I suspect. \$\endgroup\$
    – jonk
    Commented Sep 9, 2021 at 3:15
  • 2
    \$\begingroup\$ @Vahe If the question isn't otherwise removed for reasons beyond your control, please feel free to update it with some good information. I'd like to see what you find out. \$\endgroup\$
    – jonk
    Commented Sep 9, 2021 at 3:36
  • 1
    \$\begingroup\$ Let me find some references and see if I can understand the polynomial generation functions used in each bit for certain cases, I can use that to post a simple representation of a digital block to compute the mantissa \$\endgroup\$
    – Vahe
    Commented Sep 9, 2021 at 3:55
  • 1
    \$\begingroup\$ @Vahe Just a side note that there are many ways to implement a PRNG. An LFSR is just one of them. LCG is another one. And what kind of floating point values you mean, as e.g. for audio you generally need range of +/- 1 which also means you can simply generate the mantissa bits and scale the exponent to your liking. \$\endgroup\$
    – Justme
    Commented Sep 9, 2021 at 7:45

1 Answer 1

2
\$\begingroup\$

Forgive the breadth of my question, but from understanding of basic digital circuits, an integer PRNG outputs a random number by using the XOR of certain bits of a LSFR.

That's one of many types of PRNGs. It's an especially bad kind, as it introduces linear dependency of bits. You'll rarely find that in applications were the randomness of the PRNG plays a crucial role.

It's one that is fairly possible to explain, and very small in implementation, so you'll find these very often were one just needs "some" form of noise.

When doing a PRNG for floats, you're planning to do something where numerical properties matter (otherwise, floating point numbers wouldn't be necessary).

how does floating point PRNG work, or get implemented as far as blocks of digital circuits

You'll rarely find such a thing (they do exist), because random floating point numbers are rarely something you need in hardware. Often, using software to convert a fixed-point PRNG-generated number to floating point suffices.

If you need to do this in hardware, it's going to be a very special use case. So, if you find such a special use case, that will dictate how you do it.

Let's assume you're in the very special case that you need a uniformly distributed random variable. I repeat: this is an unlikely special case for a float PRNG. In almost all cases you'd use a uniform fixed-point PRNG and convert the result to float. You'd make sure that your PRNG makes adequate numbers. There's optimized PRNGs for that purpose, for example xoroshiro256+.

Or at the very least from a mathematical standpoint using bits of representation of the value to work on.

This depends heavily on what you need this for. No general statement is possible. As said, generation of floating point numbers in hardware is a rather unusual thing to do.

Is this concept covered in a computer arithmetic course, or more broadly in a VLSI course?

Computer arithmetic courses don't concern themselves, usually, with digital hardware design.

VLSI courses will not concern themselves with super-duper-special-case problems like generating random floating point numbers.

\$\endgroup\$
3
  • \$\begingroup\$ My question of how to implement a function as such in hardware (a specific function to a hardware unit like an ASIC, or an FPGA, as opposed to a General Purpose computer, and concepts covered in the two hardware course which I now see covers topics in a different domains, that when used together can reveal more details my question. To understand the hardware implementation details of this from a A) system level, then B) digital logic standpoint, A) The float is generated using a cascaded stage of computation units (#1 - fixed point PRNG, followed by #2 - the floating point convert unit). \$\endgroup\$
    – Vahe
    Commented Sep 9, 2021 at 14:05
  • 1
    \$\begingroup\$ @Vahe I don't understand this comment: "how to implement this in hardware": I extensively addressed that, especially as "you don't, unless you have very specific needs for it, which you don't describe, and which would then dictate the way you do it". I can't tell you how to do an non-sensible thing sensibly! \$\endgroup\$ Commented Sep 9, 2021 at 21:55
  • \$\begingroup\$ Looks like this special case of implementation would need to be handled by a routine defined in software, rather than fixed hardware resources, but your explanation was clarifying for my question \$\endgroup\$
    – Vahe
    Commented Sep 10, 2021 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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