rogue
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
rogue::utilities::Prbs Class Reference

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

#include <Prbs.h>

Inheritance diagram for rogue::utilities::Prbs:
rogue::interfaces::stream::Slave rogue::interfaces::stream::Master rogue::interfaces::stream::Pool rogue::EnableSharedFromThis< rogue::interfaces::stream::Slave > rogue::EnableSharedFromThis< rogue::interfaces::stream::Master > rogue::EnableSharedFromThis< rogue::interfaces::stream::Pool > rogue::EnableSharedFromThisBase rogue::EnableSharedFromThisBase rogue::EnableSharedFromThisBase

Public Member Functions

 Prbs ()
 Constructs a PRBS instance with default taps and width.
 
 ~Prbs ()
 Destroys the PRBS instance and stops background generation.
 
void setWidth (uint32_t width)
 Sets generator/checker data width.
 
void setTaps (uint32_t tapCnt, uint8_t *taps)
 Configures LFSR taps.
 
void setTapsPy (boost::python::object p)
 Configures LFSR taps from a Python sequence.
 
void sendCount (bool state)
 Enables or disables transmission of sequence counters in payload.
 
void genFrame (uint32_t size)
 Generates and transmits one PRBS frame.
 
void enable (uint32_t size)
 Enables periodic background frame generation.
 
void disable ()
 Disables periodic background frame generation.
 
bool getRxEnable ()
 Returns whether RX checking is enabled.
 
void setRxEnable (bool state)
 Enables or disables RX checking.
 
uint32_t getRxErrors ()
 Returns RX error count.
 
uint32_t getRxCount ()
 Returns RX frame count.
 
uint64_t getRxBytes ()
 Returns RX byte count.
 
double getRxRate ()
 Returns computed RX frame rate.
 
double getRxBw ()
 Returns computed RX bandwidth.
 
double getTxRate ()
 Returns computed TX frame rate.
 
void setTxPeriod (uint32_t txPeriod)
 Sets background TX period.
 
uint32_t getTxPeriod ()
 Returns configured background TX period.
 
double getTxBw ()
 Returns computed TX bandwidth.
 
uint32_t getTxErrors ()
 Returns TX error count.
 
uint32_t getTxCount ()
 Returns TX frame count.
 
uint64_t getTxBytes ()
 Returns TX byte count.
 
void checkPayload (bool state)
 Enables or disables payload checking.
 
void genPayload (bool state)
 Enables or disables payload generation.
 
void resetCount ()
 Resets RX/TX counters and statistics.
 
void acceptFrame (std::shared_ptr< rogue::interfaces::stream::Frame > frame)
 Accepts a frame from an upstream master.
 
- Public Member Functions inherited from rogue::interfaces::stream::Slave
 Slave ()
 Constructs a stream slave.
 
virtual ~Slave ()
 Destroys the stream slave.
 
virtual void stop ()
 Shuts down threads associated with this object.
 
void setDebug (uint32_t debug, std::string name)
 Sets debug message verbosity and logger name.
 
uint64_t getFrameCount ()
 Returns frame counter.
 
uint64_t getByteCount ()
 Returns byte counter.
 
bool ensureSingleBuffer (std::shared_ptr< rogue::interfaces::stream::Frame > &frame, bool reqEn)
 Ensures frame is backed by a single buffer.
 
std::shared_ptr< rogue::interfaces::stream::FramereqLocalFrame (uint32_t size, bool zeroCopyEn)
 Services a local frame allocation request through this object's pool interface.
 
boost::python::object lshiftPy (boost::python::object p)
 Supports << operator usage from Python.
 
std::shared_ptr< rogue::interfaces::stream::Master > & operator<< (std::shared_ptr< rogue::interfaces::stream::Master > &other)
 Connects this slave to a master via stream chaining operator.
 
- Public Member Functions inherited from rogue::interfaces::stream::Pool
 Pool ()
 Constructs a pool with default allocation behavior enabled.
 
virtual ~Pool ()
 Destroys the pool and releases any cached buffer storage.
 
uint32_t getAllocBytes ()
 Returns total currently allocated bytes.
 
uint32_t getAllocCount ()
 Returns total currently allocated buffer count.
 
virtual std::shared_ptr< rogue::interfaces::stream::FrameacceptReq (uint32_t size, bool zeroCopyEn)
 Services a frame allocation request from a master.
 
virtual void retBuffer (uint8_t *data, uint32_t meta, uint32_t size)
 Returns buffer data to the allocator.
 
void setFixedSize (uint32_t size)
 Sets fixed-size mode.
 
uint32_t getFixedSize ()
 Returns fixed-size allocation setting.
 
void setPoolSize (uint32_t size)
 Sets buffer pool size.
 
uint32_t getPoolSize ()
 Returns configured maximum number of cached pool entries.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::stream::Pool >
std::shared_ptr< rogue::interfaces::stream::Poolshared_from_this ()
 Returns a shared_ptr<T> for this instance.
 
- Public Member Functions inherited from rogue::EnableSharedFromThisBase
virtual ~EnableSharedFromThisBase ()
 Virtual destructor for polymorphic base usage.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::stream::Slave >
std::shared_ptr< rogue::interfaces::stream::Slaveshared_from_this ()
 Returns a shared_ptr<T> for this instance.
 
- Public Member Functions inherited from rogue::interfaces::stream::Master
 Master ()
 Constructs a stream master.
 
virtual ~Master ()
 Destroys the stream master.
 
uint32_t slaveCount ()
 Returns the number of attached slaves.
 
void addSlave (std::shared_ptr< rogue::interfaces::stream::Slave > slave)
 Attaches a downstream slave.
 
std::shared_ptr< rogue::interfaces::stream::FramereqFrame (uint32_t size, bool zeroCopyEn)
 Requests allocation of a new frame from the primary slave.
 
void sendFrame (std::shared_ptr< rogue::interfaces::stream::Frame > frame)
 Sends a frame to all attached slaves.
 
bool ensureSingleBuffer (std::shared_ptr< rogue::interfaces::stream::Frame > &frame, bool reqEn)
 Ensures a frame is represented by a single buffer.
 
virtual void stop ()
 Stops frame generation and shuts down associated threads.
 
void equalsPy (boost::python::object p)
 Supports == operator usage from Python.
 
boost::python::object rshiftPy (boost::python::object p)
 Supports >> operator usage from Python.
 
void operator== (std::shared_ptr< rogue::interfaces::stream::Slave > &other)
 Supports == operator usage in C++.
 
std::shared_ptr< rogue::interfaces::stream::Slave > & operator>> (std::shared_ptr< rogue::interfaces::stream::Slave > &other)
 Connects this master to a slave via stream chaining operator.
 
- Public Member Functions inherited from rogue::EnableSharedFromThis< rogue::interfaces::stream::Master >
std::shared_ptr< rogue::interfaces::stream::Mastershared_from_this ()
 Returns a shared_ptr<T> for this instance.
 

Static Public Member Functions

static std::shared_ptr< rogue::utilities::Prbscreate ()
 Creates a PRBS generator/checker instance.
 
static void setup_python ()
 Registers Python bindings for this class.
 
- Static Public Member Functions inherited from rogue::interfaces::stream::Slave
static std::shared_ptr< rogue::interfaces::stream::Slavecreate ()
 Creates a new stream slave.
 
static void setup_python ()
 Registers this type with Python bindings.
 
- Static Public Member Functions inherited from rogue::interfaces::stream::Pool
static void setup_python ()
 Registers this type with Python bindings.
 
- Static Public Member Functions inherited from rogue::interfaces::stream::Master
static std::shared_ptr< rogue::interfaces::stream::Mastercreate ()
 Creates a stream master.
 
static void setup_python ()
 Registers this type with Python bindings.
 

Additional Inherited Members

- Protected Member Functions inherited from rogue::interfaces::stream::Pool
std::shared_ptr< rogue::interfaces::stream::BufferallocBuffer (uint32_t size, uint32_t *total)
 Allocate a buffer passed size.
 
std::shared_ptr< rogue::interfaces::stream::BuffercreateBuffer (void *data, uint32_t meta, uint32_t size, uint32_t alloc)
 Creates a Buffer with a pre-allocated data block.
 
void decCounter (uint32_t alloc)
 Decrements allocation counter.
 

Detailed Description

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:

Definition at line 48 of file Prbs.h.

Constructor & Destructor Documentation

◆ Prbs()

rogue::utilities::Prbs::Prbs ( )

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.

Definition at line 55 of file Prbs.cpp.

◆ ~Prbs()

rogue::utilities::Prbs::~Prbs ( )

Destroys the PRBS instance and stops background generation.

Deconstructor.

Definition at line 102 of file Prbs.cpp.

Member Function Documentation

◆ acceptFrame()

void rogue::utilities::Prbs::acceptFrame ( std::shared_ptr< rogue::interfaces::stream::Frame frame)
virtual

Accepts a frame from an upstream master.

Accept a frame from master.

Parameters
frameReceived stream frame.

Reimplemented from rogue::interfaces::stream::Slave.

Definition at line 408 of file Prbs.cpp.

◆ checkPayload()

void rogue::utilities::Prbs::checkPayload ( bool  state)

Enables or disables payload checking.

Set check payload flag, default = true.

Parameters
stateTrue to validate payload contents.

Definition at line 310 of file Prbs.cpp.

◆ create()

rogue::utilities::PrbsPtr rogue::utilities::Prbs::create ( )
static

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.

Returns
Shared pointer to the created PRBS object.

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.

Definition at line 49 of file Prbs.cpp.

◆ disable()

void rogue::utilities::Prbs::disable ( )

Disables periodic background frame generation.

Disable auto generation.

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

Definition at line 226 of file Prbs.cpp.

◆ enable()

void rogue::utilities::Prbs::enable ( uint32_t  size)

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
sizePayload size in bytes for generated frames.

Definition at line 209 of file Prbs.cpp.

◆ genFrame()

void rogue::utilities::Prbs::genFrame ( uint32_t  size)

Generates and transmits one PRBS frame.

Generate a data frame.

Parameters
sizePayload size in bytes.

Definition at line 333 of file Prbs.cpp.

◆ genPayload()

void rogue::utilities::Prbs::genPayload ( bool  state)

Enables or disables payload generation.

Set generate payload flag, default = true.

Parameters
stateTrue to generate PRBS payload bytes.

Definition at line 315 of file Prbs.cpp.

◆ getRxBw()

double rogue::utilities::Prbs::getRxBw ( )

Returns computed RX bandwidth.

Get rx bw.

Returns
Receive bandwidth in bytes/second.

Definition at line 280 of file Prbs.cpp.

◆ getRxBytes()

uint64_t rogue::utilities::Prbs::getRxBytes ( )

Returns RX byte count.

Get rx bytes.

Returns
Total received payload bytes.

Definition at line 260 of file Prbs.cpp.

◆ getRxCount()

uint32_t rogue::utilities::Prbs::getRxCount ( )

Returns RX frame count.

Get rx count.

Returns
Number of received frames.

Definition at line 255 of file Prbs.cpp.

◆ getRxEnable()

bool rogue::utilities::Prbs::getRxEnable ( )

Returns whether RX checking is enabled.

Get rx enable.

Returns
True when RX checking is enabled.

Definition at line 237 of file Prbs.cpp.

◆ getRxErrors()

uint32_t rogue::utilities::Prbs::getRxErrors ( )

Returns RX error count.

Get RX errors.

Returns
Number of receive-side check failures.

Definition at line 250 of file Prbs.cpp.

◆ getRxRate()

double rogue::utilities::Prbs::getRxRate ( )

Returns computed RX frame rate.

Get rx rate.

Returns
Receive frame rate in frames/second.

Definition at line 275 of file Prbs.cpp.

◆ getTxBw()

double rogue::utilities::Prbs::getTxBw ( )

Returns computed TX bandwidth.

Get tx bw.

Returns
Transmit bandwidth in bytes/second.

Definition at line 300 of file Prbs.cpp.

◆ getTxBytes()

uint64_t rogue::utilities::Prbs::getTxBytes ( )

Returns TX byte count.

Get TX bytes.

Returns
Total transmitted payload bytes.

Definition at line 305 of file Prbs.cpp.

◆ getTxCount()

uint32_t rogue::utilities::Prbs::getTxCount ( )

Returns TX frame count.

Get TX count.

Returns
Number of transmitted frames.

Definition at line 270 of file Prbs.cpp.

◆ getTxErrors()

uint32_t rogue::utilities::Prbs::getTxErrors ( )

Returns TX error count.

Get TX errors.

Returns
Number of transmit-side generation errors.

Definition at line 265 of file Prbs.cpp.

◆ getTxPeriod()

uint32_t rogue::utilities::Prbs::getTxPeriod ( )

Returns configured background TX period.

Get tx rate limit.

Returns
TX period in microseconds.

Definition at line 290 of file Prbs.cpp.

◆ getTxRate()

double rogue::utilities::Prbs::getTxRate ( )

Returns computed TX frame rate.

Get tx rate.

Returns
Transmit frame rate in frames/second.

Definition at line 285 of file Prbs.cpp.

◆ resetCount()

void rogue::utilities::Prbs::resetCount ( )

Resets RX/TX counters and statistics.

Reset counters.

Definition at line 321 of file Prbs.cpp.

◆ sendCount()

void rogue::utilities::Prbs::sendCount ( bool  state)

Enables or disables transmission of sequence counters in payload.

Send counter value.

Parameters
stateTrue to include counters in generated data.

Definition at line 170 of file Prbs.cpp.

◆ setRxEnable()

void rogue::utilities::Prbs::setRxEnable ( bool  state)

Enables or disables RX checking.

Set rx enable.

Parameters
stateTrue to validate incoming PRBS frames.

Definition at line 242 of file Prbs.cpp.

◆ setTaps()

void rogue::utilities::Prbs::setTaps ( uint32_t  tapCnt,
uint8_t *  taps 
)

Configures LFSR taps.

Set taps.

Parameters
tapCntNumber of tap entries in taps.
tapsPointer to tap index array.

Definition at line 142 of file Prbs.cpp.

◆ setTapsPy()

void rogue::utilities::Prbs::setTapsPy ( boost::python::object  p)

Configures LFSR taps from a Python sequence.

Set taps, python.

Parameters
pPython object containing tap values.

Definition at line 157 of file Prbs.cpp.

◆ setTxPeriod()

void rogue::utilities::Prbs::setTxPeriod ( uint32_t  txPeriod)

Sets background TX period.

Set tx rate limit.

Parameters
txPeriodPeriod in microseconds between generated frames.

Definition at line 295 of file Prbs.cpp.

◆ setup_python()

void rogue::utilities::Prbs::setup_python ( )
static

Registers Python bindings for this class.

Definition at line 521 of file Prbs.cpp.

◆ setWidth()

void rogue::utilities::Prbs::setWidth ( uint32_t  width)

Sets generator/checker data width.

Set width.

Parameters
widthData width in bits.

Definition at line 130 of file Prbs.cpp.


The documentation for this class was generated from the following files: