PRBS

The Prbs class provides both a PRBS transmitter and receiver.

Python binding

This C++ class is also exported into Python as rogue.utilities.Prbs.

Python API page: - Prbs

Prbs objects in C++ are referenced by the following shared pointer typedef:

typedef std::shared_ptr<rogue::utilities::Prbs> rogue::utilities::PrbsPtr
[header]

The class description is shown below:

class Prbs : public rogue::interfaces::stream::Slave, public rogue::interfaces::stream::Master
[header]

PRBS generator/checker that can act as both stream master and slave.

The engine can transmit deterministic pseudo-random patterns and verify received patterns for bit-error testing. It supports one-shot frame generation and optional background transmit mode.

Threading model:

  • Receive checking executes synchronously in the thread calling acceptFrame().

  • Optional periodic transmit mode (enable()) runs in an internal TX thread that repeatedly calls genFrame().

  • Counters, LFSR state, and configuration shared between RX/TX paths are protected by an internal mutex.

Public Functions

Prbs()
[header] [impl]

Constructs a PRBS instance with default taps and width.

Creator with default taps and size.

This constructor is a low-level C++ allocation path. Prefer create() when shared ownership or Python exposure is required.

~Prbs()
[header] [impl]

Destroys the PRBS instance and stops background generation.

Deconstructor.

void setWidth(uint32_t width)
[header] [impl]

Sets generator/checker data width.

Set width.

Parameters:

width – Data width in bits.

void setTaps(uint32_t tapCnt, uint8_t *taps)
[header] [impl]

Configures LFSR taps.

Set taps.

Parameters:
  • tapCnt – Number of tap entries in taps.

  • taps – Pointer to tap index array.

void setTapsPy(boost::python::object p)
[header] [impl]

Configures LFSR taps from a Python sequence.

Set taps, python.

Parameters:

p – Python object containing tap values.

void sendCount(bool state)
[header] [impl]

Enables or disables transmission of sequence counters in payload.

Send counter value.

Parameters:

state – True to include counters in generated data.

void genFrame(uint32_t size)
[header] [impl]

Generates and transmits one PRBS frame.

Generate a data frame.

Parameters:

size – Payload size in bytes.

void enable(uint32_t size)
[header] [impl]

Enables periodic background frame generation.

Auto run data generation.

Starts an internal TX worker thread if one is not already running. Generated frames use the configured TX period from setTxPeriod().

Parameters:

size – Payload size in bytes for generated frames.

void disable()
[header] [impl]

Disables periodic background frame generation.

Disable auto generation.

Stops and joins the internal TX worker thread started by enable().

bool getRxEnable()
[header] [impl]

Returns whether RX checking is enabled.

Get rx enable.

Returns:

True when RX checking is enabled.

void setRxEnable(bool state)
[header] [impl]

Enables or disables RX checking.

Set rx enable.

Parameters:

state – True to validate incoming PRBS frames.

uint32_t getRxErrors()
[header] [impl]

Returns RX error count.

Get RX errors.

Returns:

Number of receive-side check failures.

uint32_t getRxCount()
[header] [impl]

Returns RX frame count.

Get rx count.

Returns:

Number of received frames.

uint64_t getRxBytes()
[header] [impl]

Returns RX byte count.

Get rx bytes.

Returns:

Total received payload bytes.

double getRxRate()
[header] [impl]

Returns computed RX frame rate.

Get rx rate.

Returns:

Receive frame rate in frames/second.

double getRxBw()
[header] [impl]

Returns computed RX bandwidth.

Get rx bw.

Returns:

Receive bandwidth in bytes/second.

double getTxRate()
[header] [impl]

Returns computed TX frame rate.

Get tx rate.

Returns:

Transmit frame rate in frames/second.

void setTxPeriod(uint32_t txPeriod)
[header] [impl]

Sets background TX period.

Set tx rate limit.

Parameters:

txPeriod – Period in microseconds between generated frames.

uint32_t getTxPeriod()
[header] [impl]

Returns configured background TX period.

Get tx rate limit.

Returns:

TX period in microseconds.

double getTxBw()
[header] [impl]

Returns computed TX bandwidth.

Get tx bw.

Returns:

Transmit bandwidth in bytes/second.

uint32_t getTxErrors()
[header] [impl]

Returns TX error count.

Get TX errors.

Returns:

Number of transmit-side generation errors.

uint32_t getTxCount()
[header] [impl]

Returns TX frame count.

Get TX count.

Returns:

Number of transmitted frames.

uint64_t getTxBytes()
[header] [impl]

Returns TX byte count.

Get TX bytes.

Returns:

Total transmitted payload bytes.

void checkPayload(bool state)
[header] [impl]

Enables or disables payload checking.

Set check payload flag, default = true.

Parameters:

state – True to validate payload contents.

void genPayload(bool state)
[header] [impl]

Enables or disables payload generation.

Set generate payload flag, default = true.

Parameters:

state – True to generate PRBS payload bytes.

void resetCount()
[header] [impl]

Resets RX/TX counters and statistics.

Reset counters.

virtual void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame)
[header] [impl]

Accepts a frame from an upstream master.

Accept a frame from master.

Parameters:

frame – Received stream frame.

Public Static Functions

static std::shared_ptr<rogue::utilities::Prbs> create()
[header] [impl]

Creates a PRBS generator/checker instance.

Class creation.

This static factory is the preferred construction path when the object is shared across Rogue graph connections or exposed to Python. It returns std::shared_ptr ownership compatible with Rogue pointer typedefs.

Company : SLAC National Accelerator Laboratory

Description : Class used to generate and receive PRBS test data.

This file is part of the rogue software platform. It is subject to the license terms in the LICENSE.txt file found in the top-level directory of this distribution and at: https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html. No part of the rogue software platform, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE.txt file.

Returns:

Shared pointer to the created PRBS object.

static void setup_python()
[header] [impl]

Registers Python bindings for this class.