Method and device for generating pseudo-random binary sequence code

文档序号:1184325 发布日期:2020-09-22 浏览:12次 中文

阅读说明:本技术 伪随机二进制序列码生成方法以及装置 (Method and device for generating pseudo-random binary sequence code ) 是由 周鹏 周锋 曾峰 于 2020-06-12 设计创作,主要内容包括:本申请提供了一种伪随机二进制序列码生成方法以及装置,其中,该方法包括:将N组随机数分别按照设定规则进行处理,以得到N组处理随机数组,其中,N为正整数;从N组处理随机数组中的每组处理随机数组抽取指定数量的数值,以得到N组数值数量为指定数量的抽取随机数;根据N组抽取随机数生成伪随机二进制序列码,能够提高生成伪随机二进制码的速度,以及伪随机二进制码的随机性。(The application provides a method and a device for generating a pseudo-random binary sequence code, wherein the method comprises the following steps: respectively processing the N groups of random numbers according to a set rule to obtain N groups of processing random numbers, wherein N is a positive integer; extracting a specified number of numerical values from each of the N groups of processing random arrays to obtain extracted random numbers of which the N groups of numerical values are the specified number; the pseudo-random binary sequence code is generated according to the N groups of extracted random numbers, so that the speed of generating the pseudo-random binary code and the randomness of the pseudo-random binary code can be improved.)

1. A method for generating a pseudo-random binary sequence code, comprising:

respectively processing the N groups of random numbers according to a set rule to obtain N groups of processing random numbers, wherein N is a positive integer;

extracting a specified number of numerical values from each of the N groups of processing random arrays to obtain an extracted random number of which the N groups of numerical values are the specified number;

and generating a pseudo-random binary sequence code according to the N groups of the extracted random numbers.

2. The method of claim 1, wherein the N sets of processing random arrays comprise a target processing random array comprising M rounds of random arrays; the extracting the number of the specified number of the numerical values from each processing random array in the N groups of processing random arrays to obtain the extracted random number of which the number of the N groups of numerical values is the specified number, includes:

extracting numerical values of appointed orders from M rounds of random arrays in the target processing random array to obtain numerical values of appointed number in the target processing random array, wherein the number of round items of the appointed rounds is a first number, and the number of order items of the appointed orders is a second number; the product of the first number and the second number is equal to the specified number; the target processing random array is any one of the N processing random arrays; m is a positive integer greater than one.

3. The method according to claim 1, wherein the processing the N groups of random numbers according to the set rule to obtain N groups of processed random numbers respectively comprises:

and respectively processing the N groups of random numbers through N feedback register chains to obtain N groups of processing random arrays.

4. The method of claim 3, wherein before the processing the N sets of random numbers through the N feedback register chains to obtain N sets of processed random numbers, the method further comprises:

and respectively providing random numbers to the N feedback register chains through N seed registers.

5. The method of claim 3, wherein the processing the N sets of random numbers through the N feedback register chains to obtain N sets of processed random numbers respectively comprises:

and performing M rounds of iterative operations on the target random number through a target feedback register chain to obtain an M round of random array of the target feedback register chain, wherein M is a set positive integer, the target feedback register chain is any one of N feedback register chains, and the target random number is a random number input into the target feedback register chain, wherein each round of iterative operations comprises one-step or multi-step iterative operations.

6. The method of claim 5, wherein each step of iterative operations is:

shifting a numerical value in an ith bit register in the target feedback register chain to an (I + 1) th bit register, wherein I is a positive integer smaller than I, and I is the number of registers in the target feedback register chain;

performing exclusive-or operation on a first numerical value in an I-bit register in the target feedback register chain and a second numerical value in a register at a specified position to obtain a target numerical value;

and storing the target value into a first bit register in the target feedback register chain.

7. The method of claim 5, wherein the extracting a specified number of values from each of the N sets of processing random numbers to obtain N sets of extracted random numbers with the specified number of values comprises:

and when the target feedback register chain is iterated to a specified round, taking out numerical values from the registers of the specified bit times of the target feedback register chain, and taking out the numerical values of specified quantity from the target feedback register chain after the target feedback register chain is iterated for M rounds.

8. The method according to any one of claims 1-7, wherein said generating a pseudo-random binary sequence code from said N groups of said extracted random numbers comprises:

and replacing part of numerical values in the N groups of the extracted random numbers with zero or one according to a preset zero-one ratio to obtain the pseudo-random binary sequence code.

9. The method according to claim 8, wherein said using zero or one for replacing part of the values in the N groups of the extracted random numbers according to a preset zero-one ratio to obtain the pseudo-random binary sequence code comprises:

when the preset zero ratio is more than one half, replacing part of numerical values in the N groups of the extracted random numbers with zeros according to the preset zero-one ratio to obtain a pseudo-random binary sequence code;

and when the preset zero ratio is less than one half, replacing part of numerical values in the N groups of the extracted random numbers by one according to the preset zero-one ratio to obtain the pseudo-random binary sequence code.

10. The method according to claim 8, wherein said using zero or one for replacing part of the values in the N groups of the extracted random numbers according to a preset zero-one ratio to obtain the pseudo-random binary sequence code comprises:

and replacing continuous partial numerical values in the N groups of the extracted random numbers with zero or one according to a preset zero-one ratio to obtain the pseudo-random binary sequence code.

11. A pseudo-random binary sequence code generating apparatus, comprising:

the processing module is used for processing the N groups of random numbers according to a set rule respectively to obtain N groups of processing random numbers, wherein N is a positive integer;

the extraction module is used for extracting numerical values of the designated number from each processing random array in the N groups of processing random arrays to obtain the extracted random numbers of which the N groups of numerical values are the designated number;

and the generating module is used for generating a pseudo-random binary sequence code according to the N groups of the extracted random numbers.

12. The apparatus of claim 11, wherein the N sets of processing random arrays comprise a target processing random array comprising M rounds of random arrays; an extraction module to:

extracting numerical values of appointed orders from M rounds of random arrays in the target processing random array to obtain numerical values of appointed number in the target processing random array, wherein the number of round items of the appointed orders is a first number, and the number of order items of the appointed orders is a second number; the product of the first number and the second number is equal to the specified number; the target processing random array is any one of the N processing random arrays; m is a positive integer greater than one.

13. A system for generating a pseudorandom binary sequence code, comprising:

the N feedback register chains are used for processing the initial random number to obtain N groups of processing random arrays, wherein N is a positive integer;

the N post-processing modules are respectively connected with the N feedback register chains and used for extracting numerical values of a specified number from each processing random array in the N processing random arrays to obtain the extracted random numbers of which the N sets of numerical values are the specified number;

and the sequence code generation module is connected with the N post-processing modules and is used for generating a pseudo-random binary sequence code according to the N groups of the extracted random numbers.

14. The system of claim 13, further comprising:

and the feedback round setting register is connected with the N feedback register chains and is used for setting the moving step number of each round of iterative operation of the N feedback register chains.

15. The system of claim 13, further comprising:

and the threshold setting register is connected with the N post-processing modules and is used for setting the value number in one feedback register chain in any round of iterative operation.

16. The system of claim 13, further comprising:

and the zero-one ratio setting register is connected with the sequence code generating module and is used for setting the zero-one ratio of the output pseudo-random binary sequence code.

17. The system of claim 13, further comprising:

and the N seed registers are respectively connected with the N feedback register chains and used for respectively inputting random numbers to the N seed registers.

18. An electronic device, comprising: the pseudo-random binary sequence code generating system of any one of claims 13-17.

19. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, is adapted to carry out the steps of the method according to any one of claims 1 to 10.

Technical Field

The invention relates to the technical field of computers, in particular to a method and a device for generating a pseudo-random binary sequence code.

Background

In the field of communication systems, when performing eye diagram test, bit error rate test or jitter tolerance test on a high-speed signal link, a Pseudo-Random Binary code stream (PRBS) is generally used to simulate a real network code stream environment. Because all data in the network occur randomly without any rule, the PRBS code stream has such a "random data" characteristic to some extent that binary "0" and "1" occur randomly, and the spectrum characteristic of the PRBS code stream is very close to white noise. However, the current PRBS code stream forming method has certain limitations.

Disclosure of Invention

The invention aims to provide a method and a device for generating a pseudo-random binary sequence code, which can improve the speed of generating the pseudo-random binary sequence code and the randomness of the pseudo-random binary sequence code.

In a first aspect, an embodiment of the present invention provides a method for generating a pseudorandom binary sequence code, including:

respectively processing the N groups of random numbers according to a set rule to obtain N groups of processing random numbers, wherein N is a positive integer;

extracting a specified number of numerical values from each of the N groups of processing random arrays to obtain an extracted random number of which the N groups of numerical values are the specified number;

and generating a pseudo-random binary sequence code according to the N groups of the extracted random numbers.

In an alternative embodiment, the N sets of processing random arrays include a target processing random array, the target processing random array including M rounds of random arrays; the extracting the number of the specified number of the numerical values from each processing random array in the N groups of processing random arrays to obtain the extracted random number of which the number of the N groups of numerical values is the specified number, includes:

extracting numerical values of appointed orders from M rounds of random arrays in the target processing random array to obtain numerical values of appointed number in the target processing random array, wherein the number of round items of the appointed rounds is a first number, and the number of order items of the appointed orders is a second number; the product of the first number and the second number is equal to the specified number; the target processing random array is any one of the N processing random arrays; m is a positive integer greater than one.

According to the method for generating the pseudo-random binary sequence code in the embodiment of the application, the position and the limitation of the round of processing the random number group extraction value in each group are increased, so that the speed of extracting the random number can be high. In addition, the random numbers are extracted at the designated positions and in the designated rounds, and the randomness of the extracted random numbers can be kept.

In an optional embodiment, the processing the N groups of random numbers according to a set rule, respectively, to obtain N groups of processed random numbers includes:

and respectively processing the N groups of random numbers through N feedback register chains to obtain N groups of processing random arrays.

In an optional implementation manner, before the processing N sets of random numbers through N feedback register chains respectively to obtain N sets of processed random numbers, the method further includes:

and respectively providing random numbers to the N feedback register chains through N seed registers.

According to the method for generating the pseudo-random binary sequence code, the random number is generated and generated through the register chain and the seed register, and one register stores one datum, so that the numerical value in the process of generating the random number can be obtained more conveniently.

In an optional implementation manner, the processing N groups of random numbers through N feedback register chains, respectively, to obtain N groups of processed random numbers includes:

and performing M rounds of iterative operations on the target random number through a target feedback register chain to obtain an M round of random array of the target feedback register chain, wherein M is a set positive integer, the target feedback register chain is any one of N feedback register chains, and the target random number is a random number input into the target feedback register chain, wherein each round of iterative operations comprises one-step or multi-step iterative operations.

According to the method for generating the pseudo-random binary sequence code, the randomness of the data can be enhanced through multiple rounds of iterative operation, and therefore the random property of the random number extracted from the random number group is better. Further, each round of iterative operation can be one-step or multi-non-iterative operation, and the random number of the random array can be adaptively adjusted.

In an alternative embodiment, each step of the iterative operation is:

shifting a numerical value in an ith bit register in the target feedback register chain to an (I + 1) th bit register, wherein I is a positive integer smaller than I, and I is the number of registers in the target feedback register chain;

performing exclusive-or operation on a first numerical value in an I-bit register in the target feedback register chain and a second numerical value in a register at a specified position to obtain a target numerical value;

and storing the target value into a first bit register in the target feedback register chain.

In the method for generating the pseudo-random binary sequence code in the embodiment of the application, the randomness of the numerical value in the register can be increased through the shift operation.

In an optional embodiment, the extracting a specified number of values from each of the N sets of processing random arrays to obtain an N set of extracted random numbers with the specified number of values includes:

and when the target feedback register chain is iterated to a specified round, taking out numerical values from the registers of the specified bit times of the target feedback register chain, and taking out the numerical values of specified quantity from the target feedback register chain after the target feedback register chain is iterated for M rounds.

According to the pseudo-random binary sequence code generation method in the embodiment of the application, the numerical value is taken out from the register when each iteration is carried out to the specified turn, so that the data storage requirement can be reduced, and the utilization rate of the register is improved by the foot-and-mouth disease.

In an optional embodiment, the generating a pseudo-random binary sequence code according to the N groups of the extracted random numbers includes:

and replacing part of numerical values in the N groups of the extracted random numbers with zero or one according to a preset zero-one ratio to obtain the pseudo-random binary sequence code.

According to the method for generating the pseudo-random binary sequence code, the zero-to-one proportion in the output pseudo-random binary sequence code can be adjusted according to the preset zero-to-one ratio through the preset zero-to-one ratio, so that the obtained pseudo-random binary sequence code can meet the test requirement on the high-speed signal link.

In an optional embodiment, said using zero or one for replacing a part of values in N groups of said extracted random numbers according to a preset zero-to-one ratio to obtain a pseudo-random binary sequence code includes:

when the preset zero ratio is more than one half, replacing part of numerical values in the N groups of the extracted random numbers with zeros according to the preset zero-one ratio to obtain a pseudo-random binary sequence code;

and when the preset zero ratio is less than one half, replacing part of numerical values in the N groups of the extracted random numbers by one according to the preset zero-one ratio to obtain the pseudo-random binary sequence code.

In the method for generating the pseudo-random binary sequence code in the embodiment of the application, a part of numerical values in the random number are extracted by using zero-one replacement, so that the zero-one proportion in the pseudo-random binary sequence code is set. Thereby, the zero-one proportion in the required pseudo-random binary sequence code can be obtained more conveniently and quickly.

In an optional embodiment, said using zero or one for replacing a part of values in N groups of said extracted random numbers according to a preset zero-to-one ratio to obtain a pseudo-random binary sequence code includes:

and replacing continuous partial numerical values in the N groups of the extracted random numbers with zero or one according to a preset zero-one ratio to obtain the pseudo-random binary sequence code.

According to the method for generating the pseudo-random binary sequence code, continuous partial numerical values are replaced by zeros or ones, so that the probability of breaking the zero-one random in the extracted random number can be reduced, and the random property of the obtained pseudo-random binary sequence code is better.

In a second aspect, an embodiment of the present invention provides a pseudo-random binary sequence code generating apparatus, including:

the processing module is used for processing the N groups of random numbers according to a set rule respectively to obtain N groups of processing random numbers, wherein N is a positive integer;

the extraction module is used for extracting numerical values of the designated number from each processing random array in the N groups of processing random arrays to obtain the extracted random numbers of which the N groups of numerical values are the designated number;

and the generating module is used for generating a pseudo-random binary sequence code according to the N groups of the extracted random numbers.

In an alternative embodiment, the N sets of processing random arrays include a target processing random array, the target processing random array including M rounds of random arrays; an extraction module to:

extracting numerical values of appointed orders from M rounds of random arrays in the target processing random array to obtain numerical values of appointed number in the target processing random array, wherein the number of round items of the appointed orders is a first number, and the number of order items of the appointed orders is a second number; the product of the first number and the second number is equal to the specified number; the target processing random array is any one of the N processing random arrays; m is a positive integer greater than one.

In a third aspect, an embodiment of the present invention provides a system for generating a pseudo-random binary sequence code, including:

the N feedback register chains are used for processing the initial random number to obtain N groups of processing random arrays, wherein N is a positive integer;

the N post-processing modules are respectively connected with the N feedback register chains and used for extracting numerical values of a specified number from each processing random array in the N processing random arrays to obtain the extracted random numbers of which the N sets of numerical values are the specified number;

and the sequence code generation module is connected with the N post-processing modules and is used for generating a pseudo-random binary sequence code according to the N groups of the extracted random numbers.

In an alternative embodiment, the method further comprises:

and the feedback round setting register is connected with the N feedback register chains and is used for setting the moving step number of each round of iterative operation of the N feedback register chains.

The pseudo-random binary sequence code generation system in the embodiment of the application is convenient for setting the iterative operation round number by setting the feedback round setting register.

In an alternative embodiment, the method further comprises:

and the threshold setting register is connected with the N post-processing modules and is used for setting the value number in one feedback register chain in any round of iterative operation.

The pseudo-random binary sequence code generation system in the embodiment of the application can more conveniently set zero-one proportion for the output pseudo-random binary sequence code by setting the threshold setting register.

In an alternative embodiment, the method further comprises:

and the zero-one ratio setting register is connected with the sequence code generating module and is used for setting the zero-one ratio of the output pseudo-random binary sequence code.

The pseudo-random binary sequence code generation system in the embodiment of the application can more conveniently realize the setting of the threshold value in the value taking process by setting the threshold value setting register and the zero ratio setting register. It is also more convenient to set a zero-one weight for the output pseudo-random binary sequence code.

In an alternative embodiment, the method further comprises:

and the N seed registers are respectively connected with the N feedback register chains and used for respectively inputting random numbers to the N seed registers.

In a fourth aspect, an embodiment of the present invention provides an electronic device, and the system for generating a pseudo-random binary sequence code according to any one of the foregoing embodiments.

In a fifth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the method according to any one of the foregoing embodiments.

The method and the device for generating the pseudo-random binary sequence code, the system for generating the pseudo-random binary sequence code, the electronic device and the computer readable storage medium have the advantages that: random numbers are extracted from the random arrays, and then pseudo-random binary sequence codes are generated by the extracted random numbers, so that more binary sequence codes with different lengths can be formed in a combined mode to adapt to different application requirements. Further, the pseudo-random binary sequence code is generated by a plurality of groups of extracted random numbers, so that the generated binary sequence code has better randomness.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.

Fig. 1 is a block diagram illustrating a pseudo-random binary sequence code generating system according to an embodiment of the present disclosure.

Fig. 2 is a block diagram illustrating a feedback register chain in the pseudo-random binary sequence code generating system according to an embodiment of the present disclosure.

Fig. 3 is a flowchart of a method for generating a pseudo-random binary sequence code according to an embodiment of the present disclosure.

Fig. 4 is a schematic functional block diagram of a pseudo-random binary sequence code generating apparatus according to an embodiment of the present application.

Detailed Description

The technical solution in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.

It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种基于数据状态变化的自动编码数据处理应用设计工具

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类