Engee documentation

PN Sequence Generator

Pseudo-noise sequence generator.

pn 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

Float64.

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

Boolean.

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

Float64.

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 to 1.

  • 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 to 1.

Default value

z^6 + z + 1

Program usage name

GeneratorPolynomial

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

[0 0 0 0 0 1]

Program usage name

InitialStates

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

Dialog parameter | Input port

Default value

Dialog parameter

Program usage name

OutputMaskSource

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

0

Program usage name

OutputMaskVector

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

1

Program usage name

SampleTimeValue

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

1

Program usage name

SamplesPerFrame

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

false (switched off)

Program usage name

Reset

Tunable

No

Evaluatable

No

# Output data type — output data type
Float64 | Bool

Details

The output data type specified as Float64 or Bool.

Values

Float64 | Bool

Default value

Float64

Program usage name

OutputDataType

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.

pn sequence generator 1 en

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

g1 = [1 0 0 0 0 0 0 0 0 0 1 0 1 0 1]

g2 = [8 2 0]

Degree of the generating polynomial,

8, which is length(g1)-1

8

Initial states

[1 0 0 0 0 0 0 0 0 0 0 1 0]

[1 0 0 0 0 0 0 0 0 0 1 0]

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

  • Value 1 of Sample time parameters

  • Value 1 of parameters Samples per frame

  • Value [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] on the Rst port

  • Value 1 of the Sample time parameters

  • Value 1 of the parameter Samples per frame

  • Value [1 0 0 0 1 1 0 1 1 1 1] on the Out port.

pn sequence generator 2

Scalar reset signal

  • Value 1 of Sample time parameters

  • Value 1 of the Samples per frame parameters

  • Value [0 0 0 0 0 1 1 0 0 0 0 0 0] on the Rst port

  • Value 1 of the Sample time parameters

  • Value 1 of the Samples per frame parameters.

pn sequence generator 3

Vector reset signal

  • Value 1 of Sample time parameters

  • Value 8 of Samples per frame parameters

  • Value [0 0 0 0 0 1 0 0 0 0 0 0 0] on the Rst port

  • Value 1 of the Sample time parameters

  • Value 8 of the Samples per frame parameters

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

[2 1 0 0]

15

[15 14 0]

28

[28 25 0]

41

[41 3 0]

3

[3 2 0]

16

[16 15 13 4 0]

29

[29 27 0]

42

[42 23 22 1 0]

4

[4 3 0]

17

[17 14 0]

30

[30 29 29 28 7 0]

43

[43 6 4 3 0]

5

[5 3 0]

18

[18 11 0]

31

[31 28 0]

44

[44 6 5 2 0]

6

[6 5 0]

19

[19 18 17 14 0]

32

[32 31 31 30 10 0]

45

[45 4 3 1 0]

7

[7 6 6 0]

20

[20 17 0]

33

[33 20 0]

46

[46 21 10 10 1 0]

8

[8 6 5 5 4 0]

21

[21 19 0]

34

[34 15 14 1 0]

47

[47 14 0]

9

[9 5 0]

22

[22 21 0]

35

[35 2 0]

48

[48 28 27 1 0]

10

[10 7 0 0]

23

[23 18 0]

36

[36 11 0]

49

[49 9 0]

11

[11 9 0]

24

[24 23 22 17 0]

37

[37 12 10 2 0]

50

[50 4 3 2 0]

12

[12 11 8 8 6 0]

25

[25 22 0]

38

[38 6 5 5 1 0]

51

[51 6 3 1 0]

13

[13 12 10 9 9 0]

26

[26 25 24 24 20 0]

39

[39 8 0]

52

[52 3 0]

14

[14 13 8 8 4 0]

27

[27 26 25 22 0]

40

[40 5 4 3 0]

53

[53 6 2 1 0]

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.

Literature

  1. Proakis, John G. "Digital Communications." 5th ed. New York: McGraw Hill, 2007.

  2. Lee, J. S., and L. E. Miller. "CDMA Systems Engineering Handbook." Boston and London. Artech House, 1998.

  3. Golomb, S.W.. "_Shift Register Sequences. Laguna Hills. Aegean Park Press, 1967.