Random number generation circuit

The random number generation circuit optimizes memory operations to efficiently output unique values by addressing specific storage locations, reducing duplication and rewrite times, thus enhancing efficiency and reducing power consumption.

JP2024137617AInactive Publication Date: 2024-10-07KIOXIA CORP
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
JP2023150464
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-22
Filing Date
2023-09-15
Publication Date
2024-10-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing random number generation circuits struggle to efficiently output unique values from a certain range without duplication, leading to inefficiencies and increased power consumption.

Method used

A random number generation circuit comprising a memory circuit and a control circuit that stores values in multiple storage areas, generates random numbers to address specific storage locations, reads and writes values to ensure non-overlapping outputs, and optimizes memory operations to reduce duplication and rewrite times.

Benefits of technology

The circuit efficiently outputs non-overlapping random numbers, reducing operation time and power consumption while enabling applications such as error emulation in nonvolatile memory systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2024137617000001_ABST
    Figure 2024137617000001_ABST
Patent Text Reader

Abstract

To provide a random number generation circuit that can efficiently output non-overlapping values from a certain range of values randomly.SOLUTION: A random number generation circuit includes a memory circuit and a control circuit. The memory circuit includes a plurality of storage areas each of which is specified by a plurality of addresses. The control circuit stores a plurality of mutually different values in the plurality of storage areas, generates a first random number, obtains a first address that is one of the plurality of addresses using the first random number, reads a first value stored in a first storage area specified by the first address among the plurality of storage areas, and reads a second value stored in a second storage area specified by a second address among the plurality of storage areas. The second address is an address having a maximum value among addresses corresponding to storage areas from which the first value has not yet been read among the plurality of storage areas. After reading the first value, the control circuit writes the second value to the first storage area. The control circuit outputs the first value.SELECTED DRAWING: Figure 4
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] An embodiment of the present invention relates to a random number generation circuit. [Background technology]

[0002] A random number generation circuit is known that randomly outputs unique values ​​from a certain range of values. [Prior art documents] [Patent documents]

[0003] [Patent Document 1] Patent No. 5813380 specification [Patent Document 2] Patent No. 6380804 specification [Patent Document 3] U.S. Patent No. 9,292,428 Summary of the Invention [Problem to be solved by the invention]

[0004] One embodiment provides a random number generation circuit that can efficiently output non-overlapping values ​​randomly from a range of values. [Means for solving the problem]

[0005] A random number generation circuit according to an embodiment includes a memory circuit and a control circuit. The memory circuit includes a plurality of storage areas each specified by a plurality of addresses. The control circuit is configured to store a plurality of values ​​different from each other in the plurality of storage areas, generate a first random number, obtain a first address that is one of the plurality of addresses using the first random number, read a first value stored in the first storage area specified by the first address among the plurality of storage areas, and read a second value stored in a second storage area specified by a second address among the plurality of storage areas. The second address is an address having a maximum value among addresses corresponding to storage areas from which the first value has not yet been read among the plurality of storage areas. The control circuit is configured to write the second value to the first storage area after reading the first value, and output the first value. [Brief description of the drawings]

[0006] [Figure 1] 1 is a block diagram showing a hardware configuration of a random number generation circuit according to a first embodiment. [Diagram 2] 2 is a diagram showing a configuration of functional blocks of a random number generation circuit according to the first embodiment; FIG. [Diagram 3] 2 is a diagram showing the exchange of instructions and data between functional blocks of the random number generation circuit according to the first embodiment. FIG. [Figure 4] 4 is a flowchart showing the operation of the random number generation circuit according to the first embodiment. [Diagram 5] FIG. 2 is a diagram showing an initial storage state in the memory circuit according to the first embodiment. [Figure 6] 5A to 5C are diagrams showing a specific example of the transition of the storage state in the memory circuit according to the first embodiment. [Figure 7] 10 is a flowchart showing the operation of the random number generation circuit according to the second embodiment. [Figure 8] FIG. 11 is a diagram showing an initial storage state in a memory circuit according to a second embodiment. [Figure 9] 13A and 13B are diagrams showing a specific example of a transition of a storage state in a memory circuit according to a second embodiment. [Figure 10]13 is a flowchart showing the operation of the random number generation circuit according to the third embodiment. [Figure 11] FIG. 13 is a diagram showing a state in which part of the operation according to the third embodiment is pipelined. [Figure 12] 13 is a flowchart showing the operation of the random number generation circuit according to the fourth embodiment. [Figure 13] 13A and 13B are diagrams showing a specific example of the transition of the storage state in the memory circuit according to the fourth embodiment. [Figure 14] 13A and 13B are diagrams showing a specific example of the transition of the storage state in the memory circuit according to the fourth embodiment. [Figure 15] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 16] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 17] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 18] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 19] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 20] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 21] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 22] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 23] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 24]13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Diagram 25] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 26] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 27] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 28] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Figure 29] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Diagram 30] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Diagram 31] 13A to 13C are diagrams illustrating specific examples of addresses, stored values, and transitions of variables in a memory circuit according to a fourth embodiment. [Diagram 32] 13 is a flowchart showing the operation of a random number generation circuit according to a modification of the fourth embodiment. [Diagram 33] FIG. 13 is a diagram showing a specific example of a transition of a storage state in a memory circuit according to a modification of the fourth embodiment. [Diagram 34] 13 is a flowchart showing the operation of the random number generation circuit according to the fifth embodiment. [Diagram 35] 13A and 13B are diagrams illustrating storage states in a memory circuit according to a fifth embodiment. [Diagram 36] 13 is a flowchart showing the operation of the random number generation circuit according to the sixth embodiment. [Figure 37] 13A and 13B are diagrams showing a specific example of the transition of the storage state in the memory circuit according to the sixth embodiment. [Figure 38] 13A and 13B are diagrams showing a specific example of the transition of the storage state in the memory circuit according to the sixth embodiment. [Figure 39] 13A and 13B are diagrams showing a specific example of the transition of the storage state in the memory circuit according to the sixth embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0007] Hereinafter, the embodiments will be described with reference to the drawings. In the following description, components having the same functions and configurations are given the same reference numerals. Furthermore, the embodiments shown below are merely examples of devices and methods for embodying the technical ideas of the embodiments, and do not specify the materials, shapes, structures, arrangements, etc. of the components as described below.

[0008] The functional blocks can be realized as either hardware or computer software, or a combination of both. It is not essential that the functional blocks are differentiated as in the following example. For example, some functions may be performed by a functional block other than the illustrated functional block. Furthermore, the illustrated functional blocks may be further divided into smaller functional subblocks.

[0009] 1. First embodiment A random number generation circuit according to the first embodiment will be described. The random number generation circuit according to the first embodiment is a circuit that uses random numbers generated by a random number generator to randomly output any number of values ​​from a certain range without duplication.

[0010] 1.1 Configuration of the first embodiment An example of the hardware configuration of the random number generation circuit of the first embodiment will be described below. Fig. 1 is a block diagram showing the hardware configuration of the random number generation circuit of the first embodiment.

[0011] The random number generation circuit 1 is configured by a semiconductor device such as a system-on-a-chip (SOC). Specifically, the random number generation circuit 1 includes a central processing unit (CPU) core (or processor core) 2, a memory core 3, an interface core 4, and a dedicated circuit core 5. The CPU core 2 performs arithmetic processing, data processing, and various controls. The memory core 3 includes a memory element that stores software and data, and a circuit that controls the memory element. The interface core 4 performs input / output of control signals and data between an external device and the random number generation circuit 1, and controls the input / output of these signals. The dedicated circuit core 5 includes a plurality of dedicated circuits having various functions described later.

[0012] Next, a description will be given of the configuration of functional blocks in the random number generation circuit of the first embodiment. Fig. 2 is a diagram showing the configuration of functional blocks in the random number generation circuit of the first embodiment.

[0013] The random number generation circuit 1 includes a random number generation control unit 10, a memory control unit 20, a repetition control unit 30, and a memory unit 40.

[0014] The random number generation control unit 10 includes a random number generator 11, a numerical range limiting circuit 12, and a decrement circuit 13. The random number generator 11 generates and outputs a random number A. The random number A is an arbitrary integer. The random number generator 11 is, for example, a random number generator such as a Mersenne twister. The numerical range limiting circuit 12 performs processing to limit the random number A to a value in the range of 0, 1, 2, ..., j. The decrement circuit 13 decrements the variable "j". That is, the decrement circuit 13 subtracts 1 from the variable "j". The variable "j" is an integer equal to or greater than 1.

[0015] The memory control unit 20 includes an initial value write control circuit 21, a data read control circuit 22, and a read and write control circuit 23. The initial value write control circuit 21 writes (Y+1) different values ​​into the memory unit 40. The (Y+1) different values ​​may be any values. For example, the (Y+1) values ​​are consecutive integer values. The minimum value of the consecutive integers is, for example, 0. The maximum value of the consecutive integers is, for example, Y. The initial value write control circuit 21 may obtain the (Y+1) values ​​from outside the random number generation circuit 1 (for example, a non-volatile memory to which the random number generation circuit 1 is connected).

[0016] The data read control circuit 22 reads out data stored in a memory area specified by address B of the memory unit 40. The read and write control circuit 23 reads out data stored in a memory area specified by address j of the memory unit 40, and writes the read data to the memory area specified by address B, where B is an integer between 0 and j. Hereinafter, accessing a memory area specified by address Z of the memory unit 40 (i.e., reading data from this memory area or writing data to this memory area) will also be referred to as accessing address Z.

[0017] The memory unit 40 includes a memory circuit 41. The memory circuit 41 stores data in a storage area designated by an address. The memory circuit 41 includes, for example, a static random access memory (SRAM).

[0018] The repetition control unit 30 includes a repetition control circuit 31. The repetition control circuit 31 controls circuits included in the random number generation control unit 10, the memory control unit 20, and the memory unit 40. The repetition control circuit 31 includes, for example, a sequencer.

[0019] The random number generation control unit 10 is configured, for example, by a dedicated circuit core 5 or a CPU core 2. The memory control unit 20 is configured, for example, by a dedicated circuit core 5 or a CPU core 2. The repetitive control unit 30 is configured, for example, by the CPU core 2. The memory unit 40 is configured, for example, by the memory core 3.

[0020] 1.2 Operation of the First Embodiment The operation of the random number generation circuit of the first embodiment will be described. First, the exchange of commands and data between the functional blocks in the random number generation circuit 1 will be described with reference to Fig. 3. Fig. 3 is a diagram showing the exchange of commands and data between the functional blocks in the random number generation circuit of the first embodiment.

[0021] First, when it is time to start operation, the repetitive control unit 30 transmits to the random number generation control unit 10 an instruction to generate a random number and an instruction on the range of random number generation.

[0022] The random number generation control unit 10 generates random numbers based on an instruction to generate random numbers and an instruction for the range of random number generation. The random number generation control unit 10 transmits the generated random numbers to the memory control unit 20. Hereinafter, the random numbers generated by the random number generation control unit 10 are also referred to as internal random numbers. In addition, the repetitive control unit 30 transmits instructions for read and write operations to the memory unit 40 to the memory control unit 20.

[0023] The memory control unit 20 transmits a read operation instruction and an address to the memory unit 40. At this time, the memory control unit 20 transmits a value based on the internal random number received from the random number generation control unit 10 as the address. The memory unit 40 reads out data stored in a storage area specified by the address based on the read operation instruction and the address. Furthermore, the memory unit 40 transmits the read data to the memory control unit 20. The memory control unit 20 outputs the received data. As described later, the data output from the memory control unit 20 is a value obtained based on the internal random number from each different value. Hereinafter, the data output from the memory control unit 20 is also referred to as an output random number.

[0024] Moreover, the memory control unit 20 transmits instructions for read and write operations to the memory unit 40. The memory unit 40 performs read and write operations based on the instructions for read and write operations. Furthermore, the memory unit 40 transmits read data to the memory control unit 20 and receives write data from the memory control unit 20.

[0025] Next, the operation of the random number generation circuit of the first embodiment will be described. Fig. 4 is a flowchart showing the operation of the random number generation circuit of the first embodiment. The operation shown in this flowchart is controlled by a repetitive control circuit (or a sequencer) 31. Fig. 5 shows the initial storage state of the memory circuit 41, and shows addresses in the memory circuit 41 and the data (stored values) stored at those addresses.

[0026] In the operation of the first embodiment, the random number generation circuit 1 randomly acquires X unique values ​​from among (Y+1) values. Here, Y is an integer equal to or greater than 1. X is an integer equal to or greater than 1 and equal to or less than Y. Here, a case will be described in which the initial value writing control circuit 21 writes consecutive integer values ​​(0 to Y) into the memory unit 40 as (Y+1) different values.

[0027] As shown in FIG. 4, first, the repetitive control circuit 31 sets a variable "i" to X. The variable "i" is a variable for managing the number of acquired output random numbers. The variable "i" is an integer equal to or less than X. The repetitive control circuit 31 also sets a variable "j" to Y. The variable "j" is a variable indicating the maximum value among the values ​​of the addresses of the memory circuit 41 from which the output random numbers have not been read out. The variable "j" is an integer equal to or less than Y. The repetitive control circuit 31 also sets an initial memory state 42_0 in the memory circuit 41 by the initial value writing control circuit 21 (S1). As shown in FIG. 5, in the initial memory state 42_0, memory values ​​0, 1, 2, 3, ..., Y-4, Y-3, Y-2, Y-1, and Y are stored in addresses 0, 1, 2, 3, ..., Y-4, Y-3, Y-2, Y-1, and Y, respectively.

[0028] Next, the repetitive control circuit 31 generates a random number (i.e., an internal random number) A by the random number generator 11 (S2). The internal random number A is an arbitrary integer.

[0029] Next, the iterative control circuit 31 performs processing to limit the internal random number A to a value in the range of 0 to j by the numerical range limiting circuit 12. That is, the numerical range limiting circuit 12 performs processing to obtain a value in the range of 0 to j using the internal random number A. Specifically, the numerical range limiting circuit 12 divides the internal random number A by (j+1). The numerical range limiting circuit 12 calculates a remainder B by this division (S3). The remainder B is an integer not less than 0 and not more than j. As described above, the initial value of the variable "j" is equal to Y. In this case, the remainder B is an integer not less than 0 and not more than Y.

[0030] Next, the repetitive control circuit 31 regards the remainder B as the address of the memory circuit 41, and reads a value P from the address B of the memory circuit 41 by the data read control circuit 22 (S4). The value P is an integer between 0 and Y. This value P is the output random number P output from the memory control unit 20.

[0031] Next, the repetitive control circuit 31 decrements the variable “i.” That is, the repetitive control circuit 31 subtracts 1 from the variable “i” (S5).

[0032] Next, the repetitive control circuit 31 judges whether the variable "i" after the subtraction is 0 or not (S6). If the variable "i" is 0 (Yes in S6), X output random numbers P have been acquired, so the repetitive control circuit 31 ends the operation.

[0033] If the variable "i" is not 0 (No in S6), the repetitive control circuit 31 judges whether the remainder B (i.e., address B) is equal to the variable "j" (S7). That is, the repetitive control circuit 31 judges whether the value of the address of the memory circuit 41 from which the output random number was read in step S4 was the maximum value among the values ​​of the addresses from which the output random number has not yet been read. If the remainder B is equal to the variable "j" (Yes in S7), the repetitive control circuit 31 skips steps S8 and S9 and decrements the variable "j" by the decrement circuit 13 (S10), since the maximum value among the values ​​of the addresses from which the output random number has not yet been read is the remainder B. That is, the repetitive control circuit 31 subtracts 1 from the variable "j". After that, the repetitive control circuit 31 repeats the processes from step S2 onwards.

[0034] If the remainder B is not equal to the variable "j" (No in S7), the repeat control circuit 31 reads the value Q stored in the memory area of ​​the memory circuit 41 indicated by the address of the value of the variable "j" by the read and write control circuit 23 (S8). The value Q is an integer between 0 and Y.

[0035] Next, the repeat control circuit 31 writes the value Q to the address B of the memory circuit 41 by the read and write control circuit 23 (S9). That is, the repeat control circuit 31 overwrites the address B from which the value P was read in step S4 with the value Q read from the address j.

[0036] Next, the process by the repetitive control circuit 31 proceeds to step S10. As described above, the repetitive control circuit 31 decrements the variable "j" by the decrement circuit 13. Thereafter, the repetitive control circuit 31 repeats the process from step S2 onwards.

[0037] By repeating the above steps S2 to S10, the random number generation circuit 1 obtains X unique output random numbers P from among the (Y+1) values.

[0038] 5 and 6, a specific operation of the random number generating circuit of the first embodiment will be described below. FIG.

[0039] In step S1 of Fig. 4, the memory circuit 41 is set to an initial storage state 42_0 as shown in Fig. 5. That is, in the initial storage state 42_0 of the memory circuit 41, storage values ​​0, 1, 2, 3, ..., Y-4, Y-3, Y-2, Y-1, and Y are stored in addresses 0, 1, 2, 3, ..., Y-4, Y-3, Y-2, Y-1, and Y, respectively.

[0040] As shown in FIG. 6, it is assumed that 4 is obtained as the remainder B in the first random number acquisition operation (step S3 in FIG. 4). Then, the value 4 stored in the address 4 is read out (step S4 in FIG. 4). Then, the read value 4 is acquired as the output random number. Thereafter, the value Y read out from the address j is written to the address 4 (steps S8 to S9 in FIG. 4). As described above, the variable "j" is equal to Y in the first random number acquisition operation. Furthermore, the variable "j" is decremented, and the range of addresses from which the output random number has not been acquired becomes 0 to (Y-1). As a result, in the memory state 42_1 of the memory circuit 41, the memory values ​​0, 1, 2, 3, Y, 5, 6, 7, 8, ..., Y-4, Y-3, Y-2, and Y-1 are stored in the addresses 0, 1, 2, 3, Y, 5, 6, 7, 8, ..., Y-4, Y-3, Y-2, and Y-1, respectively. It should be noted that the state of the address Y in the storage state 42_1 is omitted in FIG.

[0041] Next, in the second random number acquisition operation (step S3 in FIG. 4), it is assumed that 7 is obtained as the remainder B. Then, the value 7 stored in the address 7 is read out (step S4 in FIG. 4). Then, the read value 7 is acquired as the output random number. After that, the value (Y-1) read from the address j (i.e., the address (Y-1)) is written to the address 7 (steps S8 to S9 in FIG. 4). Furthermore, the variable "j" is decremented from (Y-1) to (Y-2), and the range of addresses from which the output random number has not been acquired becomes 0 to (Y-2). As a result, in the memory state 42_2 of the memory circuit 41, the memory values ​​0, 1, 2, 3, Y, 5, 6, Y-1, 8, ..., Y-4, Y-3, and Y-2 are stored in the addresses 0, 1, 2, 3, Y, 5, 6, Y-1, 8, ..., Y-4, Y-3, and Y-2, respectively. Incidentally, the states of address (Y-1) to address Y in the storage state 42_2 are omitted in FIG.

[0042] Furthermore, suppose that in the third random number acquisition operation (step S3 in FIG. 4), 4 is obtained as the remainder B. Then, the value Y stored in address 4 is read out (step S4 in FIG. 4). Then, the read out value Y is acquired as the output random number. After that, the value (Y-2) read out from address j (i.e., address (Y-2)) is written to address 4 (steps S8 to S9 in FIG. 4). Furthermore, the variable "j" is decremented from (Y-2) to (Y-3), and the range of addresses from which no output random number has been acquired becomes 0 to (Y-3). As a result, in the memory state 42_3 of the memory circuit 41, the memory values ​​0, 1, 2, 3, Y-2, 5, 6, Y-1, 8, ..., Y-4, and Y-3 are stored in addresses 0, 1, 2, 3, 4, 5, 6, 7, 8, ..., Y-4, and Y-3, respectively. Incidentally, the states of address (Y-2) to address Y in the storage state 42_3 are omitted in FIG.

[0043] Furthermore, in the fourth random number acquisition operation (step S3 in FIG. 4), it is assumed that (Y-3) is obtained as the remainder B. Then, the value (Y-3) stored in the address (Y-3) is read out (step S4 in FIG. 4). Then, the read out value (Y-3) is acquired as the output random number. After that, the variable "j" is decremented from (Y-3) to (Y-4), and the range of addresses from which the output random number has not been acquired becomes 0 to (Y-4). As a result, in the memory state 42_4 of the memory circuit 41, the memory values ​​0, 1, 2, 3, Y-2, 5, 6, Y-1, 8, ..., and Y-4 are stored in the addresses 0, 1, 2, 3, 4, 5, 6, 7, 8, ..., and Y-4, respectively. Note that the states of the addresses (Y-3) to Y in the memory state 42_4 are omitted in FIG. 6.

[0044] By repeating the above-described operation of obtaining random numbers X times, the random number generation circuit 1 can obtain X unique output random numbers from among (Y+1) values.

[0045] 1.3 Effects of the First Embodiment According to the first embodiment, it is possible to provide a random number generation circuit that can efficiently output unique values ​​randomly from a certain range of values.

[0046] In the first embodiment, the random number B generated by the random number generation control unit 10 is used as an address for reading data from the memory circuit 41 of the memory unit 40. The memory circuit 41 stores non-overlapping values ​​0 to Y. The memory control unit 20 outputs the value P read from the address B as a random number. Every time the data stored in the address B is read, the value read from an address in the memory circuit 41 that has not yet been read is overwritten in the address B. Then, the range of the random number to be obtained next is decremented. That is, the value stored in the address once read is overwritten by the value stored in the address that has not yet been read, and the range of the random number to be obtained is reduced. As a result, even if the random number B (i.e., address B) generated by the random number generation control unit 10 thereafter overlaps with a previous value, the value P read from the memory circuit 41 does not overlap with the previously read value.

[0047] In the first embodiment, after the value P stored in the address B is read from the memory circuit 41, the value stored in the address B is rewritten so that the read values ​​are not duplicated, but the number of times this rewriting is performed is only once per random number output. Therefore, the number of times the value stored in the memory circuit 41 is rewritten can be kept to a minimum, and the number of times the value in the memory circuit 41 is rewritten can be reduced.

[0048] Therefore, in the configuration of the first embodiment, the number of times values ​​are rewritten in the memory circuit 41 can be reduced, so that the operation of acquiring X random numbers can be speeded up. In other words, the time required for the operation of acquiring X random numbers can be shortened.

[0049] Furthermore, since the number of times values ​​are rewritten in the memory circuit 41 can be reduced, the power consumption related to the operation of obtaining X random numbers can be reduced.

[0050] As described above, according to the first embodiment, it is possible to provide a random number generation circuit capable of efficiently outputting random numbers.

[0051] An example in which the random number generation circuit of the first embodiment is applied to error emulation of a non-volatile memory will be described below. The non-volatile memory is, for example, a NAND type flash memory.

[0052] A semiconductor device including the random number generation circuit 1 can function as a memory controller that controls a nonvolatile memory. The semiconductor device functioning as a memory controller and the nonvolatile memory configure a memory system. The memory controller is electrically connected to the nonvolatile memory. The memory controller can use the random number generation circuit 1 to execute error emulation of the nonvolatile memory.

[0053] In the error emulation, for example, error data is randomly inserted into data (read data) read from a non-volatile memory. This error emulation is used, for example, to evaluate the error correction capability of a memory controller. For example, the memory controller reads read data from a non-volatile memory. When determining the positions of 500 error data from among 4000 candidate positions of error data in the read data, the memory controller randomly acquires 500 unique values ​​(i.e., X=500) from 4000 integers (i.e., Y=3999) using the random number generation circuit 1 of the first embodiment. The memory controller determines the positions of the 500 error data based on the acquired values. The memory controller inserts errors into the determined positions. Then, the memory controller executes error correction on the read data including the inserted errors.

[0054] In this case, the random number generation circuit 1 can perform this operation by simply rewriting the data stored in the memory circuit 41 500 times. In other words, if the random number generation circuit 1 of the first embodiment is used for error emulation, it is possible to reduce the number of times data is rewritten in the memory circuit 41 required for the above operation.

[0055] 2. Second embodiment A random number generation circuit of the second embodiment will be described. The random number generation circuit of the second embodiment is a circuit that uses random numbers generated by a random number generator to randomly output all values ​​from a certain range of values ​​without duplication. In the second embodiment, the differences from the first embodiment will be mainly described.

[0056] 2.1 Configuration of the second embodiment The hardware configuration and functional block configuration of the random number generation circuit of the second embodiment are similar to those of the first embodiment described above.

[0057] 2.2 Operation of the Second Embodiment The operation of the random number generation circuit of the second embodiment will be described. Fig. 7 is a flowchart showing the operation of the random number generation circuit of the second embodiment. The process shown in this flowchart is controlled by a repetitive control circuit (or a sequencer) 31. Fig. 8 shows the initial storage state of the memory circuit 41, and shows addresses in the memory circuit 41 and the data (stored values) stored at those addresses.

[0058] In the operation of the second embodiment, the random number generation circuit 1 randomly obtains (X+1) unique values, where X is an integer equal to or greater than 1. The second embodiment corresponds to the case in the first embodiment where X is (Y+1).

[0059] 7, first, the repetitive control circuit 31 sets a variable "i" to X. The repetitive control circuit 31 also sets an initial storage state 43_0 in the memory circuit 41 by the initial value write control circuit 21 (S21). As shown in FIG 8, in the initial storage state 43_0, storage values ​​0, 1, 2, 3, ..., X-4, X-3, X-2, X-1, and X are stored in addresses 0, 1, 2, 3, ..., X-4, X-3, X-2, X-1, and X, respectively.

[0060] Next, the repetitive control circuit 31 generates an internal random number A by the random number generator 11 (S22). The internal random number A is an arbitrary integer.

[0061] Next, the iterative control circuit 31 performs processing to limit the internal random number A to a value in the range of 0 to i by the numerical range limiting circuit 12. That is, the numerical range limiting circuit 12 performs processing to obtain a value in the range of 0 to i using the internal random number A. Specifically, the numerical range limiting circuit 12 divides the internal random number A by (i+1). The numerical range limiting circuit 12 calculates the remainder B from this division (S23).

[0062] Next, the repetitive control circuit 31 regards the remainder B as an address of the memory circuit 41, and reads the value P from the address B of the memory circuit 41 by the data read control circuit 22 (S24).

[0063] Next, the repetitive control circuit 31 judges whether the remainder B is equal to the variable "i" (S25). If the remainder B is not equal to the variable "i" (No in S25), the repetitive control circuit 31 reads the value Q stored in the memory area of ​​the memory circuit 41 indicated by the address of the value of the variable "i" by the read and write control circuit 23 (S26).

[0064] Next, the repeat control circuit 31 writes the value Q to the address B of the memory circuit 41 by the read and write control circuit 23 (S27). That is, the repeat control circuit 31 overwrites the address B from which the value P was read in step S24 with the value Q read from the address i. Thereafter, the process by the repeat control circuit 31 proceeds to step S28.

[0065] On the other hand, if the remainder B is equal to the variable "i" (Yes in S25), the maximum value among the values ​​of the addresses from which the output random number has not yet been read is the remainder B, so steps S26 and S27 are skipped and the processing by the repetitive control circuit 31 proceeds to step S28.

[0066] The repetitive control circuit 31 decrements the variable "i" by the decrement circuit 13 (S28). That is, the repetitive control circuit 31 subtracts 1 from the variable "i".

[0067] Next, the repetitive control circuit 31 judges whether the variable "i" after the subtraction is 0 or not (S29). If the variable "i" is not 0 (No in S29), the repetitive control circuit 31 repeats the processes from step S22 onwards.

[0068] On the other hand, if the variable "i" is 0 (Yes in S29), the repeat control circuit 31 reads the value P stored in address 0 by the data read control circuit 22 (S30). After that, the repeat control circuit 31 ends the operation.

[0069] By repeating the above-mentioned steps S22 to S30, the random number generation circuit 1 obtains (X+1) unique output random numbers P from among the (X+1) values.

[0070] A specific operation of the random number generating circuit of the second embodiment will be described below with reference to Figures 8 and 9. Figure 9 shows a specific example of the transition of the storage state in the memory circuit 41 due to the operation of the second embodiment.

[0071] In step S21 of Fig. 7, the memory circuit 41 is set to an initial storage state 43_0 as shown in Fig. 8. That is, in the initial storage state 43_0, storage values ​​0, 1, 2, 3, ..., X-4, X-3, X-2, X-1, and X are stored in addresses 0, 1, 2, 3, ..., X-4, X-3, X-2, X-1, and X, respectively.

[0072] As shown in FIG. 9, assume that in the first random number acquisition operation (step S23 in FIG. 7), a remainder B of 3 is obtained. Then, the value 3 stored in address 3 is read out (step S24 in FIG. 7). The read value 3 is then acquired as an output random number. Thereafter, the value X read out from address i is written to address 3 (steps S26-S27 in FIG. 7). Note that, as described above, in the first random number acquisition operation, the variable "i" is equal to X. Furthermore, the variable "i" is decremented, and the range of addresses from which an output random number has not been acquired becomes 0 to (X-1). As a result, in the memory state 43_1 of the memory circuit 41, the memory values ​​0, 1, 2, X, 4, 5, 6, 7, 8, ..., X-4, X-3, X-2, and X-1 are stored in the addresses 0, 1, 2, 3, 4, 5, 6, 7, 8, ..., X-4, X-3, X-2, and X-1, respectively. Note that the state of the address X in the memory state 43_1 is omitted in FIG. 9.

[0073] Next, in the second random number acquisition operation (step S23 in FIG. 7), it is assumed that 8 is obtained as the remainder B. Then, the value 8 stored in address 8 is read out (step S24 in FIG. 7). Then, the read value 8 is acquired as the output random number. After that, the value (X-1) read from address i (i.e., address (X-1)) is written to address 8 (steps S26 to S27 in FIG. 7). Furthermore, the variable "i" is decremented from (X-1) to (X-2), and the range of addresses from which no output random number has been acquired becomes 0 to (X-2). As a result, in the memory state 43_2 of the memory circuit 41, the memory values ​​0, 1, 2, X, 4, 5, 6, 7, X-1, ..., X-4, X-3, and X-2 are stored in addresses 0, 1, 2, 3, 4, 5, 6, 7, X-1, ..., X-4, X-3, and X-2, respectively. Incidentally, the states of address (X-1) to address X in the storage state 43_2 are omitted in FIG.

[0074] Furthermore, suppose that in the third random number acquisition operation (step S23 in FIG. 7), 3 is obtained as the remainder B. Then, the value X stored in address 3 is read out (step S24 in FIG. 7). Then, the read out value X is acquired as the output random number. Thereafter, the value (X-2) read out from address i (i.e., address (X-2)) is written to address 3 (steps S26 to S27 in FIG. 7). Furthermore, the variable "i" is decremented from (X-2) to (X-3), and the range of addresses from which no output random number has been acquired becomes 0 to (X-3). As a result, in the memory state 43_3 of the memory circuit 41, the stored values ​​0, 1, 2, X-2, 4, 5, 6, 7, X-1, ..., X-4, and X-3 are stored in addresses 0, 1, 2, 3, 4, 5, 6, 7, X-1, ..., X-4, and X-3, respectively. Incidentally, the states of address (X-2) to address X in the storage state 43_3 are omitted in FIG.

[0075] Furthermore, in the fourth random number acquisition operation (step S23 in FIG. 7), it is assumed that (X-3) is obtained as the remainder B. Then, the value (X-3) stored in the address (X-3) is read out (step S24 in FIG. 7). Then, the read out value (X-3) is acquired as the output random number. After that, the variable "i" is decremented from (X-3) to (X-4), and the range of addresses from which no output random number has been acquired becomes 0 to (X-4). As a result, in the memory state 43_4 of the memory circuit 41, the memory values ​​0, 1, 2, X-2, 4, 5, 6, 7, X-1, ..., and X-4 are stored in the addresses 0, 1, 2, 3, 4, 5, 6, 7, 8, ..., and X-4, respectively. Note that the states of the addresses (X-3) to X in the memory state 43_4 are omitted in FIG. 9.

[0076] By repeating the above-described operation of obtaining random numbers (X+1) times, the random number generation circuit 1 can obtain (X+1) unique output random numbers from among (X+1) values.

[0077] 2.3 Effects of the second embodiment According to the second embodiment, it is possible to provide a random number generation circuit that can efficiently output unique values ​​randomly from a certain range of values.

[0078] In the configuration of the second embodiment, all values ​​can be output randomly from among (X+1) mutually unique values. Therefore, in the configuration of the second embodiment, a shuffle circuit (or a rearrangement circuit) that randomly extracts all values ​​in a certain range can be realized. Other effects are the same as those of the first embodiment described above.

[0079] 3. Third embodiment A random number generating circuit according to the third embodiment will be described. In the third embodiment, an example will be shown in which some of the operations described in the first embodiment are executed in parallel. In the third embodiment, differences from the first embodiment will be mainly described.

[0080] 3.1 Configuration of the third embodiment The hardware configuration and functional block configuration of the random number generation circuit of the third embodiment are similar to those of the first embodiment described above.

[0081] 3.2 Operation of the Third Embodiment The operation of the random number generation circuit of the third embodiment will be described below with reference to a flowchart of FIG 10.

[0082] In the operation of obtaining X output random numbers P, the operations from the process of generating an internal random number A (S2) to the process of decrementing the variable "j" (S10) are repeated X times.

[0083] In this process that is repeatedly executed X times, as shown in FIG. 10, the process of generating an internal random number A (S2), the process of calculating the remainder B (S3), the process of decrementing the variable “i” (S5), and the process of reading the value Q (S8) can be executed in parallel.

[0084] For example, the process (S5) of decrementing the variable "i" and the process (S8) of reading the value Q in the operation of obtaining the first output random number can be executed in parallel with the process (S2) of generating the internal random number A in the operation of obtaining the second output random number. In other words, the process (S2) of generating the internal random number A in the operation of obtaining the second output random number can be executed in parallel with the process (S5) of decrementing the variable "i" and the process (S8) of reading the value Q in the operation of obtaining the first output random number.

[0085] The process (S2) of generating an internal random number A is performed by the random number generator 11 in the random number generation control unit 10. The process (S3) of calculating the remainder B is performed by the numerical range limiting circuit 12. The process (S5) of decrementing the variable "i" is performed by the repetitive control circuit 31 in the repetitive control unit 30. Furthermore, the process (S8) of reading out the value Q is performed by the read and write control circuit 23 in the memory control unit 20.

[0086] When at least two of these processes are executed by a dedicated hardware circuit, multiple dedicated hardware circuits can operate in parallel, making it possible to execute at least two of the processes of generating an internal random number (S2) (or calculating the remainder (S3)), decrementing the variable “i” (S5), and reading the value Q (S8) in parallel.

[0087] FIG. 11 is a diagram showing a state in which part of the operation in the third embodiment is pipelined.

[0088] In the operation of obtaining X output random numbers P, random number generation processes (S2 and S3) and read and write processes (S8 and S9) are repeated X times. The random number generation processes (S2 and S3) include a process (S2) of generating an internal random number A, and a process (S3) of calculating a remainder B. The read and write processes (S8 and S9) include a process (S8) of reading a value Q from the memory circuit 41, and a process (S9) of writing the value Q.

[0089] 11, for example, in an operation to obtain a first output random number, random number generation process 51a shown in (1) is executed, followed by read and write process 51b. In an operation to obtain a second output random number, random number generation process 52a shown in (2) is executed, followed by read and write process 52b. Furthermore, in an operation to obtain a third output random number, random number generation process 53a shown in (3) is executed, followed by read and write process 53b.

[0090] The random number generation processes 51a, 52a, and 53a are executed by the random number generator 11 and the numerical range limiting circuit 12. The read and write processes 51b, 52b, and 53b are executed by the read and write control circuit 23. When each of the random number generator 11, the numerical range limiting circuit 12, and the read and write control circuit 23 is formed by a dedicated hardware circuit, these can operate independently.

[0091] 11, the read and write process 51b (1) and the random number generation process 52a (2) can be executed in parallel. That is, the random number generation process 52a in the second operation of obtaining an output random number can be executed in parallel with the read and write process 51b in the first operation of obtaining an output random number.

[0092] Similarly, the read and write process 52b in (2) and the random number generation process 53a in (3) can be executed in parallel. That is, the random number generation process 53a in the third operation of obtaining an output random number can be executed in parallel with the read and write process 52b in the second operation of obtaining an output random number.

[0093] 3.3 Effects of the third embodiment According to the third embodiment, it is possible to provide a random number generation circuit that can efficiently output unique values ​​randomly from a certain range of values.

[0094] In the configuration of the third embodiment, in the processes (S2) to (S10) that are repeatedly executed X times, it is possible to execute the random number generation process (S2) (or the remainder calculation process (S3)), the decrement process (S5) of the variable "i", and the read process (S8) of the value Q in parallel. This makes it possible to speed up the operation of obtaining X output random numbers P. In other words, the time required for the operation of obtaining X output random numbers P can be shortened.

[0095] In addition, in the configuration of the third embodiment, as shown in Fig. 11, in a random number generation process 51a and a read and write process 51b that are repeatedly executed X times, it is possible to execute the read and write process 51b that is executed earlier and the random number generation process 51a that is executed later in parallel. This makes it possible to speed up the operation of obtaining X output random numbers P. In other words, it is possible to shorten the time required for the operation of obtaining X output random numbers P. Other effects are the same as those of the first embodiment described above.

[0096] 4. Fourth embodiment A random number generating circuit of the fourth embodiment will be described. In the fourth embodiment, an example will be shown in which addresses in a memory circuit 41 are divided into a first group and a second group, and values ​​stored in addresses belonging to the first group are calculated as output random numbers with smaller numbers, and values ​​stored in addresses belonging to the second group are calculated as output random numbers with larger numbers. In the fourth embodiment, differences from the first embodiment will be mainly described.

[0097] 4.1 Configuration of the fourth embodiment Addresses in the memory circuit 41 are represented by numbers, for example. Hereinafter, the numbers representing addresses are referred to as address numbers. In the fourth embodiment, addresses in the memory circuit 41 are divided and managed into two groups: a first group having large address numbers and a second group having small address numbers. The same value is stored in a storage area specified by an address in the first group and a storage area specified by an address in the second group. The addresses in the memory circuit 41 and the storage states including their values ​​will be described in detail later.

[0098] The rest of the hardware configuration and functional block configuration of the random number generation circuit of the fourth embodiment are similar to those of the first embodiment described above.

[0099] 4.2 Operation of the Fourth Embodiment The operation of the random number generation circuit of the fourth embodiment will be described. Fig. 12 is a flowchart showing the operation of the random number generation circuit of the fourth embodiment. The process shown in this flowchart is controlled by a repetitive control circuit (or a sequencer) 31. Figs. 13 and 14 show the transition of the storage state in the memory circuit 41, and show the remainder B, addresses in the memory circuit 41, and the data (stored values) stored at those addresses.

[0100] The random number generation circuit 1 of the fourth embodiment uses Y (=X / 2) values ​​to randomly obtain X unique values ​​from X values. Here, Y is an integer between 0 and (X / 2). X is an integer between 0 and 0. "N1", "N2", "B", "C", "D", and "R" are prepared as variables used by the repetitive control circuit 31 for calculation.

[0101] 12, first, the repetitive control circuit 31 sets variables "N1" and "N2" to Y (=X / 2) (S1). The variables "N1" and "N2" are variables for managing the number of acquired output random numbers. The variables "N1" and "N2" are each integers equal to or less than (X / 2).

[0102] Furthermore, the repetitive control circuit 31 sets the initial storage state 44_0 in the memory circuit 41 by the initial value write control circuit 21 (S1).

[0103] 13, the memory circuit 41 has, for example, addresses 0, 1, 2, 3, ..., Y-2, Y-1, Y, Y+1, ..., X-4, X-3, X-2, and X-1. These addresses 0, 1, 2, ..., and X-1 are divided into a first group of Y addresses with smaller address numbers and a second group of Y addresses with larger address numbers. The first group includes addresses 0, 1, 2, 3, ..., Y-2, and Y-1. The second group includes addresses Y, Y+1, ..., X-4, X-3, X-2, and X-1.

[0104] In the initial memory state 44_0, the addresses 0, 1, 2, 3, ..., Y-2, and Y-1 belonging to the first group store memory values ​​0, 1, 2, 3, ..., Y-2, and Y-1, respectively. The addresses Y, Y+1, ..., X-4, X-3, X-2, and X-1 belonging to the second group store memory values ​​0, 1, ..., Y-4, Y-3, Y-2, and Y-1, respectively. That is, the same value 0 is stored in the addresses 0 and Y. The same value 1 is stored in the addresses 1 and (Y+1). The same value 2 is stored in the addresses 2 and (Y+2). Similarly, the same value is stored in the addresses of the first group and the addresses of the second group. Note that the values ​​in parentheses written in the memory values ​​in Figs. 13 and 14 indicate the values ​​when output as output random numbers.

[0105] Next, the repetitive control circuit 31 generates a random number (i.e., an internal random number) A by the random number generator 11 (S2). The internal random number A is an arbitrary integer.

[0106] Next, the numerical range limiting circuit 12 of the repetitive control circuit 31 performs processing to obtain a value in the range of 0 to (X-1) using the internal random number A. Specifically, the numerical range limiting circuit 12 divides the internal random number A by (N1+N2). The numerical range limiting circuit 12 sets the remainder calculated by this division to a variable "B" (S3). The value of the variable "B" is an integer equal to or greater than 0 and equal to or less than (X-1).

[0107] Next, the repeat control circuit 31 judges whether the variable "B" is smaller than the variable "N1" (S4). If the variable "B" is smaller than the variable "N1" (Yes in S4), the repeat control circuit 31 performs the process of steps S5 to S7. First, the repeat control circuit 31 sets 0 to the variable "C" (S5). The variable "C" is a variable that is added to the stored value read from the memory circuit 41. Next, the repeat control circuit 31 decrements the variable "N1" (S6). Furthermore, the repeat control circuit 31 sets the value of the variable "N1" to the variable "D" (S7). The variable "D" is a variable for indicating the maximum value among the values ​​of the addresses whose stored values ​​have not yet been read. After that, the process by the repeat control circuit 31 proceeds to step S12.

[0108] On the other hand, if the variable "B" is not smaller than the variable "N1" (No in S4), the repeat control circuit 31 performs the processing of steps S8 to S11. First, the repeat control circuit 31 adds Y to the variable "B" and subtracts the value of the variable "N1" (S8). The repeat control circuit 31 sets Y to the variable "C" (S9). The repeat control circuit 31 decrements the variable "N2" (S10). Furthermore, the repeat control circuit 31 sets the value of (N2+Y) to the variable "D" (S11). After that, the processing by the repeat control circuit 31 proceeds to step S12.

[0109] Next, in step S12, the repetitive control circuit 31 regards the value of variable "B" as the address of the memory circuit 41, and reads out the value stored at address B of the memory circuit 41 by the data read control circuit 22. Furthermore, the repetitive control circuit 31 adds the value of variable "C" to the value read out from address B, and sets the obtained value to variable "R" (S13). Variable "R" is an integer equal to or greater than 0 and equal to or less than (2Y-1). The value of this variable "R" is the output random number output from the memory control unit 20.

[0110] Next, the repetitive control circuit 31 judges whether or not (N1+N2) is 0 (S14). If (N1+N2) is 0 (Yes in S14), X output random numbers R have been obtained, and therefore the repetitive control circuit 31 ends its operation.

[0111] On the other hand, if (N1+N2) is not 0 (No in S14), the repetitive control circuit 31 judges whether or not the variable "B" is equal to the variable "D" (S15). That is, the repetitive control circuit 31 judges whether or not the value of the address B in the memory circuit 41 from which the value was read in step S12 is the maximum value among the values ​​of the addresses from which the value has not yet been read in the first group or the second group.

[0112] If the variable "B" is equal to the variable "D" (Yes in S15), the maximum value among the addresses whose values ​​have not yet been read is the variable "B", so the repeat control circuit 31 skips step S16 and returns to step S2, and repeats the processing from step S2 onwards.

[0113] On the other hand, if the variables "B" and "D" are not equal (No in S15), the repeat control circuit 31 reads the value stored in the memory area of ​​the memory circuit 41 indicated by the address of the value of the variable "D" (i.e., the value stored at address D) by the read and write control circuit 23, and writes the read value to address B of the memory circuit 41 (S16). That is, the repeat control circuit 31 overwrites the value read from address D to address B from which the value was read in step S12. After that, the repeat control circuit 31 returns to step S2 and repeats the processes from step S2 onwards.

[0114] By repeating the above steps S2 to S16, the random number generation circuit 1 uses values ​​from 0 to Y to obtain X unique output random numbers R from among X values.

[0115] A specific operation of the random number generation circuit 1 of the fourth embodiment will be described below. Figures 15 to 31 show specific examples of the addresses and stored values ​​in the memory circuit 41 and the transitions of the variables "N1", "N2", "B", "C", "D", and "R" when the random number generation circuit 1 is operating. The operation of the random number generation circuit 1 is controlled by a repetitive control circuit (or a sequencer) 31.

[0116] 12, variables "N1" and "N2" are each set to Y. Furthermore, as shown in FIGS. 13 and 15, the memory circuit 41 is set to an initial storage state 44_0.

[0117] In the initial storage state 44_0 of the memory circuit 41, storage values ​​0, 1, 2, 3, ..., Y-2, and Y-1 are stored in addresses 0, 1, 2, 3, ..., Y-2, and Y-1 belonging to the first group, respectively. Furthermore, storage values ​​0, 1, ..., Y-4, Y-3, Y-2, and Y-1 are stored in addresses Y, Y+1, ..., X-4, X-3, X-2, and X-1 belonging to the second group, respectively.

[0118] Next, the operation of obtaining the first output random number R is executed.

[0119] In steps S2 and S3 of FIG. 12, it is assumed that 2 is obtained as the remainder (i.e., variable "B"). Then, as shown in FIG. 16, 2 is set to variable "B". Furthermore, since the value 2 of variable "B" is smaller than the value Y of variable "N1" (Yes in S4), the processes of steps S5 to S7 are executed. As shown in FIG. 17, variable "C" is set to 0, and the value of variable "N1" is decremented from Y to (Y-1) (S5 and S6). Furthermore, as shown in FIG. 18, the value (Y-1) of variable "N1" is set to variable "D" (S7).

[0120] Next, the value 2 stored in address B, i.e., address 2, is read out. Furthermore, as shown in Fig. 19, the value 0 of variable "C" is added to the read out value 2, and the value 2 is set to variable "R" (S12 and S13). Then, the value 2 of variable "R" is obtained as the output random number.

[0121] Next, as shown in Fig. 20, the value (Y-1) stored in address D (address (Y-1)) is read out, and the read value (Y-1) is written to address B, i.e., address 2 (S16) (see storage state 44_1 in Fig. 13). This completes the first operation of obtaining output random number 2.

[0122] Next, the operation of obtaining the second output random number R is executed.

[0123] In steps S2 and S3 of FIG. 12, it is assumed that Y is obtained as the remainder (i.e., variable "B"). Then, as shown in FIG. 21, Y is set to variable "B". Furthermore, since the value Y of variable "B" is not smaller than the value (Y-1) of variable "N1" (No in S4), the processes of steps S8 to S11 are executed. As shown in FIG. 22, Y is added to variable "B" having the value Y, and the value (Y-1) of variable "N1" is subtracted. As a result, (Y+1) is set to variable "B" (S8).

[0124] Next, as shown in Fig. 23, Y is set to variable "C", and the value of variable "N2" is decremented from Y to become (Y-1) (S9 and S10). Furthermore, as shown in Fig. 24, the value of (N2+Y) is set to variable "D". That is, (2Y-1) is set to variable "D" (S11).

[0125] Next, the value 1 stored in address B (address (Y+1)) is read out. Furthermore, as shown in FIG. 25, the value Y of variable "C" is added to the read out value 1, and the value (Y+1) is set to variable "R" (S12 and S13). Then, the value (Y+1) of variable "R" is obtained as the output random number.

[0126] Next, as shown in Fig. 26, the value (Y-1) stored in address D (address (X-1)) is read out, and the read value (Y-1) is written to address B, i.e., address (Y+1) (S16) (see storage state 44_2 in Fig. 14). This completes the operation of obtaining the second output random number (Y+1).

[0127] Next, the third operation of obtaining the output random number R is executed.

[0128] In steps S2 and S3 of FIG. 12, it is assumed that 2 is obtained as the remainder (i.e., variable "B"). Then, as shown in FIG. 27, 2 is set to variable "B". Furthermore, since the value 2 of variable "B" is smaller than the value (Y-1) of variable "N1" (Yes in S4), the processes of steps S5 to S7 are executed. As shown in FIG. 28, variable "C" is set to 0, and the value of variable "N1" is decremented from (Y-1) to (Y-2) (S5 and S6). Furthermore, as shown in FIG. 29, the value (Y-2) of variable "N1" is set to variable "D" (S7).

[0129] Next, the value (Y-1) stored at address B, i.e., address 2, is read out. Furthermore, as shown in Fig. 30, the value 0 of variable "C" is added to the read out value (Y-1), and the value (Y-1) is set to variable "R" (S12 and S13). Then, the value (Y-1) of variable "R" is obtained as the output random number.

[0130] Next, as shown in Fig. 31, the value (Y-2) stored in address D is read out, and the read value (Y-2) is written to address B, i.e., address 2 (S16) (see storage state 44_3 in Fig. 14). This completes the operation of obtaining the third output random number (Y-1).

[0131] Next, an operation for acquiring the fourth output random number R is executed. Here, diagrams showing the addresses and stored values ​​of the memory circuit 41 and the transitions of the variables “N1”, “N2”, “B”, “C”, “D”, and “R” are omitted.

[0132] In steps S2 and S3 of FIG. 12, it is assumed that (Y-1) is obtained as the remainder (i.e., variable "B"). Then, (Y-1) is set to variable "B". Furthermore, since the value (Y-1) of variable "B" is not smaller than the value (Y-2) of variable "N1" (No in S4), the processes of steps S8 to S11 are executed. Y is added to variable "B" having the value (Y-1), and the value (Y-2) of variable "N1" is subtracted. As a result, (Y+1) is set to variable "B" (S8).

[0133] Next, Y is set to the variable "C", and the value of the variable "N2" is decremented from (Y-1) to (Y-2) (S9 and S10). Furthermore, the value of (N2+Y) is set to the variable "D". That is, (2Y-1) is set to the variable "D" (S11).

[0134] Next, the value (Y-1) stored at address B, i.e., address (Y+1), is read out. Furthermore, the value Y of variable "C" is added to the read out value (Y-1), and the value (2Y-1) is set to variable "R" (S12 and S13). Then, the value (2Y-1) of variable "R" is obtained as the output random number.

[0135] Next, the value (Y-2) stored in address D, i.e., address (X-2), is read out, and the read value (Y-2) is written to address B, i.e., address (Y+1) (S16) (see memory state 44_4 in FIG. 14). This completes the operation of obtaining the fourth output random number (2Y-1).

[0136] By repeating the above-described operation of obtaining random numbers X times, the random number generation circuit 1 can obtain X unique output random numbers from among X values ​​using values ​​from 0 to Y.

[0137] 4.3 Modification of the fourth embodiment The operation of the random number generating circuit according to the modification of the fourth embodiment will be described. In the modification of the fourth embodiment, an example will be shown in which the addresses in the memory circuit 41 are divided into a first group and a second group, and values ​​stored in addresses belonging to the first group are calculated as even output random numbers, and values ​​stored in addresses belonging to the second group are calculated as odd output random numbers.

[0138] Fig. 32 is a flowchart showing the operation of the random number generating circuit of the modified example of the fourth embodiment. The process shown in this flowchart is controlled by a repetitive control circuit (or a sequencer) 31. Fig. 33 shows the transition of the storage state in the memory circuit 41, and shows the remainder B, addresses in the memory circuit 41, and data (storage values) stored at those addresses.

[0139] As shown in Fig. 32, first, the repetitive control circuit 31 sets variables "N1" and "N2" to Y (=X / 2) (S1a). The variables "N1" and "N2" are variables for managing the number of acquired output random numbers. The variables "N1" and "N2" are each integers equal to or less than (X / 2).

[0140] Furthermore, the repetitive control circuit 31 sets the initial storage state 45_0 in the memory circuit 41 by the initial value write control circuit 21 (S1a).

[0141] The memory state 45_0 is the same as the memory state 44_0 in the fourth embodiment. In the memory state 45_0, the memory values ​​0, 1, 2, 3, ..., Y-2, and Y-1 are stored in the addresses 0, 1, 2, 3, ..., Y-2, and Y-1 of the first group, respectively. The memory values ​​0, 1, ..., Y-4, Y-3, Y-2, and Y-1 are stored in the addresses Y, Y+1, ..., X-4, X-3, X-2, and X-1 of the second group, respectively. That is, the same values ​​are stored in the addresses of the first group and the addresses of the second group. Note that the values ​​in parentheses written in the memory values ​​in FIG. 33 indicate the values ​​when output as output random numbers.

[0142] The process of steps S2 to S7 by the repetitive control circuit 31 shown in FIG. 32 is similar to the process of steps S2 to S7 shown in FIG.

[0143] If the variable "B" is not smaller than the variable "N1" (No in S4), the repeat control circuit 31 performs the process of steps S8 to S11. First, the repeat control circuit 31 adds Y to the variable "B" and subtracts the value of the variable "N1" (S8). Next, the repeat control circuit 31 sets the variable "C" to 1 (S9a). The repeat control circuit 31 decrements the variable "N2" (S10). Furthermore, the repeat control circuit 31 sets the value of (N2+Y) to the variable "D" (S11). After that, the process by the repeat control circuit 31 proceeds to step S12.

[0144] Next, in step S12, the repetitive control circuit 31 regards the value of variable "B" as the address of the memory circuit 41, and reads out the value stored at address B of the memory circuit 41 by the data read control circuit 22. Furthermore, the repetitive control circuit 31 doubles the value read out from address B, adds the value of variable "C", and sets the obtained value to variable "R" (S13a). Variable "R" is an integer equal to or greater than 0 and equal to or less than (2Y-1). The value of this variable "R" is the output random number output from the memory control unit 20.

[0145] The process of steps S14 to S16 by the repetitive control circuit 31 shown in FIG. 32 is similar to the process of steps S14 to S16 shown in FIG.

[0146] By repeating the above steps S2 to S16, the random number generation circuit 1 uses values ​​from 0 to Y to obtain X unique output random numbers R from among X values.

[0147] Hereinafter, a specific operation of the random number generation circuit 1 according to the modified example of the fourth embodiment will be described with reference to FIGS.

[0148] 32, variables "N1" and "N2" are each set to Y. Furthermore, as shown in FIG 33, the memory circuit 41 is set to an initial storage state 45_0.

[0149] In the initial storage state 45_0 of the memory circuit 41, storage values ​​0, 1, 2, 3, ..., Y-2, and Y-1 are stored in addresses 0, 1, 2, 3, ..., Y-2, and Y-1 belonging to the first group, respectively. Furthermore, storage values ​​0, 1, ..., Y-4, Y-3, Y-2, and Y-1 are stored in addresses Y, Y+1, ..., X-4, X-3, X-2, and X-1 belonging to the second group, respectively.

[0150] Next, the operation of obtaining the first output random number R is executed.

[0151] In steps S2 and S3 of FIG. 32, it is assumed that 2 is obtained as the remainder (i.e., variable "B"). Since the value 2 of variable "B" is smaller than the value Y of variable "N1" (Yes in S4), the processes of steps S5 to S7 are executed. First, 0 is set to variable "C" (S5). Variable "N1" is decremented from Y to (Y-1) (S6). The value (Y-1) of variable "N1" is set to variable "D" (S7).

[0152] Next, as shown in Fig. 33, the value 2 stored in address B (address 2) is read out (S12). The read out value 2 is doubled, and the value 0 of variable "C" is added to it, and the result is set as variable "R" (S13a). Then, the value 4 of variable "R" is obtained as the output random number.

[0153] After that, the value (Y-1) read from address D (address (Y-1)) is written to address B (address 2) (S16).

[0154] Also, by decrementing the variable "N1", the range of addresses from which no output random number has been obtained becomes 0 to (Y-2) in the first group and Y to (X-1) in the second group. As a result, in the memory state 45_1 of the memory circuit 41, the memory values ​​0, 1, Y-1, 3, ..., and Y-2 are stored in the addresses 0, 1, 2, 3, ..., and Y-2 of the first group, respectively. Furthermore, the memory values ​​0, 1, ..., Y-4, Y-3, Y-2, and Y-1 are stored in the addresses Y, Y+1, ..., X-4, X-3, X-2, and X-1 of the second group, respectively.

[0155] Next, the operation of obtaining the second output random number R is executed.

[0156] In steps S2 and S3 of FIG. 32, it is assumed that Y is obtained as the remainder (i.e., variable "B"). Then, since the value Y of variable "B" is not smaller than the value (Y-1) of variable "N1" (No in S4), the processes of steps S8 to S11 are executed. First, Y is added to variable "B" and the value (Y-1) of variable "N1" is subtracted, and the obtained value (Y+1) is set to variable "B" (S8). 1 is set to variable "C" (S9a). The value of variable "N2" is decremented from Y to (Y-1) (S10). Furthermore, (N2+Y) is set to variable "D" (S11). That is, (2Y-1) is set to variable "D".

[0157] 33, the value 1 stored at address B of the memory circuit 41, i.e., address (Y+1), is read out (S12). The read value 1 is doubled, and the value 1 of the variable "C" is added to it, and the result is set as the variable "R" (S13a). Then, the value 3 of the variable "R" is obtained as the output random number.

[0158] After that, the value (Y-1) read from address D (address (2Y-1), ie, address (X-1)) is written to address B (address (Y+1)) (S16).

[0159] Also, by decrementing the variable "N2", the range of addresses from which no output random numbers have been obtained becomes 0 to (Y-2) in the first group and Y to (X-2) in the second group. As a result, in the memory state 45_2 of the memory circuit 41, the memory values ​​0, 1, Y-1, 3, ..., and Y-2 are stored in the addresses 0, 1, 2, 3, ..., and Y-2 of the first group, respectively. Furthermore, the memory values ​​0, Y-1, ..., Y-4, Y-3, and Y-2 are stored in the addresses Y, Y+1, ..., X-4, X-3, and X-2 of the second group, respectively.

[0160] By repeating the above-described operation of obtaining random numbers X times, the random number generation circuit 1 can obtain X unique output random numbers from among X values ​​using values ​​from 0 to Y.

[0161] 4.4 Effects of the fourth embodiment According to the fourth embodiment and its modification, it is possible to efficiently output non-overlapping values ​​from a certain range of values ​​at random, and it is also possible to reduce the amount of values ​​stored in a memory circuit.

[0162] In the fourth embodiment, addresses in memory circuit 41 are divided into a first group and a second group, and the same Y (=X / 2) values ​​(0 to (Y-1)) are stored in the addresses of the first group and the addresses of the second group, respectively. When acquiring X output random numbers, if a value stored in an address of the first group is read out, that value is calculated as an output random number with a smaller number (0 to (Y-1)), and if a value stored in an address of the second group is read out, that value is calculated as an output random number with a larger number (Y to (2Y-1)).

[0163] In a modified example, the addresses in memory circuit 41 are divided into a first group and a second group, and the same Y values ​​(0 to (Y-1)) are stored in the addresses of the first group and the addresses of the second group, respectively. When acquiring X output random numbers, if a value stored in an address of the first group is read out, that value is calculated as an even output random number (0, 2, 4, ..., 2Y-4, 2Y-2), and if a value stored in an address of the second group is read out, that value is calculated as an odd output random number (1, 3, 5, ..., 2Y-3, 2Y-1).

[0164] In the random number generation circuit 1 of the fourth embodiment and its modified example, in order to obtain X output random numbers, it is not necessary to store values ​​from 0 to (X-1) (i.e., 0 to (2Y-1)) in the memory circuit 41; it is sufficient to store values ​​from 0 to (Y-1) in the memory circuit 41.

[0165] For example, when obtaining 1024 output random numbers (e.g., integers from 0 to 1023), it is not necessary to store integers from 0 to 1023 as values ​​in the memory circuit 41, but it is sufficient to store integers from 0 to 511 in storage areas specified by addresses of the first and second groups of the memory circuit 41, respectively. While 10 bits are required to express integers from 0 to 1023, integers from 0 to 511 can be expressed with 9 bits. That is, in the fourth embodiment and the modified example, the storage capacity required for the memory circuit 41 can be reduced. Other effects are similar to those of the first embodiment described above.

[0166] 5. Fifth embodiment A random number generating circuit of the fifth embodiment will be described. In the fifth embodiment, an example will be shown in which the memory area in the memory circuit 41 is divided into a first memory area and a second memory area, and the value stored in the address in the first memory area is calculated as a small output random number (0 to Y-1), and the value written in the address in the second memory area is calculated as a large output random number (Y to (2Y-1)). In the fifth embodiment, the differences from the first embodiment will be mainly described.

[0167] 5.1 Configuration of the fifth embodiment The memory circuit 41 includes two memory areas M0 and M1. The memory areas M0 and M1 each have an independent address range. The same value is stored at the same address in the memory areas M0 and M1.

[0168] The rest of the hardware configuration and functional block configuration of the random number generation circuit of the fifth embodiment are similar to those of the first embodiment described above.

[0169] 5.2 Operation of the Fifth Embodiment The operation of the random number generation circuit of the fifth embodiment will be described. Fig. 34 is a flowchart showing the operation of the random number generation circuit of the fifth embodiment. The process shown in this flowchart is controlled by a repetitive control circuit (or a sequencer) 31. Fig. 35 is a diagram showing the initial storage states in memory areas M0 and M1.

[0170] The random number generation circuit 1 of the fifth embodiment, like the fourth embodiment, uses Y (=X / 2) values ​​to randomly obtain X unique values ​​from X values. Here, Y is an integer between 0 and (X / 2). X is an integer between 0 and 0. "N1", "N2", "B", "C", "D", "R", and "M" are prepared as variables used by the repetitive control circuit 31 for calculation.

[0171] As shown in Fig. 34, first, the repetitive control circuit 31 sets variables "N1" and "N2" to Y (=X / 2) (S1b). The variables "N1" and "N2" are variables for managing the number of acquired output random numbers. The variables "N1" and "N2" are each integers equal to or less than (X / 2).

[0172] Furthermore, the repetitive control circuit 31 sets the initial storage states 46_00 and 46_01 in the memory areas M0 and M1, respectively, by the initial value write control circuit 21 (S1b).

[0173] 35, for example, memory region M0 has addresses 0, 1, 2, 3, ..., Y-4, Y-3, Y-2, and Y-1. Similarly, memory region M1 has addresses 0, 1, 2, 3, ..., Y-4, Y-3, Y-2, and Y-1. That is, memory regions M0 and M1 have the same addresses.

[0174] In the initial storage state 46_00 in the memory area M0, storage values ​​0, 1, 2, 3, ..., Y-2, and Y-1 are stored in addresses 0, 1, 2, 3, ..., Y-2, and Y-1, respectively. In the initial storage state 46_01 in the memory area M1, storage values ​​0, 1, ..., Y-4, Y-3, Y-2, and Y-1 are stored in addresses 0, 1, ..., Y-4, Y-3, Y-2, and Y-1, respectively. That is, the storage value 0 is stored in address 0 of the memory area M0 and memory area M1. The storage value 1 is stored in address 1 of the memory area M0 and memory area M1. Similarly, the storage values ​​2 to (Y-1) are stored in addresses 2 to (Y-1) of the memory area M0 and memory area M1, respectively. The values ​​in parentheses written in the storage values ​​in FIG. 35 indicate the values ​​when output as output random numbers.

[0175] The process of steps S2 to S4 performed by the repetitive control circuit 31 shown in FIG. 34 is similar to the process of steps S2 to S4 shown in FIG.

[0176] Next, if the variable "B" is smaller than the variable "N1" (Yes in S4), the repeat control circuit 31 performs the processes of steps S5 to S7 and S21. The processes of steps S5 to S7 by the repeat control circuit 31 shown in FIG. 34 are similar to the processes of steps S5 to S7 shown in FIG. 12. Furthermore, the repeat control circuit 31 sets a value indicating that the memory area M0 has been selected to the variable "M" (S21). After that, the process by the repeat control circuit 31 proceeds to step S12a.

[0177] On the other hand, if the variable "B" is not smaller than the variable "N1" (No in S4), the repeat control circuit 31 performs the processes of steps S8a, S9, S10, S11a, and S22. First, the repeat control circuit 31 subtracts the value of the variable "N1" from the variable "B" (S8a). Next, the repeat control circuit 31 sets the variable "C" to Y (S9). The repeat control circuit 31 decrements the variable "N2" (S10). The repeat control circuit 31 sets the value of the variable "N2" to the variable "D" (S11a). Furthermore, the repeat control circuit 31 sets the variable "M" to a value indicating that the memory area M1 is selected (S22). After that, the process by the repeat control circuit 31 proceeds to step S12a.

[0178] Next, in step S12a, the repeat control circuit 31 regards the value of variable "B" as an address of memory area M0 or M1, and reads out the value stored in address "B" of memory area M0 or M1 that has been set to variable "M" by the data read control circuit 22.

[0179] 34. The process of steps S13 to S15 by the repetitive control circuit 31 shown in FIG. 34 is similar to the process of steps S13 to S15 shown in FIG.

[0180] If the variables "B" and "D" are not equal (No in S15), the repeat control circuit 31 reads the value stored in address D of memory area M0 or M1 set for variable "M" by the read and write control circuit 23, and writes the read value to address B of the memory area set for variable "M" (S16a). That is, the repeat control circuit 31 overwrites address B, from which the value was read in step S12a, with the value read from address D. Thereafter, the repeat control circuit 31 returns to step S2 and repeats the processes from step S2 onwards.

[0181] By repeating the above steps S2 to S16a, the random number generation circuit 1 uses values ​​from 0 to Y to obtain X unique output random numbers R from among X values.

[0182] 5.3 Modification of the fifth embodiment As in the modified example of the fourth embodiment, in the fifth embodiment, the memory circuit 41 is divided into an area for even output random numbers and an area for odd output random numbers. That is, in the modified example of the fifth embodiment, the memory area in the memory circuit 41 is divided into a first memory area and a second memory area. Then, the value stored in the address in the first memory area is calculated as an even output random number, and the value stored in the address in the second memory area is calculated as an odd output random number.

[0183] 5.4 Effects of the Fifth Embodiment According to the fifth embodiment and its modification, it is possible to efficiently output non-overlapping values ​​from a certain range of values ​​at random, and to reduce the amount of values ​​stored in the memory circuit. In the fourth embodiment and its modification, for example, the address range of one SRAM is divided into a first group and a second group. In the fifth embodiment and its modification, for example, two SRAMs are assigned to memory regions M0 and M1, respectively. With such a configuration, the same effect as the fourth embodiment and its modification can be obtained.

[0184] 6. Sixth embodiment A random number generating circuit according to the sixth embodiment will be described. In the sixth embodiment, an example will be shown in which the memory area in the memory circuit 41 is divided into four memory areas, and an output random number is calculated according to each memory area. In the sixth embodiment, differences from the first embodiment will be mainly described.

[0185] 6.1 Configuration of the sixth embodiment The memory circuit 41 in the sixth embodiment includes four memory regions M0, M1, M2, and M3. The memory regions M0, M1, M2, and M3 each have an independent address range. The same value is stored at the same address in the memory regions M0, M1, M2, and M3.

[0186] The rest of the hardware configuration and functional block configuration of the random number generation circuit of the sixth embodiment are similar to those of the first embodiment described above.

[0187] 6.2 Operation of the Sixth Embodiment The operation of the random number generation circuit of the sixth embodiment will be described. Fig. 36 is a flowchart showing the operation of the random number generation circuit of the sixth embodiment. The process shown in this flowchart is controlled by a repetitive control circuit (or a sequencer) 31. Figs. 37 to 39 are diagrams showing the transition of the storage state in memory areas M0, M1, M2, and M3. Figs. 37 to 39 show the remainder B, addresses in memory areas M0, M1, M2, and M3, and the data (storage values) stored at those addresses.

[0188] The random number generation circuit 1 of the sixth embodiment uses Z (=X / 4) values ​​to randomly obtain X unique values ​​from X values. Here, Z is an integer between 0 and (X / 4). X is an integer between 0 and 0. "N1", "N2", "N3", "N4", "B", "C", "D", "R", and "M" are prepared as variables used by the repetitive control circuit 31 for calculation.

[0189] 36, first, the repetitive control circuit 31 sets variables "N1", "N2", "N3", and "N4" to Z (=Y / 2=X / 4) (S31). The variables "N1", "N2", "N3", and "N4" are variables for managing the number of acquired output random numbers. The variables "N1", "N2", "N3", and "N4" are each integers equal to or less than (X / 4).

[0190] Furthermore, the repetitive control circuit 31 sets the initial storage states 48_00, 48_01, 48_02, and 48_03 in the memory areas M0, M1, M2, and M3, respectively, by the initial value write control circuit 21 (S31).

[0191] 37, for example, memory regions M0, M1, M2, and M3 have addresses 0, 1, 2, 3, ..., Z-4, Z-3, Z-2, and Z-1, respectively. That is, memory regions M0, M1, M2, and M3 have the same address.

[0192] In the initial memory states 48_00, 48_01, 48_02, and 48_03 of the memory regions M0, M1, M2, and M3, respectively, the memory values ​​0, 1, 2, 3, ..., Z-4, Z-3, Z-2, and Z-1 are stored in the addresses 0, 1, 2, 3, ..., Z-4, Z-3, Z-2, and Z-1, respectively. That is, the memory value 0 is stored in the address 0 of the memory regions M0, M1, M2, and M3. The memory value 1 is stored in the address 1 of the memory regions M0, M1, M2, and M3. Similarly, the memory values ​​2 to (Z-1) are stored in the addresses 2 to (Z-1) of the memory regions M0, M1, M2, and M3, respectively. The values ​​in parentheses written in the memory values ​​in Figures 37 to 39 indicate the values ​​when they are output as output random numbers.

[0193] Next, the repetitive control circuit 31 generates a random number (i.e., an internal random number) A by the random number generator 11 (S32). The internal random number A is an arbitrary integer.

[0194] Next, the numerical range limiting circuit 12 of the repetitive control circuit 31 performs processing to obtain a value in the range of 0 to (X-1) using the internal random number A. Specifically, the numerical range limiting circuit 12 divides the internal random number A by (N1+N2+N3+N4). The numerical range limiting circuit 12 sets the remainder calculated by this division to a variable "B" (S33). The value of the variable "B" is an integer equal to or greater than 0 and equal to or less than (X-1).

[0195] Next, the repeat control circuit 31 judges whether the variable "B" is smaller than the variable "N1" (S34). If the variable "B" is smaller than the variable "N1" (Yes in S34), the repeat control circuit 31 performs the processes of steps S35 to S38. First, the repeat control circuit 31 sets the variable "C" to 0 (S35). Next, the repeat control circuit 31 decrements the variable "N1" (S36). The repeat control circuit 31 sets the value of the variable "N1" to the variable "D" (S37). Furthermore, the repeat control circuit 31 sets a value indicating that the memory area M0 is selected to the variable "M" (S38). After that, the process by the repeat control circuit 31 proceeds to step S56.

[0196] If the variable "B" is not smaller than the variable "N1" (No in S34), the repeat control circuit 31 performs the process of step S39 and subsequent steps. First, the repeat control circuit 31 subtracts the value of the variable "N1" from the variable "B" (S39). Then, the repeat control circuit 31 judges whether the variable "B" is smaller than the variable "N2" (S40). If the variable "B" is smaller than the variable "N2" (Yes in S40), the repeat control circuit 31 performs the process of steps S41 to S44. First, the repeat control circuit 31 sets the variable "C" to 1 (S41). Then, the repeat control circuit 31 decrements the variable "N2" (S42). The repeat control circuit 31 sets the value of the variable "N2" to the variable "D" (S43). Furthermore, the repeat control circuit 31 sets the value indicating that the memory area M1 is selected to the variable "M" (S44). Thereafter, the process by the repetitive control circuit 31 proceeds to step S56.

[0197] If the variable "B" is not smaller than the variable "N2" (No in S40), the repeat control circuit 31 performs the process of step S45 and subsequent steps. First, the repeat control circuit 31 subtracts the value of the variable "N2" from the variable "B" (S45). Then, the repeat control circuit 31 judges whether the variable "B" is smaller than the variable "N3" (S46). If the variable "B" is smaller than the variable "N3" (Yes in S46), the repeat control circuit 31 performs the process of steps S47 to S50. First, the repeat control circuit 31 sets the variable "C" to 2 (S47). Then, the repeat control circuit 31 decrements the variable "N3" (S48). The repeat control circuit 31 sets the value of the variable "N3" to the variable "D" (S49). Furthermore, the repeat control circuit 31 sets a value indicating that the memory area M2 is selected to the variable "M" (S50). Thereafter, the process by the repetitive control circuit 31 proceeds to step S56.

[0198] If the variable "B" is not smaller than the variable "N3" (No in S46), the repeat control circuit 31 performs the process of steps S51 to S55. First, the repeat control circuit 31 subtracts the value of the variable "N3" from the variable "B" (S51). Next, the repeat control circuit 31 sets the variable "C" to 3 (S52). The repeat control circuit 31 decrements the variable "N4" (S53). The repeat control circuit 31 sets the value of the variable "N4" to the variable "D" (S54). Furthermore, the repeat control circuit 31 sets a value indicating that the memory area M3 is selected to the variable "M" (S55). After that, the process by the repeat control circuit 31 proceeds to step S56.

[0199] Next, in step S56, the repeat control circuit 31 regards the value of variable “B” as the address of memory area M0, M1, M2, or M3, and reads the value stored in address B of the memory area set to variable “M” by the data read control circuit 22.

[0200] Furthermore, the repetitive control circuit 31 multiplies the value read from address B by four, adds the value of variable "C" to it, and sets the obtained value to variable "R" (S57). Variable "R" is an integer between 0 and (2Y-1). The value of this variable "R" is the output random number output from the memory control unit 20.

[0201] Next, the repetitive control circuit 31 judges whether or not (N1+N2+N3+N4) is 0 (S58). If (N1+N2+N3+N4) is 0 (Yes in S58), X output random numbers R have been obtained, and therefore the repetitive control circuit 31 ends its operation.

[0202] On the other hand, if (N1+N2+N3+N4) is not 0 (No in S58), the repeat control circuit 31 judges whether or not the variable "B" is equal to the variable "D" (S59). That is, the repeat control circuit 31 judges whether or not the value of address B of the memory area from which the value was read in step S56 is the maximum value among the values ​​of addresses from which the value has not yet been read.

[0203] If the variables "B" and "D" are equal (Yes in S59), the maximum value among the addresses whose values ​​have not yet been read is the variable "B", so the repeat control circuit 31 skips step S60 and returns to step S32, and repeats the processing from step S32 onwards.

[0204] On the other hand, if the variables "B" and "D" are not equal (No in S59), the repeat control circuit 31 reads the value stored in address D of the memory area set for variable "M" by the read and write control circuit 23, and writes the read value to address B of the memory area set for variable "M" (S60). That is, the repeat control circuit 31 overwrites address B, from which the value was read in step S56, with the value read from address D. Thereafter, the repeat control circuit 31 returns to step S32 and repeats the processes from step S32 onwards.

[0205] By repeating the above-mentioned steps S32 to S60, the random number generation circuit 1 uses values ​​from 0 to Z to obtain X unique output random numbers R from among X values.

[0206] The specific operation of the random number generation circuit 1 of the sixth embodiment will be described below with reference to FIGS.

[0207] In step S31 of Fig. 36, variables "N1", "N2", "N3" and "N4" are each set to Z. Furthermore, as shown in Fig. 37, memory areas M0, M1, M2 and M3 are set to initial storage states 48_00, 48_01, 48_02 and 48_03, respectively.

[0208] In the initial memory states 48_00, 48_01, 48_02, and 48_03 in the memory areas M0, M1, M2, and M3, respectively, memory values ​​0, 1, 2, 3, ..., Z-4, Z-3, Z-2, and Z-1 are stored at addresses 0, 1, 2, 3, ..., Z-4, Z-3, Z-2, and Z-1, respectively.

[0209] Next, the operation of obtaining the first output random number R is executed.

[0210] In steps S32 and S33 of FIG. 36, it is assumed that 2 is obtained as the remainder (i.e., variable "B"). Since the value 2 of variable "B" is smaller than the value Z of variable "N1" (Yes in S34), the processes of steps S35 to S38 are executed. First, 0 is set to variable "C" (S35). The value of variable "N1" is decremented from Z to (Z-1) (S36). The value (Z-1) of variable "N1" is set to variable "D" (S37). Furthermore, a value indicating that memory area M0 has been selected is set to variable "M" (S38).

[0211] Next, as shown in Fig. 37, the value 2 stored in address B (address 2) of memory area M0 is read out (S56). The read value 2 is multiplied by 4, and the value 0 of variable "C" is added to it, and the result is set as variable "R" (S57). Then, the value 8 of variable "R" is obtained as the output random number.

[0212] After that, as shown in FIG. 38, the value (Z-1) read from address D (address (Z-1)) is written to address B (address 2) (S60).

[0213] Also, by decrementing the variable "N1", the range of addresses from which no output random number has been obtained becomes 0 to (Z-2) in memory area M0, 0 to (Z-1) in memory area M1, 0 to (Z-1) in memory area M2, and 0 to (Z-1) in memory area M3. As a result, in memory state 48_10 of memory area M0, memory values ​​0, 1, Z-1, 3, ..., and Z-2 are stored in addresses 0, 1, 2, 3, ..., and Z-2, respectively. In memory states 48_11, 48_12, and 48_13 of memory areas M1, M2, and M3, respectively, memory values ​​0, 1, ..., Z-2, and Z-1 are stored in addresses 0, 1, ..., Z-2, and Z-1, respectively.

[0214] Next, the operation of obtaining the second output random number R is executed.

[0215] In steps S32 and S33 of FIG. 36, it is assumed that Y (=2Z) is obtained as the remainder (i.e., variable "B"). Since the value 2Z of variable "B" is not smaller than the value (Z-1) of variable "N1" (No in S34), the processing from step S39 onwards is executed. The value (Z-1) of variable "N1" is subtracted from variable "B" having the value 2Z, and the obtained value (Z+1) is set to variable "B" (S39).

[0216] Next, since the value (Z+1) of the variable "B" is not smaller than the value Z of the variable "N2" (No in S40), the processing from step S45 onwards is executed. The value Z of the variable "N2" is subtracted from the variable "B" having the value (Z+1), and the obtained value 1 is set to the variable "B" (S45).

[0217] Next, since the value 1 of variable "B" is smaller than the value Z of variable "N3" (Yes in S46), the processes of steps S47 to S50 are executed. First, variable "C" is set to 2 (S47). The value of variable "N3" is decremented from Z to (Z-1) (S48). The value (Z-1) of variable "N3" is set to variable "D" (S49). Furthermore, variable "M" is set to a value indicating that memory area M2 has been selected (S50).

[0218] 38, the value 1 stored in address B (address 1) of memory area M2 is read (S56). The read value 1 is multiplied by 4, and the value 2 of variable "C" is added to it, resulting in the result being set as variable "R" (S57). Then, the value 6 of variable "R" is obtained as the output random number.

[0219] After that, as shown in FIG. 39, the value (Z-1) read from address D (address (Z-1)) is written to address B (address 1) (S60).

[0220] Also, by decrementing the variable "N3", the range of addresses from which no output random number has been obtained becomes 0 to (Z-2) in memory area M0, 0 to (Z-1) in memory area M1, 0 to (Z-2) in memory area M2, and 0 to (Z-1) in memory area M3. As a result, in the memory state 48_20 of memory area M0, memory values ​​0, 1, Z-1, 3, ..., and Z-2 are stored in addresses 0, 1, 2, 3, ..., and Z-2, respectively. In the memory states 48_21 and 48_23 of memory areas M1 and M3, memory values ​​0, 1, ..., Z-2, and Z-1 are stored in addresses 0, 1, ..., Z-2, and Z-1, respectively. In the memory state 48_22 of memory area M2, memory values ​​0, Z-1, ..., and Z-2 are stored in addresses 0, 1, ..., and Z-2, respectively.

[0221] By repeating the above-described operation of obtaining random numbers X times, the random number generation circuit 1 can use values ​​from 0 to Z to obtain X unique output random numbers from among X values.

[0222] 6.3 Effects of the Sixth Embodiment According to the sixth embodiment, it is possible to efficiently output non-overlapping values ​​from a certain range of values ​​at random, and to reduce the amount of values ​​stored in the memory circuit. In the fifth embodiment and its modification, for example, two SRAMs are assigned to the memory regions M0 and M1, respectively. In the sixth embodiment, for example, four SRAMs are assigned to the memory regions M0, M1, M2, and M3, respectively. With such a configuration, the same effects as those of the fifth embodiment and its modification can be obtained.

[0223] For example, when obtaining 1024 output random numbers (e.g., integers from 0 to 1023), it is not necessary to store values ​​0 to 1023 in the address range 0 to 1023 in the memory circuit 41, but it is sufficient to store values ​​0 to 255 in the address range 0 to 255 in the memory areas M0, M1, M2, and M3, respectively. While 10 bits are required to express integers from 0 to 1023, integers from 0 to 255 can be expressed with 8 bits. That is, in the sixth embodiment, the storage capacity required for the memory circuit 41 can be reduced. Other effects are similar to those of the first embodiment described above.

[0224] 7.Other The random number generating circuit of the above-described embodiment can also be expressed as follows.

[0225] The random number generation circuit of the embodiment includes a memory circuit and a control circuit. The memory circuit includes a plurality of storage areas each specified by a plurality of addresses (for example, 0 to Y) (Y is an integer of 1 or more).

[0226] The control circuit is configured to: store a plurality of mutually different values ​​(e.g., 0 to Y) in the plurality of storage areas, respectively; generate a first random number (e.g., internal random number A); obtain a first address (e.g., address B) that is one of the plurality of addresses using the first random number; read a first value (e.g., value P) stored in a first storage area designated by the first address among the plurality of storage areas; and read a second value (e.g., value Q) stored in a second storage area designated by a second address (e.g., address j) among the plurality of storage areas. The second address is an address having a maximum value among addresses corresponding to storage areas from which the first value has not yet been read among the plurality of storage areas. The control circuit is configured to write the second value to the first storage area after reading the first value. The control circuit is configured to output the first value.

[0227] Although some embodiments of the present invention have been described, these embodiments are presented as examples and are not intended to limit the scope of the invention. These embodiments can be implemented in various other forms, and various omissions, substitutions, and modifications can be made without departing from the spirit of the invention. These embodiments and their modifications are included in the scope of the invention and its equivalents described in the claims, as well as in the scope and spirit of the invention. [Explanation of symbols]

[0228] 1...random number generation circuit, 2...CPU core, 3...memory core, 4...interface core, 5...dedicated circuit core, 10...random number generation control unit, 11...random number generator, 12...numeric range limiting circuit, 13...decrement circuit, 20...memory control unit, 21...initial value write control circuit, 22...data read control circuit, 23...read and write control circuit, 30...repeat control unit, 31...repeat control circuit, 40...memory unit, 41...memory circuit.

Claims

1. a memory circuit including a plurality of storage areas each specified by a plurality of addresses; storing a plurality of mutually different values ​​in the plurality of storage areas, Generate a first random number; obtaining a first address, which is one of the plurality of addresses, using the first random number; reading a first value stored in a first storage area designated by the first address among the plurality of storage areas; reading a second value stored in a second storage area designated by a second address, which is an address having a maximum value among addresses corresponding to storage areas from which the first value has not yet been read out, among the plurality of storage areas; writing the second value to the first storage area after reading the first value; outputting the first value; and a control circuit configured to Random number generation circuit.

2. The number of the different values ​​is (Y+1) (Y is an integer of 1 or more), the plurality of addresses are integers between 0 and Y, The control circuit is configured to store integers between 0 and Y inclusive as the plurality of mutually different values ​​in each of the plurality of storage areas.

2. The random number generating circuit according to claim 1.

3. The control circuit is configured to divide the first random number by (Y+1) and obtain a remainder as the first address.

3. The random number generating circuit according to claim 2.

4. The control circuit is configured to divide the first random number by a value obtained by adding 1 to the number of addresses corresponding to the memory area from which the first value has not yet been read, and obtain the resulting remainder as the first address.

2. The random number generating circuit according to claim 1.

5. The control circuit is further configured to repeat the process from generating the first random number to reading the first value a first number of times while narrowing a range of addresses corresponding to the memory area from which the first value has not yet been read.

2. The random number generating circuit according to claim 1.

6. The first number of times is different from the number of the plurality of different values.

6. The random number generating circuit according to claim 5.

7. The first number of times is equal to the number of the plurality of different values.

6. The random number generating circuit according to claim 5.

8. The control circuit is further configured to skip writing the second value to the first storage area when the first address and the second address are equal.

2. The random number generating circuit according to claim 1.

9. a first circuit for generating the first random number; a second circuit for reading the second value stored in the second storage area.

2. The random number generating circuit according to claim 1.

10. The first circuit and the second circuit are configured to operate independently and in parallel.

10. The random number generating circuit according to claim 9.

11. a memory circuit including a plurality of storage areas each specified by a plurality of addresses; Dividing the plurality of addresses into a first group and a second group; storing a plurality of mutually different values ​​in a plurality of first storage areas respectively designated by a plurality of addresses of the first group, and storing values ​​identical to the values ​​stored in the plurality of first storage areas respectively in a plurality of second storage areas respectively designated by a plurality of addresses of the second group; Generate a first random number; obtaining a first address, which is one of the plurality of addresses, using the first random number; When the first address belongs to the first group, reading a first value stored in a third storage area designated by the first address among the plurality of first storage areas, and performing a first operation on the first value to obtain a second value; reading a third value stored in a fourth storage area designated by a second address that is an address having a maximum value among addresses corresponding to storage areas from which the first value has not yet been read out, among the plurality of first storage areas; writing the third value to the third storage area after reading the first value; Outputting the second value; When the first address belongs to the second group, reading a fourth value stored in a fifth storage area designated by the first address among the plurality of second storage areas, and performing a second operation on the fourth value to obtain a fifth value; reading a sixth value stored in a sixth storage area designated by a third address, which is an address having a maximum value among addresses corresponding to storage areas from which the fourth value has not yet been read out, among the plurality of second storage areas; writing the sixth value to the fifth memory area after reading the fourth value; outputting the fifth value; and a control circuit configured to Random number generation circuit.

12. When obtaining X (an integer equal to or greater than 0) random numbers, the control circuit: Dividing the plurality of addresses into the first group and the second group, each group including Y addresses, which is half of X; When the first address belongs to the first group, Set the first variable to 0, The first operation includes adding a value of the first variable to the first value; When the first address belongs to the second group, Set the first variable to Y; The second operation is configured to add the value of the first variable to the fourth value. The random number generating circuit according to claim 11.

13. When obtaining X (an integer equal to or greater than 0) random numbers, the control circuit: Dividing the plurality of addresses into the first group and the second group, each group including Y addresses, which is half of X; When the first address belongs to the first group, Set the first variable to 0, the first operation includes doubling the first value and adding a value of the first variable; When the first address belongs to the second group, Setting the first variable to 1; The second operation is configured to double the fourth value and add the value of the first variable. The random number generating circuit according to claim 11.

14. the memory circuit includes a first memory and a second memory; the first memory includes the plurality of first storage areas; the second memory includes the plurality of second storage areas; The random number generating circuit according to claim 11.

15. The control circuit includes: further dividing the plurality of addresses into a third group and a fourth group; storing the same values ​​as those stored in the plurality of first storage areas in a plurality of seventh storage areas designated by a plurality of addresses of the third group, respectively; storing the same values ​​as those stored in the plurality of first storage areas in a plurality of eighth storage areas designated by the plurality of addresses of the fourth group, respectively; When the first address belongs to the third group, reading a seventh value stored in a ninth storage area designated by the first address among the plurality of seventh storage areas, and performing a third operation on the seventh value to obtain an eighth value; reading a ninth value stored in a tenth memory area designated by a fourth address, which is an address having a maximum value among addresses corresponding to memory areas from which the seventh value has not yet been read out, among the plurality of seventh memory areas; writing the ninth value to the ninth storage area after reading the seventh value; outputting the eighth value; When the first address belongs to the fourth group, reading a tenth value stored in an eleventh memory area designated by the first address among the plurality of eighth memory areas, and performing a fourth operation on the tenth value to obtain an eleventh value; reading a twelfth value stored in a twelfth memory area designated by a fifth address, which is an address having a maximum value among addresses corresponding to memory areas from which the tenth value has not yet been read out, among the eighth memory areas; after reading the tenth value, writing the twelfth value to the eleventh memory area; outputting the eleventh value; It was configured as follows: The random number generating circuit according to claim 11.

16. When obtaining X (an integer equal to or greater than 0) random numbers, the control circuit: Dividing the plurality of addresses into the first group, the second group, the third group, and the fourth group, each of which includes Z addresses, which is one-fourth of the X; When the first address belongs to the first group, Set the first variable to 0, the first operation multiplies the first value by four and adds the value of the first variable; When the first address belongs to the second group, Setting the first variable to 1; the second operation multiplies the fourth value by four and adds the value of the first variable; When the first address belongs to the third group, Setting the first variable to 2; the third operation multiplies the seventh value by four and adds the value of the first variable; When the first address belongs to the fourth group, Setting the first variable to 3; The fourth operation is configured to multiply the tenth value by four and add the value of the first variable.

16. The random number generating circuit according to claim 15.

17. A non-volatile memory; a memory controller including the random number generation circuit according to claim 1 and configured to control the non-volatile memory; The memory controller includes: Reading data from the non-volatile memory; inserting an error into the read data based on the first value output from the random number generation circuit; The error correction is performed on the data into which the error has been inserted. The memory system is configured as follows.

18. The memory controller includes: determining a position of the error to be inserted into the read data based on the first value output from the random number generating circuit; 20. The memory system of claim 17.

Citation Information

Patent Citations

  • Tobacco pipe

    JP1983013380A

  • Treatment of membrane separation system

    JP1988080804A

  • Memory system

    US9292428B2