Pseudo-random Binary Sequence (PRBS) Generator (prbs_generator_b)

Generates a stream of pseudo-random boolean symbols.

Design

A pseudo-random binary sequence (PRBS) is a deterministic sequence that is statistically similar to a truly random sequence.

PRBS generators are typically implemented using Linear Feedback Shift Registers (LFSR). A polynomial specifies which taps of the LFSR are used as feedback to generate the next input. Polynomials that generate maximum length sequences are typically used as they provide the longest period before the PRBS pattern repeats. The length of a maximum length PRBS pattern is \(2^n-1\), where \(n\) is the order of the LFSR polynomial.

Two examples of the LSFR PRBS generator implementation, for different polynomials are in Figure 382: and Figure 383:.

Arrangement of feedback registers to implement PRBS generator.

Figure 382: Fibonacci style LSFR PRBS generator implementing the polynomial \(x^n + x^d + 1\).

Arrangement of feedback registers to implement PRBS generator.

Figure 383: Fibonacci style LSFR PRBS generator implementing the polynomial \(x^n + x^e + x^d + 1\).

In both Figure 382: and Figure 383:, at the end of the chain of shift registers \(y\) is the output point.

In some applications it is desirable to start the PRBS at a specific point in the sequence. This can be done via setting the initial_seed property. Additionally, in some applications is is desirable to invert the feedback used by the LFSR. This can be done via the invert_output property.

A PRBS will output all possible \(n\) bit values except the all zeros pattern, or if the invert_output property is true, the all ones pattern.

When invert_output is false, if the initial_seed property is set to zero, the PRBS generator will only output zeros. When invert_output is true, if the initial_seed property is set to all ones, the PRBS generator will only output ones. For all other values of initial_seed the PRBS generator will output the sequence specified by the polynomial_taps property starting at the specified seed value.

In this application the most significant bit of the LFSR is used as the source of the PRBS, and is output as a boolean stream.

Interface

<?xml version="1.0"?>
<componentspec>
  <property name="polynomial_taps" type="uchar" arraylength="6" parameter="true" default="31,28"
    description="Taps of PRBS polynomial."/>
  <property name="enable" type="bool" writable="true" default="1" description="When true the PRBS generator is enabled."/>
  <property name="invert_output" type="bool" writable="true" default="0" description="When true the output is inverted."/>
  <property name="initial_seed" type="ulong" writable="true" default="0x55555555" description="Initial seed for the PRBS generator."/>
  <property name="message_length" type="ushort" writable="false" initial="true" default="16384"
    description="Output message length. Must not be 0."/>
  <port name="output" producer="true" protocol="bool_timed_sample-prot"/>
</componentspec>

Ports

Inputs:

None.

Outputs:

  • output: Primary output samples port.

    • Protocol: bool_timed_sample-prot

    • Optional: False

Opcode Handling

The worker will output a zero length message with the discontinuity opcode whenever the enable property is changed from true to false. This is because the PRBS generator is reset when disabled which causes a discontinuity in the PRBS.

Properties

  • polynomial_taps: Taps of PRBS polynomial. Is an array of up to six unsigned chars, meaning a maximum of six taps can be specified. If the PRBS polynomial is \(x^7+x^6+1\) then polynomial_taps should be set to 7,6. There is no need to specify the \(x^0\) term as this is implied.

    • Type: uchar

      • Array dimensions: ['6']

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

    • Default value: 31,28

  • enable: When true the PRBS generator is enabled.

    • Type: bool

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: 1

  • invert_output: When true the output is inverted.

    • Type: bool

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: 0

  • initial_seed: Initial seed for the PRBS generator.

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: True

      • Initial: False

      • Volatile: False

    • Default value: 0x55555555

  • message_length: Output message length. Must not be 0.

    • Type: ushort

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: True

      • Volatile: False

    • Default value: 16384

The below table gives the polynomials the component is built for.

Polynomial

polynomial_taps

Period

\(x^7 + x^6 + 1\)

7, 6

127

\(x^9 + x^5 + 1\)

9, 5

511

\(x^{11} + x^9 + 1\)

11, 9

2,047

\(x^{15} + x^{14} + 1\)

15, 14

32,767

\(x^{16} + x^{14} + x^{13} + x^{11} + 1\)

16, 14, 13, 11

65,535

\(x^{17} + x^{14} + 1\)

17, 14

131,071

\(x^{20} + x^3 + 1\)

20, 3

1,948,575

\(x^{23} + x^{18} + 1\)

23, 18

8,388,607

\(x^{29} + x^{27} + 1\)

29, 27

536,870,911

\(x^{31} + x^{28} + 1\)

31, 28

2,147,483,647

Implementations

  • prbs_generator_b (HDL)

    A Fibonacci LFSR HDL implementation. This is sometimes referred to as a backwards counter LFSR implementation. The alternative LFSR implementation is known as a Galois LFSR. Fibonacci and Galois LFSRs will output a different sequence for the same polynomial and initial value. To achieve the same sequence in a Galois LFSR as with a Fibonacci LFSR, subtract each of the tap values from the polynomial order. For example a Fibonacci LFSR with polynomial \(x^7 + x^6 + 1\) is equivalent to a Galois LFSR with polynomial \(x^7 + x^1 + 1\).

Example Application

<?xml version="1.0"?>
<application done="file_write">
  <instance component="ocpi.comp.sdr.generator.prbs_generator_b" connect="file_write">
    <property name="enable" value="true"/>
    <property name="invert_output" value="true"/>
    <property name="initial_seed" value="0x55555555"/>
    <property name="polynomial_taps" value="31,28"/>
  </instance>
  <instance component="ocpi.core.file_write">
    <property name="filename" value="output.bin"/>
  </instance>
</application>

Dependencies

The dependencies to other elements in OpenCPI are:

There is also a dependency on:

  • ieee.std_logic_1164

  • ieee.numeric_std

  • ieee.math_real

Limitations

Limitations of prbs_generator_b are:

  • A maximum of 6 taps can be specified. i.e. \(x^a + x^b + x^c + x^d + x^e + x^f + 1\)

Testing

Tested platforms: None

Component testing not completed.