WO2021142830A1 - Random number generation circuit, random number generation method, and electronic device - Google Patents

Random number generation circuit, random number generation method, and electronic device Download PDF

Info

Publication number
WO2021142830A1
WO2021142830A1 PCT/CN2020/072982 CN2020072982W WO2021142830A1 WO 2021142830 A1 WO2021142830 A1 WO 2021142830A1 CN 2020072982 W CN2020072982 W CN 2020072982W WO 2021142830 A1 WO2021142830 A1 WO 2021142830A1
Authority
WO
WIPO (PCT)
Prior art keywords
signal
frequency
random number
output terminal
output
Prior art date
Application number
PCT/CN2020/072982
Other languages
French (fr)
Chinese (zh)
Inventor
魏祥野
修黎明
白一鸣
Original Assignee
京东方科技集团股份有限公司
北京京东方技术开发有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 京东方科技集团股份有限公司, 北京京东方技术开发有限公司 filed Critical 京东方科技集团股份有限公司
Priority to CN202080000040.XA priority Critical patent/CN113498506B/en
Priority to PCT/CN2020/072982 priority patent/WO2021142830A1/en
Publication of WO2021142830A1 publication Critical patent/WO2021142830A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators

Definitions

  • the present disclosure relates to the field of display technology, and in particular to a random number generation circuit, a random number generation method, and electronic equipment.
  • TRNG True Random Number Generator
  • the present disclosure aims to solve at least one of the technical problems existing in the prior art, and proposes a random number generation circuit, a random number generation method, and an electronic device.
  • the present disclosure provides a random number generation circuit, including:
  • the pulse generating sub-circuit is configured to generate a plurality of pulses, and the frequency of the pulses changes with changes in environmental parameters;
  • a frequency-locked loop loop comprising: a frequency and phase-discrimination sub-circuit configured to generate a phase relationship indicating signal and a frequency relationship indicating signal according to the phase relationship between the input signal and the feedback signal, the phase relationship indicating signal indicating Whether the phase of the input signal leads the phase of the feedback signal, the frequency relationship indicating signal indicates the frequency relationship between the input signal and the feedback signal; the feedback sub-circuit is configured to indicate according to the frequency relationship The frequency of the signal and the pulse to generate the feedback signal;
  • a seed generation sub-circuit configured to generate a random number seed according to the phase relationship indication signal
  • the random number generating sub-circuit is configured to generate a random number sequence according to the random number seed.
  • the pulse generation sub-circuit includes: a loop oscillator.
  • the feedback sub-circuit includes:
  • a control unit configured to generate a frequency control word according to the frequency relationship indication signal
  • the digital control oscillating unit is configured to generate an intermediate signal according to the frequency control word and the frequency of the pulse, the frequency of the intermediate signal is K*f/F, where K is all generated by the pulse generating sub-circuit The number of the pulses, f is the frequency of the pulses, and F is the frequency control word;
  • the first frequency dividing unit is configured to divide the frequency of the intermediate signal to generate the feedback signal.
  • the frequency division coefficient of the first frequency division unit is 1.
  • the first frequency dividing unit is further configured to adjust the frequency dividing coefficient of the first frequency dividing unit according to the control parameter.
  • the digitally controlled oscillation unit includes: a time average frequency direct period synthesizer.
  • the phase relationship indicator signal is a digital signal
  • the random number seed is: a binary number obtained by combining multiple values of the phase relationship indicator signal.
  • the random number seed is a binary number with n+1 bits
  • the random number generation sub-circuit is specifically configured to: shift the random number seed to the right multiple times, each time right Shifting to generate a binary sequence, and the random number sequence is composed of at least one of the binary sequences;
  • the first bit in the first binary sequence is generated by performing a predetermined logical operation on the values of the last two bits of the random number seed, and the other bits in the first binary sequence are generated by the first n bits of the random number seed.
  • the bit position is shifted to the right by one bit;
  • the first bit in the i+1th binary sequence is generated by the last two bits of the i-th binary sequence after a predetermined logical operation, and the other bits in the i+1th binary sequence are generated by the first bit in the i+1th binary sequence.
  • the first n bits of i binary sequences are shifted to the right by one bit, n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequences.
  • the predetermined logical operation is an exclusive OR operation.
  • the random number generating sub-circuit includes: a pseudo-random binary sequence code generator.
  • the frequency and phase discrimination sub-circuit includes:
  • the first input terminal is configured to receive the input signal
  • the second input terminal is configured to receive the feedback signal
  • the second frequency dividing unit is configured to divide the frequency of the input signal
  • a register unit configured to obtain multiple signal values of the output signal of the second frequency dividing unit at multiple edges of the feedback signal
  • the first logic unit is configured to perform logic operations on the multiple signal values output by the register unit to output a first digital signal to the first output terminal when the phase of the input signal leads the phase of the feedback signal , Output a second digital signal to the second output terminal; and output the first digital signal to the second output terminal and output to the first output terminal when the phase of the input signal lags the phase of the feedback signal A second digital signal; the phase relationship indication signal is obtained by processing the output signal of the first output terminal and the output signal of the second output terminal according to the first logic rule;
  • the second logic unit is configured to perform logic operations on the output signals of the first output terminal and the second output terminal to output to the third output terminal when the frequency of the input signal is greater than the frequency of the feedback signal.
  • the first digital signal, the second digital signal is output to a fourth output terminal, and the second digital signal is output to the third output terminal when the frequency of the input signal is less than the frequency of the feedback signal,
  • the first digital signal is output to the fourth output terminal;
  • the frequency relationship indication signal is obtained by processing the output signal of the third output terminal and the output signal of the fourth output terminal according to a second logic rule.
  • the register unit includes: a first D flip-flop, a second D flip-flop, a third D flip-flop, and a fourth D flip-flop, the input terminal of the first D flip-flop and the first D flip-flop
  • the input ends of the three D flip-flops are all connected to the output end of the second frequency dividing unit, the input end of the second D flip-flop is connected to the output end of the first D flip-flop, and the fourth D trigger is connected to the output end of the first D flip-flop.
  • the input terminal of the device is connected to the output terminal of the third D flip-flop, the clock terminal of the first D flip-flop, the clock terminal of the second D flip-flop and the clock terminal of the fourth D flip-flop are all Connected to the second input terminal, and the clock terminal of the third D flip-flop is connected to the second input terminal through a first NOT gate.
  • the first logic unit includes: a first XOR gate and a second XOR gate, and two input terminals of the first XOR gate are respectively connected to the output terminal of the second D flip-flop Is connected to the output terminal of the fourth D flip-flop, the two input terminals of the second XOR gate are respectively connected to the output terminal of the first D flip-flop and the output terminal of the fourth D flip-flop, the The output terminal of the first XOR gate is connected to the first output terminal, and the output terminal of the second XOR gate is connected to the second output terminal;
  • the second logic unit includes: a second NOT gate, a third NOT gate, a first AND gate, and a second AND gate. Two input terminals of the first AND gate are connected to the first output terminal and the The second output terminal is connected, one of the input terminals of the second AND gate is connected to the first output terminal through the second NOT gate, and the other output terminal of the second AND gate is connected through the third inverter. The gate is connected to the second output terminal.
  • an embodiment of the present disclosure also provides a random number generation method, including:
  • a phase relationship indicator signal and a frequency relationship indicator signal are generated according to the phase relationship between the input signal and the feedback signal, the phase relationship indicator signal indicates whether the phase of the input signal is ahead of the phase of the feedback signal, and the frequency relationship indicator signal indicates The frequency relationship between the input signal and the feedback signal; the feedback signal is generated according to the frequency relationship indicator signal and the frequency of the pulse;
  • a random number sequence is generated according to the random number seed.
  • the feedback signal is generated according to the following steps:
  • the frequency of the intermediate signal is K*f/F, where K is the number of pulses generated by the pulse generation sub-circuit, and f is The frequency of the pulse, F is the frequency control word;
  • the intermediate signal is frequency-divided to generate the feedback signal.
  • the frequency division coefficient is 1.
  • the step of dividing the frequency of the intermediate signal includes: adjusting a frequency dividing coefficient according to a control parameter, and dividing the frequency of the intermediate signal by using the adjusted frequency dividing coefficient.
  • the phase relationship indicator signal is a digital signal
  • the random number seed is: a binary number obtained by combining multiple values of the phase relationship indicator signal.
  • the random number seed is a binary number with n+1 bits
  • the step of generating a random number sequence according to the random number seed includes:
  • the random number seed is shifted right multiple times, and each right shift generates a binary sequence, and the random number sequence is composed of at least one binary sequence; wherein, the first bit in the first binary sequence is The value of the last two bits of the random number seed is generated after a predetermined logical operation.
  • the other bits in the first binary sequence are generated by shifting the first n bits of the random number seed to the right by one bit; the i+1th binary
  • the first bit in the sequence is generated by performing a predetermined logical operation on the last two bits of the i-th binary sequence, and the other bits in the i+1-th binary sequence are generated by shifting the first n bits of the i-th binary sequence to the right by one bit.
  • n is an integer greater than
  • i is an integer greater than 0 and less than the total number of the binary sequence.
  • an embodiment of the present disclosure also provides an electronic device including the above-mentioned random number generation circuit.
  • Fig. 1 shows a schematic block diagram of a random number generating circuit according to some embodiments of the present disclosure.
  • FIG. 2 shows a circuit diagram of a ring oscillator according to some embodiments of the present disclosure.
  • Fig. 3 shows a schematic diagram of a frequency and phase discrimination sub-circuit according to some embodiments of the present disclosure.
  • Fig. 4 shows a schematic diagram of the waveforms of the input signal and the feedback signal of the input phase discrimination sub-circuit according to some embodiments of the present disclosure.
  • FIG. 5 shows a circuit diagram of a time average frequency direct period synthesizer according to some embodiments of the present disclosure.
  • FIG. 6 shows a schematic diagram of the principle of time average frequency according to some embodiments of the present disclosure.
  • FIG. 7 shows a schematic diagram of a random number generation sub-circuit according to some embodiments of the present disclosure.
  • FIG. 8 shows a schematic diagram of the imaging effect of a random number sequence generated by a random number generating circuit according to some embodiments of the present disclosure.
  • FIG. 9 shows a schematic diagram of a random number generation method according to some embodiments of the present disclosure.
  • FIG. 10 shows a schematic diagram of generating a feedback signal according to some embodiments of the present disclosure.
  • FIG. 1 shows a schematic block diagram of a random number generation circuit according to some embodiments of the present disclosure.
  • the random number generation circuit includes: The pulse generation sub-circuit 10, the frequency-locked loop loop, the seed generation sub-circuit 40, and the random number generation sub-circuit 50.
  • the pulse generating sub-circuit 10 is configured to generate a plurality of pulses, and the frequency of the pulses generated by the pulse generating sub-circuit 10 changes with changes in environmental parameters.
  • the pulse generation sub-circuit 10 is an oscillator, and its oscillation frequency drifts with changes in environmental parameters (such as temperature).
  • the frequency-locked loop loop is a time average frequency-locked loop (TAF-FLL) loop, which is configured to lock the frequency of the input signal and the frequency of the feedback signal.
  • the frequency-locked loop loop includes: a frequency and phase discrimination sub-circuit 20 and a feedback sub-circuit 30.
  • the frequency and phase discrimination sub-circuit 20 is configured to generate a phase relationship indicator signal and a frequency relationship indicator signal according to the phase relationship between the input signal (whose frequency is fi) and the feedback signal (whose frequency is fb), and the phase relationship indicator signal indicates the phase relationship of the input signal. Whether the phase is ahead of the phase of the feedback signal fb, the frequency relationship indicator signal indicates the magnitude relationship between the frequency fi of the input signal and the frequency fb of the feedback signal.
  • the feedback sub-circuit 30 is configured to generate the feedback signal fb according to the frequency relationship indicator signal and the frequency of the pulse.
  • the input signal may be generated by an external crystal oscillator (Crystal), or by a Micro-Electro-Mechanical System (MEMS), or by an oscillator (for example, a ring oscillator (Ring Oscillator)). , RO)) produced.
  • crystal crystal
  • MEMS Micro-Electro-Mechanical System
  • oscillator for example, a ring oscillator (Ring Oscillator)). , RO)
  • the input signal fi input to the phase-locked loop loop is easily jittered under the interference of thermal noise.
  • the frequency of the pulse generated by the pulse generating sub-circuit 10 will also drift with the change of environmental parameters, regardless of How the input signal jitters and how the pulse frequency drifts, the feedback sub-circuit 30 will make the frequency fb of the feedback signal consistent with the frequency fi of the input signal according to the relationship between the frequency of the input signal and the feedback signal. Due to the jitter of the input signal and the drift of the pulse frequency, the phase of the input signal and the feedback signal received by the phase discrimination sub-circuit 20 will be highly uncertain. Therefore, the phase relationship indicator signal generated according to the phase relationship has a high degree of uncertainty. The high uncertainty improves the randomness of the random number seed generated according to the phase relationship indicator signal, which in turn increases the randomness of the generated random number, and realizes the generation of a true random number.
  • the pulse generation sub-circuit 10 includes a ring oscillator 11, for example, an oscillator based on cross-cascaded NAND gates (CROSS NAND GATEs).
  • Fig. 2 shows a circuit diagram of a ring oscillator according to some embodiments of the present disclosure.
  • the ring oscillator 11 includes 8-stage NAND units (P0 ⁇ P15) in cross-cascade connection.
  • the level includes a pair of NAND gates.
  • the ring oscillator 11 generates a plurality of evenly spaced pulses in phase.
  • the biggest characteristic of the ring oscillator 11 is that it is unstable. The initial condition of its oscillation is random, and its oscillation frequency is very sensitive to the environment. When the temperature changes slightly, the oscillation frequency will drift.
  • the frequency discrimination sub-circuit 20 adopts a phase frequency detector (Phase Frequency Detector, PFD).
  • FIG. 3 shows a schematic diagram of the phase discrimination sub-circuit according to some embodiments of the present disclosure, such as As shown in FIG. 3, the frequency and phase discrimination sub-circuit 20 includes: a first input terminal, a second input terminal, a first output terminal out1, a second output terminal out2, a third output terminal out3, a fourth output terminal out4, and a second output terminal out2.
  • the first input terminal is configured to receive an input signal with a frequency fi.
  • the second input terminal is configured to receive a feedback signal with a frequency of fb.
  • the second frequency dividing unit 21 is configured to divide the frequency of the input signal.
  • the second frequency dividing unit 21 adopts a two frequency divider.
  • the register unit 22 is configured to obtain multiple signal values of the output signal of the second frequency dividing unit 21 at multiple edges of the feedback signal. For example, the signal value of the second frequency dividing unit 21 at the two adjacent rising edges of the feedback signal and the falling edge between the two rising edges is obtained.
  • the register unit 22 includes: a first D flip-flop 221, a second D flip-flop 222, a third D flip-flop 223, and a fourth D flip-flop 224, the input terminal of the first D flip-flop 221 and the third D flip-flop
  • the input terminals of 223 are all connected to the output terminal of the second frequency dividing unit 21, the input terminal of the second D flip-flop 222 is connected to the output terminal of the first D flip-flop 221, and the input terminal of the fourth D flip-flop 224 is connected to the third
  • the output terminal of the D flip-flop 223 is connected, the clock terminal of the first D flip-flop 221, the clock terminal of the second D flip-flop 222 and the clock terminal of the fourth D flip-flop 224 are all connected to the second input terminal, and the third D flip-flop
  • the clock terminal of the converter 223 is connected to the second input terminal through the first NOT gate 25.
  • the first logic unit 23 is connected to the first output terminal out1 and the second output terminal out2.
  • the first logic unit 23 is configured to perform logic operations on multiple signal values output by the register unit 22, so that the phase of the input signal leads the feedback signal
  • the first digital signal is output to the first output terminal out1 and the second digital signal is output to the second output terminal out2; and the first digital signal is output to the second output terminal out2 when the phase of the input signal lags the phase of the feedback signal.
  • Signal output a second digital signal to the first output terminal out1.
  • the phase relationship indication signal is obtained by processing the output signal of the first output terminal out1 and the output signal of the second output terminal out2 according to the first logic rule.
  • the first logic rule is: when the first output terminal out1 outputs the first digital signal and the second output terminal out2 outputs the second digital signal, the phase relationship indicator signal is set to the first digital signal; when the first output terminal out1 When the second digital signal is output and the second output terminal out2 outputs the first digital signal, the phase relationship indicating signal is set to the second digital signal; wherein, when the phase relationship indicating signal is the first digital signal, the phase of the indicating input signal is ahead of The phase of the feedback signal; when the phase relationship indicator signal is the second digital signal, the phase of the indicator input signal lags the phase of the feedback signal.
  • the value of the first digital signal is 1 and the value of the second digital signal is 0.
  • the phase relationship The value of the indicating signal is 1; when the value of the output signal of the first output terminal out1 is 0 and the value of the output signal of the second output terminal out2 is 1, the value of the phase relationship indicating signal is 0; when the first output terminal out1 When the values of the output signal of and the output signal of the second output terminal out2 are both 1 or both are 0, they are discarded.
  • the value of the phase relationship indicator signal is 1, it indicates that the phase of the input signal is ahead of the phase of the feedback signal; when the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal lags the phase of the feedback signal.
  • the second logic unit 24 is connected to the third output terminal out3 and the fourth output terminal out4.
  • the second logic unit 24 is configured to perform logic operations on the output signals of the first output terminal out1 and the second output terminal out2 to determine the difference between the input signals
  • the first digital signal is output to the third output terminal out3
  • the second digital signal is output to the fourth output terminal out4.
  • the third output terminal out3 is output.
  • the second digital signal is output, and the first digital signal is output to the fourth output terminal out4.
  • the frequency relationship indication signal is obtained by processing the output signal of the third output terminal out3 and the output signal of the fourth output terminal out4 according to the second logic rule.
  • the second logic rule is: when the third output terminal out3 outputs the first digital signal and the fourth output terminal out4 outputs the second digital signal, the frequency relationship indicator signal is set to the first digital signal; when the third output terminal out3 When the second digital signal is output and the fourth output terminal out4 outputs the first digital signal, the frequency indicating signal is set to the second digital signal; wherein, when the frequency relationship indicating signal is the first digital signal, the frequency of the indicating input signal is greater than the feedback signal When the frequency relationship indicator signal is the second digital signal, it indicates that the frequency of the input signal is less than the frequency of the feedback signal.
  • the frequency relationship The value of the indicating signal is 1; when the value of the output signal of the third output terminal out3 is 0 and the value of the output signal of the fourth output terminal out4 is 1, the value of the frequency relationship indicating signal is 0; when the third output terminal out3 When the values of the output signal of and the output signal of the fourth output terminal out4 are both 0 or both, they are discarded.
  • the frequency relationship indicator signal When the value of the frequency relationship indicator signal is 1, it indicates that the frequency fi of the input signal is greater than the frequency fb of the feedback signal; when the value of the frequency relationship indicator signal is 0, it indicates that the frequency fi of the input signal is less than the frequency fb of the feedback signal.
  • the register unit 22 includes: a first D flip-flop 221, a second D flip-flop 222, a third D flip-flop 223, and a fourth D flip-flop 224, the first D flip-flop
  • the input terminal of 221 and the input terminal of the third D flip-flop 223 are both connected to the output terminal of the second frequency dividing unit 21, the input terminal of the second D flip-flop 222 is connected to the output terminal of the first D flip-flop 221, and the fourth The input terminal of the D flip-flop 224 is connected to the output terminal of the third D flip-flop 223, the clock terminal of the first D flip-flop 221, the clock terminal of the second D flip-flop 222, and the clock terminal of the fourth D flip-flop 224 are all connected to The second input terminal is connected, and the clock terminal of the third D flip-flop 223 is connected to the second input terminal through the first NOT gate 25.
  • the first logic unit 23 includes: a first XOR gate 231 and a second XOR gate 232, the two input terminals of the first XOR gate 231 are respectively connected to the output terminal of the second D flip-flop 222 and the fourth D flip-flop 224
  • the two input terminals of the second XOR gate 232 are connected to the output terminal of the first D flip-flop 221 and the output terminal of the fourth D flip-flop 224 respectively.
  • the output terminal of the first XOR gate 231 is connected to the output terminal of the fourth D flip-flop 224, respectively.
  • An output terminal out1 is connected, and the output terminal of the second XOR gate 232 is connected to the second output terminal out2.
  • the second logic unit 24 includes: a second inverter gate 241, a third inverter gate 242, a first AND gate 243, and a second AND gate 244.
  • the two input terminals of the first AND gate 243 are connected to the first output terminal out1 and the first output terminal, respectively.
  • the two output terminals out2 are connected, one of the input terminals of the second AND gate 244 is connected to the first output terminal out1 through the second NOT gate 241, and the other output terminal of the second AND gate 244 is connected to the second output terminal through the third NOT gate 242 End connected.
  • Fig. 4 shows a schematic diagram of the input signal and the feedback signal of the input phase discrimination sub-circuit according to some embodiments of the present disclosure.
  • the solid line in the upper part represents the ideal input signal waveform, and the lower part
  • the solid line in the middle represents the ideal feedback signal waveform. Both the input signal and the feedback signal will jitter due to their own noise.
  • the dashed line represents the boundary of the pulse edge when the input signal/feedback signal is disturbed by noise.
  • the pulse edge is anywhere within the dashed line. The probability of occurrence is the same.
  • the phase of the input signal leads the phase of the feedback signal, it may also happen that the phase of the input signal lags behind the phase of the feedback signal, or it may happen that the input signal and the feedback phase coincide.
  • the feedback signal (or its inverted signal) is used as the clock signal of the first D flip-flop 221 to the fourth D flip-flop 224, and the frequency discrimination
  • the input signal in the phase sub-circuit 20 is used as the input signal of the first D flip-flop 221 and the third D flip-flop 223.
  • the D flip-flop is in a metastable state. State, it is possible to output 0 or 1, thereby increasing the uncertainty of the phase relationship indicator signal generated by the frequency and phase discrimination sub-circuit 20, thereby increasing the randomness of the random number generated according to the phase relationship indicator signal.
  • the feedback sub-circuit 30 includes: a control unit 31, a digitally controlled oscillation unit 32 and a first frequency dividing unit 33.
  • the control unit 31 is configured to generate the frequency control word F according to the frequency relationship indication signal output by the frequency discrimination sub-circuit 20. For example, the control unit 31 reads the initial frequency control word F from the storage device. When the frequency relationship indication signal indicates that the frequency fi of the input signal is greater than the frequency fb of the feedback signal, the control unit 31 reduces the current frequency control word by 1. ; When the frequency relationship indication signal indicates that the frequency of the input signal fi is less than the frequency of the feedback signal fb, the control unit 31 increases the current frequency control word by 1.
  • K is generated by the pulse generating sub-circuit 10
  • the number of pulses, f is the frequency of the pulses, and F is the frequency control word.
  • the first frequency dividing unit 33 is configured to divide the frequency of the intermediate signal to generate the aforementioned feedback signal.
  • the digitally controlled oscillation unit 32 adopts a time average frequency direct period synthesis (TAF-DPS) circuit architecture based on a time average frequency direct period synthesis (TAF-DPS) circuit architecture.
  • TAF-DPS time average frequency direct period synthesis
  • FIG. 5 shows a circuit diagram of a time average frequency direct period synthesizer according to some embodiments of the present disclosure. As shown in FIG. 5, the time average frequency direct period synthesizer 320 may include a first input module, a second input module 3230, and Output module 3240.
  • the first input module includes a first logic control circuit 3210 and a second logic control circuit 3220.
  • the first logic control circuit 3210 includes a first adder 3211, a first register 3212, and a second register 3213.
  • the second logic control circuit 3220 may include a second adder 3221, a third register 3222, and a fourth register 3223.
  • the second input module 3230 includes a first K ⁇ 1 multiplexer 3231, a second K ⁇ 1 multiplexer 3232, and a 2 ⁇ 1 multiplexer 3233.
  • the first K ⁇ 1 multiplexer 3231 and the second K ⁇ 1 multiplexer 3232 each include a plurality of input terminals, a control input terminal, and an output terminal.
  • the multiple input ends of the first K ⁇ 1 multiplexer 3231 and the second K ⁇ 1 multiplexer 3232 are respectively used to receive K (K is an integer greater than 1) output by the pulse generation sub-circuit.
  • the phases are uniform Interval pulses.
  • the 2 ⁇ 1 multiplexer 3233 includes a control input terminal, an output terminal, a first input terminal for receiving the output of the first K ⁇ 1 multiplexer 3231, and a second K ⁇ 1 multiplexer for receiving the output.
  • the time span (for example, the phase difference) between any two adjacent pulses among the K pulses with uniformly spaced phases may be the reference time unit ⁇ .
  • the output module 3240 includes a trigger circuit.
  • the trigger circuit is used to generate pulse trains.
  • the trigger circuit includes a D flip-flop 3241, a first inverter 3242, and a second inverter 3243.
  • the D flip-flop 3241 includes a data input terminal, a clock input terminal for receiving the output from the output terminal of the 2 ⁇ 1 multiplexer 3233, and an output terminal for outputting the first clock signal CLK1.
  • the first inverter 3242 includes an input terminal for receiving the first clock signal CLK1 and an output terminal for outputting a signal to the data input terminal of the D flip-flop 3241.
  • the second inverter 3243 includes an input terminal for receiving the first clock signal CLK1 and an output terminal for outputting the second clock signal CLK2.
  • the first clock signal CLK1 is output to the control input terminal of the 2 ⁇ 1 multiplexer 3233, and the output terminal of the first inverter 3242 is connected to the data input terminal of the D flip-flop 3241.
  • the first adder 3211 may add the frequency control word F and the most significant bits (for example, 5 bits) stored in the first register 3212, and then add them at the rising edge of the second clock signal CLK2 The result is saved in the first register 3212; alternatively, the first adder 3211 may add the frequency control word F and all the information stored in the first register 3212, and then save the addition result at the rising edge of the second clock signal CLK2 To the first register 3212. At the next rising edge of the second clock signal CLK2, the most significant bit stored in the first register 3212 will be stored in the second register 3213 and used as the selection signal of the first K ⁇ 1 multiplexer 3231 for One pulse is selected from the K pulses as the output signal of the first K ⁇ 1 multiplexer 3231.
  • the most significant bit stored in the first register 3212 will be stored in the second register 3213 and used as the selection signal of the first K ⁇ 1 multiplexer 3231 for One pulse is selected from the K pulses as the output signal of the first K ⁇ 1 multiplexer 3231.
  • the second adder 3221 may add the frequency control word F/2 and the most significant bit stored in the first register 3212, and then save the addition result in the third register 3222 at the rising edge of the second clock signal CLK2 .
  • the information stored in the third register 3222 will be stored in the fourth register 3223 and used as the selection signal of the second K ⁇ 1 multiplexer 3223 for slave K One of these pulses is selected as the output signal of the second K ⁇ 1 multiplexer 3223.
  • the 2 ⁇ 1 multiplexer 3233 can select the output signal from the first K ⁇ 1 multiplexer 3231 and the second K ⁇ 1 multiplexer 3232 at the rising edge of the first clock signal CLK1 One of the output signals is used as the output signal of the 2 ⁇ 1 multiplexer 3233 and used as the input clock signal of the D flip-flop 3241.
  • one of the output terminal of the D flip-flop 3241 and the output terminal of the second inverter 3243 can be used as the output of the time average frequency direct periodic synthesizer 320.
  • the selection signal output by the second register 3213 can be used to select the falling edge of the synthesized clock signal generated by the time average frequency direct cycle synthesizer 320
  • the selection signal output by the fourth register 3223 can be used to select the time average frequency direct cycle.
  • the rising edge of the synthesized clock signal generated by the synthesizer 320, and the signal fed back to the first adder 3211 by the first register 3212 can be used to control the period switching of the synthesized clock generated by the time average frequency direct cycle synthesizer 320.
  • the time average frequency direct period synthesizer 320 generates the intermediate signal based on the time average frequency (TAF).
  • TAF time average frequency
  • FIG. 6 shows a schematic diagram of the principle of the time average frequency according to some embodiments of the present disclosure.
  • the output time period of the average frequency synthesizer 320 directly there are two, two kinds of output signal are periodic first period and the second period T A T B.
  • the first period and the second period T A T B can be represented by the following formula (1) and formula (2).
  • I is the integer part of the frequency control word F
  • r is the decimal part of the frequency control word F.
  • the first period and the second period T A T B can be generated by a staggered manner comprises two different periods (different frequencies) of the clock signal.
  • the average period of the generated clock signal is T TAF , and the average frequency f TAF is as shown in the following formula (3).
  • f is the frequency of the pulse
  • K is the number of pulses generated by the pulse generating sub-circuit 10.
  • the characteristic of the time average frequency direct period synthesizer 320 is: changing the frequency control word F, the frequency f TAF of the generated clock signal can complete the frequency switching after two cycles.
  • the time average frequency direct period synthesizer 320 is based on the working mode of TAF, so that the frequency of the output signal changes between the two frequencies. Therefore, the phase of the intermediate signal changes. This phase change makes the frequency discrimination sub-circuit 20 The randomness of the output signal is improved, thereby further improving the randomness of generating random numbers.
  • the first frequency dividing unit 33 adopts a frequency divider.
  • the first frequency division unit 33 is configured as a dither circuit.
  • the first frequency division unit 33 is further configured to adjust the first frequency division unit 33 according to the control parameter.
  • a frequency division coefficient of the frequency division unit 33 is configured as a dither circuit.
  • the control parameter is generated by a parameter generation circuit, which may be the same circuit as the random number generation sub-circuit 50, and the value of each random number in the random number sequence generated by the random number generation sub-circuit 50 is used as the control parameter.
  • a parameter generation circuit which may be the same circuit as the random number generation sub-circuit 50
  • the value of each random number in the random number sequence generated by the random number generation sub-circuit 50 is used as the control parameter.
  • the frequency division coefficient of the first frequency dividing unit 33 is adjusted to 2; when the random number generating sub-circuit 50 outputs 1, the frequency dividing coefficient of the first frequency dividing unit 33 is adjusted to 1.
  • the random number generating sub-circuit 50 continuously outputs 0 and 0, the frequency division coefficient of the first frequency dividing unit 33 is adjusted to 2.
  • the parameter generation circuit may also be a circuit other than the random number generation sub-circuit 50.
  • the phase relationship indicator signal is a digital signal
  • the random number seed is a binary number obtained by combining values of a plurality of phase relationship indicator signals. It should be noted that in the embodiments of the present disclosure, a certain signal being 0 means that the value of the signal is 0, and a certain signal being 1 means that the value of the signal is 1.
  • the value of the phase relationship indicator signal is 0 or 1.
  • the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal lags behind the phase of the feedback signal.
  • the value of the phase relationship indicator signal is 1, it indicates the input signal.
  • the phase of is ahead of the phase of the feedback signal.
  • the random number seed is a binary number, which has n+1 bits
  • the random number generation sub-circuit 50 is specifically configured to: perform multiple right shifts on the random number seed, and each right shift generates one A binary sequence, the random number sequence is composed of at least one binary sequence.
  • the first bit in the first binary sequence is generated by performing a predetermined logical operation on the values of the last two bits of the random number seed, and the other bits in the first binary sequence are generated by the first n bits of the random number seed.
  • the first bit in the i+1th binary sequence is generated by the last two digits of the i-th binary sequence after a predetermined logical operation, and the other bits in the i+1th binary sequence are generated by the i-th
  • the first n bits of the binary sequence are generated by shifting one bit to the right, n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequence. It should be noted that the first bit in the binary sequence is the highest bit in the binary sequence, and the last two bits of the random number seed are the lowest bit and its adjacent bits among the multiple bits of the random number seed.
  • the random number generating sub-circuit 50 includes a pseudo-random binary sequence code generator.
  • FIG. 7 shows a schematic diagram of a random number generating sub-circuit according to some embodiments of the present disclosure.
  • the random number generating sub-circuit 51 includes: a logic operation unit 512, a shift register, and a plurality of data selectors 513 ,
  • the number of bits of the random number seed SG is n+1
  • the shift register includes n+1 stage D flip-flops 514, the input terminals of n+1 stage D flip-flops 514 and n+1 data selectors 513
  • the output terminals o1 are connected in one-to-one correspondence.
  • the input terminal of the first level D flip-flop 514 is connected to the output terminal o1 of the first data selector 513, and the input terminal 514 of the second level D flip-flop is connected to the second data selection The output terminal o1 of the device 513, and so on, until the input terminal of the n+1-th stage D flip-flop 514 is connected to the output terminal o1 of the n+1-th data selector 513.
  • the first input terminal i1 of the first data selector 513 is connected to the output terminal of the logic operation unit 512, and the first input terminal i1 of the jth data selector 513 is connected to the output terminal of the j-1th stage D flip-flop 514, where , J is an integer, and 1 ⁇ j ⁇ n+1.
  • the n+1 bit values of the random number seed SG are respectively input to the second input terminal i2 of the n+1 data selectors 512, and the two input terminals of the logical operation unit 512 are respectively connected to the D flip-flops 514 of the latter two stages.
  • the output terminal is connected to the output terminal of the logic operation unit 512, and the first input terminal i1 of the jth data selector 513 is connected to the output terminal of the j-1th stage D flip-flop 514, where , J is an integer, and 1 ⁇ j ⁇ n+1.
  • the n+1 bit values of the random number seed SG are respectively input to the second input terminal i2 of the
  • the random number generation sub-circuit 51 When the random number generation sub-circuit 51 is triggered to generate a random number, the second input terminal i2 and the output terminal o1 of each data selector 513 are controlled to be turned on, so that n+1 bits of data of the random number seed SG are input to n+1 respectively.
  • the input terminal of the stage D flip-flop 514 is then controlled to conduct the first input terminal i1 and the output terminal o1 of each data selector 513.
  • Each bit in the binary sequence output by the n+1 level D flip-flop 514 is denoted as prbs[0], prbs[1]...prbs[n], prbs[n-1] and prbs[n] are input to Two input terminals of the logic operation unit 512.
  • a plurality of binary sequences generated by the random number generation sub-circuit 51 after multiple right shifts are arranged in sequence to form the random number sequence, and the first bit prbs[0] in the first binary sequence is used as the first random number sequence.
  • Bit, the last bit of the last binary sequence prbs[n] is used as the last bit of the random number sequence.
  • the random number seed is 01100010
  • the binary sequence generated by the random number generation sub-circuit 51 after the first right shift operation is: 10110001
  • the binary sequence generated by the second right shift operation is: 11011000
  • the third right shift is performed
  • the binary sequence generated by the shift operation is: 01101100
  • the binary sequence generated by the fourth right shift operation is: 00110110, and so on.
  • the random number sequence is composed of four binary sequences arranged in the order of generation, that is, the random number sequence is 10110001110110000110110000110110.
  • FIG. 8 shows a schematic diagram of the imaging effect of a random number sequence generated by a random number generating circuit according to some embodiments of the present disclosure, wherein the random number sequence generated by the random number generating circuit includes 65536-bit random numbers, each of which is randomly The number is 0 or 1.
  • the image size of Figure 8 is 256*256, including 65536 pixels in total. Each pixel corresponds to a random number. The gray scale of each pixel is determined by the value of the corresponding random number.
  • the random number is When 0, the pixel is black, when the random number is 1, the pixel is white. It can be seen from Figure 8 that the random number distribution of the random number sequence meets the requirements of white noise, and there is no obvious pattern.
  • each part of the random number generator circuit is a digital circuit, which has low power consumption, low power consumption, and high cost.
  • the low-cost feature is beneficial to be integrated in various chips, and the random number generated by the random generation circuit is relatively high, which can provide higher security and reliability in the communication process.
  • the present disclosure also provides a random number generation method.
  • FIG. 9 shows a schematic diagram of a random number generation method according to some embodiments of the present disclosure.
  • the random number generation method can be executed by the above-mentioned random number generation circuit.
  • the random number generation method in the embodiment of the present disclosure includes the following steps S10 to S40.
  • Step S10 multiple pulses are generated, and the frequency of the pulses changes with changes in environmental parameters.
  • Step S20 Generate a phase relationship indicator signal and a frequency relationship indicator signal according to the phase relationship between the input signal and the feedback signal, the phase relationship indicator signal indicates whether the phase of the input signal is ahead of the phase of the feedback signal, and the frequency relationship indicator signal indicates the input signal and the feedback signal The frequency of the relationship.
  • the feedback signal is generated based on the frequency relationship indicator signal and the frequency of the pulse.
  • the phase relationship indication signal is obtained by processing the output signal of the first output terminal out1 and the output signal of the second output terminal out2 of the frequency discrimination sub-circuit 20 in FIG. 3 according to the first logic rule.
  • the output signal of the first output terminal out1, the output signal of the second output terminal out2, and the phase relationship indicator signal are all digital signals.
  • the value of the first digital signal is 1, and the value of the second digital signal is 0.
  • the first rule is: when the value of the output signal of the first output terminal out1 is 1, the value of the output signal of the second output terminal out2 is When 0, the value of the phase relationship indicating signal is 1; when the value of the output signal of the first output terminal out1 is 0 and the value of the output signal of the second output terminal out2 is 1, the value of the phase relationship indicating signal is 0; When the value of the output signal of the first output terminal out1 and the value of the output signal of the second output terminal out2 are both 1 or 0, they are discarded.
  • the value of the phase relationship indicator signal is 1, it indicates that the phase of the input signal is ahead of the phase of the feedback signal; when the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal lags the phase of the feedback signal.
  • FIG. 10 shows a schematic diagram of generating a feedback signal according to some embodiments of the present disclosure. As shown in FIG. 10, the feedback signal is generated according to the following steps S21 to S23.
  • Step S21 Generate a frequency control word according to the frequency relationship indication signal.
  • step S21 is executed by the control unit 31 in FIG. 1. Before step S21, first obtain the initial frequency control word. In step S21, when the frequency relationship indicating signal indicates that the frequency fi of the input signal is greater than the frequency fb of the feedback signal, the control unit 31 reduces the current frequency control word by 1; When the frequency relationship indicator signal indicates that the frequency of the input signal fi is less than the frequency of the feedback signal fb, the current frequency control word is increased by 1.
  • Step S22 Generate an intermediate signal according to the frequency control word and the frequency of the pulse.
  • the frequency of the intermediate signal is K*f/F, where K is the number of pulses generated by the pulse generating sub-circuit, and f is step S10
  • the frequency of the pulse generated in, F is the frequency control word.
  • Step S23 Frequency division is performed on the intermediate signal to generate a feedback signal.
  • step S23 the frequency division coefficient for dividing the intermediate signal is 1; for another example, step S23 includes: adjusting the frequency division coefficient according to the control parameter, and dividing the intermediate signal by using the adjusted frequency division coefficient.
  • Step S30 Generate a random number seed according to the phase relationship indicator signal.
  • the phase relationship indicator signal is a digital signal
  • the random number seed is: a digital signal sequence formed based on a combination of multiple phase relationship indicator signals.
  • the value of the phase relationship indicator signal is 0 or 1. When the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal is behind the phase of the feedback signal. When the phase relationship indicator signal is 1, it indicates that the phase of the input signal is ahead of the feedback signal. The phase of the feedback signal.
  • the digital signal sequence composed of m phase relationship indicating signals constitutes a random number seed, that is, 0110011110.
  • Step S40 Generate a random number sequence according to the random number seed.
  • the random number seed is a binary number with multiple bits.
  • step S40 is performed by a pseudo-random binary sequence code generator, and step S40 includes: performing multiple right shifts on the values of multiple bits of the random number seed, and each right shift generates a binary sequence.
  • the random number sequence is composed of at least one binary sequence; among them, the first bit in the first binary sequence is generated by performing a predetermined logical operation on the value of the last two bits of the random number seed, and the other bits in the first binary sequence The bit is generated by shifting the first n bits of the random number seed to the right by one bit; the first bit in the i+1th binary sequence is generated by the last two bits of the i-th binary sequence after a predetermined logical operation, the i+1th The other bits in a binary sequence are generated by shifting the first n bits of the i-th binary sequence by one bit to the right, where n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequence.
  • an embodiment of the present disclosure also provides an electronic device, which includes the aforementioned random number generation circuit provided in the embodiment of the present disclosure.
  • the electronic device in the embodiment of the present disclosure may be a chip in a communication device. All parts of the random number generating circuit provided by the embodiments of the present disclosure adopt digital circuits, so that they can be easily integrated in various chips.
  • the random number generated by the random number generating circuit in the embodiment of the present disclosure has a high degree of randomness, thereby improving the security and reliability of the electronic device in communication.

Abstract

Provided are a random number generation circuit and method, and an electronic device. The random number generation circuit comprises: a pulse generation sub-circuit, configured to generate a plurality of pulses, wherein the frequency of the pulses varies with a change in environmental parameters; a frequency-locked loop circuit, wherein the frequency-locked loop circuit comprises a frequency-discrimination and phase-discrimination sub-circuit, configured to generate a phase relationship indicator signal and a frequency relationship indicator signal according to a phase relationship between an input signal and a feedback signal, the phase relationship indicator signal indicates whether the phase of the input signal is ahead of the phase of the feedback signal, and the frequency relationship indicator signal indicates a frequency magnitude relationship between the input signal and the feedback signal; a feedback sub-circuit, configured to generate the feedback signal according to the frequency relationship indicator signal and the frequency of the pulses; a seed generation sub-circuit, configured to generate a random number seed according to the phase relationship indicator signal; and a random number generation sub-circuit, configured to generate a random number sequence according to the random number seed.

Description

随机数生成电路、随机数生成方法和电子设备Random number generating circuit, random number generating method and electronic equipment 技术领域Technical field
本公开涉及显示技术领域,具体涉及一种随机数生成电路、随机数生成方法和电子设备。The present disclosure relates to the field of display technology, and in particular to a random number generation circuit, a random number generation method, and electronic equipment.
背景技术Background technique
通信是万物联网(Internet of everything)的基石之一,随着时代的发展,通信将在未来电子系统中扮演重要的角色,但是万物联网同时也带来了网络安全问题。因此,高度安全的网络加密是不可或缺的,目前加密的方法主要依赖于硬件中的真随机数生成器(True Random Number Generator,TRNG),利用随机数进行加密。Communication is one of the cornerstones of the Internet of everything. With the development of the times, communication will play an important role in future electronic systems. However, the Internet of everything also brings network security issues. Therefore, highly secure network encryption is indispensable. The current encryption method mainly relies on the True Random Number Generator (TRNG) in the hardware, which uses random numbers for encryption.
发明内容Summary of the invention
本公开旨在至少解决现有技术中存在的技术问题之一,提出了一种随机数生成电路、随机数生成方法和电子设备。The present disclosure aims to solve at least one of the technical problems existing in the prior art, and proposes a random number generation circuit, a random number generation method, and an electronic device.
本公开提供一种随机数生成电路,包括:The present disclosure provides a random number generation circuit, including:
脉冲生成子电路,被配置为生成多个脉冲,且所述脉冲的频率随环境参数的变化而变化;The pulse generating sub-circuit is configured to generate a plurality of pulses, and the frequency of the pulses changes with changes in environmental parameters;
锁频环回路,所述锁频环回路包括:鉴频鉴相子电路,被配置为根据输入信号和反馈信号的相位关系生成相位关系指示信号和频率关系指示信号,所述相位关系指示信号指示所述输入信号的相位是否超前于所述反馈信号的相位,所述频率关系指示信号指示所述输入信号与所述反馈信号的频率大小关系;反馈子电路,被配置为根据所述频率关系指示信号和所述脉冲的频率生成所述反馈信号;A frequency-locked loop loop, the frequency-locked loop loop comprising: a frequency and phase-discrimination sub-circuit configured to generate a phase relationship indicating signal and a frequency relationship indicating signal according to the phase relationship between the input signal and the feedback signal, the phase relationship indicating signal indicating Whether the phase of the input signal leads the phase of the feedback signal, the frequency relationship indicating signal indicates the frequency relationship between the input signal and the feedback signal; the feedback sub-circuit is configured to indicate according to the frequency relationship The frequency of the signal and the pulse to generate the feedback signal;
种子生成子电路,被配置为根据所述相位关系指示信号生成随机数种子;A seed generation sub-circuit, configured to generate a random number seed according to the phase relationship indication signal;
随机数生成子电路,被配置为根据所述随机数种子生成随机数序列。The random number generating sub-circuit is configured to generate a random number sequence according to the random number seed.
在一些实施例中,所述脉冲生成子电路包括:环路振荡器。In some embodiments, the pulse generation sub-circuit includes: a loop oscillator.
在一些实施例中,所述反馈子电路包括:In some embodiments, the feedback sub-circuit includes:
控制单元,被配置为根据所述频率关系指示信号生成频率控制字;A control unit configured to generate a frequency control word according to the frequency relationship indication signal;
数字控制振荡单元,被配置为根据所述频率控制字和所述脉冲的频率生成中间信号,所述中间信号的频率为K*f/F,其中,K为所述脉冲生成子电路生成的所述脉冲的个数,f为所述脉冲的频率,F为所述频率控制字;The digital control oscillating unit is configured to generate an intermediate signal according to the frequency control word and the frequency of the pulse, the frequency of the intermediate signal is K*f/F, where K is all generated by the pulse generating sub-circuit The number of the pulses, f is the frequency of the pulses, and F is the frequency control word;
第一分频单元,被配置为对所述中间信号进行分频,生成所述反馈信号。The first frequency dividing unit is configured to divide the frequency of the intermediate signal to generate the feedback signal.
在一些实施例中,所述第一分频单元的分频系数为1。In some embodiments, the frequency division coefficient of the first frequency division unit is 1.
在一些实施例中,所述第一分频单元还被配置为根据控制参数调节所述第一分频单元的分频系数。In some embodiments, the first frequency dividing unit is further configured to adjust the frequency dividing coefficient of the first frequency dividing unit according to the control parameter.
在一些实施例中,所述数字控制振荡单元包括:时间平均频率直接周期合成器。In some embodiments, the digitally controlled oscillation unit includes: a time average frequency direct period synthesizer.
在一些实施例中,所述相位关系指示信号为数字信号,所述随机数种子为:多个所述相位关系指示信号的值组合得到的二进制数。In some embodiments, the phase relationship indicator signal is a digital signal, and the random number seed is: a binary number obtained by combining multiple values of the phase relationship indicator signal.
在一些实施例中,所述随机数种子为具有n+1个比特位的二进制数,所述随机数生成子电路具体被配置为:对所述随机数种子进行多次右移,每次右移均生成一个二进制序列,所述随机数序列由至少一个所述二进制序列组成;In some embodiments, the random number seed is a binary number with n+1 bits, and the random number generation sub-circuit is specifically configured to: shift the random number seed to the right multiple times, each time right Shifting to generate a binary sequence, and the random number sequence is composed of at least one of the binary sequences;
其中,第一个二进制序列中的第一位由所述随机数种子的后两个比特位的值进行预定逻辑运算后生成,第一个二进制序列中的其他位由随机数种子的前n个比特位右移一位生成;第i+1个二进制序列中的第一位由第i个二进制序列的后两位进行预定逻辑运算后生成,第i+1个二进制序列中的其他位由第i个二进制序列的前n位右移一位生成,n为大于0的整数,i为大于0且小于所述二进制序列总个数的整 数。Wherein, the first bit in the first binary sequence is generated by performing a predetermined logical operation on the values of the last two bits of the random number seed, and the other bits in the first binary sequence are generated by the first n bits of the random number seed. The bit position is shifted to the right by one bit; the first bit in the i+1th binary sequence is generated by the last two bits of the i-th binary sequence after a predetermined logical operation, and the other bits in the i+1th binary sequence are generated by the first bit in the i+1th binary sequence. The first n bits of i binary sequences are shifted to the right by one bit, n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequences.
在一些实施例中,所述预定逻辑运算为异或运算。In some embodiments, the predetermined logical operation is an exclusive OR operation.
在一些实施例中,所述随机数生成子电路包括:伪随机二进制序列码发生器。In some embodiments, the random number generating sub-circuit includes: a pseudo-random binary sequence code generator.
在一些实施例中,所述鉴频鉴相子电路包括:In some embodiments, the frequency and phase discrimination sub-circuit includes:
第一输入端,被配置为接收所述输入信号;The first input terminal is configured to receive the input signal;
第二输入端,被配置为接收所述反馈信号;The second input terminal is configured to receive the feedback signal;
第二分频单元,被配置为对所述输入信号进行分频;The second frequency dividing unit is configured to divide the frequency of the input signal;
寄存器单元,被配置为获取所述第二分频单元的输出信号在所述反馈信号的多个边沿处的多个信号值;A register unit configured to obtain multiple signal values of the output signal of the second frequency dividing unit at multiple edges of the feedback signal;
第一逻辑单元,被配置为对所述寄存器单元输出的多个信号值进行逻辑运算,以在所述输入信号的相位超前于所述反馈信号的相位时向第一输出端输出第一数字信号、向第二输出端输出第二数字信号;并在所述输入信号的相位落后于所述反馈信号的相位时向所述第二输出端输出第一数字信号、向所述第一输出端输出第二数字信号;所述相位关系指示信号由所述第一输出端的输出信号和所述第二输出端的输出信号按照第一逻辑规则处理后得到;The first logic unit is configured to perform logic operations on the multiple signal values output by the register unit to output a first digital signal to the first output terminal when the phase of the input signal leads the phase of the feedback signal , Output a second digital signal to the second output terminal; and output the first digital signal to the second output terminal and output to the first output terminal when the phase of the input signal lags the phase of the feedback signal A second digital signal; the phase relationship indication signal is obtained by processing the output signal of the first output terminal and the output signal of the second output terminal according to the first logic rule;
第二逻辑单元,被配置为对所述第一输出端和所述第二输出端的输出信号进行逻辑运算,以在所述输入信号的频率大于所述反馈信号的频率时向第三输出端输出所述第一数字信号、向第四输出端输出所述第二数字信号,在所述输入信号的频率小于所述反馈信号的频率时向所述第三输出端输出所述第二数字信号、向所述第四输出端输出所述第一数字信号;所述频率关系指示信号由所述第三输出端的输出信号和所述第四输出端的输出信号按照第二逻辑规则处理后得到。The second logic unit is configured to perform logic operations on the output signals of the first output terminal and the second output terminal to output to the third output terminal when the frequency of the input signal is greater than the frequency of the feedback signal The first digital signal, the second digital signal is output to a fourth output terminal, and the second digital signal is output to the third output terminal when the frequency of the input signal is less than the frequency of the feedback signal, The first digital signal is output to the fourth output terminal; the frequency relationship indication signal is obtained by processing the output signal of the third output terminal and the output signal of the fourth output terminal according to a second logic rule.
在一些实施例中,所述寄存器单元包括:第一D触发器、第二D触发器、第三D触发器和第四D触发器,所述第一D触发器的输入端和所述第三D触发器的输入端均与所述第二分频单元的输出端相连,所述第二D触发器的输入端与所述第一D触发器的输出端相连,所述 第四D触发器的输入端与所述第三D触发器的输出端相连,所述第一D触发器的时钟端、所述第二D触发器的时钟端和所述第四D触发器的时钟端均与所述第二输入端相连,所述第三D触发器的时钟端通过第一非门与所述第二输入端相连。In some embodiments, the register unit includes: a first D flip-flop, a second D flip-flop, a third D flip-flop, and a fourth D flip-flop, the input terminal of the first D flip-flop and the first D flip-flop The input ends of the three D flip-flops are all connected to the output end of the second frequency dividing unit, the input end of the second D flip-flop is connected to the output end of the first D flip-flop, and the fourth D trigger is connected to the output end of the first D flip-flop. The input terminal of the device is connected to the output terminal of the third D flip-flop, the clock terminal of the first D flip-flop, the clock terminal of the second D flip-flop and the clock terminal of the fourth D flip-flop are all Connected to the second input terminal, and the clock terminal of the third D flip-flop is connected to the second input terminal through a first NOT gate.
在一些实施例中,所述第一逻辑单元包括:第一异或门和第二异或门,所述第一异或门的两个输入端分别与所述第二D触发器的输出端和所述第四D触发器的输出端相连,所述第二异或门的两个输入端分别与第一D触发器的输出端和所述第四D触发器的输出端相连,所述第一异或门的输出端与所述第一输出端相连,所述第二异或门的输出端与所述第二输出端相连;In some embodiments, the first logic unit includes: a first XOR gate and a second XOR gate, and two input terminals of the first XOR gate are respectively connected to the output terminal of the second D flip-flop Is connected to the output terminal of the fourth D flip-flop, the two input terminals of the second XOR gate are respectively connected to the output terminal of the first D flip-flop and the output terminal of the fourth D flip-flop, the The output terminal of the first XOR gate is connected to the first output terminal, and the output terminal of the second XOR gate is connected to the second output terminal;
所述第二逻辑单元包括:第二非门、第三非门、第一与门和第二与门,所述第一与门的两个输入端分别与所述第一输出端和所述第二输出端相连,所述第二与门的其中一个输入端通过所述第二非门与所述第一输出端相连,所述第二与门的另一个输出端通过所述第三非门与所述第二输出端相连。The second logic unit includes: a second NOT gate, a third NOT gate, a first AND gate, and a second AND gate. Two input terminals of the first AND gate are connected to the first output terminal and the The second output terminal is connected, one of the input terminals of the second AND gate is connected to the first output terminal through the second NOT gate, and the other output terminal of the second AND gate is connected through the third inverter. The gate is connected to the second output terminal.
相应地,本公开实施例还提供一种随机数生成方法,包括:Correspondingly, an embodiment of the present disclosure also provides a random number generation method, including:
生成多个脉冲,所述脉冲的频率随环境参数的变化而变化;Generating a plurality of pulses, the frequency of the pulses changing with changes in environmental parameters;
根据输入信号和反馈信号的相位关系生成相位关系指示信号和频率关系指示信号,所述相位关系指示信号指示所述输入信号的相位是否超前于所述反馈信号的相位,所述频率关系指示信号指示所述输入信号与所述反馈信号的频率大小关系;所述反馈信号根据所述频率关系指示信号和所述脉冲的频率而生成;A phase relationship indicator signal and a frequency relationship indicator signal are generated according to the phase relationship between the input signal and the feedback signal, the phase relationship indicator signal indicates whether the phase of the input signal is ahead of the phase of the feedback signal, and the frequency relationship indicator signal indicates The frequency relationship between the input signal and the feedback signal; the feedback signal is generated according to the frequency relationship indicator signal and the frequency of the pulse;
根据所述相位关系指示信号生成随机数种子;Generating a random number seed according to the phase relationship indication signal;
根据所述随机数种子生成随机数序列。A random number sequence is generated according to the random number seed.
在一些实施例中,所述反馈信号根据以下步骤生成:In some embodiments, the feedback signal is generated according to the following steps:
根据所述频率关系指示信号生成频率控制字;Generating a frequency control word according to the frequency relationship indication signal;
根据所述频率控制字和所述脉冲的频率生成中间信号,所述中间信号的频率为K*f/F,其中,K为所述脉冲生成子电路生成的所述脉冲 的个数,f为所述脉冲的频率,F为所述频率控制字;Generate an intermediate signal according to the frequency control word and the frequency of the pulse. The frequency of the intermediate signal is K*f/F, where K is the number of pulses generated by the pulse generation sub-circuit, and f is The frequency of the pulse, F is the frequency control word;
对所述中间信号进行分频,生成所述反馈信号。The intermediate signal is frequency-divided to generate the feedback signal.
在一些实施例中,对所述中间信号进行分频的步骤中,分频系数为1。In some embodiments, in the step of frequency division of the intermediate signal, the frequency division coefficient is 1.
在一些实施例中,对所述中间信号进行分频的步骤包括:根据控制参数调节分频系数,利用调节后的分频系数对所述中间信号进行分频。In some embodiments, the step of dividing the frequency of the intermediate signal includes: adjusting a frequency dividing coefficient according to a control parameter, and dividing the frequency of the intermediate signal by using the adjusted frequency dividing coefficient.
在一些实施例中,所述相位关系指示信号为数字信号,所述随机数种子为:多个所述相位关系指示信号的值组合得到的二进制数。In some embodiments, the phase relationship indicator signal is a digital signal, and the random number seed is: a binary number obtained by combining multiple values of the phase relationship indicator signal.
在一些实施例中,所述随机数种子为具有n+1个比特位的二进制数,In some embodiments, the random number seed is a binary number with n+1 bits,
根据所述随机数种子生成随机数序列的步骤包括:The step of generating a random number sequence according to the random number seed includes:
对所述随机数种子进行多次右移,每次右移均生成一个二进制序列,所述随机数序列由至少一个所述二进制序列组成;其中,第一个二进制序列中的第一位由所述随机数种子的后两个比特位的值进行预定逻辑运算后生成,第一个二进制序列中的其他位由随机数种子的前n个比特位右移一位生成;第i+1个二进制序列中的第一位由第i个二进制序列的后两位进行预定逻辑运算后生成,第i+1个二进制序列中的其他位由第i个二进制序列的前n位右移一位生成,n为大于0的整数,i为大于0且小于所述二进制序列总个数的整数。The random number seed is shifted right multiple times, and each right shift generates a binary sequence, and the random number sequence is composed of at least one binary sequence; wherein, the first bit in the first binary sequence is The value of the last two bits of the random number seed is generated after a predetermined logical operation. The other bits in the first binary sequence are generated by shifting the first n bits of the random number seed to the right by one bit; the i+1th binary The first bit in the sequence is generated by performing a predetermined logical operation on the last two bits of the i-th binary sequence, and the other bits in the i+1-th binary sequence are generated by shifting the first n bits of the i-th binary sequence to the right by one bit. n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequence.
相应地,本公开实施例还提供一种电子设备,包括上述的随机数生成电路。Correspondingly, an embodiment of the present disclosure also provides an electronic device including the above-mentioned random number generation circuit.
附图说明Description of the drawings
附图是用来提供对本公开的进一步理解,并且构成说明书的一部分,与下面的具体实施方式一起用于解释本公开,但并不构成对本公开的限制。在附图中:The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure, but do not constitute a limitation to the present disclosure. In the attached picture:
图1示出了根据本公开的一些实施例的随机数生成电路的示意性框图。Fig. 1 shows a schematic block diagram of a random number generating circuit according to some embodiments of the present disclosure.
图2示出了根据本公开的一些实施例的环路振荡器的电路图。FIG. 2 shows a circuit diagram of a ring oscillator according to some embodiments of the present disclosure.
图3示出了根据本公开的一些实施例的鉴频鉴相子电路的示意图。Fig. 3 shows a schematic diagram of a frequency and phase discrimination sub-circuit according to some embodiments of the present disclosure.
图4示出了根据本公开的一些实施例的输入鉴频鉴相子电路的输入信号和反馈信号的波形示意图。Fig. 4 shows a schematic diagram of the waveforms of the input signal and the feedback signal of the input phase discrimination sub-circuit according to some embodiments of the present disclosure.
图5示出了根据本公开的一些实施例的时间平均频率直接周期合成器的电路图。FIG. 5 shows a circuit diagram of a time average frequency direct period synthesizer according to some embodiments of the present disclosure.
图6示出了根据本公开的一些实施例的时间平均频率的原理示意图。FIG. 6 shows a schematic diagram of the principle of time average frequency according to some embodiments of the present disclosure.
图7示出了根据本公开的一些实施例的随机数生成子电路的示意图。FIG. 7 shows a schematic diagram of a random number generation sub-circuit according to some embodiments of the present disclosure.
图8示出了根据本公开的一些实施例的随机数生成电路生成的随机数序列的图像化效果示意图。FIG. 8 shows a schematic diagram of the imaging effect of a random number sequence generated by a random number generating circuit according to some embodiments of the present disclosure.
图9示出了根据本公开的一些实施例的随机数生成方法的示意图。FIG. 9 shows a schematic diagram of a random number generation method according to some embodiments of the present disclosure.
图10示出了根据本公开的一些实施例的生成反馈信号的示意图。FIG. 10 shows a schematic diagram of generating a feedback signal according to some embodiments of the present disclosure.
具体实施方式Detailed ways
为使本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be described clearly and completely in conjunction with the accompanying drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without creative labor are within the protection scope of the present disclosure.
这里用于描述本公开的实施例的术语并非旨在限制和/或限定本公开的范围。例如,除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。 应该理解的是,本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。除非上下文另外清楚地指出,否则单数形式“一个”、“一”或者“该”等类似词语也不表示数量限制,而是表示存在至少一个。The terms used here to describe the embodiments of the present disclosure are not intended to limit and/or define the scope of the present disclosure. For example, unless otherwise defined, the technical terms or scientific terms used in the present disclosure shall have the usual meanings understood by those with ordinary skills in the field to which the present disclosure belongs. It should be understood that the "first", "second" and similar words used in the present disclosure do not denote any order, quantity or importance, but are only used to distinguish different components. Unless the context clearly dictates otherwise, the singular form "a", "an" or "the" and other similar words do not mean a quantitative limitation, but instead mean that there is at least one.
将进一步理解的是,术语“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“耦接”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。It will be further understood that the terms "including" or "including" and other similar words mean that the elements or items appearing before the word cover the elements or items listed after the word and their equivalents, but do not exclude other elements or items . Similar words such as "connected" or "coupled" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right", etc. are only used to indicate the relative position relationship. When the absolute position of the described object changes, the relative position relationship may also change accordingly.
第一方面,本公开实施例提供一种随机数生成电路,图1示出了根据本公开的一些实施例的随机数生成电路的示意性框图,如图1所示,随机数生成电路包括:脉冲生成子电路10、锁频环回路、种子生成子电路40和随机数生成子电路50。In the first aspect, embodiments of the present disclosure provide a random number generation circuit. FIG. 1 shows a schematic block diagram of a random number generation circuit according to some embodiments of the present disclosure. As shown in FIG. 1, the random number generation circuit includes: The pulse generation sub-circuit 10, the frequency-locked loop loop, the seed generation sub-circuit 40, and the random number generation sub-circuit 50.
脉冲生成子电路10被配置为生成多个脉冲,且脉冲生成子电路10生成的脉冲的频率随环境参数的变化而变化。例如,脉冲生成子电路10为振荡器,其振荡频率随环境参数(如,温度)变化而发生漂移。The pulse generating sub-circuit 10 is configured to generate a plurality of pulses, and the frequency of the pulses generated by the pulse generating sub-circuit 10 changes with changes in environmental parameters. For example, the pulse generation sub-circuit 10 is an oscillator, and its oscillation frequency drifts with changes in environmental parameters (such as temperature).
锁频环回路为时间平均频率锁频环(TAF-FLL)回路,被配置为将输入信号的频率和反馈信号的频率锁定。锁频环回路包括:鉴频鉴相子电路20和反馈子电路30。鉴频鉴相子电路20被配置为根据输入信号(其频率为fi)和反馈信号(其频率为fb)的相位关系生成相位关系指示信号和频率关系指示信号,相位关系指示信号指示输入信号的相位是否超前于反馈信号fb的相位,频率关系指示信号指示输入信号的频率fi与反馈信号的频率fb的大小关系。反馈子电路被30被配置为根据频率关系指示信号和脉冲的频率生成反馈信号fb。The frequency-locked loop loop is a time average frequency-locked loop (TAF-FLL) loop, which is configured to lock the frequency of the input signal and the frequency of the feedback signal. The frequency-locked loop loop includes: a frequency and phase discrimination sub-circuit 20 and a feedback sub-circuit 30. The frequency and phase discrimination sub-circuit 20 is configured to generate a phase relationship indicator signal and a frequency relationship indicator signal according to the phase relationship between the input signal (whose frequency is fi) and the feedback signal (whose frequency is fb), and the phase relationship indicator signal indicates the phase relationship of the input signal. Whether the phase is ahead of the phase of the feedback signal fb, the frequency relationship indicator signal indicates the magnitude relationship between the frequency fi of the input signal and the frequency fb of the feedback signal. The feedback sub-circuit 30 is configured to generate the feedback signal fb according to the frequency relationship indicator signal and the frequency of the pulse.
在本公开实施例中,输入信号可以由外部的晶振(Crystal)产生,或者由微机电系统(Micro-Electro-Mechanical System,MEMS)产生,或者由振荡器(例如,环路振荡器(Ring Oscillator,RO))产生。In the embodiments of the present disclosure, the input signal may be generated by an external crystal oscillator (Crystal), or by a Micro-Electro-Mechanical System (MEMS), or by an oscillator (for example, a ring oscillator (Ring Oscillator)). , RO)) produced.
本公开实施例中,输入锁相环回路的输入信号fi很容易在热噪声的干扰下发生抖动,同时,脉冲生成子电路10生成的脉冲的频率也会随环境参数的变化发生漂移,而无论输入信号如何抖动、脉冲频率如何漂移,反馈子电路30均会根据输入信号与反馈信号的频率的大小关系,以使反馈信号的频率fb与输入信号的频率fi一致。由于输入信号的抖动以及脉冲频率的漂移,会导致鉴频鉴相子电路20接收到的输入信号和反馈信号的相位具有很高的不确定性,因此根据相位关系生成的相位关系指示信号具有很高的不确定性,从而使得根据相位关系指示信号生成的随机数种子的随机性提高,进而使得生成的随机数的随机性提高,实现真随机数的生成。In the embodiment of the present disclosure, the input signal fi input to the phase-locked loop loop is easily jittered under the interference of thermal noise. At the same time, the frequency of the pulse generated by the pulse generating sub-circuit 10 will also drift with the change of environmental parameters, regardless of How the input signal jitters and how the pulse frequency drifts, the feedback sub-circuit 30 will make the frequency fb of the feedback signal consistent with the frequency fi of the input signal according to the relationship between the frequency of the input signal and the feedback signal. Due to the jitter of the input signal and the drift of the pulse frequency, the phase of the input signal and the feedback signal received by the phase discrimination sub-circuit 20 will be highly uncertain. Therefore, the phase relationship indicator signal generated according to the phase relationship has a high degree of uncertainty. The high uncertainty improves the randomness of the random number seed generated according to the phase relationship indicator signal, which in turn increases the randomness of the generated random number, and realizes the generation of a true random number.
在一些实施例中,脉冲生成子电路10包括环路振荡器11,例如,基于交叉级联的与非门(CROSS NAND GATEs)的振荡器。图2示出了根据本公开的一些实施例的环路振荡器的电路图,如图2所示,环路振荡器11包括交叉级联的8级与非门单元(P0~P15),每一级包括一对与非门。环路振荡器11生成多个相位均匀间隔脉冲。环路振荡器11最大的特点为不稳定,其振荡的初始条件是随机的,并且其振荡频率对环境非常敏感,当温度发生轻微变化时,振荡频率就会发生漂移。In some embodiments, the pulse generation sub-circuit 10 includes a ring oscillator 11, for example, an oscillator based on cross-cascaded NAND gates (CROSS NAND GATEs). Fig. 2 shows a circuit diagram of a ring oscillator according to some embodiments of the present disclosure. As shown in Fig. 2, the ring oscillator 11 includes 8-stage NAND units (P0~P15) in cross-cascade connection. The level includes a pair of NAND gates. The ring oscillator 11 generates a plurality of evenly spaced pulses in phase. The biggest characteristic of the ring oscillator 11 is that it is unstable. The initial condition of its oscillation is random, and its oscillation frequency is very sensitive to the environment. When the temperature changes slightly, the oscillation frequency will drift.
在一些实施例中,鉴频鉴相子电路20采用鉴频鉴相器(Phase Frequency Detector,PFD),图3示出了根据本公开的一些实施例的鉴频鉴相子电路的示意图,如图3所示,鉴频鉴相子电路20包括:第一输入端、第二输入端、第一输出端out1、第二输出端out2、第三输出端out3、第四输出端out4、第二分频单元21、寄存器单元22、第一逻辑单元23和第二逻辑单元24。第一输入端被配置为接收频率为fi的输入信号。第二输入端被配置为接收频率为fb的反馈信号。第二分频单元21被配置为对输入信号进行分频。例如,第二分频单元21采用二分频器。In some embodiments, the frequency discrimination sub-circuit 20 adopts a phase frequency detector (Phase Frequency Detector, PFD). FIG. 3 shows a schematic diagram of the phase discrimination sub-circuit according to some embodiments of the present disclosure, such as As shown in FIG. 3, the frequency and phase discrimination sub-circuit 20 includes: a first input terminal, a second input terminal, a first output terminal out1, a second output terminal out2, a third output terminal out3, a fourth output terminal out4, and a second output terminal out2. The frequency dividing unit 21, the register unit 22, the first logic unit 23, and the second logic unit 24. The first input terminal is configured to receive an input signal with a frequency fi. The second input terminal is configured to receive a feedback signal with a frequency of fb. The second frequency dividing unit 21 is configured to divide the frequency of the input signal. For example, the second frequency dividing unit 21 adopts a two frequency divider.
寄存器单元22被配置为获取第二分频单元21的输出信号在反馈信号的多个边沿处的多个信号值。例如,获取第二分频单元21在反馈信号的相邻两个上升沿以及该两个上升沿之间的下降沿处的信号值。The register unit 22 is configured to obtain multiple signal values of the output signal of the second frequency dividing unit 21 at multiple edges of the feedback signal. For example, the signal value of the second frequency dividing unit 21 at the two adjacent rising edges of the feedback signal and the falling edge between the two rising edges is obtained.
例如,寄存器单元22包括:第一D触发器221、第二D触发器222、第三D触发器223和第四D触发器224,第一D触发器221的输入端和第三D触发器223的输入端均与第二分频单元21的输出端相连,第二D触发器222的输入端与第一D触发器221的输出端相连,第四D触发器224的输入端与第三D触发器223的输出端相连,第一D触发器221的时钟端、第二D触发器222的时钟端和第四D触发器224的时钟端均与第二输入端相连,第三D触发器223的时钟端通过第一非门25与第二输入端相连。For example, the register unit 22 includes: a first D flip-flop 221, a second D flip-flop 222, a third D flip-flop 223, and a fourth D flip-flop 224, the input terminal of the first D flip-flop 221 and the third D flip-flop The input terminals of 223 are all connected to the output terminal of the second frequency dividing unit 21, the input terminal of the second D flip-flop 222 is connected to the output terminal of the first D flip-flop 221, and the input terminal of the fourth D flip-flop 224 is connected to the third The output terminal of the D flip-flop 223 is connected, the clock terminal of the first D flip-flop 221, the clock terminal of the second D flip-flop 222 and the clock terminal of the fourth D flip-flop 224 are all connected to the second input terminal, and the third D flip-flop The clock terminal of the converter 223 is connected to the second input terminal through the first NOT gate 25.
第一逻辑单元23连接第一输出端out1和第二输出端out2,第一逻辑单元23被配置为对寄存器单元22输出的多个信号值进行逻辑运算,从而在输入信号的相位超前于反馈信号的相位时向第一输出端out1输出第一数字信号、向第二输出端out2输出第二数字信号;并在输入信号的相位落后于反馈信号的相位时向第二输出端out2输出第一数字信号、向第一输出端out1输出第二数字信号。相位关系指示信号由第一输出端out1的输出信号和第二输出端out2的输出信号按照第一逻辑规则处理后得到。The first logic unit 23 is connected to the first output terminal out1 and the second output terminal out2. The first logic unit 23 is configured to perform logic operations on multiple signal values output by the register unit 22, so that the phase of the input signal leads the feedback signal The first digital signal is output to the first output terminal out1 and the second digital signal is output to the second output terminal out2; and the first digital signal is output to the second output terminal out2 when the phase of the input signal lags the phase of the feedback signal. Signal, output a second digital signal to the first output terminal out1. The phase relationship indication signal is obtained by processing the output signal of the first output terminal out1 and the output signal of the second output terminal out2 according to the first logic rule.
例如,第一逻辑规则为:当第一输出端out1输出第一数字信号、第二输出端out2输出第二数字信号时,将相位关系指示信号设置为第一数字信号;当第一输出端out1输出第二数字信号、第二输出端out2输出第一数字信号时,将相位关系指示信号设置为第二数字信号;其中,相位关系指示信号为第一数字信号时,指示输入信号的相位超前于反馈信号的相位;相位关系指示信号为第二数字信号时,指示输入信号的相位落后于反馈信号的相位。例如,第一数字信号的值为1,第二数字信号的值为0,当第一输出端out1的输出信号的值为1、第二输出端out2的输出信号的值为0时,相位关系指示信号的值为1;当第一输出端out1的输出信号的值为0、第二输出端out2的输出信号的值为1时,相位关系指示信号的值为0;当第一输出端out1的输出信号和第二输出端out2的输出信号的值均为1或均为0时,将其丢弃。相位关系指示信号的值为1时,指示输入信号的相位超前于反馈信号 的相位;相位关系指示信号的值为0时,指示输入信号的相位落后于反馈信号的相位。For example, the first logic rule is: when the first output terminal out1 outputs the first digital signal and the second output terminal out2 outputs the second digital signal, the phase relationship indicator signal is set to the first digital signal; when the first output terminal out1 When the second digital signal is output and the second output terminal out2 outputs the first digital signal, the phase relationship indicating signal is set to the second digital signal; wherein, when the phase relationship indicating signal is the first digital signal, the phase of the indicating input signal is ahead of The phase of the feedback signal; when the phase relationship indicator signal is the second digital signal, the phase of the indicator input signal lags the phase of the feedback signal. For example, the value of the first digital signal is 1 and the value of the second digital signal is 0. When the value of the output signal of the first output terminal out1 is 1, and the value of the output signal of the second output terminal out2 is 0, the phase relationship The value of the indicating signal is 1; when the value of the output signal of the first output terminal out1 is 0 and the value of the output signal of the second output terminal out2 is 1, the value of the phase relationship indicating signal is 0; when the first output terminal out1 When the values of the output signal of and the output signal of the second output terminal out2 are both 1 or both are 0, they are discarded. When the value of the phase relationship indicator signal is 1, it indicates that the phase of the input signal is ahead of the phase of the feedback signal; when the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal lags the phase of the feedback signal.
第二逻辑单元24连接第三输出端out3和第四输出端out4,第二逻辑单元24被配置为对第一输出端out1和第二输出端out2的输出信号进行逻辑运算,以在输入信号的频率大于反馈信号的频率时向第三输出端out3输出第一数字信号、向第四输出端out4输出第二数字信号,在输入信号的频率fi小于反馈信号的频率fb时向第三输出端out3输出第二数字信号、向第四输出端out4输出第一数字信号。频率关系指示信号由所述第三输出端out3的输出信号和所述第四输出端out4的输出信号按照第二逻辑规则处理后得到。The second logic unit 24 is connected to the third output terminal out3 and the fourth output terminal out4. The second logic unit 24 is configured to perform logic operations on the output signals of the first output terminal out1 and the second output terminal out2 to determine the difference between the input signals When the frequency is greater than the frequency of the feedback signal, the first digital signal is output to the third output terminal out3, and the second digital signal is output to the fourth output terminal out4. When the frequency fi of the input signal is less than the frequency fb of the feedback signal, the third output terminal out3 is output. The second digital signal is output, and the first digital signal is output to the fourth output terminal out4. The frequency relationship indication signal is obtained by processing the output signal of the third output terminal out3 and the output signal of the fourth output terminal out4 according to the second logic rule.
例如,第二逻辑规则为:当第三输出端out3输出第一数字信号、第四输出端out4输出第二数字信号时,将频率关系指示信号设置为第一数字信号;当第三输出端out3输出第二数字信号、第四输出端out4输出第一数字信号时,将频率指示信号设置为第二数字信号;其中,频率关系指示信号为第一数字信号时,指示输入信号的频率大于反馈信号的频率;频率关系指示信号为第二数字信号时,指示输入信号的频率小于反馈信号的频率。例如,第一数字信号的值为1、第二数字信号的值为0,当第三输出端out3的输出信号的值为1、第四输出端out4的输出信号的值为0时,频率关系指示信号的值为1;当第三输出端out3的输出信号的值为0、第四输出端out4的输出信号的值为1时,频率关系指示信号的值为0;当第三输出端out3的输出信号和第四输出端out4的输出信号的值均为0或均为1时,将其丢弃。频率关系指示信号的值为1时,指示输入信号的频率fi大于反馈信号的频率fb;频率关系指示信号的值为0时,指示输入信号的频率fi小于反馈信号的频率fb。For example, the second logic rule is: when the third output terminal out3 outputs the first digital signal and the fourth output terminal out4 outputs the second digital signal, the frequency relationship indicator signal is set to the first digital signal; when the third output terminal out3 When the second digital signal is output and the fourth output terminal out4 outputs the first digital signal, the frequency indicating signal is set to the second digital signal; wherein, when the frequency relationship indicating signal is the first digital signal, the frequency of the indicating input signal is greater than the feedback signal When the frequency relationship indicator signal is the second digital signal, it indicates that the frequency of the input signal is less than the frequency of the feedback signal. For example, when the value of the first digital signal is 1, and the value of the second digital signal is 0, when the value of the output signal of the third output terminal out3 is 1, and the value of the output signal of the fourth output terminal out4 is 0, the frequency relationship The value of the indicating signal is 1; when the value of the output signal of the third output terminal out3 is 0 and the value of the output signal of the fourth output terminal out4 is 1, the value of the frequency relationship indicating signal is 0; when the third output terminal out3 When the values of the output signal of and the output signal of the fourth output terminal out4 are both 0 or both, they are discarded. When the value of the frequency relationship indicator signal is 1, it indicates that the frequency fi of the input signal is greater than the frequency fb of the feedback signal; when the value of the frequency relationship indicator signal is 0, it indicates that the frequency fi of the input signal is less than the frequency fb of the feedback signal.
在一些实施例中,如图3所示,寄存器单元22包括:第一D触发器221、第二D触发器222、第三D触发器223和第四D触发器224,第一D触发器221的输入端和第三D触发器223的输入端均与第二分频单元21的输出端相连,第二D触发器222的输入端与第一D触发 器221的输出端相连,第四D触发器224的输入端与第三D触发器223的输出端相连,第一D触发器221的时钟端、第二D触发器222的时钟端和第四D触发器224的时钟端均与第二输入端相连,第三D触发器223的时钟端通过第一非门25与第二输入端相连。In some embodiments, as shown in FIG. 3, the register unit 22 includes: a first D flip-flop 221, a second D flip-flop 222, a third D flip-flop 223, and a fourth D flip-flop 224, the first D flip-flop The input terminal of 221 and the input terminal of the third D flip-flop 223 are both connected to the output terminal of the second frequency dividing unit 21, the input terminal of the second D flip-flop 222 is connected to the output terminal of the first D flip-flop 221, and the fourth The input terminal of the D flip-flop 224 is connected to the output terminal of the third D flip-flop 223, the clock terminal of the first D flip-flop 221, the clock terminal of the second D flip-flop 222, and the clock terminal of the fourth D flip-flop 224 are all connected to The second input terminal is connected, and the clock terminal of the third D flip-flop 223 is connected to the second input terminal through the first NOT gate 25.
第一逻辑单元23包括:第一异或门231和第二异或门232,第一异或门231的两个输入端分别与第二D触发器222的输出端和第四D触发器224的输出端相连,第二异或门232的两个输入端分别与第一D触发器221的输出端和第四D触发器224的输出端相连,第一异或门231的输出端与第一输出端out1相连,第二异或门232的输出端与第二输出端out2相连。第二逻辑单元24包括:第二非门241、第三非门242、第一与门243和第二与门244,第一与门243的两个输入端分别与第一输出端out1和第二输出端out2相连,第二与门244的其中一个输入端通过第二非门241与第一输出端out1相连,第二与门244的另一个输出端通过第三非门242与第二输出端相连。The first logic unit 23 includes: a first XOR gate 231 and a second XOR gate 232, the two input terminals of the first XOR gate 231 are respectively connected to the output terminal of the second D flip-flop 222 and the fourth D flip-flop 224 The two input terminals of the second XOR gate 232 are connected to the output terminal of the first D flip-flop 221 and the output terminal of the fourth D flip-flop 224 respectively. The output terminal of the first XOR gate 231 is connected to the output terminal of the fourth D flip-flop 224, respectively. An output terminal out1 is connected, and the output terminal of the second XOR gate 232 is connected to the second output terminal out2. The second logic unit 24 includes: a second inverter gate 241, a third inverter gate 242, a first AND gate 243, and a second AND gate 244. The two input terminals of the first AND gate 243 are connected to the first output terminal out1 and the first output terminal, respectively. The two output terminals out2 are connected, one of the input terminals of the second AND gate 244 is connected to the first output terminal out1 through the second NOT gate 241, and the other output terminal of the second AND gate 244 is connected to the second output terminal through the third NOT gate 242 End connected.
图4示出了根据本公开的一些实施例的输入鉴频鉴相子电路的输入信号和反馈信号的波形示意图,如图4所示,上方中的实线表示理想的输入信号的波形,下方中的实线表示理想的反馈信号的波形,输入信号和反馈信号均会因各自的噪声发生抖动,虚线表示输入信号/反馈信号受噪声干扰时脉冲边沿的边界,脉冲边沿在虚线范围内任意位置出现的几率相同。鉴频鉴相子电路20在确定输入信号和输出信号的相位关系时,将出现不确定性。例如,有可能会出现输入信号的相位超前于反馈信号的相位的情况,也有可能出现输入信号的相位落后于反馈信号的相位的情况,还有可能会出现输入信号与反馈相位一致的情况。并且,在图3所示的鉴频鉴相子电路20中,反馈信号(或其反相后的信号)作为第一D触发器221至第四D触发器224的时钟信号,而鉴频鉴相子电路20中的输入信号作为第一D触发器221和第三D触发器223的输入信号,当D触发器的输入信号和时钟信号的相位极其接近时,D触发器处于亚稳态的状态,输出0或1均有可能,从而增加了鉴频鉴相子电路20生成的相位关系指示信号的不确定性,进而 提高了根据相位关系指示信号所生成的随机数的随机度。Fig. 4 shows a schematic diagram of the input signal and the feedback signal of the input phase discrimination sub-circuit according to some embodiments of the present disclosure. As shown in Fig. 4, the solid line in the upper part represents the ideal input signal waveform, and the lower part The solid line in the middle represents the ideal feedback signal waveform. Both the input signal and the feedback signal will jitter due to their own noise. The dashed line represents the boundary of the pulse edge when the input signal/feedback signal is disturbed by noise. The pulse edge is anywhere within the dashed line. The probability of occurrence is the same. When the frequency and phase discrimination sub-circuit 20 determines the phase relationship between the input signal and the output signal, uncertainty will occur. For example, it may happen that the phase of the input signal leads the phase of the feedback signal, it may also happen that the phase of the input signal lags behind the phase of the feedback signal, or it may happen that the input signal and the feedback phase coincide. Moreover, in the frequency discrimination sub-circuit 20 shown in FIG. 3, the feedback signal (or its inverted signal) is used as the clock signal of the first D flip-flop 221 to the fourth D flip-flop 224, and the frequency discrimination The input signal in the phase sub-circuit 20 is used as the input signal of the first D flip-flop 221 and the third D flip-flop 223. When the phases of the input signal of the D flip-flop and the clock signal are very close, the D flip-flop is in a metastable state. State, it is possible to output 0 or 1, thereby increasing the uncertainty of the phase relationship indicator signal generated by the frequency and phase discrimination sub-circuit 20, thereby increasing the randomness of the random number generated according to the phase relationship indicator signal.
在一些实施例中,反馈子电路30包括:控制单元31、数字控制振荡单元32和第一分频单元33。In some embodiments, the feedback sub-circuit 30 includes: a control unit 31, a digitally controlled oscillation unit 32 and a first frequency dividing unit 33.
控制单元31被配置为根据鉴频鉴相子电路20输出的频率关系指示信号生成频率控制字F。例如,控制单元31从存储设备中读取初始的频率控制字F,当频率关系指示信号指示输入信号的频率fi大于反馈信号的频率fb时,控制单元31将当前的频率控制字减小1,;当频率关系指示信号指示输入信号fi的频率小于反馈信号fb的频率时,控制单元31将当前的频率控制字增大1。The control unit 31 is configured to generate the frequency control word F according to the frequency relationship indication signal output by the frequency discrimination sub-circuit 20. For example, the control unit 31 reads the initial frequency control word F from the storage device. When the frequency relationship indication signal indicates that the frequency fi of the input signal is greater than the frequency fb of the feedback signal, the control unit 31 reduces the current frequency control word by 1. ; When the frequency relationship indication signal indicates that the frequency of the input signal fi is less than the frequency of the feedback signal fb, the control unit 31 increases the current frequency control word by 1.
数字控制振荡单元32被配置为根据频率控制字和脉冲生成子电路10生成的脉冲的频率生成中间信号,中间信号的频率fo=K*f/F,其中,K为脉冲生成子电路10生成的脉冲的个数,f为所述脉冲的频率,F为频率控制字。The digital control oscillating unit 32 is configured to generate an intermediate signal according to the frequency control word and the frequency of the pulse generated by the pulse generating sub-circuit 10, the frequency of the intermediate signal fo=K*f/F, where K is generated by the pulse generating sub-circuit 10 The number of pulses, f is the frequency of the pulses, and F is the frequency control word.
第一分频单元33被配置为对中间信号进行分频,生成上述反馈信号。The first frequency dividing unit 33 is configured to divide the frequency of the intermediate signal to generate the aforementioned feedback signal.
在一些实施例中,数字控制振荡单元32采用基于时间平均频率直接周期合成(Time Average Frequency-Direct Period Synthesis,TAF-DPS)电路架构的时间平均频率直接周期合成器。图5示出了根据本公开的一些实施例的时间平均频率直接周期合成器的电路图,如图5所示,时间平均频率直接周期合成器320可以包括第一输入模块、第二输入模块3230以及输出模块3240。In some embodiments, the digitally controlled oscillation unit 32 adopts a time average frequency direct period synthesis (TAF-DPS) circuit architecture based on a time average frequency direct period synthesis (TAF-DPS) circuit architecture. FIG. 5 shows a circuit diagram of a time average frequency direct period synthesizer according to some embodiments of the present disclosure. As shown in FIG. 5, the time average frequency direct period synthesizer 320 may include a first input module, a second input module 3230, and Output module 3240.
例如,如图5所示,第一输入模块包括第一逻辑控制电路3210和第二逻辑控制电路3220。第一逻辑控制电路3210包括第一加法器3211、第一寄存器3212和第二寄存器3213。第二逻辑控制电路3220可以包括第二加法器3221、第三寄存器3222和第四寄存器3223。For example, as shown in FIG. 5, the first input module includes a first logic control circuit 3210 and a second logic control circuit 3220. The first logic control circuit 3210 includes a first adder 3211, a first register 3212, and a second register 3213. The second logic control circuit 3220 may include a second adder 3221, a third register 3222, and a fourth register 3223.
第二输入模块3230包括第一K→1多路复用器3231、第二K→1多路复用器3232和2→1多路复用器3233。第一K→1多路复用器3231和第二K→1多路复用器3232均包括多个输入端、控制输入端和输出 端。第一K→1多路复用器3231和第二K→1多路复用器3232的多个输入端分别用于接收脉冲生成子电路输出的K(K为大于1的整数)个相位均匀间隔的脉冲。2→1多路复用器3233包括控制输入端、输出端、用于接收第一K→1多路复用器3231的输出的第一输入端和用于接收第二K→1多路复用器3232的输出的第二输入端。例如,K个相位均匀间隔的脉冲中的任意两个相邻的脉冲之间的时间跨度(例如,相位差)可以为基准时间单位Δ。The second input module 3230 includes a first K→1 multiplexer 3231, a second K→1 multiplexer 3232, and a 2→1 multiplexer 3233. The first K→1 multiplexer 3231 and the second K→1 multiplexer 3232 each include a plurality of input terminals, a control input terminal, and an output terminal. The multiple input ends of the first K→1 multiplexer 3231 and the second K→1 multiplexer 3232 are respectively used to receive K (K is an integer greater than 1) output by the pulse generation sub-circuit. The phases are uniform Interval pulses. The 2→1 multiplexer 3233 includes a control input terminal, an output terminal, a first input terminal for receiving the output of the first K→1 multiplexer 3231, and a second K→1 multiplexer for receiving the output. The second input terminal of the output of the user 3232. For example, the time span (for example, the phase difference) between any two adjacent pulses among the K pulses with uniformly spaced phases may be the reference time unit Δ.
例如,如图5所示,输出模块3240包括触发电路。触发电路用于生成脉冲串。触发电路包括D触发器3241、第一反相器3242和第二反相器3243。D触发器3241包括数据输入端、用于接收来自2→1多路复用器3233的输出端的输出的时钟输入端和用于输出第一时钟信号CLK1的输出端。第一反相器3242包括用于接收第一时钟信号CLK1的输入端和用于输出信号到D触发器3241的数据输入端的输出端。第二反相器3243包括用于接收第一时钟信号CLK1的输入端和用于输出第二时钟信号CLK2的输出端。For example, as shown in FIG. 5, the output module 3240 includes a trigger circuit. The trigger circuit is used to generate pulse trains. The trigger circuit includes a D flip-flop 3241, a first inverter 3242, and a second inverter 3243. The D flip-flop 3241 includes a data input terminal, a clock input terminal for receiving the output from the output terminal of the 2→1 multiplexer 3233, and an output terminal for outputting the first clock signal CLK1. The first inverter 3242 includes an input terminal for receiving the first clock signal CLK1 and an output terminal for outputting a signal to the data input terminal of the D flip-flop 3241. The second inverter 3243 includes an input terminal for receiving the first clock signal CLK1 and an output terminal for outputting the second clock signal CLK2.
第一时钟信号CLK1被输出到2→1多路复用器3233的控制输入端,第一反相器3242的输出端连接到D触发器3241的数据输入端。The first clock signal CLK1 is output to the control input terminal of the 2→1 multiplexer 3233, and the output terminal of the first inverter 3242 is connected to the data input terminal of the D flip-flop 3241.
例如,第一加法器3211可以将频率控制字F和第一寄存器3212存储的最高有效位(most significant bits,例如,5比特)相加,然后在第二时钟信号CLK2的上升沿时将相加结果保存到第一寄存器3212中;或者,第一加法器3211可以将频率控制字F和第一寄存器3212存储的所有信息相加,然后在第二时钟信号CLK2的上升沿时将相加结果保存到第一寄存器3212中。在下一个第二时钟信号CLK2的上升沿时,第一寄存器3212存储的最高有效位将被存储到第二寄存器3213中,并作为第一K→1多路复用器3231的选择信号,用于从K个脉冲中选择一个脉冲作为第一K→1多路复用器3231的输出信号。For example, the first adder 3211 may add the frequency control word F and the most significant bits (for example, 5 bits) stored in the first register 3212, and then add them at the rising edge of the second clock signal CLK2 The result is saved in the first register 3212; alternatively, the first adder 3211 may add the frequency control word F and all the information stored in the first register 3212, and then save the addition result at the rising edge of the second clock signal CLK2 To the first register 3212. At the next rising edge of the second clock signal CLK2, the most significant bit stored in the first register 3212 will be stored in the second register 3213 and used as the selection signal of the first K→1 multiplexer 3231 for One pulse is selected from the K pulses as the output signal of the first K→1 multiplexer 3231.
例如,第二加法器3221可以将频率控制字F/2和第一寄存器3212存储的最高有效位相加,然后在第二时钟信号CLK2的上升沿时将相加结果保存到第三寄存器3222中。在下一个第一时钟信号CLK1的上 升沿时,第三寄存器3222存储的信息将被存储到第四寄存器3223中,并作为第二K→1多路复用器3223的选择信号,用于从K个脉冲中选择一个脉冲作为第二K→1多路复用器3223的输出信号。For example, the second adder 3221 may add the frequency control word F/2 and the most significant bit stored in the first register 3212, and then save the addition result in the third register 3222 at the rising edge of the second clock signal CLK2 . At the next rising edge of the first clock signal CLK1, the information stored in the third register 3222 will be stored in the fourth register 3223 and used as the selection signal of the second K→1 multiplexer 3223 for slave K One of these pulses is selected as the output signal of the second K→1 multiplexer 3223.
2→1多路复用器3233可以在第一时钟信号CLK1的上升沿时,选择来自第一K→1多路复用器3231的输出信号和来自第二K→1多路复用器3232的输出信号中的一个作为2→1多路复用器3233的输出信号,以作为D触发器3241的输入时钟信号。The 2→1 multiplexer 3233 can select the output signal from the first K→1 multiplexer 3231 and the second K→1 multiplexer 3232 at the rising edge of the first clock signal CLK1 One of the output signals is used as the output signal of the 2→1 multiplexer 3233 and used as the input clock signal of the D flip-flop 3241.
例如,D触发器3241的输出端和第二反相器3243的输出端之一可以作为时间平均频率直接周期合成器320的输出。For example, one of the output terminal of the D flip-flop 3241 and the output terminal of the second inverter 3243 can be used as the output of the time average frequency direct periodic synthesizer 320.
例如,第二寄存器3213输出的选择信号可以用于选择时间平均频率直接周期合成器320的生成的合成的时钟信号的下降沿,第四寄存器3223输出的选择信号可以用于选择时间平均频率直接周期合成器320的生成的合成的时钟信号的上升沿,第一寄存器3212反馈到第一加法器3211的信号可以用于控制时间平均频率直接周期合成器320的生成的合成的时钟的周期切换。For example, the selection signal output by the second register 3213 can be used to select the falling edge of the synthesized clock signal generated by the time average frequency direct cycle synthesizer 320, and the selection signal output by the fourth register 3223 can be used to select the time average frequency direct cycle. The rising edge of the synthesized clock signal generated by the synthesizer 320, and the signal fed back to the first adder 3211 by the first register 3212 can be used to control the period switching of the synthesized clock generated by the time average frequency direct cycle synthesizer 320.
时间平均频率直接周期合成器320基于时间平均频率(Time Average Frequency,TAF)来生成中间信号,图6示出了根据本公开的一些实施例的时间平均频率的原理示意图。结合图5和图6所示,时间平均频率直接周期合成器320的输出有两种,两种输出信号的周期分别为第一周期T A和第二周期T B。如图6所示,对于基准时间单位Δ和频率控制字F=I+r,可以获得两种时间周期:第一周期T A和第二周期T B。第一周期T A和第二周期T B可以分别通过以下公式(1)和公式(2)表示。其中,I为频率控制字F的整数部分,r为频率控制字F的小数部分。 The time average frequency direct period synthesizer 320 generates the intermediate signal based on the time average frequency (TAF). FIG. 6 shows a schematic diagram of the principle of the time average frequency according to some embodiments of the present disclosure. In conjunction with FIG. 5 and FIG. 6, the output time period of the average frequency synthesizer 320 directly, there are two, two kinds of output signal are periodic first period and the second period T A T B. 6, a reference time unit for the frequency control word and Δ F = I + r, can obtain two time periods: a first period and a second period T A T B. The first period and the second period T A T B can be represented by the following formula (1) and formula (2). Among them, I is the integer part of the frequency control word F, and r is the decimal part of the frequency control word F.
T A=I·Δ     (1) T A =I·Δ (1)
T B=(I+1)·Δ      (2) T B =(I+1)·Δ (2)
利用第一周期T A和第二周期T B,通过交错的方式可以生成包括两种不同周期(不同的频率)的时钟信号。所生成的时钟信号的平均 周期为T TAF,平均频率f TAF如下述公式(3)所示。 Using the first period and the second period T A T B, can be generated by a staggered manner comprises two different periods (different frequencies) of the clock signal. The average period of the generated clock signal is T TAF , and the average frequency f TAF is as shown in the following formula (3).
Figure PCTCN2020072982-appb-000001
Figure PCTCN2020072982-appb-000001
其中,f为脉冲的频率,K为脉冲生成子电路10生成的脉冲的个数。时间平均频率直接周期合成器320的特点为:改变频率控制字F,所生成的时钟信号的频率f TAF即可在两个周期后完成频率切换。 Among them, f is the frequency of the pulse, and K is the number of pulses generated by the pulse generating sub-circuit 10. The characteristic of the time average frequency direct period synthesizer 320 is: changing the frequency control word F, the frequency f TAF of the generated clock signal can complete the frequency switching after two cycles.
时间平均频率直接周期合成器320基于TAF的工作模式,使得输出信号的频率在两个频率之间变化,因此,中间信号的相位是变化的,这种相位的变化使得鉴频鉴相子电路20输出信号的随机性提高,从而进一步提高了生成随机数的随机度。The time average frequency direct period synthesizer 320 is based on the working mode of TAF, so that the frequency of the output signal changes between the two frequencies. Therefore, the phase of the intermediate signal changes. This phase change makes the frequency discrimination sub-circuit 20 The randomness of the output signal is improved, thereby further improving the randomness of generating random numbers.
在一些实施例中,第一分频单元33采用分频器。In some embodiments, the first frequency dividing unit 33 adopts a frequency divider.
为了将脉冲生成子电路10的噪声全部传入鉴频鉴相子电路20,在一些实施例中,将第一分频单元33的分频系数设置为较小的值,例如,分频系数N=1。In order to transmit all the noise of the pulse generation sub-circuit 10 to the frequency and phase discrimination sub-circuit 20, in some embodiments, the frequency division coefficient of the first frequency division unit 33 is set to a small value, for example, the frequency division coefficient N = 1.
在一些实施例中,为了增加鉴频鉴相子电路20输出信号的随机性,将第一分频单元33设置为抖动电路,例如,第一分频单元33还被配置为根据控制参数调节第一分频单元33的分频系数。In some embodiments, in order to increase the randomness of the output signal of the frequency discrimination sub-circuit 20, the first frequency division unit 33 is configured as a dither circuit. For example, the first frequency division unit 33 is further configured to adjust the first frequency division unit 33 according to the control parameter. A frequency division coefficient of the frequency division unit 33.
例如,控制参数由参数生成电路生成,该参数生成电路可以与随机数生成子电路50为同一电路,将随机数生成子电路50生成的随机数序列中的各个随机数的值作为控制参数。例如,随机数生成子电路50输出0时,第一分频单元33的分频系数被调节为2;随机数生成子电路50输出1时,第一分频单元33的分频系数被调节为1。又例如,随机数生成子电路50连续输出0、0时,第一分频单元33的分频系数被调节为2;随机数生成子电路50连续输出0、1时,第一分频单元33的分频系数被调节为1;随机数生成子电路50连续输出1、0时,第一分频单元33的分频系数被调节为3。当然,参数生成电路也可以为随机数生成子电路50之外的电路。For example, the control parameter is generated by a parameter generation circuit, which may be the same circuit as the random number generation sub-circuit 50, and the value of each random number in the random number sequence generated by the random number generation sub-circuit 50 is used as the control parameter. For example, when the random number generating sub-circuit 50 outputs 0, the frequency division coefficient of the first frequency dividing unit 33 is adjusted to 2; when the random number generating sub-circuit 50 outputs 1, the frequency dividing coefficient of the first frequency dividing unit 33 is adjusted to 1. For another example, when the random number generating sub-circuit 50 continuously outputs 0 and 0, the frequency division coefficient of the first frequency dividing unit 33 is adjusted to 2. When the random number generating sub-circuit 50 continuously outputs 0, 1, the first frequency dividing unit 33 When the frequency division coefficient of the first frequency division unit 33 is adjusted to 3 when the random number generation sub-circuit 50 continuously outputs 1 and 0, the frequency division coefficient of the first frequency division unit 33 is adjusted to 3. Of course, the parameter generation circuit may also be a circuit other than the random number generation sub-circuit 50.
在一些实施例中,相位关系指示信号为数字信号,所述随机数种子为多个相位关系指示信号的值组合得到的二进制数。需要说明的是,本公开实施例中,某一信号为0是指该信号的值为0,某一信号为1 是指该信号的值为1。In some embodiments, the phase relationship indicator signal is a digital signal, and the random number seed is a binary number obtained by combining values of a plurality of phase relationship indicator signals. It should be noted that in the embodiments of the present disclosure, a certain signal being 0 means that the value of the signal is 0, and a certain signal being 1 means that the value of the signal is 1.
例如,相位关系指示信号的值为0或1;当相位关系指示信号的值为0时,指示输入信号的相位落后于反馈信号的相位,当相位关系指示信号的值为1时,指示输入信号的相位超前于反馈信号的相位。For example, the value of the phase relationship indicator signal is 0 or 1. When the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal lags behind the phase of the feedback signal. When the value of the phase relationship indicator signal is 1, it indicates the input signal. The phase of is ahead of the phase of the feedback signal.
例如,在预定时长内,鉴频鉴相子电路20进行了m(例如,m=10)次相位对比,生成m个相位关系指示信号,m个相位关系指示信号的值分别为0、1、1、0、0、1、1、1、1、0,则m个相位关系指示信号的值组成的数字信号序列构成随机数种子,即,0110011110。需要理解的是,m=10仅为示例性说明,在实际应用中,m可以取更大的值,从而产生更多位数的随机数种子,例如,64为、128位、256位等,从而提高随机数生成子电路50生成的随机数的复杂度。For example, within a predetermined period of time, the frequency and phase discrimination sub-circuit 20 performs m (for example, m=10) phase comparisons to generate m phase relationship indicator signals, and the values of the m phase relationship indicator signals are 0, 1, respectively. 1, 0, 0, 1, 1, 1, 1, 0, then the digital signal sequence composed of the values of m phase relationship indicator signals constitutes a random number seed, that is, 0110011110. It should be understood that m=10 is only an exemplary illustration. In practical applications, m can take a larger value to generate a random number seed with more digits, for example, 64, 128, 256, etc. Therefore, the complexity of the random number generated by the random number generating sub-circuit 50 is increased.
在一些实施例中,随机数种子为二进制数,其具有n+1个比特位,随机数生成子电路50具体被配置为:对随机数种子进行多次右移,每次右移均生成一个二进制序列,所述随机数序列由至少一个二进制序列组成。其中,第一个二进制序列中的第一位由随机数种子的后两个比特位的值进行预定逻辑运算后生成,第一个二进制序列中的其他位由随机数种子的前n个比特位右移一位生成;第i+1个二进制序列中的第一位由第i个二进制序列的后两位进行预定逻辑运算后生成,第i+1个二进制序列中的其他位由第i个二进制序列的前n位右移一位生成,n为大于0的整数,i为大于0且小于所述二进制序列总个数的整数。需要说明的是,二进制序列中的第一位是二进制序列中的最高位,随机数种子的后两个比特位则是随机数种子的多个比特位中的最低位及其相邻位。In some embodiments, the random number seed is a binary number, which has n+1 bits, and the random number generation sub-circuit 50 is specifically configured to: perform multiple right shifts on the random number seed, and each right shift generates one A binary sequence, the random number sequence is composed of at least one binary sequence. Among them, the first bit in the first binary sequence is generated by performing a predetermined logical operation on the values of the last two bits of the random number seed, and the other bits in the first binary sequence are generated by the first n bits of the random number seed. Generated by shifting one bit to the right; the first bit in the i+1th binary sequence is generated by the last two digits of the i-th binary sequence after a predetermined logical operation, and the other bits in the i+1th binary sequence are generated by the i-th The first n bits of the binary sequence are generated by shifting one bit to the right, n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequence. It should be noted that the first bit in the binary sequence is the highest bit in the binary sequence, and the last two bits of the random number seed are the lowest bit and its adjacent bits among the multiple bits of the random number seed.
例如,随机数生成子电路50包括:伪随机二进制序列码发生器。图7示出了根据本公开的一些实施例的随机数生成子电路的示意图,如图7所示,随机数生成子电路51包括:逻辑运算单元512、移位寄存器和多个数据选择器513,随机数种子SG的比特位的位数为n+1,移位寄存器包括n+1级D触发器514,n+1级D触发器514的输入端与n+1个数据选择器513的输出端o1一一对应连接,具体地,第1 级D触发器514的输入端连接第1个数据选择器513的输出端o1,第2级D触发器的输入端514连接第2个数据选择器513的输出端o1,依次类推,直至第n+1级D触发器514的输入端连接第n+1个数据选择器513的输出端o1。第1个数据选择器513的第一输入端i1连接逻辑运算单元512的输出端,第j个数据选择器513的第一输入端i1连接第j-1级D触发器514的输出端,其中,j为整数,且1<j≤n+1。随机数种子SG的n+1位比特位的值分别输入到n+1个数据选择器512的第二输入端i2,逻辑运算单元512的两个输入端分别连接后两级D触发器514的输出端。在触发随机数生成子电路51生成随机数时,控制每个数据选择器513的第二输入端i2与输出端o1导通,从而使得随机数种子SG的n+1位数据分别输入n+1级D触发器514的输入端,之后,控制每个数据选择器513的第一输入端i1与输出端o1导通。n+1级D触发器514每次输出的二进制序列中的各位分别记作prbs[0]、prbs[1]……prbs[n],prbs[n-1]和prbs[n]分别输入至逻辑运算单元512的两个输入端。For example, the random number generating sub-circuit 50 includes a pseudo-random binary sequence code generator. FIG. 7 shows a schematic diagram of a random number generating sub-circuit according to some embodiments of the present disclosure. As shown in FIG. 7, the random number generating sub-circuit 51 includes: a logic operation unit 512, a shift register, and a plurality of data selectors 513 , The number of bits of the random number seed SG is n+1, and the shift register includes n+1 stage D flip-flops 514, the input terminals of n+1 stage D flip-flops 514 and n+1 data selectors 513 The output terminals o1 are connected in one-to-one correspondence. Specifically, the input terminal of the first level D flip-flop 514 is connected to the output terminal o1 of the first data selector 513, and the input terminal 514 of the second level D flip-flop is connected to the second data selection The output terminal o1 of the device 513, and so on, until the input terminal of the n+1-th stage D flip-flop 514 is connected to the output terminal o1 of the n+1-th data selector 513. The first input terminal i1 of the first data selector 513 is connected to the output terminal of the logic operation unit 512, and the first input terminal i1 of the jth data selector 513 is connected to the output terminal of the j-1th stage D flip-flop 514, where , J is an integer, and 1<j≤n+1. The n+1 bit values of the random number seed SG are respectively input to the second input terminal i2 of the n+1 data selectors 512, and the two input terminals of the logical operation unit 512 are respectively connected to the D flip-flops 514 of the latter two stages. The output terminal. When the random number generation sub-circuit 51 is triggered to generate a random number, the second input terminal i2 and the output terminal o1 of each data selector 513 are controlled to be turned on, so that n+1 bits of data of the random number seed SG are input to n+1 respectively The input terminal of the stage D flip-flop 514 is then controlled to conduct the first input terminal i1 and the output terminal o1 of each data selector 513. Each bit in the binary sequence output by the n+1 level D flip-flop 514 is denoted as prbs[0], prbs[1]...prbs[n], prbs[n-1] and prbs[n] are input to Two input terminals of the logic operation unit 512.
例如,随机数生成子电路51经过多次右移生成的多个二进制序列依次排列,组成所述随机数序列,第一个二进制序列中的第一位prbs[0]作为随机数序列的第一位,最后一个二进制序列的最后一位prbs[n]作为随机数序列的最后一位。For example, a plurality of binary sequences generated by the random number generation sub-circuit 51 after multiple right shifts are arranged in sequence to form the random number sequence, and the first bit prbs[0] in the first binary sequence is used as the first random number sequence. Bit, the last bit of the last binary sequence prbs[n] is used as the last bit of the random number sequence.
例如,随机数种子为01100010,随机数生成子电路51进行第一次右移操作后生成的二进制序列为:10110001;进行第二次右移操作生成的二进制序列为:11011000;进行第三次右移操作生成的二进制序列为:01101100;进行第四次右移操作生成的二进制序列为:00110110,以此类推。随机数序列由四个二进制序列按照生成顺序依次排列后组成,即,随机数序列为10110001110110000110110000110110。For example, the random number seed is 01100010, the binary sequence generated by the random number generation sub-circuit 51 after the first right shift operation is: 10110001; the binary sequence generated by the second right shift operation is: 11011000; the third right shift is performed The binary sequence generated by the shift operation is: 01101100; the binary sequence generated by the fourth right shift operation is: 00110110, and so on. The random number sequence is composed of four binary sequences arranged in the order of generation, that is, the random number sequence is 10110001110110000110110000110110.
图8示出了根据本公开的一些实施例的随机数生成电路生成的随机数序列的图像化效果示意图,其中,利用随机数生成电路生成的随机数序列包括65536位的随机数,每位随机数为0或1,图8的图像大小为256*256,共包括65536个像素,每个像素点对应一个随机数, 每个像素点的灰度由相应的随机数的值确定,随机数为0时,像素点呈黑色,随机数为1时,像素点呈白色。从图8可以看出随机数序列的随机数分布满足白噪声要求,没有明显的图案。FIG. 8 shows a schematic diagram of the imaging effect of a random number sequence generated by a random number generating circuit according to some embodiments of the present disclosure, wherein the random number sequence generated by the random number generating circuit includes 65536-bit random numbers, each of which is randomly The number is 0 or 1. The image size of Figure 8 is 256*256, including 65536 pixels in total. Each pixel corresponds to a random number. The gray scale of each pixel is determined by the value of the corresponding random number. The random number is When 0, the pixel is black, when the random number is 1, the pixel is white. It can be seen from Figure 8 that the random number distribution of the random number sequence meets the requirements of white noise, and there is no obvious pattern.
现有技术中的大部分随机数生成器都包含有模拟电路,其生产周期长,成本高,而在本公开实施例中,随机数生成电路的各部分均为数字电路,具有低功耗、低成本的特点,有利于集成在各种芯片中,并且,随机生成电路生成随机数的随机度较高,能够在通信过程中提供更高的安全性和可靠性。Most random number generators in the prior art include analog circuits, which have a long production cycle and high cost. In the embodiments of the present disclosure, each part of the random number generator circuit is a digital circuit, which has low power consumption, low power consumption, and high cost. The low-cost feature is beneficial to be integrated in various chips, and the random number generated by the random generation circuit is relatively high, which can provide higher security and reliability in the communication process.
第二方面,本公开还提供一种随机数生成方法,图9示出了根据本公开的一些实施例的随机数生成方法的示意图,该随机数生成方法可以由上述随机数生成电路来执行。如图9所示,本公开实施例中的随机数生成方法包括以下步骤S10至步骤S40。In the second aspect, the present disclosure also provides a random number generation method. FIG. 9 shows a schematic diagram of a random number generation method according to some embodiments of the present disclosure. The random number generation method can be executed by the above-mentioned random number generation circuit. As shown in FIG. 9, the random number generation method in the embodiment of the present disclosure includes the following steps S10 to S40.
步骤S10、生成多个脉冲,脉冲的频率随环境参数的变化而变化。Step S10, multiple pulses are generated, and the frequency of the pulses changes with changes in environmental parameters.
步骤S20、根据输入信号和反馈信号的相位关系生成相位关系指示信号和频率关系指示信号,相位关系指示信号指示输入信号的相位是否超前于反馈信号的相位,频率关系指示信号指示输入信号与反馈信号的频率大小关系。反馈信号根据频率关系指示信号和脉冲的频率而生成。Step S20: Generate a phase relationship indicator signal and a frequency relationship indicator signal according to the phase relationship between the input signal and the feedback signal, the phase relationship indicator signal indicates whether the phase of the input signal is ahead of the phase of the feedback signal, and the frequency relationship indicator signal indicates the input signal and the feedback signal The frequency of the relationship. The feedback signal is generated based on the frequency relationship indicator signal and the frequency of the pulse.
例如,相位关系指示信号由图3中鉴频鉴相子电路20的第一输出端out1的输出信号和第二输出端out2的输出信号按照第一逻辑规则处理后得到。第一输出端out1的输出信号、第二输出端out2的输出信号、相位关系指示信号均为数字信号。例如,第一数字信号的值为1,第二数字信号的值为0,第一规则为:当第一输出端out1的输出信号的值为1、第二输出端out2的输出信号的值为0时,相位关系指示信号的值为1;当第一输出端out1的输出信号的值为0、第二输出端out2的输出信号的值为1时,相位关系指示信号的值为0;当第一输出端out1的输出信号的值和第二输出端out2的输出信号的值均为1或均为0时,将其丢弃。相位关系指示信号的值为1时,指示输入信号的相位超前于反馈信号的相位;相位关系指示信号的值为0时, 指示输入信号的相位落后于反馈信号的相位。For example, the phase relationship indication signal is obtained by processing the output signal of the first output terminal out1 and the output signal of the second output terminal out2 of the frequency discrimination sub-circuit 20 in FIG. 3 according to the first logic rule. The output signal of the first output terminal out1, the output signal of the second output terminal out2, and the phase relationship indicator signal are all digital signals. For example, the value of the first digital signal is 1, and the value of the second digital signal is 0. The first rule is: when the value of the output signal of the first output terminal out1 is 1, the value of the output signal of the second output terminal out2 is When 0, the value of the phase relationship indicating signal is 1; when the value of the output signal of the first output terminal out1 is 0 and the value of the output signal of the second output terminal out2 is 1, the value of the phase relationship indicating signal is 0; When the value of the output signal of the first output terminal out1 and the value of the output signal of the second output terminal out2 are both 1 or 0, they are discarded. When the value of the phase relationship indicator signal is 1, it indicates that the phase of the input signal is ahead of the phase of the feedback signal; when the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal lags the phase of the feedback signal.
图10示出了根据本公开的一些实施例的生成反馈信号的示意图,如图10所示,反馈信号根据以下步骤S21至步骤S23生成。FIG. 10 shows a schematic diagram of generating a feedback signal according to some embodiments of the present disclosure. As shown in FIG. 10, the feedback signal is generated according to the following steps S21 to S23.
步骤S21、根据频率关系指示信号生成频率控制字。Step S21: Generate a frequency control word according to the frequency relationship indication signal.
例如,步骤S21由图1中的控制单元31执行。在步骤S21之前,先获取初始的频率控制字,在步骤S21中,当频率关系指示信号指示输入信号的频率fi大于反馈信号的频率fb时,控制单元31将当前的频率控制字减小1;当频率关系指示信号指示输入信号fi的频率小于反馈信号fb的频率时,将当前的频率控制字增大1。For example, step S21 is executed by the control unit 31 in FIG. 1. Before step S21, first obtain the initial frequency control word. In step S21, when the frequency relationship indicating signal indicates that the frequency fi of the input signal is greater than the frequency fb of the feedback signal, the control unit 31 reduces the current frequency control word by 1; When the frequency relationship indicator signal indicates that the frequency of the input signal fi is less than the frequency of the feedback signal fb, the current frequency control word is increased by 1.
步骤S22、根据频率控制字和脉冲的频率生成中间信号,该中间信号的频率为K*f/F,其中,K为所述脉冲生成子电路生成的所述脉冲的个数,f为步骤S10中生成的脉冲的频率,F为所述频率控制字。Step S22: Generate an intermediate signal according to the frequency control word and the frequency of the pulse. The frequency of the intermediate signal is K*f/F, where K is the number of pulses generated by the pulse generating sub-circuit, and f is step S10 The frequency of the pulse generated in, F is the frequency control word.
步骤S23、对中间信号进行分频,生成反馈信号。Step S23: Frequency division is performed on the intermediate signal to generate a feedback signal.
例如,步骤S23中,对中间信号进行分频的分频系数为1;又例如,步骤S23包括:根据控制参数调节分频系数,利用调节后的分频系数对所述中间信号进行分频。For example, in step S23, the frequency division coefficient for dividing the intermediate signal is 1; for another example, step S23 includes: adjusting the frequency division coefficient according to the control parameter, and dividing the intermediate signal by using the adjusted frequency division coefficient.
步骤S30、根据相位关系指示信号生成随机数种子。Step S30: Generate a random number seed according to the phase relationship indicator signal.
在一种实施例中,相位关系指示信号为数字信号,随机数种子为:基于多个相位关系指示信号组合形成的数字信号序列。例如,相位关系指示信号的值为0或1,相位关系指示信号的值为0时,指示输入信号的相位落后于反馈信号的相位,相位关系指示信号为1时,指示输入信号的相位超前于反馈信号的相位。In an embodiment, the phase relationship indicator signal is a digital signal, and the random number seed is: a digital signal sequence formed based on a combination of multiple phase relationship indicator signals. For example, the value of the phase relationship indicator signal is 0 or 1. When the value of the phase relationship indicator signal is 0, it indicates that the phase of the input signal is behind the phase of the feedback signal. When the phase relationship indicator signal is 1, it indicates that the phase of the input signal is ahead of the feedback signal. The phase of the feedback signal.
例如,在预定时长内,鉴频鉴相子电路进行了m(例如,m=10)次相位对比,生成m个相位关系指示信号,m个相位关系指示信号的值分别为0、1、1、0、0、1、1、1、1、0,则m个相位关系指示信号组成的数字信号序列构成随机数种子,即,0110011110。需要理解的是,m=10仅为示例性说明,在实际应用中,m可以取更大的值,从而产生更多位数的随机数种子,例如,64位、128位、256位等,从而提高随机数生成子电路的随机度。For example, within a predetermined period of time, the frequency and phase discrimination sub-circuit performs m (for example, m=10) phase comparisons to generate m phase relationship indicator signals, and the values of the m phase relationship indicator signals are 0, 1, and 1, respectively. , 0, 0, 1, 1, 1, 1, 0, the digital signal sequence composed of m phase relationship indicating signals constitutes a random number seed, that is, 0110011110. It should be understood that m=10 is only an exemplary illustration. In practical applications, m can take a larger value to generate a random number seed with more digits, for example, 64-bit, 128-bit, 256-bit, etc. Thereby improving the randomness of the random number generating sub-circuit.
步骤S40、根据随机数种子生成随机数序列。Step S40: Generate a random number sequence according to the random number seed.
例如,随机数种子为具有多个比特位的二进制数。在一些实施例中,步骤S40由伪随机二进制序列码发生器执行,步骤S40包括:对所述随机数种子的多个比特位的值进行多次右移,每次右移均生成一个二进制序列,随机数序列由至少一个二进制序列组成;其中,第一个二进制序列中的第一位由随机数种子的后两个比特位的值进行预定逻辑运算后生成,第一个二进制序列中的其他位由随机数种子的前n个比特位右移一位生成;第i+1个二进制序列中的第一位由第i个二进制序列的后两位进行预定逻辑运算后生成,第i+1个二进制序列中的其他位由第i个二进制序列的前n位右移一位生成,n为大于0的整数,i为大于0且小于二进制序列总个数的整数。For example, the random number seed is a binary number with multiple bits. In some embodiments, step S40 is performed by a pseudo-random binary sequence code generator, and step S40 includes: performing multiple right shifts on the values of multiple bits of the random number seed, and each right shift generates a binary sequence. , The random number sequence is composed of at least one binary sequence; among them, the first bit in the first binary sequence is generated by performing a predetermined logical operation on the value of the last two bits of the random number seed, and the other bits in the first binary sequence The bit is generated by shifting the first n bits of the random number seed to the right by one bit; the first bit in the i+1th binary sequence is generated by the last two bits of the i-th binary sequence after a predetermined logical operation, the i+1th The other bits in a binary sequence are generated by shifting the first n bits of the i-th binary sequence by one bit to the right, where n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequence.
第三方面,本公开实施例还提供一种电子设备,该电子设备包括本公开实施例中提供的上述随机数生成电路。In a third aspect, an embodiment of the present disclosure also provides an electronic device, which includes the aforementioned random number generation circuit provided in the embodiment of the present disclosure.
本公开实施例中的电子设备可以为通信设备中的芯片。本公开实施例提供的随机数生成电路的各部分均采用数字电路,从而可以轻松地集成在各种芯片中。The electronic device in the embodiment of the present disclosure may be a chip in a communication device. All parts of the random number generating circuit provided by the embodiments of the present disclosure adopt digital circuits, so that they can be easily integrated in various chips.
本公开实施例中的随机数生成电路生成的随机数的随机度较高,从而提高了电子设备在通信中的安全性以及可靠性。The random number generated by the random number generating circuit in the embodiment of the present disclosure has a high degree of randomness, thereby improving the security and reliability of the electronic device in communication.
可以理解的是,以上实施方式仅仅是为了说明本公开的原理而采用的示例性实施方式,然而本公开并不局限于此。对于本领域内的普通技术人员而言,在不脱离本公开的精神和实质的情况下,可以做出各种变型和改进,这些变型和改进也视为本公开的保护范围。It can be understood that the above implementations are merely exemplary implementations used to illustrate the principle of the present disclosure, but the present disclosure is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present disclosure, and these modifications and improvements are also deemed to be within the protection scope of the present disclosure.

Claims (20)

  1. 一种随机数生成电路,包括:A random number generation circuit, including:
    脉冲生成子电路,被配置为生成多个脉冲,且所述脉冲的频率随环境参数的变化而变化;The pulse generating sub-circuit is configured to generate a plurality of pulses, and the frequency of the pulses changes with changes in environmental parameters;
    锁频环回路,所述锁频环回路包括:鉴频鉴相子电路,被配置为根据输入信号和反馈信号的相位关系生成相位关系指示信号和频率关系指示信号,所述相位关系指示信号指示所述输入信号的相位是否超前于所述反馈信号的相位,所述频率关系指示信号指示所述输入信号与所述反馈信号的频率大小关系;反馈子电路,被配置为根据所述频率关系指示信号和所述脉冲的频率生成所述反馈信号;A frequency-locked loop loop, the frequency-locked loop loop comprising: a frequency and phase-discrimination sub-circuit configured to generate a phase relationship indicating signal and a frequency relationship indicating signal according to the phase relationship between the input signal and the feedback signal, the phase relationship indicating signal indicating Whether the phase of the input signal leads the phase of the feedback signal, the frequency relationship indicating signal indicates the frequency relationship between the input signal and the feedback signal; the feedback sub-circuit is configured to indicate according to the frequency relationship The frequency of the signal and the pulse to generate the feedback signal;
    种子生成子电路,被配置为根据所述相位关系指示信号生成随机数种子;A seed generation sub-circuit, configured to generate a random number seed according to the phase relationship indication signal;
    随机数生成子电路,被配置为根据所述随机数种子生成随机数序列。The random number generating sub-circuit is configured to generate a random number sequence according to the random number seed.
  2. 根据权利要求1所述的随机数生成电路,其中,所述脉冲生成子电路包括:环路振荡器。The random number generating circuit according to claim 1, wherein the pulse generating sub-circuit includes: a ring oscillator.
  3. 根据权利要求1所述的随机数生成电路,其中,所述反馈子电路包括:The random number generating circuit according to claim 1, wherein the feedback sub-circuit comprises:
    控制单元,被配置为根据所述频率关系指示信号生成频率控制字;A control unit configured to generate a frequency control word according to the frequency relationship indication signal;
    数字控制振荡单元,被配置为根据所述频率控制字和所述脉冲的频率生成中间信号,所述中间信号的频率为K*f/F,其中,K为所述脉冲生成子电路生成的所述脉冲的个数,f为所述脉冲的频率,F为所述频率控制字;The digital control oscillating unit is configured to generate an intermediate signal according to the frequency control word and the frequency of the pulse, the frequency of the intermediate signal is K*f/F, where K is all generated by the pulse generating sub-circuit The number of the pulses, f is the frequency of the pulses, and F is the frequency control word;
    第一分频单元,被配置为对所述中间信号进行分频,生成所述反 馈信号。The first frequency dividing unit is configured to divide the frequency of the intermediate signal to generate the feedback signal.
  4. 根据权利要求3所述的随机数生成电路,其中,所述第一分频单元的分频系数为1。4. The random number generating circuit according to claim 3, wherein the frequency division coefficient of the first frequency division unit is 1.
  5. 根据权利要求3所述的随机数生成电路,其中,所述第一分频单元还被配置为根据控制参数调节所述第一分频单元的分频系数。3. The random number generating circuit according to claim 3, wherein the first frequency dividing unit is further configured to adjust the frequency dividing coefficient of the first frequency dividing unit according to a control parameter.
  6. 根据权利要求3所述的随机数生成电路,其中,所述数字控制振荡单元包括:时间平均频率直接周期合成器。4. The random number generating circuit according to claim 3, wherein the digitally controlled oscillation unit comprises: a time average frequency direct periodic synthesizer.
  7. 根据权利要求1所述的随机数生成电路,其中,所述相位关系指示信号为数字信号,所述随机数种子为:多个所述相位关系指示信号的值组合得到的二进制数。4. The random number generating circuit according to claim 1, wherein the phase relationship indicating signal is a digital signal, and the random number seed is a binary number obtained by combining a plurality of values of the phase relationship indicating signal.
  8. 根据权利要求1所述的随机数生成电路,其中,所述随机数种子为具有n+1个比特位的二进制数,所述随机数生成子电路具体被配置为:对所述随机数种子进行多次右移,每次右移均生成一个二进制序列,所述随机数序列由至少一个所述二进制序列组成;The random number generation circuit according to claim 1, wherein the random number seed is a binary number with n+1 bits, and the random number generation sub-circuit is specifically configured to: Multiple right shifts, each right shift generates a binary sequence, and the random number sequence is composed of at least one binary sequence;
    其中,第一个二进制序列中的第一位由所述随机数种子的后两个比特位的值进行预定逻辑运算后生成,第一个二进制序列中的其他位由随机数种子的前n个比特位右移一位生成;第i+1个二进制序列中的第一位由第i个二进制序列的后两位进行预定逻辑运算后生成,第i+1个二进制序列中的其他位由第i个二进制序列的前n位右移一位生成,n为大于0的整数,i为大于0且小于所述二进制序列总个数的整数。Wherein, the first bit in the first binary sequence is generated by performing a predetermined logical operation on the values of the last two bits of the random number seed, and the other bits in the first binary sequence are generated by the first n bits of the random number seed. The bit position is shifted to the right by one bit; the first bit in the i+1th binary sequence is generated by the last two digits of the i-th binary sequence after a predetermined logic operation, and the other bits in the i+1th binary sequence are generated by the i+1th binary sequence. The first n bits of i binary sequences are shifted to the right by one bit, n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequences.
  9. 根据权利要求8所述的随机数生成电路,其中,所述预定逻辑 运算为异或运算。The random number generating circuit according to claim 8, wherein the predetermined logical operation is an exclusive OR operation.
  10. 根据权利要求8所述的随机数生成电路,其中,所述随机数生成子电路包括:伪随机二进制序列码发生器。8. The random number generating circuit according to claim 8, wherein the random number generating sub-circuit comprises: a pseudo-random binary sequence code generator.
  11. 根据权利要求1所述的随机数生成电路,其中,所述鉴频鉴相子电路包括:The random number generating circuit according to claim 1, wherein the frequency and phase discrimination sub-circuit comprises:
    第一输入端,被配置为接收所述输入信号;The first input terminal is configured to receive the input signal;
    第二输入端,被配置为接收所述反馈信号;The second input terminal is configured to receive the feedback signal;
    第二分频单元,被配置为对所述输入信号进行分频;The second frequency dividing unit is configured to divide the frequency of the input signal;
    寄存器单元,被配置为获取所述第二分频单元的输出信号在所述反馈信号的多个边沿处的多个信号值;A register unit configured to obtain multiple signal values of the output signal of the second frequency dividing unit at multiple edges of the feedback signal;
    第一逻辑单元,被配置为对所述寄存器单元输出的多个信号值进行逻辑运算,以在所述输入信号的相位超前于所述反馈信号的相位时向第一输出端输出第一数字信号、向第二输出端输出第二数字信号;并在所述输入信号的相位落后于所述反馈信号的相位时向所述第二输出端输出第一数字信号、向所述第一输出端输出第二数字信号;所述相位关系指示信号由所述第一输出端的输出信号和所述第二输出端的输出信号按照第一逻辑规则处理后得到;The first logic unit is configured to perform logic operations on the multiple signal values output by the register unit to output a first digital signal to the first output terminal when the phase of the input signal leads the phase of the feedback signal , Output a second digital signal to the second output terminal; and output the first digital signal to the second output terminal and output to the first output terminal when the phase of the input signal lags the phase of the feedback signal A second digital signal; the phase relationship indication signal is obtained by processing the output signal of the first output terminal and the output signal of the second output terminal according to the first logic rule;
    第二逻辑单元,被配置为对所述第一输出端和所述第二输出端的输出信号进行逻辑运算,以在所述输入信号的频率大于所述反馈信号的频率时向第三输出端输出所述第一数字信号、向第四输出端输出所述第二数字信号,在所述输入信号的频率小于所述反馈信号的频率时向所述第三输出端输出所述第二数字信号、向所述第四输出端输出所述第一数字信号;所述频率关系指示信号由所述第三输出端的输出信号和所述第四输出端的输出信号按照第二逻辑规则处理后得到。The second logic unit is configured to perform logic operations on the output signals of the first output terminal and the second output terminal to output to the third output terminal when the frequency of the input signal is greater than the frequency of the feedback signal The first digital signal, the second digital signal is output to a fourth output terminal, and the second digital signal is output to the third output terminal when the frequency of the input signal is less than the frequency of the feedback signal, The first digital signal is output to the fourth output terminal; the frequency relationship indication signal is obtained by processing the output signal of the third output terminal and the output signal of the fourth output terminal according to a second logic rule.
  12. 根据权利要求11所述的随机数生成电路,其中,所述寄存器 单元包括:第一D触发器、第二D触发器、第三D触发器和第四D触发器,所述第一D触发器的输入端和所述第三D触发器的输入端均与所述第二分频单元的输出端相连,所述第二D触发器的输入端与所述第一D触发器的输出端相连,所述第四D触发器的输入端与所述第三D触发器的输出端相连,所述第一D触发器的时钟端、所述第二D触发器的时钟端和所述第四D触发器的时钟端均与所述第二输入端相连,所述第三D触发器的时钟端通过第一非门与所述第二输入端相连。The random number generation circuit according to claim 11, wherein the register unit comprises: a first D flip-flop, a second D flip-flop, a third D flip-flop, and a fourth D flip-flop, the first D flip-flop The input terminal of the device and the input terminal of the third D flip-flop are both connected to the output terminal of the second frequency dividing unit, and the input terminal of the second D flip-flop is connected to the output terminal of the first D flip-flop. Connected, the input terminal of the fourth D flip-flop is connected to the output terminal of the third D flip-flop, the clock terminal of the first D flip-flop, the clock terminal of the second D flip-flop and the first D flip-flop The clock terminals of the four D flip-flops are all connected to the second input terminal, and the clock terminal of the third D flip-flop is connected to the second input terminal through a first NOT gate.
  13. 根据权利要求12所述的随机数生成电路,其中,所述第一逻辑单元包括:第一异或门和第二异或门,所述第一异或门的两个输入端分别与所述第二D触发器的输出端和所述第四D触发器的输出端相连,所述第二异或门的两个输入端分别与第一D触发器的输出端和所述第四D触发器的输出端相连,所述第一异或门的输出端与所述第一输出端相连,所述第二异或门的输出端与所述第二输出端相连;The random number generating circuit according to claim 12, wherein the first logic unit comprises: a first XOR gate and a second XOR gate, and two input terminals of the first XOR gate are respectively connected to the The output terminal of the second D flip-flop is connected to the output terminal of the fourth D flip-flop, and the two input terminals of the second XOR gate are respectively connected to the output terminal of the first D flip-flop and the fourth D flip-flop The output terminal of the XOR gate is connected to the output terminal, the output terminal of the first XOR gate is connected to the first output terminal, and the output terminal of the second XOR gate is connected to the second output terminal;
    所述第二逻辑单元包括:第二非门、第三非门、第一与门和第二与门,所述第一与门的两个输入端分别与所述第一输出端和所述第二输出端相连,所述第二与门的其中一个输入端通过所述第二非门与所述第一输出端相连,所述第二与门的另一个输出端通过所述第三非门与所述第二输出端相连。The second logic unit includes: a second NOT gate, a third NOT gate, a first AND gate, and a second AND gate. Two input terminals of the first AND gate are connected to the first output terminal and the The second output terminal is connected, one of the input terminals of the second AND gate is connected to the first output terminal through the second NOT gate, and the other output terminal of the second AND gate is connected through the third inverter. The gate is connected to the second output terminal.
  14. 一种随机数生成方法,包括:A random number generation method, including:
    生成多个脉冲,所述脉冲的频率随环境参数的变化而变化;Generating a plurality of pulses, the frequency of the pulses changing with changes in environmental parameters;
    根据输入信号和反馈信号的相位关系生成相位关系指示信号和频率关系指示信号,所述相位关系指示信号指示所述输入信号的相位是否超前于所述反馈信号的相位,所述频率关系指示信号指示所述输入信号与所述反馈信号的频率大小关系;所述反馈信号根据所述频率关系指示信号和所述脉冲的频率而生成;A phase relationship indicator signal and a frequency relationship indicator signal are generated according to the phase relationship between the input signal and the feedback signal, the phase relationship indicator signal indicates whether the phase of the input signal is ahead of the phase of the feedback signal, and the frequency relationship indicator signal indicates The frequency relationship between the input signal and the feedback signal; the feedback signal is generated according to the frequency relationship indicator signal and the frequency of the pulse;
    根据所述相位关系指示信号生成随机数种子;Generating a random number seed according to the phase relationship indication signal;
    根据所述随机数种子生成随机数序列。A random number sequence is generated according to the random number seed.
  15. 根据权利要求14所述的方法,其中,所述反馈信号根据以下步骤生成:The method according to claim 14, wherein the feedback signal is generated according to the following steps:
    根据所述频率关系指示信号生成频率控制字;Generating a frequency control word according to the frequency relationship indication signal;
    根据所述频率控制字和所述脉冲的频率生成中间信号,所述中间信号的频率为K*f/F,其中,K为所述脉冲生成子电路生成的所述脉冲的个数,f为所述脉冲的频率,F为所述频率控制字;Generate an intermediate signal according to the frequency control word and the frequency of the pulse. The frequency of the intermediate signal is K*f/F, where K is the number of pulses generated by the pulse generation sub-circuit, and f is The frequency of the pulse, F is the frequency control word;
    对所述中间信号进行分频,生成所述反馈信号。The intermediate signal is frequency-divided to generate the feedback signal.
  16. 根据权利要求15所述的方法,其中,对所述中间信号进行分频的步骤中,分频系数为1。The method according to claim 15, wherein in the step of dividing the frequency of the intermediate signal, the frequency dividing coefficient is 1.
  17. 根据权利要求15所述的方法,其中,对所述中间信号进行分频的步骤包括:根据控制参数调节分频系数,利用调节后的分频系数对所述中间信号进行分频。The method according to claim 15, wherein the step of dividing the frequency of the intermediate signal comprises: adjusting a frequency dividing coefficient according to a control parameter, and dividing the frequency of the intermediate signal by using the adjusted frequency dividing coefficient.
  18. 根据权利要求14所述的方法,其中,所述相位关系指示信号为数字信号,所述随机数种子为:多个所述相位关系指示信号的值组合得到的二进制数。The method according to claim 14, wherein the phase relationship indicator signal is a digital signal, and the random number seed is: a binary number obtained by combining a plurality of values of the phase relationship indicator signal.
  19. 根据权利要求14所述的方法,其中,所述随机数种子为具有n+1个比特位的二进制数,The method according to claim 14, wherein the random number seed is a binary number with n+1 bits,
    根据所述随机数种子生成随机数序列的步骤包括:The step of generating a random number sequence according to the random number seed includes:
    对所述随机数种子进行多次右移,每次右移均生成一个二进制序列,所述随机数序列由至少一个所述二进制序列组成;其中,第一个二进制序列中的第一位由所述随机数种子的后两个比特位的值进行预 定逻辑运算后生成,第一个二进制序列中的其他位由随机数种子的前n个比特位右移一位生成;第i+1个二进制序列中的第一位由第i个二进制序列的后两位进行预定逻辑运算后生成,第i+1个二进制序列中的其他位由第i个二进制序列的前n位右移一位生成,n为大于0的整数,i为大于0且小于所述二进制序列总个数的整数。The random number seed is shifted right multiple times, and each right shift generates a binary sequence, and the random number sequence is composed of at least one binary sequence; wherein, the first bit in the first binary sequence is The value of the last two bits of the random number seed is generated after a predetermined logical operation. The other bits in the first binary sequence are generated by shifting the first n bits of the random number seed by one bit to the right; the i+1th binary The first bit in the sequence is generated by performing a predetermined logical operation on the last two bits of the i-th binary sequence, and the other bits in the i+1-th binary sequence are generated by shifting the first n bits of the i-th binary sequence to the right by one bit. n is an integer greater than 0, and i is an integer greater than 0 and less than the total number of the binary sequence.
  20. 一种电子设备,包括权利要求1所述的随机数生成电路。An electronic device comprising the random number generating circuit according to claim 1.
PCT/CN2020/072982 2020-01-19 2020-01-19 Random number generation circuit, random number generation method, and electronic device WO2021142830A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202080000040.XA CN113498506B (en) 2020-01-19 2020-01-19 Random number generation circuit, random number generation method, and electronic device
PCT/CN2020/072982 WO2021142830A1 (en) 2020-01-19 2020-01-19 Random number generation circuit, random number generation method, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/072982 WO2021142830A1 (en) 2020-01-19 2020-01-19 Random number generation circuit, random number generation method, and electronic device

Publications (1)

Publication Number Publication Date
WO2021142830A1 true WO2021142830A1 (en) 2021-07-22

Family

ID=76863322

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/072982 WO2021142830A1 (en) 2020-01-19 2020-01-19 Random number generation circuit, random number generation method, and electronic device

Country Status (2)

Country Link
CN (1) CN113498506B (en)
WO (1) WO2021142830A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023070405A1 (en) * 2021-10-27 2023-05-04 京东方科技集团股份有限公司 Random number generator and random number generation method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1397871A (en) * 2001-07-17 2003-02-19 富士电气化学株式会社 Random number generator and probability generator
US20070195917A1 (en) * 2006-01-30 2007-08-23 Joakim Landmark Phase locked loop circuitry
CN101588178A (en) * 2008-05-23 2009-11-25 中芯国际集成电路制造(上海)有限公司 Self-biased phase-locked loop
CN101594145A (en) * 2008-05-26 2009-12-02 中芯国际集成电路制造(上海)有限公司 Self-biased phase-locked loop
CN108471309A (en) * 2018-02-12 2018-08-31 中国科学院上海微系统与信息技术研究所 A kind of lock detecting circuit for phaselocked loop
CN108536423A (en) * 2017-03-03 2018-09-14 群联电子股份有限公司 Random data generation circuit, memory storage apparatus and random data production method
US20180269885A1 (en) * 2017-03-17 2018-09-20 Kabushiki Kaisha Toshiba Oscillator, semiconductor device and wireless communication apparatus

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5047967A (en) * 1989-07-19 1991-09-10 Apple Computer, Inc. Digital front end for time measurement and generation of electrical signals
EP0665650A1 (en) * 1994-01-31 1995-08-02 STMicroelectronics S.A. Low voltage high speed phase frequency detector
KR100516713B1 (en) * 2003-02-10 2005-09-22 매그나칩 반도체 유한회사 Phase Frequency Detector in PLL
US9002488B2 (en) * 2010-02-22 2015-04-07 Cypress Semiconductor Corporation Clock synthesis systems, circuits and methods
CN103870238B (en) * 2012-12-10 2018-03-16 北京普源精电科技有限公司 Pseudo-random sequence generator and its generation method based on FPGA
CN103312319B (en) * 2013-05-23 2015-09-23 江苏博纳雨田通信电子有限公司 Be applied to the spurious reduction phase frequency detector circuit in integer-N PLL
CN107425851B (en) * 2017-08-09 2021-08-06 京东方科技集团股份有限公司 Frequency compensator, electronic device, and frequency compensation method
CN108429551B (en) * 2018-01-31 2022-07-05 京东方科技集团股份有限公司 Control method of electronic equipment and electronic equipment
CN110199477B (en) * 2019-04-23 2022-02-01 京东方科技集团股份有限公司 Clock spread spectrum circuit, electronic device and clock spread spectrum method
CN110518906B (en) * 2019-08-30 2023-04-07 京东方科技集团股份有限公司 Signal generating circuit and method thereof, digital time conversion circuit and method thereof

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1397871A (en) * 2001-07-17 2003-02-19 富士电气化学株式会社 Random number generator and probability generator
US20070195917A1 (en) * 2006-01-30 2007-08-23 Joakim Landmark Phase locked loop circuitry
CN101588178A (en) * 2008-05-23 2009-11-25 中芯国际集成电路制造(上海)有限公司 Self-biased phase-locked loop
CN101594145A (en) * 2008-05-26 2009-12-02 中芯国际集成电路制造(上海)有限公司 Self-biased phase-locked loop
CN108536423A (en) * 2017-03-03 2018-09-14 群联电子股份有限公司 Random data generation circuit, memory storage apparatus and random data production method
US20180269885A1 (en) * 2017-03-17 2018-09-20 Kabushiki Kaisha Toshiba Oscillator, semiconductor device and wireless communication apparatus
CN108471309A (en) * 2018-02-12 2018-08-31 中国科学院上海微系统与信息技术研究所 A kind of lock detecting circuit for phaselocked loop

Also Published As

Publication number Publication date
CN113498506A (en) 2021-10-12
CN113498506B (en) 2024-03-19

Similar Documents

Publication Publication Date Title
CN106293617B (en) Real random number generator
US9735787B2 (en) Frequency synthesizer with dynamic phase and pulse-width control
US10754620B2 (en) Self-timed random number generator
CN102968290B (en) A kind of true Random Number Generator of isomery lightweight
KR101987141B1 (en) Random number generator
US20130346459A1 (en) Method for generating random numbers
Balasch et al. Design and testing methodologies for true random number generators towards industry certification
US7151399B2 (en) System and method for generating multiple clock signals
CN102736890A (en) High-speed random number generator based on open-loop structure
WO2021142830A1 (en) Random number generation circuit, random number generation method, and electronic device
US11777541B2 (en) Digital fingerprint generation circuit, generation method and electronic device
US20090327381A1 (en) True random number generator
Lee et al. Implementing a phase detection ring oscillator PUF on FPGA
JP2010002959A (en) Pseudo-random number generating device
TW201421356A (en) Storage circuit with random number generation mode
CN111124363B (en) True random number generation method and true random number generator
US7733152B2 (en) Control signal generating circuit enabling value of period of a generated clock signal to be set as the period of a reference signal multiplied or divided by an arbitrary real number
US9160316B2 (en) Digital controlled oscillator and frequency variable oscillator
TWI706320B (en) Real random number generating device and method of field programmable gate array
CN114115807A (en) Random number generator and random number generation method
WO2022062711A1 (en) Digital fingerprint generator and digital fingerprint generation method
CN116069295B (en) True random number generation circuit, true random number generation method and electronic equipment
US10763870B1 (en) Digital fractional clock synthesizer with period modulation
US20230169167A1 (en) Semiconductor device and clock control method
CN111522529B (en) Random number generator for field programmable gate array

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20913303

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20913303

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 20913303

Country of ref document: EP

Kind code of ref document: A1