Engee documentation

PN Sequence Generator

A pseudo-noise sequence generator.

blockType: PNSequenceGenerator

Path in the library:

/Communication Systems/Sources/Sequence Generators/PN Sequence Generator

Description

Block PN Sequence Generator generates a sequence of pseudorandom binary numbers using a linear feedback shift register (LFSR). Pseudorandom sequences are commonly used for pseudorandom scrambling and in systems with a spectrum extended by the direct sequence method. For more information, see Additional Info.

Ports

Output

# Out — a sequence of pseudorandom noise
binary vector

Details

The sequence PN returned as a binary vector. The output data type is determined by the parameter Output data type.

Data types

Float64, Bool

Complex numbers support

No

Input

# Rst — the sequence of reset signals
0 | 1

Details

A sequence of reset signals, the values can be 0 or 1. For more information, see Behavior reset.

Dependencies

To use this option, select the option checkbox. Reset on nonzero input.

Data types

Bool

Complex numbers support

No

# Mask — output mask
binary vector

Details

The output mask for the delay of the PN sequence from the initial time, specified as a binary vector with elements . – the degree of the generating polynomial.

Dependencies

To use this parameter, set for the parameter Output mask source meaning Input port.

Data types

Float64

Complex numbers support

No

Parameters

Main

# Generator polynomial — generating polynomial
String

Details

The generating polynomial that defines the feedback of the shift register. Set as:

  • A symbolic vector or a string scalar of a polynomial whose constant member is 1.

  • A binary vector is a string of length , representing the coefficients of the polynomial in descending order of degree. The length of this vector should be equal to , where – the degree of the polynomial. The first and last values must be equal 1, which indicates a leading term with degree and a permanent member, equal to 1.

  • An integer vector is a string specifying exponentials for nonzero terms of a polynomial in descending order of strength. The last element must be equal to 0, which means a permanent 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

The initial states of the shift register of the PN sequence generator at the start of 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 parameter Generator polynomial. For more information, see Simple shift register generator and The order of the polynomial and the orientation of the shift register.

In order for the block to generate a nonzero sequence, the parameter vector Initial states 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 — The source of the output mask
Dialog parameter | Input port

Details

The source of the output mask, indicating how information about the output mask is transmitted to the block. Set as:

  • Dialog parameter – to use the parameter Output mask vector (or scalar shift value).

  • Input port – to add and use the 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 a binary string vector. , where – the degree of the generating polynomial. This parameter determines the delay of the PN sequence from the initial time. For more information, seeOffset of the starting point of the PN sequence.

Dependencies

To use this parameter, set for the parameter Output mask source meaning Dialog parameter.

Default value

0

Program usage name

OutputMaskVector

Tunable

No

Evaluatable

Yes

# Sample time — sampling period
Real number

Details

The sampling period of the signal, specified as a positive scalar.

  • If the value is set to -1, the output signal inherits the sampling time from the lower one. Information about the relationship between the parameters Sample time and Samples per frame see the section Sampling period.

Example

1 sets the sampling period to 1 second

Default value

1

Program usage name

SampleTimeValue

Tunable

No

Evaluatable

Yes

# Samples per frame — number of counts per frame
Real number

Details

The number of samples per frame in one output channel, set as a positive integer. To get information about the relationship between the parameters Sample time and Samples per frame see the section Sampling period.

Default value

1

Program usage name

SamplesPerFrame

Tunable

No

Evaluatable

Yes

# Reset on nonzero input — reset with non-zero input
Logical

Details

Check this box to add the Rst input port. For more information, see the section Behavior reset.

Default value

false (switched off)

Program usage name

Reset

Tunable

No

Evaluatable

No

# Output data type — type of output data
Float64 | Bool

Details

The type of output data 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

To generate PN sequences, a linear feedback shift register (LFSR) is used, implemented as a simple shift register generator (SSRG). This type of shift register is also known as the Fibonacci implementation.

pn sequence generator 1 en

The polynomial defines the feedback of the shift register. This is a primitive binary polynomial. . For the coefficient , where – from 0 before , coefficient equal to 1 if there is a connection from -th register to the adder. The leading member, , and a permanent member, , the generating polynomial must be equal to 1 because the polynomial must be primitive. At each time step, all registers are the generator updates its values according to the value of the incoming arrow in the shift register. Adders perform addition modulo 2. The LFSR output reflects the sum of all connections in the mask vector .

  • is set by the parameter Generator polynomial.

  • Initial value is set by the parameter Initial states.

  • defines the offset of the starting point of the PN sequence and is set by the parameter Output mask vector (or scalar shift value)] or the Mask port.

This table shows two sets of parameter values that correspond to the generating polynomial. .

Quantity Example 1 Example 2

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

g2 = [8 2 0]

Degree of the generating polynomial,

8, which amounts to length(g1)-1

8

Initial states

[1 0 0 0 0 0 1 0]

[1 0 0 0 0 0 1 0]

The order of the polynomial and the orientation of the shift register

The implementation orients the shift registers from left to right, while the generating polynomial ( ), the initial states and the mask output are determined in descending order. In particular, .

When trying to model and compare the results from the literature, you should understand whether your source uses the same convention or a mirror image of that convention and whether they are defined in ascending order.

Offset of the starting point of the PN sequence

To shift the starting point of the PN sequence, specify the parameter Output mask vector (or scalar shift value) how:

  • An integer representing the length of the shift.

    Default value 0 the parameter Output mask vector (or scalar shift value), corresponds to the absence of a shift. As shown in the diagram of the LFSR shift register in Simple shift register generator, there is no shift when the only connection occurs along the arrow indicated by .

    This table shows the shift that occurs when set for the parameter Output mask vector (or scalar shift value) meaning 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. In the diagram of the LFSR shift register in A simple shift register generator is shown Output mask vector (or scalar shift value), set as a vector mask, . The binary vector must contain elements where – the degree of the generating polynomial.

    A binary vector corresponds to a polynomial , degrees not higher than . The mask vector corresponding to the shift by , is a vector that represents modulo , where the generating polynomial.

For example, if the degree of the generating polynomial is 4, then the mask vector corresponding to , this is [0 1 0 0], which represents the polynomial .

Reset behavior

Before resetting the generator sequence, you need to check the option box. Reset on nonzero input to enable the Rst input port. Assume that the block PN Sequence Generator outputs [1 0 0 1 1 0 1 1] when there is no reset. This table shows the effect on the block output. PN Sequence Generator the specified parameter values.

Resetting the signal Signal Reset Parameters Block PN Sequence Generator Signal reset and output signal

There is no reset

  • Value 1 the parameter Sample time

  • Meaning 1 the parameter Samples per frame

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

  • Value 1 the parameter Sample time

  • Meaning 1 the parameter Samples per frame

  • Meaning [1 0 0 1 1 0 1 1] on the Out port

pn sequence generator 2

Scalar reset signal

  • Value 1 the parameter Sample time

  • Meaning 1 the parameter Samples per frame

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

  • Value 1 the parameter Sample time

  • Meaning 1 the parameter Samples per frame

pn sequence generator 3

Vector reset signal

  • Value 1 the parameter Sample time

  • Meaning 8 the parameter Samples per frame

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

  • Value 1 the parameter Sample time

  • Meaning 8 the parameter Samples per frame

If there is no reset, the block outputs the sequence without resetting. For the cases of scalar and vector reset signals, the unit provides a reset signal. [0 0 0 1 0 0 0 0] to the Rst port. Since the fourth bit of the reset signal is 1, and Sample time – This 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 having degree , set for the parameter Generator polynomial the value is 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]

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 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 30 10 0

45

[45 4 3 1 0]

7

[7 6 0]

20

[20 17 0]

33

[33 20 0]

46

[46 21 10 1 0]

8

[8 6 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]

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 6 0]

25

[25 22 0]

38

[38 6 5 1 0]

51

[51 6 3 1 0]

13

[13 12 10 9 0]

26

[26 25 24 20 0]

39

[39 8 0]

52

[52 3 0]

14

[14 13 8 4 0]

27

[27 26 25 22 0]

40

[40 5 4 3 0]

53

[53 6 2 1 0]

For more information about the configurations of the shift registers that these polynomials represent, see [1].

Sampling period

The time between output updates is equal to the product of the parameter values Samples per frame and Sample time. For example, if Sample time and Samples per frame equal 1, the block outputs one count every second. If you increase the value Samples per frame before 10, then the block will output a vector 10×1 every 10 seconds. This synchronization ensures that the equivalent output speed is independent of the parameter. Samples per frame.

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.