A random calculator based on Sobol random numbers
By using a new generation unit and a highly parallel SC calculation unit based on Sobol random numbers in the random calculator, and using one-hot coding and addition selectors to replace AND gates, the problems of high hardware overhead and high latency of traditional random calculators are solved, and A highly energy-efficient and low-latency stochastic calculator suitable for AI processors.
Patent Information
- Application Number
- CN202311063550.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-22
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-08-22
AI Technical Summary
When traditional stochastic calculators improve calculation accuracy, the hardware overhead is too large, which leads to an increase in circuit design burden. When the parallel architecture reduces calculation delays, the hardware overhead increases exponentially, making it difficult to ensure high energy efficiency and low latency at the same time.
Design a random calculator based on Sobol random numbers, using a new Sobol random number generation unit and a highly parallel SC computing unit, generating a random calculation sequence through the one-hot encoding form of Sobol random numbers, and using additions and selectors to replace a large number of AND gates , reducing hardware overhead and latency.
It implements a stochastic calculator with smaller hardware overhead and high computing energy efficiency, which solves the problem of decreased SC computing energy efficiency in high-precision scenarios and low-latency SC computing energy efficiency. It is suitable for AI processors, especially autonomous driving perception scenarios.
Smart Images

Figure CN117270815B_ABST
Abstract
Description
[Technical field]
[0001] The present invention relates to the field of high energy efficiency AI computing technology, and in particular to a random calculator based on Sobol random numbers. [Background technology]
[0002] Traditional binary fixed-point computing methods can complete AI training and reasoning tasks with high precision. However, as the computational scale of AI tasks increases, the hardware overhead of binary fixed-point computing increases, which becomes an important bottleneck. Among the methods to solve this problem, the characteristics of stochastic computing (SC), "low computational overhead and small loss of precision", are very consistent with the characteristics of AI, "high computational density and high error tolerance", so it has attracted a lot of research.
[0003] Stochastic computing: It uses random bit streams to represent continuous values. SC encodes values through a random sequence of "0" and "1", in which the probability of "1" is generally used to represent the target value. Then complex operations can be implemented with simple bit operations, so the SC computing unit has low overhead. For example, its multiplication can be implemented by an AND gate. A simple example is: for example, if there are p, q∈[0,1], p×q needs to be calculated. Stochastic computing uses probability instead of arithmetic to perform this operation. Suppose there are two random and independent bit streams, one with a probability of 1 p and the other with a probability of 1 q, then after the AND operation of the results of the two streams, the probability of 1 in the new bit stream is p×q.
[0004] Figure 1 This is a schematic diagram of a traditional random calculator. Figure 1 As shown, the stochastic calculator generally includes a forward conversion unit (Binary to Stochastic, B2S), an SC calculation unit, and a backward conversion unit (Stochastic to Binary, S2B). The forward conversion unit converts binary numbers into random sequences, usually including a random number generator and a comparator; the SC calculation unit includes units such as multiplication and addition of the random field; the backward conversion unit generally obtains the number of "1" in the sequence through a parallel counter (ParallelCounter, PC), thereby converting the random sequence back to a binary number. However, the serial operation of the traditional SC leads to increased operation delay, which is difficult to meet the real-time processing requirements of the autonomous driving processor; the random sequence generated based on random numbers introduces a large loss of precision, which affects the safety of autonomous driving.
[0005] At present, some technologies have proposed optimization methods for the application of random computing. For the problem of operation delay, the parallel SC architecture is adopted to reduce the calculation delay, that is, to calculate multiple bits of the sequence in the same clock cycle. However, higher parallelism also increases the hardware overhead exponentially. For the accuracy problem, many works have adopted high-precision, low-variance Sobol random numbers to replace the traditional random number generation SC sequence. This SC sequence based on Sobol random numbers effectively improves the accuracy of random calculations. The basic idea of the Sobol sequence principle is to generate a series of high-quality random numbers through a special algorithm. However, the hardware overhead of the forward conversion unit based on Sobol random numbers is too large, which brings additional burden to the circuit design.
[0006] The following relevant literature was retrieved using the keyword Stochastic Computing.
[0007] Related search result 1: The paper "Liu S, Han J. Toward energy-efficient stochastic circuits using parallel Sobol sequences [J]. IEEE Transactions on Very Large Scale Integration (VLSI) Systems, 2018, 26 (7): 1326-1339." This paper proposes a Sobol random number generation unit based on direction vectors. However, the disadvantage of its work is that it needs to store a lot of direction vectors and needs to be driven by counters, which is too expensive for random sequences with a relatively short sequence length.
[0008] Related search result 2: The paper "Asadi S, Najafi MH, Imani MA low-cost fsm-based bit-stream generator for low-discrepancy stochastic computing [C] / / 2021 Design, Automation & Test in Europe Conference & Exhibition (DATE). IEEE, 2021: 908-913." This article proposes a Sobol sequence generator based on FSM, which does not need to generate Sobol random numbers, but only needs to store the one-hot encoding of Sobol random numbers. However, the disadvantage of its work is that the number of states of the state machine is too large, and the hardware overhead is still too large at that time; the connection between Sobol random numbers is not used, and the storage of one-hot encoding loses the intrinsic relationship between Sobol random numbers.
[0009] Related search result 3: The paper "Faraji SR, Najafi MH, Li B, et al. Energy-efficient convolutional neural networks with deterministic bit-stream processing [C] / / 2019 Design, Automation & Test in Europe Conference & Exhibition (DATE). IEEE, 2019: 1757-1762." This paper proposes to use Sobol random numbers to generate Sobol sequences and use them in neural network reasoning, which uses serial calculations. However, its working disadvantage is that serial calculations lead to high hardware delays. If the delay is reduced through high parallel design, the hardware overhead will increase significantly, and high energy efficiency and low delay cannot be guaranteed at the same time.
[0010] Aiming at the technical problems that the hardware overhead of the forward conversion unit based on Sobol random numbers is too large and the hardware overhead is doubled by using a parallel SC architecture to reduce calculation delay, the present invention makes technical improvements to the random calculator. [Summary of the invention]
[0011] The object of the present invention is to provide a random calculator with low hardware cost and high computational energy efficiency.
[0012] To achieve the above-mentioned purpose, the technical solution adopted by the present invention is a random calculator based on Sobol random numbers, including a forward conversion unit, an SC calculation unit and a backward conversion unit, wherein the forward conversion unit is used to convert a first multiplier binary number into a first random calculation sequence and convert a second multiplier binary number into a second random calculation sequence, the SC calculation unit is used to perform random domain multiplication calculation on the first random calculation sequence and the second random calculation sequence, and the backward conversion unit is used to convert the product random calculation sequence output by the SC calculation unit back into a binary number, wherein the binary number ∈[0,1];
[0013] The forward conversion unit includes a Sobol1 random number generator and a Sobol2 random number generator, wherein the Sobol1 random number and the Sobol2 random number are new Sobol random number arrays ∈[0,1], with a group number of an even number n, Sobol1[m]-Sobol1[m-1]=0.5, Sobol2[m]-Sobol2[m-1]=0.5, m∈[2,4,6…n-2,n]; the Sobol1 random number generator retains the first '1' position of the binary form of the Sobol1 random number and sets the remaining positions to "0" to convert it into a one-hot encoding form of the Sobol1 random number, and the Sobol2 random number generator retains the first '1' position of the binary form of the Sobol2 random number and sets the remaining positions to "0" to convert it into a one-hot encoding form of the Sobol2 random number;
[0014] The forward conversion unit generates a first random calculation sequence by using the probability of "1" to represent the first multiplier binary number based on the Sobol1 random number one-hot encoding form, and generates a second random calculation sequence by using the probability of "1" to represent the second multiplier binary number based on the Sobol2 random number one-hot encoding form;
[0015] When the SC calculation unit performs random domain multiplication calculation on the first random calculation sequence and the second random calculation sequence, the corresponding second random calculation sequence bits from the same Sobol1 random number one-hot encoding form are added, and then the multiplied first random calculation sequence bits are used to select the output calculation result to be "0" or the addition calculation result, and a large number of AND gates are replaced by addition and selectors.
[0016] Preferably, in the above-mentioned random calculator based on Sobol random numbers, the SC calculation unit performs the following steps when replacing a large number of AND gates with adders and selectors:
[0017] S1. Find the bits with the same bit value in the first random calculation sequence, and move the bit pairs of the first random calculation sequence and the second random calculation sequence where the bits with the same bit value in the first random calculation sequence are located to the front of the random calculation sequence;
[0018] S2, adding the bits of the first random calculation sequence and the second random calculation sequence bit pairs where the bits with the same bit value of the first random calculation sequence are located, and the bits of the second random calculation sequence derived from the same Sobol1 random number one-hot encoding form, and then selecting and outputting the calculation result through the bits with the same bit value of the first random calculation sequence is "0" or the addition calculation result;
[0019] S3, repeating steps S1 and S2, and finally, using an AND gate to complete the calculation for the first random calculation sequence and the second random calculation sequence bit pairs that have not participated in the calculation.
[0020] Preferably, in the above-mentioned random calculator based on Sobol random numbers, the Sobol1 random number generator and the Sobol2 random number generator are based on a new Sobol random number generating unit; the new Sobol random number generating unit includes a state machine, and the state machine is used to store the Sobol1 random number and the Sobol2 random number.
[0021] Preferably, the state machine stores n / 2 of the Sobol1 random numbers or Sobol2 random numbers, Sobol1[m-1], Sobol2[m-1], m∈[2,4,6…n-2,n]; the novel Sobol random number generating unit further comprises a selector and a NOT gate, the state machine outputs the highest bit of the Sobol1 random number or Sobol2 random number to be connected to the first input of the selector, and the selector output is connected to the second input of the selector after passing through the NOT gate; the low-order bits of the Sobol1 random number or Sobol2 random number output by the state machine remain unchanged, and the selector implements continuous flipping of the highest-order bits of the Sobol1 random number or Sobol2 random number output by the selector through CLK flipping, thereby generating all the Sobol1 random numbers or Sobol2 random numbers.
[0022] Preferably, the selector realizes continuous flipping of the highest bit of the Sobol1 random number or Sobol2 random number output by the selector through binary frequency CLK flipping. When CLK is high, the highest bit of the Sobol1 random number or Sobol2 random number remains unchanged. When CLK is low, the highest bit of the Sobol1 random number or Sobol2 random number is inverted.
[0023] The random calculator based on Sobol random numbers of the present invention has the following beneficial effects: 1. A forward conversion unit based on Sobol random numbers with lower hardware overhead is proposed to solve the problem of reduced energy efficiency of SC calculations in high-precision scenarios; 2. A new SC calculation unit with high energy efficiency and low latency is proposed to solve the problem of reduced energy efficiency of SC calculations under low latency.
Brief Description of the Drawings
[0024] Figure 1 is a schematic diagram of a traditional random calculator, where: Figure 1 (a) is the overall architecture diagram of the random calculator. Figure 1 (b) is the structure diagram of the forward conversion unit. Figure 1 (c) is the structure diagram of the SC computing unit. Figure 1(d) is the structural diagram of the backward conversion unit.
[0025] Figure 2 It is a schematic diagram of the structure of a new Sobol random number generating unit.
[0026] Figure 3 This is a schematic diagram of the regularity between the new Sobol random numbers.
[0027] Figure 4 This is a schematic diagram of the high parallel working method of the new SC computing unit, where: Figure 4 (a) is a schematic diagram of the forward conversion unit converting binary into a new random sequence. Figure 4 (b) is a schematic diagram of the multiplication of the new random sequence. [Specific implementation method]
[0028] The features and exemplary embodiments of various aspects of the present invention will be described in detail below. In the detailed description below, many specific details are proposed to provide a comprehensive understanding of the present invention. But it is obvious to those skilled in the art that the present invention can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present invention by illustrating examples of the present invention. The present invention is by no means limited to any specific configuration and algorithm proposed below, but covers any modification, replacement and improvement of elements, parts and algorithms without departing from the concept of the present invention. In the accompanying drawings and the following description, known structures and technologies are not shown to avoid unnecessary ambiguity to the present invention.
[0029] Example
[0030] This embodiment implements a random calculator based on Sobol random numbers.
[0031] This embodiment is aimed at AI high-efficiency computing units, and uses stochastic computing (SC) to optimize traditional binary-based multiplication and accumulation operations, and reduce the hardware overhead in the application process of SC (computing unit).
[0032] The random calculator of this embodiment includes a forward conversion unit, a new SC calculation unit and a backward conversion unit, wherein the forward conversion unit includes a new Sobol random number generation unit. The random calculator of this embodiment aims at the shortcomings existing in the work of the existing random calculator, and proposes a new Sobol random number generation unit based on Sobol random numbers with lower overhead, so as to solve the problem of reduced SC calculation energy efficiency in high-precision scenarios; and proposes a new SC calculation unit with high energy efficiency and low latency for high parallel calculation of SC sequences based on Sobol to improve the calculation energy efficiency, so as to solve the problem of reduced SC calculation energy efficiency under low latency.
[0033] The random calculator of this embodiment is suitable for an AI processor and is used in autonomous driving perception scenarios with high requirements for accuracy and latency.
[0034] Figure 2 This is a schematic diagram of the structure of a new Sobol random number generation unit. Figure 1 As shown, the novel Sobol-based random number generation unit with lower overhead proposed in this embodiment has the following structural characteristics.
[0035] 1. By utilizing the correlation between adjacent Sobol random numbers (in binary form), the number of state machines storing Sobol random numbers can be reduced by half, that is, only half of the Sobol random numbers are stored.
[0036] 2. Figure 3 This is a schematic diagram of the regularity between the new Sobol random numbers. Figure 3 As shown, only the highest bit (in binary form) is flipped between each pair of dark and light Sobol random numbers, that is, the difference between each pair of dark and light colors is 0.5, such as 0 and 0.5, 0.25 and 0.75, 0.125 and 0.625... Figure 3 Diff=1000 means that the difference between the two rows is 0.5, and the binary representation of 0.5 is 0.10000. It should be emphasized that the arrangement rule of Sobol random numbers: Sobol random numbers are infinitely long, and the number of groups is infinite. The value is between [0,1]. The same number of groups does not necessarily step by 0.0625. The new Sobol random numbers in this embodiment do not consider the stepping rule. As long as the arrangement is 1-2, 3-4, 5-6, and so on, the new Sobol random number array with a difference of 0.5 between the two rows is formed.
[0037] 3. The state machine can only store dark Sobol values or light Sobol values, and then generate all Sobol random numbers by flipping the highest bit of the Sobol value through CLK. In this way, the overhead of the state machine is reduced.
[0038] 4. Sobol-based random sequences can be generated by selecting from binary values through one-hot encoding. One-hot encoding, also known as one-bit effective encoding, uses an N-bit state register to encode N states. Each state has its own independent register bit, and at any time, only one bit is valid.
[0039] In the n bits output by the state machine of the novel Sobol random number generator of this embodiment, the lower (n-1) bits remain unchanged, and the highest bit will be continuously flipped according to CLK (divided by two) (i.e., when CLK is high, MSB remains unchanged; when CLK is low, MSB is inverted). In this embodiment, if three different random numbers are required for each cycle, three novel Sobol random number generators are required.
[0040] Figure 4 This is a schematic diagram of the high parallel operation of the new SC computing unit. Figure 4 As shown, the energy-efficient, low-latency SC computing unit proposed in this implementation has the following optimization details.
[0041] 1. Figure 4 (a) is a schematic diagram of the forward conversion unit converting binary into a new random sequence. Figure 4 As shown in (a), this embodiment generates a new Sobol-based SC sequence by one-hot encoding the binary form of the Sobol random number, and its encoding method is "the position of the first '1'". The one-hot encoding form only reflects the position where the highest binary bit "1" appears, and cannot cover all binary information; one-hot encoding is essentially a kind of extraction of effective information.
[0042] According to the one-hot encoding of Sobol random numbers, this embodiment takes the corresponding bits of the binary input as the bits of the SC sequence. Figure 4 Taking the binary input sample-1 in (a) as an example, observe the one-hot encoding of Sobol-1: for 00000, this embodiment directly obtains the SC bit as 0; for 10000, this embodiment takes the first bit "0" of sample-1 "0110" as the SC bit; for 01000, this embodiment takes the second bit "1" of sample-1 as the SC bit; for 00100, this embodiment takes the third bit "1" of sample-1 as the SC bit. Multiplication in the SC domain requires at least two sets of unrelated random sequences, so this embodiment requires at least two Sobol random number generators. Correspondingly, the forward conversion unit of this embodiment includes at least two Sobol random number generators.
[0043] 2. Figure 4 (b) is a schematic diagram of the multiplication of the new random sequence. Figure 4 As shown in (b), when two SC sequences are multiplied, it can be predicted that some SC bits come from the same binary bits, so these bits can be added together, and then the SC bits multiplied with them are used to select whether the calculation result is 0 or themselves. Specifically, in random calculations, the multiplication of two sequences is essentially a pair-by-pair bit multiplication, as shown in Figure 1As shown in (c), swapping the order of calculating different bit pairs will not affect the result. Therefore, this embodiment collects the bits that meet the described rules together for calculation, and uses addition and selectors to replace a large amount of AND gate overhead (many bit pairs are calculated together, requiring many AND gates). Figure 4 The first and second steps in (b) have described the optimization method, and the third and fourth steps are to repeat the first and second steps.
[0044] 3. These SC bits added in advance can be used directly for subsequent addition or converted to binary.
[0045] 4. By using two-way selectors to replace a large number of traditional AND gates, this embodiment greatly reduces the number of AND gates used in multiplication, reduces the overhead of the SC calculation unit under high parallelism, and realizes high-energy-efficiency and low-latency SC calculation.
[0046] Implementation example 1:
[0047] For the new Sobol random number generation unit.
[0048] Taking Sobol-1 random numbers as an example, the new Sobol random number state machine of this embodiment can only store the 1st, 3rd, 5th, ... odd Sobol random numbers, and the difference between the 2nd, 4th, 6th, ... even Sobol random numbers and the odd Sobol random numbers is 0.5.
[0049] Therefore, the state machine of this embodiment can be transformed once every two cycles, that is, in the 1st and 2nd cycles, the state machine outputs the first Sobol random number; in the 3rd and 4th cycles, the state machine outputs the third Sobol random number, and so on for the remaining cycles. Outside the state machine, the highest bit of the output value is flipped through the binary clock and the MUX gate. For example, in the first cycle, the state machine outputs the first Sobol value, "0". Its four-bit binary representation is 0000. In the first cycle, the binary CLK value is 1, and the highest bit remains unchanged; in the second cycle, the state machine still outputs the first Sobol value, "0", and the binary CLK value is 0, so the highest bit is inverted to 1000, and its value is 0.5, which is the second Sobol value. The subsequent cycles are analogous.
[0050] In this way, this embodiment can greatly reduce the number of Sobol values that need to be stored and reduce hardware overhead.
[0051] Implementation example 2:
[0052] For the new SC computing unit:
[0053] This embodiment uses one-hot encoding to generate the SC sequence, that is, the position where the first "1" appears in the binary form of the Sobol random number. This embodiment uses one-hot encoding to select the corresponding bit from the binary output as the SC sequence. Figure 4 As shown in (a), for the Sobol value of 0.75, its binary form is 1100..., and the position where the first 1 appears is the first bit, so its one-hot encoding is 1000... The one-hot encoding form only reflects the position where the highest binary bit "1" of 1100... appears, and cannot cover all the information in the binary form of the Sobol value; one-hot encoding is essentially a kind of extraction of effective information.
[0054] Through this one-hot encoding, this embodiment selects the first bit in the binary input as the bit of its SC sequence, which is "0" in sample 1 and "1" in sample 2. The other bits in the SC sequence are also generated according to this rule. Figure 4 Taking the binary input sample-1 in (a) as an example, observe the one-hot encoding of Sobol-1: for 00000, this embodiment directly obtains the SC bit as 0; for 10000, this embodiment takes the first bit "0" of sample-1 "0110" as the SC bit; for 01000, this embodiment takes the second bit "1" of sample-1 as the SC bit; for 00100, this embodiment takes the third bit "1" of sample-1 as the SC bit. Multiplication in the SC domain requires at least two sets of unrelated random sequences, so this embodiment requires at least two Sobol random number generators. Correspondingly, the forward conversion unit of this embodiment includes at least two Sobol random number generators.
[0055] like Figure 4As shown in (b), in the Sobol random number, there are many values whose one-hot codes are the same, which means that their corresponding SC bits must also be the same. When two SC sequences are multiplied, for example, one SC sequence is SC sequence 1 generated based on Sobol-1, and the other SC sequence is SC sequence 2 generated based on Sobol-2 (in order to ensure that the two sequences are unrelated to improve accuracy). In the first step, this embodiment finds the same SC bit ("0" in the figure), and moves the SC bit pairs (in the dotted box) of SC sequence 1 and SC sequence 2 where these same SC bits are located to the front of the sequence (adjusting the order of the bit pairs does not affect the accuracy); in the second step, the corresponding SC bits of SC sequence 2 in the same SC bit pairs in SC sequence 1 are added, and then the "same SC bits" in SC sequence 1 are used to select the result of "0" or the addition result of the corresponding SC bits of SC sequence 2; in the third step, similar to the first step, the "same SC bits" of SC sequence 2 that have not participated in the calculation are picked out, and the SC bit pairs of SC sequence 1 and SC sequence 2 where they are located are adjusted to the front of the sequence; in the fourth step, the calculation result is selected through the MUX gate using the same method as in the second step. Finally, the bits in SC sequence 1 and SC sequence 2 that have not participated in the calculation are calculated using the traditional SC calculation method (one AND gate is used for each pair of bits). This embodiment collects the bits that meet the description rule together for calculation, and uses addition and selectors to replace a large amount of AND gate overhead (many bit pairs are calculated together, requiring many AND gates). Figure 4 The first and second steps in (b) have described the optimization method, and the third and fourth steps are to repeat the first and second steps.
[0056] Through the above method, the huge number of AND gates in highly parallel SC calculations can be greatly reduced, while still maintaining high energy efficiency when using the Sobol sequence and highly parallel architecture.
[0057] Those skilled in the art will appreciate that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, wherein the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0058] The above is only a preferred embodiment of the present invention. It should be pointed out that ordinary technicians in this technical field can make several improvements and supplements without departing from the principle of the present invention. These improvements and supplements should also be regarded as the scope of protection of the present invention.
Claims
1. A random calculator based on Sobol random numbers, comprising a forward conversion unit, an SC calculation unit and a backward conversion unit, wherein the forward conversion unit is used to convert a first multiplier binary number into a first random calculation sequence and a second multiplier binary number into a second random calculation sequence, the SC calculation unit is used to perform random field multiplication calculation on the first random calculation sequence and the second random calculation sequence, and the backward conversion unit is used to convert the product random calculation sequence output by the SC calculation unit back into a binary number, wherein the binary number ∈ [0, 1]; characterized in that: The forward conversion unit includes a Sobol1 random number generator and a Sobol2 random number generator, wherein the Sobol1 random number and the Sobol2 random number are new Sobol random number arrays ∈[0,1], with a group number of an even number n, Sobol1[m]-Sobol1[m-1]=0.5, Sobol2[m]-Sobol2[m-1]=0.5, m∈[2,4,6…n-2,n]; the Sobol1 random number generator retains the first '1' position of the binary form of the Sobol1 random number and sets the remaining positions to "0" to convert it into a one-hot encoding form of the Sobol1 random number, and the Sobol2 random number generator retains the first '1' position of the binary form of the Sobol2 random number and sets the remaining positions to "0" to convert it into a one-hot encoding form of the Sobol2 random number; The forward conversion unit generates a first random calculation sequence by using the probability of "1" to represent the first multiplier binary number based on the Sobol1 random number one-hot encoding form, and generates a second random calculation sequence by using the probability of "1" to represent the second multiplier binary number based on the Sobol2 random number one-hot encoding form; When the SC calculation unit performs random domain multiplication calculation on the first random calculation sequence and the second random calculation sequence, the corresponding second random calculation sequence bits from the same Sobol1 random number one-hot encoding form are added, and then the multiplied first random calculation sequence bits are used to select the output calculation result to be "0" or the addition calculation result, and a large number of AND gates are replaced by addition and selectors; The SC calculation unit performs the following steps when replacing a large number of AND gates with adders and selectors: S1. Find the bits with the same bit value in the first random calculation sequence, and move the bit pairs of the first random calculation sequence and the second random calculation sequence where the bits with the same bit value in the first random calculation sequence are located to the front of the random calculation sequence; S2, adding the bits of the first random calculation sequence and the second random calculation sequence bit pairs where the bits with the same bit value of the first random calculation sequence are located, and the bits of the second random calculation sequence derived from the same Sobol1 random number one-hot encoding form, and then selecting and outputting the calculation result through the bits with the same bit value of the first random calculation sequence is "0" or the addition calculation result; S3, repeating steps S1 and S2, and finally, the first random calculation sequence and the second random calculation sequence bit pairs that have not participated in the calculation are calculated using an AND gate; The Sobol1 random number generator and the Sobol2 random number generator are based on a novel Sobol random number generating unit; the novel Sobol random number generating unit comprises a state machine, and the state machine is used to store the Sobol1 random number and the Sobol2 random number; The state machine stores n / 2 of the Sobol1 random numbers or Sobol2 random numbers, Sobol1[m-1], Sobol2[m-1], m∈[2,4,6…n-2,n]; the novel Sobol random number generating unit further comprises a selector and a NOT gate, the state machine outputs the highest bit of the Sobol1 random number or the Sobol2 random number and connects it to the first input of the selector, and the selector output is connected to the second input of the selector after passing through the NOT gate; the state machine outputs the Sobol1 random number or the Sobol2 random number with the lower bit unchanged, and the selector realizes the continuous flipping of the highest bit of the Sobol1 random number or the Sobol2 random number output by the selector through CLK flipping, Generate all Sobol1 random numbers or Sobol2 random numbers; The selector achieves continuous flipping of the highest bit of the Sobol1 random number or Sobol2 random number output by the selector through the binary frequency CLK flipping. When CLK is high, the highest bit of the Sobol1 random number or Sobol2 random number remains unchanged. When CLK is low, the highest bit of the Sobol1 random number or Sobol2 random number is inverted.
Citation Information
Patent Citations
Low-discrepancy deterministic bit-stream processing using sobol sequences
US20200401376A1
Finite State Machine-Based Bit-Stream Generator for Low-Discrepancy Stochastic Computing
US20230025438A1
