The LUT-SR Family of Uniform Random Number Generators for FPGA Architectures David B

The LUT-SR Family of Uniform Random Number Generators for FPGA Architectures David B

TRANSACTIONS ON VLSI 1 The LUT-SR Family of Uniform Random Number Generators for FPGA Architectures David B. Thomas, Member, IEEE, and Wayne Luk, Member, IEEE Abstract—FPGA-optimised Random Number Generators simple method for engineers to instantiate an RNG which (RNGs) are more resource efficient than software-optimised meets the specific needs of their application. Specifically, it RNGs, as they can take advantage of bit-wise operations and shows how to create a family of generators called LUT-SR FPGA-specific features. However, it is difficult to concisely describe FPGA-optimised RNGs, so they are not commonly used RNGs, which use LUTs as shift-registers to achieve high- in real-world designs. This paper describes a type of FPGA RNG quality and long periods, while requiring very few resources. called a LUT-SR RNG, which takes advantage of bit-wise XOR The main contributions are: operations and the ability to turn LUTs into shift-registers of • A type of FPGA-optimised uniform RNG called a LUT- varying lengths. This provides a good resource-quality balance compared to previous FPGA-optimised generators, between the SR generator, which uses LUT-based shift-registers to 1024 previous high-resource high-period LUT-FIFO RNGs and low- implement generators with periods of 2 − 1 or more, resource low-quality LUT-OPT RNGs, with quality comparable using two LUTs and two FFs per generated random bit. to the best software generators. The LUT-SR generators can also • An algorithm for describing LUT-SR RNGs using five be expressed using a simple C++ algorithm contained within the integers, and a set of open-source test-benches and tools. paper, allowing 60 fully-specified LUT-SR RNGs with different characteristics to be embedded in the paper, backed up by an • Tables of 60 LUT-SR RNGs covering output widths from 1024 19937 online set of VHDL generators and test-benches. 32 up to 624, with periods from 2 −1 up to 2 −1. • A theoretical quality analysis of the given RNGs in terms Index Terms—FPGA, Uniform Random Number Generator, Equidistribution of equidistribution, and a comparison with other software and hardware RNGs. The LUT-SR family was first presented in a conference I. INTRODUCTION paper [4], which concentrated on the practical aspects of ONTE Carlo applications are ideally suited to FPGAs, constructing and using these generators. This paper adds M due to the highly parallel nature of the applications, Section V which describes the method used to find maximum and because it is possible to take advantage of hardware period generators, Section VI describing the process used to features to create very efficient random number generators. select the highest quality generators, and a rigorous theoretical In particular, uniform random bits are extremely cheap to quality analysis in terms of equidistribution in Section VIII. generate in an FPGA, as large numbers of bits can be generated per cycle at high clock-rates using LUT-OPT [1] or LUT-FIFO II. OVERVIEW OF BINARY LINEAR RNGS generators [2]. In addition, these generators can be customised to meet the exact requirements of the application, both in terms The LUT-SR RNGs are part of a large family of RNGs, all of the number of bits required per cycle, and for the FPGA of which are based on binary linear recurrences. This family architecture of the target platform. includes many of the most popular contemporary software Despite these advantages, FPGA-optimised generators are generators, such as the Mersenne Twister (MT-19937) [5], the not widely used in practise, as the process of constructing a Combined Tausworthe (TAUS-113) [3], SFMT [6], WELL [7], generator for a given parametrisation is time-consuming, in and TT-800 [8]. This section gives an overview of the under- terms of both developer man-hours and CPU-time. While it lying maths, and describes existing binary linear RNGs used is possible to construct all possible generators ahead of time, in FPGAs. the resulting set of cores would require many megabytes, and be difficult to integrate into existing tools and design-flows. A. Binary Linear RNGs Faced with these unpalatable choices, engineers under time Binary linear recurrences operate on bits (binary digits), constraints understandably choose less efficient methods, such where addition and multiplication of bits is implemented using as Combined Tausworthe generators [3], or parallel LFSRs. exclusive-or (⊕) and bitwise-and (⊗). 1 The recurrence of an This paper describes a family of generators which makes RNG with n-bit state and r-bit outputs is defined as: it easier to use FPGA-optimised generators, by providing a xi+1 = Axi (1) The support of UK Engineering and Physical Sciences Research Council yi+1 = Bxi+1 (2) (Grants EP/D062322/1 and EP/C549481/1), Alpha Data, and Xilinx is grate- fully acknowledged. T where xi = (xi;1; xi;2; :::; xi;n) is the n-bit state of the D. Thomas is with the Dept. of Electrical and Electronic Engineering, T Imperial College London ([email protected]). generator; yi = (yi;1; yi;2; :::; yi;r) is the r-bit output of the W. Luk is with the Dept. of Computing, Imperial College London ([email protected]). 1This is the same as operating modulo-2, or in the Galois field GF(2). TRANSACTIONS ON VLSI 2 generator; A is an n × n binary transition matrix; and B is that all members of GM implement a matrix A with an r × n binary output matrix. Because the state is finite, and a primitive characteristic polynomial. This is achieved the recurrence is deterministic, eventually the state sequence either by randomly selecting and testing members of x0; x1; x2; ::: must start to repeat. GF , or by exhaustive enumeration if jGF j is small. The minimum value p such that xi+p = xi is called the 3) Find the generator gI 2 GM which produces the period of the generator, and one goal in designing random output stream with highest statistical quality, either by number generators is to achieve the maximum period of considering multiple members with different A matrices, p = 2n − 1; a period of 2n cannot be achieved because or by trying many different B matrices for a single it is impossible to choose A such that x0 = 0 maps to transition matrix. anything other than x1 = 0. This leads to two sequences in a The selected RNG instance gI 2 GF can then be expressed maximum period generator: a degenerate sequence of length as code (e.g. C or VHDL) and used in the target architecture. one which contains only zero, and the main sequence which iterates through every possible non-zero n-bit pattern before B. LUT-Optimised RNGs repeating. A necessary and sufficient condition for a generator to have maximum period is that the characteristic polynomial LUT-optimised (LUT-OPT) generators [1] are a family of P (z) of the transition matrix A must be primitive [1]. generators with a matrix A where each row and column The matrix B is used to transform the internal RNG state contains t − 1 or t ones. In hardware terms this means that into the random output bits produced by the generator. In the each row maps to a t − 1 or t-input XOR gate, and so can simplest case we have r = n and B = I, which means the be implemented in a single t-input LUT. Thus if the current state bits are used directly as random output bits, but in many vector state is held in a register, each bit of the new vector generators most of the internal state bits are not sufficiently state can be calculated in a single LUT, and an r-bit generator random. In these cases r < n, and either some state bits are can be implemented in r fully-utilised LUT-FFs. The basic not propagated through to the output, or multiple state bits are structure of a LUT-OPT generator is shown in Figure 1 (a). A simple example of a maximum period LUT-OPT gener- XOR’d together to produce each output bit. ator with r = 6 and t = 3 is given by the recurrence: The quality of a generators is measured in two ways: 2 3 2 3 2 3 empirical tests, which look at generated sequences of numbers; 0 1 1 0 0 0 xi+1;1 xi;2 ⊕ xi;3 60 1 1 0 0 17 6xi+1;27 6 xi;2 ⊕ xi;3 ⊕ xi;6 7 and theoretical tests, which considered mathematical proper- 60 1 0 1 0 07 6x 7 6 x ⊕ x 7 A = 6 7 ; 6 i+1;37 = 6 i;2 i;4 7 ties of the entire number sequence. Examples of empirical 61 0 0 0 1 07 6x 7 6 x ⊕ x 7 6 7 6 i+1;47 6 i;1 i;5 7 tests are to track the distribution of ones versus zeros, or to 41 0 0 0 0 15 4xi+1;55 4 xi;1 ⊕ xi;6 5 examine the Fourier transform of the uniform sequence, and 1 0 0 1 1 0 xi+1;6 xi;1 ⊕ xi;4 ⊕ xi;5 to see if the observed behaviour deviates significantly from the behaviour of an ideal uniform source. Many such tests are Such matrices can be found for all t ≥ 3 and r ≥ 4, and are gathered into batteries such as TestU01 [9], which examine practical for generating up to ∼ 1000 uniform bits per cycle. long output sequences from a given RNG to find evidence of LUT-OPT generators have two key advantages: non-randomness.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us