Pseudo-random sequence generation method and device, computer equipment and storage medium
By obtaining the target offset value and state transition matrix of the initial pseudo-random sequence for matrix operation, the problem of insufficient efficiency and universality of pseudo-random sequence generation in the prior art is solved, and efficient and general pseudo-random sequence generation is achieved.
Patent Information
- Application Number
- CN202411097425.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-22
AI Technical Summary
The prior art has poor efficiency and versatility when generating pseudo-random sequences, and there are problems with non-university in customized instructions or hardware circuits. The limited register bit width of scalar processors leads to inefficient sequence generation.
By obtaining the target offset value of the initial pseudo-random sequence, the initial state matrix is determined, and matrix operation is performed with the target state transition matrix until the generated pseudo-random sequence length reaches the preset length, improving the generation efficiency and universality of the pseudo-random sequence.
The generation efficiency and versatility of pseudo-random sequences are improved, and the problem of wasting chip area and power consumption of customized hardware circuits is solved, and matrix operations are performed in parallel in vector processors to improve generation efficiency.
Smart Images

Figure CN119002864A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular, to a pseudo-random sequence generation method, apparatus, computer equipment and storage medium. Background Art
[0002] Pseudo-random sequences are widely used in communication systems. In related technologies, most of them use processor custom instructions, dedicated hardware circuits, and processor scalars to generate pseudo-random sequences.
[0003] The method of using custom instructions or special hardware circuits to generate pseudo-random sequences is to customize the pseudo-random sequence according to the pseudo-random sequence generator polynomial specified in the protocol, and to generate corresponding custom instructions or customized hardware circuits according to the changes in the generator polynomial. These custom instructions or customized hardware circuits are not universal. The method of using processor scalars to generate pseudo-random sequences is to use scalar processor instructions to generate them sequentially according to the pseudo-random sequence generator polynomial. However, due to the limited register width of the scalar processor and the sequential generation, it will cause low efficiency. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, computer device and storage medium for generating a pseudo-random sequence.
[0005] A first aspect of an embodiment of the present application provides a method for generating a pseudo-random sequence, comprising:
[0006] Acquire a target offset value of an initial pseudo-random sequence, and determine an initial state matrix in the initial pseudo-random sequence according to the target offset value; wherein the initial state matrix is a sequence after the initial pseudo-random sequence is offset, and a column rank of the initial state matrix is a first preset value;
[0007] Acquire a target state transfer matrix corresponding to the initial pseudo-random sequence, and perform a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation;
[0008] If the length of the post-operation pseudo-random sequence is less than the preset length, the new initial state matrix is used as the initial state matrix, and the target state transfer matrix and the initial state matrix are re-matrixed to obtain a new post-operation pseudo-random sequence, until the sum of the lengths of all current post-operation pseudo-random sequences is not less than the preset length, then the pseudo-random sequence formed by merging all post-operation pseudo-random sequences is determined as the target pseudo-random sequence.
[0009] In an optional embodiment of the present application, determining an initial state matrix in the initial pseudo-random sequence according to the target offset value includes:
[0010] Using the initial pseudo-random sequence elements as input values of a generator polynomial of the initial pseudo-random sequence to obtain corresponding output values;
[0011] Constructing a first initial state matrix starting from an offset value based on each of the output values;
[0012] Merging the first initial state matrices to form an initial state set;
[0013] The first initial state matrix corresponding to the target offset value is obtained by querying from the initial state set, and the first initial state matrix obtained by querying is used as the target initial state matrix.
[0014] In an optional embodiment of the present application, constructing a first initial state matrix starting from an offset value based on each of the output values includes:
[0015] Constructing a subsequent initial state matrix of the initial pseudo-random sequence based on each of the output values;
[0016] Selecting each target sequence element starting from an offset value from the initial pseudo-random sequence and an initial state matrix subsequent to the initial pseudo-random sequence;
[0017] A first initial state matrix is constructed based on each target sequence element.
[0018] In an optional embodiment of the present application, the step of obtaining a target state transfer matrix corresponding to the initial pseudo-random sequence includes:
[0019] A first state transfer matrix is obtained according to the initial state matrix and the state matrix after the initial state matrix is offset by a preset amount; wherein the row rank and column rank of the first state transfer matrix are both first preset values;
[0020] A target state transfer matrix is determined according to the first state transfer matrix; wherein a column rank of the target state transfer matrix is a first preset value.
[0021] In an optional embodiment of the present application, a first state transfer matrix is obtained according to the initial state matrix and the state matrix after the initial state matrix is offset by a preset amount by the following expression:
[0022] [x(n+m)x(n+m+1)…x(n+m+p-1)]=G*[x(n)x(n+1)…x(n+p-1)] T
[0023] Among them, G is the first state transfer matrix, [x(n+m)x(n+m+1)…x(n+m+p-1)] is the state matrix after the initial state matrix is offset with the offset preset amount of m, [x(n)x(n+1)…x(n+p-1)] is the initial state matrix starting from n, and p is the first preset value.
[0024] In an optional embodiment of the present application, determining a target state transfer matrix according to the first state transfer matrix includes:
[0025] Determine a plurality of matrices corresponding to the first state transfer matrix;
[0026] The first row vector in each of the square matrices is used as a row vector of a target state transfer matrix to obtain the target state transfer matrix.
[0027] In an optional embodiment of the present application, performing a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation includes:
[0028] Writing the target state transfer matrix into a first vector register of a preset vector processor;
[0029] According to the instruction of the preset vector processor, the initial state matrix is amplified, and the amplified initial state matrix is written into the second vector register of the preset vector processor;
[0030] According to the instructions of the preset vector processor, a parallel multiplication-addition operation is performed on the target state transfer matrix in the first vector register and the initial state matrix in the second vector register to obtain a pseudo-random sequence after the operation, and the pseudo-random sequence after the operation is written into a third vector register of the preset vector processor.
[0031] A second aspect of the embodiments of the present application provides a pseudo-random sequence generating device, comprising:
[0032] An acquisition module, used to acquire a target offset value of an initial pseudo-random sequence, and determine an initial state matrix in the initial pseudo-random sequence according to the target offset value; wherein the initial state matrix is a sequence after the initial pseudo-random sequence is offset, and a column rank of the initial state matrix is a first preset value;
[0033] An operation module, used for acquiring a target state transfer matrix corresponding to the initial pseudo-random sequence, performing a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation;
[0034] A determination module is used to, if the length of the post-operation pseudo-random sequence is less than a preset length, use a new initial state matrix as the initial state matrix, and re-perform matrix operations on the target state transfer matrix and the initial state matrix to obtain a new post-operation pseudo-random sequence, until the sum of the lengths of all current post-operation pseudo-random sequences is not less than the preset length, then determine the pseudo-random sequence formed by merging all post-operation pseudo-random sequences as the target pseudo-random sequence.
[0035] According to a third aspect of an embodiment of the present application, a computer device is provided, comprising: a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of any of the above pseudo-random sequence generation methods are implemented.
[0036] A fourth aspect of the embodiments of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of any of the above methods for generating a pseudo-random sequence are implemented.
[0037] The above technical solution provided by the embodiment of the present application has at least some or all of the following advantages compared with the prior art:
[0038] The pseudo-random sequence generation method described in the embodiment of the present application obtains a target offset value of an initial pseudo-random sequence, and determines an initial state matrix in the initial pseudo-random sequence according to the target offset value; wherein the initial state matrix is a sequence after the initial pseudo-random sequence is offset, and the column rank of the initial state matrix is a first preset value; a target state transfer matrix corresponding to the initial pseudo-random sequence is obtained, and a matrix operation is performed on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after operation; if the length of the pseudo-random sequence after operation is less than a preset length, a new initial state matrix is used as the initial state matrix, and a matrix operation is performed on the target state transfer matrix and the initial state matrix again to obtain a new pseudo-random sequence after operation, until the sum of the lengths of all the pseudo-random sequences after operation is not less than the preset length, then a pseudo-random sequence formed by merging all the pseudo-random sequences after operation is determined as a target pseudo-random sequence, which can improve the efficiency and versatility of pseudo-random sequence generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0040] Figure 1 A flowchart of a pseudo-random sequence generation method provided in one embodiment of the present application;
[0041] Figure 2A flowchart for the specific implementation of step 100 in the pseudo-random sequence generation method provided in one embodiment of the present application;
[0042] Figure 3 A flowchart for the specific implementation of step 110 in the pseudo-random sequence generation method provided in one embodiment of the present application;
[0043] Figure 4 A flowchart for the specific implementation of step 200 in the pseudo-random sequence generation method provided in one embodiment of the present application;
[0044] Figure 5 A flowchart for the specific implementation of step 200 in the pseudo-random sequence generation method provided in another embodiment of the present application;
[0045] Figure 6 A schematic diagram of the structure of a pseudo-random sequence generation device provided in one embodiment of the present application;
[0046] Figure 7 A schematic diagram of the computer device structure provided for one embodiment of the present application. DETAILED DESCRIPTION
[0047] In the process of implementing the present application, the inventors found that the current method of generating pseudo-random sequences is relatively poor in efficiency and versatility.
[0048] In response to the above problems, embodiments of the present application provide a method, apparatus, computer device, and storage medium for generating a pseudo-random sequence to improve the efficiency and versatility of generating a pseudo-random sequence.
[0049] The solutions in the embodiments of the present application can be implemented using various computer languages, for example, the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0050] In order to make the technical solutions and advantages in the embodiments of the present application more clearly understood, the exemplary embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than an exhaustive list of all the embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0051] See also Figure 1 The pseudo-random sequence generation method provided in the embodiment of the present application includes the following steps 100 to 300:
[0052] Step 100: Obtain a target offset value of an initial pseudo-random sequence, and determine an initial state matrix in the initial pseudo-random sequence according to the target offset value; wherein the initial state matrix is a sequence after the initial pseudo-random sequence is offset, and a column rank of the initial state matrix is a first preset value.
[0053] The initial pseudo-random sequence can be a row or column of multiple elements, for example: x1, x2, x3…x d , when the target offset value is j, the initial state matrix is [x 1+j , x 2+j , x 3+j …x d+j ], the first preset value is d, and the target offset value is used to determine the first element of the initial state matrix. When the first element of the initial pseudo-random sequence is x1, the first element of the initial state matrix is x 1+j The column rank of the initial state matrix is consistent with the number of elements in the initial pseudo-random sequence.
[0054] Step 200: Obtain a target state transfer matrix corresponding to the initial pseudo-random sequence, and perform a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation.
[0055] The target state transfer matrix is constructed by a first state matrix that causes the initial pseudo-random sequence to shift by a preset amount, the row rank of the target state transfer matrix can be the bit width of a preset vector processor for matrix operations, and the column rank of the target state transfer matrix is a first preset value. The matrix operations performed between the target state transfer matrix and the initial state matrix include, but are not limited to, multiplication and addition, etc. For example, the target state transfer matrix is first multiplied by a target preset value to obtain an intermediate state matrix, and the intermediate state matrix is multiplied by the transpose of the initial state matrix; or the target state transfer matrix is directly multiplied by the transpose of the initial state matrix, and so on. In the case where the target state transfer matrix is an m×n matrix and the initial state matrix is a 1×n matrix, the pseudo-random sequence obtained by directly multiplying the target state transfer matrix by the transpose of the initial state matrix is an m×1 matrix.
[0056] Step 300: If the length of the post-operation pseudo-random sequence is less than the preset length, a new initial state matrix is used as the initial state matrix, and the target state transfer matrix and the initial state matrix are re-matrixed to obtain a new post-operation pseudo-random sequence, until the sum of the lengths of all current post-operation pseudo-random sequences is not less than the preset length, then a pseudo-random sequence formed by merging all post-operation pseudo-random sequences is determined as the target pseudo-random sequence.
[0057] Wherein, when the post-operation pseudo-random sequence is an m×1 matrix, the size relationship between the m value and the preset length is compared. When the m value is less than the preset length, it is necessary to continue to generate a new post-operation pseudo-random sequence to form a longer sequence with the original post-operation pseudo-random sequence, and iterate in this way until the sum of the lengths of all current post-operation pseudo-random sequences is not less than the preset length. The new initial state matrix is composed of the first multiple elements in the post-operation pseudo-random sequence, wherein the number of elements constituting the new initial state matrix is the same as the number of elements in the original initial state matrix.
[0058] The pseudo-random sequence generation method of the present application performs matrix operations on the target state transfer matrix and the initial state matrix to obtain a post-operation pseudo-random sequence, and uses the post-operation pseudo-random sequence as part or all of the target pseudo-random sequence. When a generating polynomial changes, a new target state transfer matrix and an initial state matrix corresponding to the changed generating polynomial are obtained, and the two are subjected to matrix operations to generate a target pseudo-random sequence. When the generating polynomial does not change, only the initial state matrix needs to be updated to support the new pseudo-random sequence generation method, thereby improving the versatility of generating pseudo-random sequences. In addition, by performing matrix operations on the target state transfer matrix and the initial state matrix to obtain a post-operation pseudo-random sequence, and using the post-operation pseudo-random sequence as part or all of the target pseudo-random sequence, it provides feasibility for executing matrix operations in parallel in a vector processor. Executing matrix operations in parallel in a vector processor can improve the efficiency of generating pseudo-random sequences.
[0059] In an optional embodiment of the present application, see Figure 2 The above step 100, determining the initial state matrix in the initial pseudo-random sequence according to the target offset value, includes the following steps 110 to 140:
[0060] Step 110: Use the initial pseudo-random sequence element as the input value of the generator polynomial of the initial pseudo-random sequence to obtain corresponding output values. The input value of the generator polynomial of the initial pseudo-random sequence may be the initial pseudo-random sequence element, and the output value of the generator polynomial of the initial pseudo-random sequence may be the subsequent sequence element of the initial pseudo-random sequence, so that the initial pseudo-random sequence is longer.
[0061] Step 120: construct a first initial state matrix starting from the offset value based on each of the output values.
[0062] Among them, there are multiple offset values, which are optional values of the target offset value.
[0063] Step 130: merge the first initial state matrices to form an initial state set.
[0064] The initial state set includes the correspondence between each different offset value and the initial state matrix, and is used to query the first initial state matrix corresponding to the offset value. The initial state set may be an initial state table.
[0065] Step 140: Obtain the first initial state matrix corresponding to the target offset value from the initial state set, and use the first initial state matrix obtained from the query as the target initial state matrix.
[0066] The target offset value is input into the initial state set as a query condition to obtain an initial state matrix corresponding to the target offset value.
[0067] In an optional embodiment of the present application, in step 140, the target offset value is used as the scrambling sequence index. The selection of the target offset value depends on the interference scenario faced by the system. The target offset value can be associated with the satellite number or the satellite beam number, but the number of target offset values is limited. For the satellite protocol standard, different target offset values are obtained according to different satellite numbers or satellite beam numbers, thereby obtaining pseudo-random sequences with different offsets. Different pseudo-random sequences scramble the data of different satellites or satellite beams to resist interference. In the case where the pseudo-random sequence is used to scramble the data of the satellite beam, the target offset value is obtained by the following expression (3):
[0068] n=2^14 *a +36 *b (3)
[0069] Where n is the target offset value, a is the satellite beam number, and b is the satellite number.
[0070] In an optional embodiment of the present application, the first preset value may be the number of elements of the initial pseudo-random sequence.
[0071] The pseudo-random sequence generation method of the present application constructs first initial state matrices corresponding to different offset values, and fuses the first initial state matrices to form an initial state set, so that when a target offset value is determined, the first initial state matrix corresponding to the target offset value in the initial state set can be directly queried without calculation, thereby speeding up the acquisition of the first initial state matrix and improving the generation efficiency of the pseudo-random sequence.
[0072] See also Figure 3 The above step 110, wherein the initial pseudo-random sequence element is used as the input value of the generator polynomial of the initial pseudo-random sequence, and the output value obtained is used to construct the initial state matrix starting from the offset value, includes the following steps 111-113:
[0073] Step 111: construct an initial state matrix subsequent to the initial pseudo-random sequence based on each of the output values.
[0074] The initial pseudo-random sequence is x1, x2, x3…x d In the case of , the output value obtained by inputting the initial pseudo-random sequence element into the generator polynomial of the initial pseudo-random sequence is x d , x d+1 , x d+2 ..., the initial state matrix of the initial pseudo-random sequence is [x d , x d+1 , x d+2 …].
[0075] Step 112: Select target sequence elements starting from an offset value from the initial pseudo-random sequence and an initial state matrix subsequent to the initial pseudo-random sequence.
[0076] In the case of an offset value of r, from [x1, x2, x3…x d , x d+1 , x d+2 …] The target sequence element selected is x 1+r , x 2+r , x 3+r …x d+r .
[0077] Step 113: construct a first initial state matrix based on each target sequence element.
[0078] The initial state matrix starting from the offset value is [x 1+r , x 2+r , x 3+r …x d+r ].
[0079] The pseudo-random sequence generation method of the present application constructs and stores an initial state matrix starting from the offset value in advance for each different offset value, and directly provides the initial state matrix corresponding to the different offset values when the initial state matrix is used to perform matrix operations later, thereby improving the generation efficiency of the pseudo-random sequence.
[0080] In an optional embodiment of the present application, taking the generation of a pseudo-random sequence after superframe scrambling in a digital video broadcasting protocol as an example,
[0081] The generating polynomial of the initial pseudo-random sequence is: 20 +x 3 +1
[0082] Where x is the element of the initial pseudo-random sequence.
[0083] The initial pseudo-random sequence is: x(0) = 1, x(1) = x(2) = ... x(19) = 0
[0084] Wherein, x(0) is the first element of the initial pseudo-random sequence, x(1) is the second element of the initial pseudo-random sequence, x(2) is the third element of the initial pseudo-random sequence, and x(19) is the 20th element of the initial pseudo-random sequence.
[0085] By using the following expression (1), the elements of the pseudo-random sequence subsequent to the initial pseudo-random sequence are determined as:
[0086] x(i+20)=x(i+3)+x(i)mod2,i=0…2 20 -22 (1)
[0087] Wherein, when i=0, the 21st element of the initial pseudo-random sequence is x(20)=x(3)+x(0)mod2; when i=1, the 22nd element of the initial pseudo-random sequence is x(21)=x(4)+x(1)mod2; ... i=2 20 -22, the second of the initial pseudo-random sequence 20 -1 element x(2 20 -2) = x(2 20 -19)+x(2 20 -22)mod2.
[0088] By the following expression (2), it is determined that the digital video broadcasting system requires the generation of the elements of the initial state matrix starting from the offset value n as:
[0089] x((i+n)mod2 20 -1), i=0…2 20 -22 (2)
[0090] When i=0, the first element of the initial state matrix starting from the offset value n is x((n) mod2 20 -1); when i=1, the second element of the initial pseudo-random sequence is x((n+1)mod2 20 -1); ... i = 2 20 -22, the second of the initial pseudo-random sequence 20 -21 elements are x((n+2 20 -22)mod2 20 -1).
[0091] In an optional embodiment of the present application, according to a limited offset value n, an initial pseudo-random sequence and a generator polynomial, an initial state matrix with a bit width of P starting from n and having n values is obtained in advance. For example, there are 128 values of n and P is 1024. Then, only a 16kB initial state set needs to be pre-stored. The initial state set can be an initial state table, which is placed in an external memory. When used, only the initial state matrix with a bit width of P corresponding to the n value needs to be written from the initial state table of the external memory according to the currently configured n value. The initial state matrix can be recorded as X(n) 1*P =[x(n)x(n+1)…x(n+P-1)], the vector dimension is 1*P.
[0092] In an optional embodiment of the present application, see Figure 4 In the above step 200, the step of obtaining the target state transfer matrix corresponding to the initial pseudo-random sequence includes steps 210 to 220:
[0093] Step 210: Obtain a first state transfer matrix according to the initial state matrix and the state matrix after the initial state matrix is offset by a preset amount; wherein the row rank and column rank of the first state transfer matrix are both first preset values.
[0094] Wherein, when [x(n)x(n+1)…x(n+p-1)] is the initial state matrix starting from n, [x(n+m)x(n+m+1)…x(n+m+p-1)] is the state matrix after the initial state matrix is shifted when the shift preset amount is m. The first state transfer matrix is used to shift the initial state matrix by a preset amount.
[0095] The first state transfer matrix is obtained by the following expression (4) according to the initial state matrix and the state matrix after the initial state matrix is shifted by a preset amount:
[0096] [x(n+m) x(n+m+1) … x(n+m+p-1)]=G*[x(n) x(n+1) … x(n+p-1)] T (4)
[0097] Among them, G is the first state transfer matrix, [x(n+m)x(n+m+1)…x(n+m+p-1)] is the state matrix after the initial state matrix is offset with the offset preset amount of m, [x(n)x(n+1)…x(n+p-1)] is the initial state matrix starting from n, and p is the first preset value.
[0098] The pseudo-random sequence generation method of the present application obtains a first state transfer matrix, which is used to determine a target state transfer matrix, and further generates a target pseudo-random sequence based on the target state transfer matrix. The target pseudo-random sequence can be quickly generated through the state transfer matrix, thereby improving the generation efficiency of the target pseudo-random sequence.
[0099] Step 220: determine a target state transfer matrix according to the first state transfer matrix; wherein the row rank of the target state transfer matrix may be a bit width of a preset vector processor, and the column rank of the target state transfer matrix may be a first preset value.
[0100] In an optional embodiment of the present application, in step 220, determining a target state transfer matrix according to the first state transfer matrix includes:
[0101] Determine a plurality of matrices corresponding to the first state transfer matrix;
[0102] The first row vector in each of the square matrices is used as a row vector of a target state transfer matrix to obtain the target state transfer matrix.
[0103] For example, the matrix G is determined according to the first state transfer matrix G p G p+1 …G 2p-1 , and then transform the P matrices G p G p+1 …G 2p-1 The first row in is used as the row vector of the target state transfer matrix to obtain the target state transfer matrix.
[0104] The pseudo-random sequence generation method of the present application uses the first row vector in each of the square matrices as the row vector of the target state transfer matrix, so that the target state transfer matrix and the initial state matrix perform matrix operations to obtain a post-operation pseudo-random sequence. The post-operation pseudo-random sequence of a preset length can be obtained through only one matrix operation, which can improve the generation efficiency of the pseudo-random sequence.
[0105] In an optional embodiment of the present application, the first state transfer matrix with the first preset value being 20 and the offset preset amount being 1 is determined by the following expression (5):
[0106] [x(n+1) x(n+2) … x(n+20)]=G1*[x(n) x(n+1) … x(n+19)] T (5)
[0107] Wherein, G1 is a first state transfer matrix with a first preset value of 20 and a preset offset of 1, [x(n+1)x(n+2)…x(n+20)] is an initial state matrix starting from n+1 when the first preset value is 20, and [x(n)x(n+1)…x(n+19)] is an initial state matrix starting from n when the first preset value is 20,
[0108]
[0109] Among them, [g0, g1, g2, ...., g 19 ]=[10010 00000 00000 00000], G1 is the first state transfer matrix of 20*20, and the continuous 20-bit length pseudo-random sequence starting from x(n+P) is obtained by the following expression (6):
[0110] X(n+P) 1*20 =[x(n+P)x(n+P+1)…x(n+P+19)]=G1 p *[x(n)x(n+1)…x(n+19)] T (6)
[0111] Among them, G1 p It is the Pth power of the G1 matrix, with a dimension of 20*20, X(n+P) 1*20 and [x(n+P)x(n+P+1)…x(n+P+19)] are both pseudo-random sequences of 20 bits starting from x(n+P), and [x(n)x(n+1)…x(n+19)] is a pseudo-random sequence of 20 bits starting from x(n).
[0112] The continuous 20-bit pseudo-random sequence starting from x(n+2P-1) is obtained by the following expression (7):
[0113] X(n+2P-1) 1*20 =[x(n+2P-1)x(n+2P)…x(n+2P+18)]=G1 2p-1 *[x(n)x(n+1)…x(n+19)] T (7)
[0114] Among them, G1 2p-1 It is the 2P-1 power of the G1 matrix, with a dimension of 20*20, X(n+2P-1) 1*20 and [x(n+2P-1)x(n+2P)…x(n+2P+18)] are both pseudo-random sequences with a continuous length of 20 bits starting from x(n+2P-1), and [x(n)x(n+1)…x(n+19)] is a pseudo-random sequence with a continuous length of 20 bits starting from x(n).
[0115] The pseudo-random sequence generation method of the present application constructs a target state transfer matrix based on an initial state matrix, and generates a pseudo-random sequence after operation according to the target state transfer matrix. After the generator polynomial of the pseudo-random sequence is changed, the pseudo-random sequence can also be generated in the same hardware circuit, thereby solving the problem of wasting chip area and power consumption caused by customized hardware circuits in related technologies.
[0116] In an optional embodiment of the present application, see Figure 5 The above step 200, performing a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation, includes steps 230-250:
[0117] Step 230: Write the target state transfer matrix into a first vector register of a preset vector processor.
[0118] Step 240: According to the instruction of the preset vector processor, the initial state matrix is amplified, and the amplified initial state matrix is written into the second vector register of the preset vector processor.
[0119] In the initial state matrix [x 1+r , x 2+r , x 3+r …x d+r ], the initial state matrix after expansion is Among them, the column rank of the expanded initial state matrix is equal to the row rank of the target state transfer matrix.
[0120] Step 250: According to the instruction of the preset vector processor, a parallel multiplication-accumulation operation is performed on the target state transfer matrix in the first vector register and the initial state matrix in the second vector register to obtain a pseudo-random sequence after the operation, and the pseudo-random sequence after the operation is written into the third vector register of the preset vector processor.
[0121] In the initial state matrix [x 1+r , x 2+r , x 3+r …x d+r ], when the target state transfer matrix is In this case, after the product and accumulation of the target state transfer matrix and the transpose of the initial state matrix, the element of the first row and first column in the obtained matrix is x 1+r *0+x 2+r *1+…+x d+r *0, and so on for other elements.
[0122] When the first preset value is 20, in order to obtain the pseudo-random sequence X(n+P) with a subsequent bit width of P starting from x(n+P) 1*20 , the state transfer matrix T with parallelism P can be constructed in advance p , the dimension is P*20, and the row vector of each row is from P matrices G1 p G1 p+1 …G1 2p-1 Extract the first row from the matrix to construct the target state transfer matrix T with a parallelism of P. p .
[0123] In an optional embodiment of the present application, in order to obtain a pseudo-random sequence after operation, the target state transfer matrix T with a dimension of P*20 is p Pre-store, and use the following expression (8) to convert the target state transfer matrix T p Perform matrix-vector product with the initial state matrix to obtain the pseudo-random sequence of the next P bits after operation starting from x(n+P):
[0124] X(n+P) 1*P =[x(n+P)x(n+P+1)…x(n+2P-1)]=T p *[x(n)x(n+1)…x(n+19)] T (8)
[0125] Among them, Tp is the target state transfer matrix, X(n+P) 1*P and [x(n+P)x(n+P+1)…x(n+2P-1)] are both pseudo-random sequences of continuous P bits in length starting from x(n+P), and [x(n)x(n+1)…x(n+19)] is a pseudo-random sequence of continuous 20 bits in length starting from x(n).
[0126] Therefore, in order to obtain a P-bit pseudo-random sequence after operation in parallel, it is only necessary to perform a matrix multiplication operation on a matrix with a dimension of P*20 and an initial state matrix with a current dimension of 20*1. In addition, the parallelism P can be set according to the vector register bit width of the current vector processor. For example, if the VR bit width is 1024 bits, then P can be set to 1024. The matrix-vector multiplication operation is implemented in parallel using vector processor instructions, including the following steps:
[0127] The state transfer matrix T with a pre-stored dimension of 1024*20 p Write into vector register VR0 in 20 beats respectively;
[0128] The initial state matrix with a dimension of 1*20 is repeatedly filled into the entire 1024-bit wide vector register with each bit in the initial state matrix in 20 beats using vector processor instructions;
[0129] The following expression (9) is used to complete the matrix-vector multiplication and accumulation through bitwise AND and XOR operations, and the multiplication and accumulation results are written into the vector register:
[0130] VR2 = VR2 ^ (VR0 & VR1) (9)
[0131] Among them, VR2 is the multiplication and accumulation result, VR0 is the state transfer matrix, and VR1 is the initial state matrix.
[0132] After 20 instruction cycles of iterative operations, the multiplication of a 1024*20 bit matrix and a 20*1 bit vector can be obtained, and a 1024-bit pseudo-random sequence can be output. A single processing unit can output 1024 / 20=51.2 bits of data in a single instruction cycle. Considering the parallel processing of multiple functional units of the vector processor, the pseudo-random sequence generation can be completed more efficiently, solving the problem of the inability to meet the system processing delay caused by the pseudo-random sequence generation process of the processor scalar processing in the related technology.
[0133] In an optional embodiment of the present application, if the length of the pseudo-random sequence after the first output operation does not meet the length requirement N, then the new initial state matrix is the pseudo-random sequence output result after the previous operation [x(n+P)x(n+P+1)…x(n+P+19)], and the target state transfer matrix T is continued through the following expression (10). p Multiply with the initial state matrix:
[0134] X(n+2P) 1*P =[x(n+2P)x(n+2P+1)…x(n+3P-1)]=T p *[x(n)x(n+1)…x(n+19)] T (10)
[0135] Among them, T p is the target state transfer matrix, X(n+2P) 1*P and [x(n+2P)x(n+2P+1)…x(n+3P-1)] are both pseudo-random sequences with a length of P bits starting from x(n+2P), and [x(n)x(n+1)…x(n+19)] is a pseudo-random sequence with a length of 20 bits starting from x(n).
[0136] The pseudo-random sequence generation method of the present application can utilize the very long instruction word technology of the vector processor to simultaneously use multiple processing units in parallel to process the matrix and vector multiplication of the bit domain, and use the single instruction stream multiple data stream instruction so that each instruction can execute a group of vector data in parallel, so that P-bit vector data can be executed in parallel, so that the generation processing of the pseudo-random sequence can be executed in parallel, improving the efficiency. At the same time, after the generator polynomial of the pseudo-random sequence is changed, only the state transfer matrix T needs to be updated. p It can support the generation of new pseudo-random sequences, and the degree of parallelism can also be modified according to the vector register bit width of the specific vector processor, which only requires modifying T p A matrix is sufficient, so it is more versatile.
[0137] It should be understood that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0138] See also Figure 6 , an embodiment of the present application provides a pseudo-random sequence generating device 600, comprising:
[0139] An acquisition module 610 is used to acquire a target offset value of an initial pseudo-random sequence, and determine an initial state matrix in the initial pseudo-random sequence according to the target offset value; wherein the initial state matrix is a sequence after the initial pseudo-random sequence is offset, and a column rank of the initial state matrix is a first preset value;
[0140] An operation module 620 is used to obtain a target state transfer matrix corresponding to the initial pseudo-random sequence, and perform a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation;
[0141] The determination module 630 is used to, if the length of the post-operation pseudo-random sequence is less than a preset length, use a new initial state matrix as the initial state matrix, and re-perform matrix operations on the target state transfer matrix and the initial state matrix to obtain a new post-operation pseudo-random sequence, until the sum of the lengths of all current post-operation pseudo-random sequences is not less than the preset length, then determine the pseudo-random sequence formed by merging all post-operation pseudo-random sequences as the target pseudo-random sequence.
[0142] In an optional embodiment of the present application, the acquisition module 610 is further used for:
[0143] Using the initial pseudo-random sequence element as an input value of a generator polynomial of the initial pseudo-random sequence, and using the obtained output value to construct an initial state matrix starting from an offset value;
[0144] Constructing an initial state set based on initial state matrices corresponding to a plurality of different offset values;
[0145] An initial state matrix corresponding to the target offset value is obtained by querying from the initial state set.
[0146] In an optional embodiment of the present application, the acquisition module 610 is further used for:
[0147] Using the initial pseudo-random sequence elements as input values of a generator polynomial of the initial pseudo-random sequence, and using the obtained output values to construct a subsequent initial state matrix of the initial pseudo-random sequence;
[0148] A target sequence element is selected from the initial pseudo-random sequence and an initial state matrix subsequent to the initial pseudo-random sequence as an element of the initial state matrix starting from the offset value.
[0149] In an optional embodiment of the present application, the operation module 620 is further configured to:
[0150] A first state transfer matrix is obtained according to the initial state matrix and the state matrix after the initial state matrix is offset by a preset amount; wherein the row rank and column rank of the first state transfer matrix are both first preset values;
[0151] A target state transfer matrix is determined according to the first state transfer matrix; wherein a column rank of the target state transfer matrix is a first preset value.
[0152] In an optional embodiment of the present application, in the operation module 620, a first state transfer matrix is obtained according to the initial state matrix and the state matrix after the initial state matrix is offset by a preset amount by the following expression (4):
[0153] [x(n+m) x(n+m+1) … x(n+m+p-1)]=G*[x(n) x(n+1) … x(n+p-1)] T (4)
[0154] Among them, G is the first state transfer matrix, [x(n+m)x(n+m+1)…x(n+m+p-1)] is the state matrix after the initial state matrix is offset with the offset preset amount of m, [x(n)x(n+1)…x(n+p-1)] is the initial state matrix starting from n, and p is the first preset value.
[0155] In an optional embodiment of the present application, the operation module 620 is further configured to:
[0156] Determine the matrix G according to the first state transfer matrix G p G p+1 …G 2p-1 ;
[0157] Respectively put P matrices G p G p+1 …G 2p-1 The first row in is used as the row vector of the target state transfer matrix to obtain the target state transfer matrix.
[0158] In an optional embodiment of the present application, the operation module 620 is further configured to:
[0159] Writing the target state transfer matrix into a first vector register of a preset vector processor;
[0160] According to the instruction of the preset vector processor, the initial state matrix is amplified, and the amplified initial state matrix is written into the second vector register of the preset vector processor;
[0161] According to the instructions of the preset vector processor, a parallel multiplication-addition operation is performed on the target state transfer matrix in the first vector register and the initial state matrix in the second vector register to obtain a pseudo-random sequence after the operation, and the pseudo-random sequence after the operation is written into a third vector register of the preset vector processor.
[0162] For the specific definition of the pseudo-random sequence generation device 600, please refer to the definition of the pseudo-random sequence generation method in the above text, which will not be repeated here. Each module in the pseudo-random sequence generation device 600 can be implemented in whole or in part by software, hardware and a combination thereof. Each of the modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the modules above.
[0163] In one embodiment, a computer device is provided, the internal structure diagram of which can be as follows: Figure 7As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a pseudo-random sequence generation method as described above is implemented. It includes: a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, any step in the pseudo-random sequence generation method as described above is implemented.
[0164] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any step in the above pseudo-random sequence generation method can be implemented.
[0165] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0166] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0167] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.
[0168] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0169] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0170] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for generating a pseudo-random sequence, characterized in that: include: Acquire a target offset value of an initial pseudo-random sequence, and determine an initial state matrix in the initial pseudo-random sequence according to the target offset value; wherein the initial state matrix is a sequence after the initial pseudo-random sequence is offset, and a column rank of the initial state matrix is a first preset value; Acquire a target state transfer matrix corresponding to the initial pseudo-random sequence, and perform a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation; If the length of the post-operation pseudo-random sequence is less than the preset length, the new initial state matrix is used as the initial state matrix, and the target state transfer matrix and the initial state matrix are re-matrixed to obtain a new post-operation pseudo-random sequence, until the sum of the lengths of all current post-operation pseudo-random sequences is not less than the preset length, then the pseudo-random sequence formed by merging all post-operation pseudo-random sequences is determined as the target pseudo-random sequence.
2. The method according to claim 1, characterized in that The step of determining an initial state matrix in the initial pseudo-random sequence according to the target offset value comprises: Using the initial pseudo-random sequence elements as input values of a generator polynomial of the initial pseudo-random sequence to obtain corresponding output values; Constructing a first initial state matrix starting from an offset value based on each of the output values; Merging the first initial state matrices to form an initial state set; The first initial state matrix corresponding to the target offset value is obtained by querying from the initial state set, and the first initial state matrix obtained by querying is used as the target initial state matrix.
3. The method according to claim 2, characterized in that The constructing a first initial state matrix starting from the offset value based on each of the output values comprises: constructing an initial state matrix subsequent to the initial pseudo-random sequence based on each of the output values; Selecting each target sequence element starting from an offset value from the initial pseudo-random sequence and an initial state matrix subsequent to the initial pseudo-random sequence; A first initial state matrix is constructed based on each target sequence element.
4. The method according to claim 1, characterized in that: The obtaining of a target state transfer matrix corresponding to the initial pseudo-random sequence comprises: A first state transfer matrix is obtained according to the initial state matrix and the state matrix after the initial state matrix is offset by a preset amount; wherein the row rank and column rank of the first state transfer matrix are both first preset values; A target state transfer matrix is determined according to the first state transfer matrix; wherein a column rank of the target state transfer matrix is a first preset value.
5. The method according to claim 4, characterized in that The first state transfer matrix is obtained according to the initial state matrix and the state matrix after the initial state matrix is offset by a preset amount through the following expression: [x(n+m)x(n+m+1)…x(n+m+p-1)]=G*[x(n)x(n+1)…x(n+p-1)] T Among them, G is the first state transfer matrix, [x(n+m)x(n+m+1)…x(n+m+p-1)] is the state matrix after the initial state matrix is offset with the offset preset amount of m, [x(n)x(n+1)…x(n+p-1)] is the initial state matrix starting from n, and p is the first preset value.
6. The method according to claim 4, characterized in that The determining a target state transfer matrix according to the first state transfer matrix includes: Determine a plurality of matrices corresponding to the first state transfer matrix; The first row vector in each of the square matrices is used as a row vector of a target state transfer matrix to obtain the target state transfer matrix.
7. The method according to claim 1, characterized in that The step of performing a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation includes: Writing the target state transfer matrix into a first vector register of a preset vector processor; Amplifying the initial state matrix according to the instruction of the preset vector processor, and writing the amplified initial state matrix into the second vector register of the preset vector processor; According to the instruction of the preset vector processor, a parallel multiplication-addition operation is performed on the target state transfer matrix in the first vector register and the initial state matrix in the second vector register to obtain a pseudo-random sequence after the operation, and the pseudo-random sequence after the operation is written into a third vector register of the preset vector processor.
8. A pseudo-random sequence generating device, characterized in that: include: An acquisition module, used to acquire a target offset value of an initial pseudo-random sequence, and determine an initial state matrix in the initial pseudo-random sequence according to the target offset value; wherein the initial state matrix is a sequence after the initial pseudo-random sequence is offset, and a column rank of the initial state matrix is a first preset value; An operation module, used for acquiring a target state transfer matrix corresponding to the initial pseudo-random sequence, performing a matrix operation on the target state transfer matrix and the initial state matrix to obtain a pseudo-random sequence after the operation; A determination module is used to, if the length of the post-operation pseudo-random sequence is less than a preset length, use a new initial state matrix as the initial state matrix, and re-perform matrix operations on the target state transfer matrix and the initial state matrix to obtain a new post-operation pseudo-random sequence, until the sum of the lengths of all current post-operation pseudo-random sequences is not less than the preset length, then determine the pseudo-random sequence formed by merging all post-operation pseudo-random sequences as the target pseudo-random sequence.
9. A computer device comprising: The method comprises a memory and a processor, wherein the memory stores a computer program, and wherein the processor implements the steps of the pseudo-random sequence generation method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the pseudo-random sequence generation method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Floating point continuous accumulation method and adder
CN120653221A
Multi-matrix double randomization method and device based on vector processor and electronic equipment
CN122451257A
