17#ifndef __ROGUE_UTILITIES_PRBS_H__
18#define __ROGUE_UTILITIES_PRBS_H__
51 static const uint32_t MaxBytes = 64;
114 uint32_t lastRxCount_;
115 uint64_t lastRxBytes_;
116 struct timeval lastRxTime_;
120 uint32_t lastTxCount_;
121 uint64_t lastTxBytes_;
122 struct timeval lastTxTime_;
127 std::shared_ptr<rogue::Logging> rxLog_;
128 std::shared_ptr<rogue::Logging> txLog_;
132 std::thread* txThread_ =
nullptr;
133 std::atomic<bool> threadEn_{
false};
138 void flfsr(uint8_t* data);
143 static double updateTime(
struct timeval* last);
156 static std::shared_ptr<rogue::utilities::Prbs>
create();
184 void setTaps(uint32_t tapCnt, uint8_t* taps);
215 void enable(uint32_t size);
328 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
332typedef std::shared_ptr<rogue::utilities::Prbs>
PrbsPtr;
Stream slave endpoint and default frame pool.
PRBS generator/checker that can act as both stream master and slave.
void resetCount()
Resets RX/TX counters and statistics.
uint64_t getTxBytes()
Returns TX byte count.
void enable(uint32_t size)
Enables periodic background frame generation.
void checkPayload(bool state)
Enables or disables payload checking.
uint32_t getTxCount()
Returns TX frame count.
void setTaps(uint32_t tapCnt, uint8_t *taps)
Configures LFSR taps.
void setTxPeriod(uint32_t txPeriod)
Sets background TX period.
uint32_t getRxCount()
Returns RX frame count.
double getRxBw()
Returns computed RX bandwidth.
Prbs()
Constructs a PRBS instance with default taps and width.
uint32_t getTxErrors()
Returns TX error count.
uint32_t getTxPeriod()
Returns configured background TX period.
uint64_t getRxBytes()
Returns RX byte count.
double getTxRate()
Returns computed TX frame rate.
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Accepts a frame from an upstream master.
void genFrame(uint32_t size)
Generates and transmits one PRBS frame.
void disable()
Disables periodic background frame generation.
void sendCount(bool state)
Enables or disables transmission of sequence counters in payload.
bool getRxEnable()
Returns whether RX checking is enabled.
static std::shared_ptr< rogue::utilities::Prbs > create()
Creates a PRBS generator/checker instance.
uint32_t getRxErrors()
Returns RX error count.
static void setup_python()
Registers Python bindings for this class.
void genPayload(bool state)
Enables or disables payload generation.
double getTxBw()
Returns computed TX bandwidth.
void setWidth(uint32_t width)
Sets generator/checker data width.
void setTapsPy(boost::python::object p)
Configures LFSR taps from a Python sequence.
void setRxEnable(bool state)
Enables or disables RX checking.
double getRxRate()
Returns computed RX frame rate.
~Prbs()
Destroys the PRBS instance and stops background generation.
std::shared_ptr< rogue::utilities::Prbs > PrbsPtr