PN Sequence Generator
Pseudo-noise sequence generator.
Description
The PN Sequence Generator block generates a sequence of pseudo-random binary numbers using a linear feedback shift register (LFSR). Pseudo-random sequences are commonly used for pseudo-random scrambling and in systems with spectrum extended by the direct sequence method. For more information, see. Optional.
Ports
Output
#
Out
—
pseudorandom noise sequence
`binary vector
Details
A PN sequence returned as a binary vector. The output data type is defined by the Output data type parameters.
Data types |
|
Complex numbers support |
No |
Input
#
Rst
—
reset sequence
0
| 1
Details
Reset signal sequence, values can be 0
or 1
. For more information, refer to [Reset Behaviour]. Reset behaviour.
Dependencies
To use this parameter, select the Reset on nonzero input parameters check box.
Data types |
|
Complex numbers support |
No |
#
Mask
—
output mask
`binary vector
Details
The output mask for delaying a PN sequence from the initial time, given as a binary vector with elements . - degree of the generating polynomial.
Dependencies
To use this parameter, set the Output mask source parameter to Input port
.
Data types |
|
Complex numbers support |
No |
Parameters
Main
#
Generator polynomial —
generating polynomial
String
Details
The generating polynomial that defines the shift register feedbacks. Defined as:
-
A character vector or string scalar of the polynomial whose constant term is
1
. -
A binary string vector of length , representing the coefficients of the polynomial in descending degree order. The length of this vector must be equal to , where is the degree of the polynomial. The first and last values must be equal to
1
, indicating a leading term with degree and a constant term equal to1
. -
Integer vector-string specifying the exponents for the non-zero terms of the polynomial in descending order of strength. The last element must be equal to
0
, indicating a constant term equal to1
.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
# Initial states — initial states of the shift register
Details
Initial states of the shift register of the PN-sequence generator when starting the simulation, specified as a binary vector-string. The length of the vector must be equal to the degree of the generating polynomial specified by the Generator polynomial parameters. For more information, see. Simple shift register generator and Polynomial order and shift register orientation.
For a block to generate a non-zero sequence, the vector of the Initial states parameters must contain at least one non-zero element. |
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Output mask source —
output mask source
Dialog parameter
| Input port
Details
An output mask source indicating how the output mask information is passed to the block. Defined as:
-
Dialog parameter
- for usage of the Output mask vector (or scalar shift value) parameters. -
Input port
- for adding and usage of Mask input port.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
# Output mask vector (or scalar shift value) — output mask vector or scalar shift value
Details
The output mask vector or scalar shift value specified as an integer scalar or binary string vector of length , where is the degree of the generating polynomial. This parameter determines the delay of the PN sequence from the initial time. For more information, seePN-sequence start point offset.
Dependencies
To use this parameter, set the Output mask source parameter to Dialog parameter
.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Sample time —
sampling period
Real number
Details
The sampling period of a signal specified as a positive scalar.
-
When set to
-1
, the output signal inherits the sampling time from the downstream signal. For information on the relationship between the Sample time and Samples per frame parameters, refer to Sampling Period.
Example: 1
specifies a sampling period of 1 second
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Samples per frame —
number of samples per frame
Real number
Details
The number of samples per frame in one channel of the output signal, specified as a positive integer. For the relationship between the Sample time and Samples per frame parameters, refer to Sampling Period.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
Yes |
#
Reset on nonzero input —
reset on non-zero input
Logical
Details
Select this check box to add the Rst input port. For details, refer to Reset Behaviour.
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
#
Output data type —
output data type
Float64
| Bool
Details
The output data type specified as Float64
or Bool
.
Values |
|
Default value |
|
Program usage name |
|
Tunable |
No |
Evaluatable |
No |
Additional Info
Simple shift register generator
A linear feedback shift register (LFSR) implemented as a simple shift register generator (SSRG) is used to generate PN sequences. This type of shift register is also known as a Fibonacci implementation.
The polynomial defines the feedbacks of the shift register. It is a primitive binary polynomial . For the quotient , where is from 0
to , the quotient is 1
if there is a link from to the adder. The leading term, , and the constant term, , of the generating polynomial must be equal to 1
because the polynomial must be primitive. At each time step, all registers, , in the generator update their values according to the value of the incoming arrow in the shift register. The adders perform addition modulo 2. The output of the LFSR reflects the sum of all connections in the mask vector .
-
is set by the Generator polynomial parameters.
-
The initial value is set by the Initial states parameters.
-
defines the offset of the PN-sequence start point and is set by the Output mask vector (or scalar shift value)] parameters or by the Mask port.
This table shows two sets of parameters values that correspond to the generating polynomial .
Quantity | Example 1 | Example 2 |
---|---|---|
|
|
|
Degree of the generating polynomial, |
|
|
Initial states |
|
|
Polynomial order and shift register orientation
The implementation orients the shift registers from left to right, with the generating polynomial ( ), initial states, and mask output defined in descending order. Specifically, .
When trying to model and compare results from the literature, you need to understand whether your source uses the same convention or a mirror image of that convention and are defined in ascending order.
*Shift of the starting point of the PN-sequence.
To shift the starting point of a PN sequence, specify the Output mask vector (or scalar shift value) parameters as:
-
An integer representing the length of the shift.
The by default value
0
of the Output mask vector (or scalar shift value) parameter, corresponds to no shift. As shown in the LFSR shift register diagram in Simple shift register generator, there is no shift when the only connection is along the arrow labelled .This table shows the shift that occurs by setting the Output mask vector (or scalar shift value) parameters to
0
compared to a positive integer .
T = 0 |
T = 1 |
T = 2 |
… |
T = |
T = |
|
Shift = |
|
|
|
… |
|
|
Shift = |
|
|
|
… |
|
|
-
A binary vector whose length is equal to the degree of the generating polynomial. The LFSR shift register diagram in Simple shift register generator shows an Output mask vector (or scalar shift value) defined as a mask vector, . The binary vector must contain elements, where is the degree of the generating polynomial.
The binary vector corresponds to a polynomial , of degree no higher than . The mask vector corresponding to a shift on , is a vector that is modulo , where is the generating polynomial.
For example, if the degree of the generating polynomial is 4, then the mask vector corresponding to , is [0 1 0 0 0]
which represents the polynomial .
*♪ Reset behaviour
Before resetting the sequence generator, the Reset on nonzero input parameters must be checked to enable the Rst input port. Assume that the PN Sequence Generator block outputs [1 0 0 0 1 1 0 1 1 0 1 1 1 1]
when there is no reset. This table shows the effect of the specified parameter values on the output of the PN Sequence Generator block.
Reset signal | Parameters for reset signal | PN Sequence Generator unit | Reset signal and output signal |
---|---|---|---|
No reset |
|
|
|
Scalar reset signal |
|
|
|
Vector reset signal |
|
|
In the case of no reset, the block outputs the sequence without reset. For the cases of scalar and vector reset signal, the block supplies a reset signal [0 0 0 0 0 1 0 0 0 0 0 0 0 0]
to the Rst port. Since the fourth bit of the reset signal is 1
and Sample time is 1
, the block resets the sequence output in the fourth bit.
*♪ Sequences of maximum length
To generate a sequence of maximum length for a generating polynomial of degree , set the Generator polynomial parameters to the value from the following table. The maximum length of the sequence is .
r | Generator Polynomial | r | Generator Polynomial | r | Generator Polynomial | r | Generator Polynomial |
---|---|---|---|---|---|---|---|
2 |
|
15 |
|
28 |
|
41 |
|
3 |
|
16 |
|
29 |
|
42 |
|
4 |
|
17 |
|
30 |
|
43 |
|
5 |
|
18 |
|
31 |
|
44 |
|
6 |
|
19 |
|
32 |
|
45 |
|
7 |
|
20 |
|
33 |
|
46 |
|
8 |
|
21 |
|
34 |
|
47 |
|
9 |
|
22 |
|
35 |
|
48 |
|
10 |
|
23 |
|
36 |
|
49 |
|
11 |
|
24 |
|
37 |
|
50 |
|
12 |
|
25 |
|
38 |
|
51 |
|
13 |
|
26 |
|
39 |
|
52 |
|
14 |
|
27 |
|
40 |
|
53 |
|
For details on the shift register configurations that these polynomials represent, see [1].
Sampling period
The time between output updates is equal to the product of the Samples per frame and Sample time parameters. For example, if Sample time and Samples per frame are equal to 1
, the block outputs one sample every second. If you increase Samples per frame to 10
, the block will output a 10 by 1 vector every 10 seconds. This synchronisation ensures that the equivalent output rate is independent of the Samples per frame parameters.