ngscopeclient 0.1-dev+51fbda87c
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members

An eye-pattern waveform. More...

#include <EyeWaveform.h>

Inheritance diagram for EyeWaveform:
Inheritance graph
[legend]
Collaboration diagram for EyeWaveform:
Collaboration graph
[legend]

Public Types

enum  EyeType { EYE_NORMAL , EYE_BER }
 
- Public Types inherited from WaveformBase
enum  WaveformFlags_t { WAVEFORM_CLIPPING = 1 }
 Flags which may apply to m_flags. More...
 

Public Member Functions

 EyeWaveform (size_t width, size_t height, float center, EyeWaveform::EyeType etype)
 Create a new blank eye waveform. More...
 
 EyeWaveform (const EyeWaveform &)=delete
 
EyeWaveformoperator= (const EyeWaveform &)=delete
 
int64_t * GetAccumData ()
 Returns a pointer to the raw (not normalized) accumulator data.
 
void Normalize ()
 Normalize the integrated integer buffer into float32 output buffer.
 
size_t GetTotalUIs ()
 Get the total number of UIs integrated in this eye.
 
size_t GetTotalSamples ()
 Get the total number of samples integrated in this eye.
 
float GetCenterVoltage ()
 Get the center voltage of the eye plot (not the center of the opening) More...
 
void IntegrateUIs (size_t uis, size_t samples)
 Marks a given number of UIs as integrated. More...
 
float GetUIWidth ()
 Return the UI width, in X axis units.
 
float GetMaskHitRate ()
 Return the mask hit rate, or zero if there is no mask defined.
 
void SetMaskHitRate (float rate)
 Set the mask hit rate (normally called by the filter or instrument owning the waveform) More...
 
double GetBERAtPoint (ssize_t pointx, ssize_t pointy, ssize_t xmid, ssize_t ymid)
 Gets the BER at a single point, relative to the center of the eye opening. More...
 
EyeType GetType ()
 Return the eye type (normal or BER)
 
virtual void FreeGpuMemory () override
 Free GPU-side memory if we are short on VRAM or do not anticipate using this waveform for a while. More...
 
virtual bool HasGpuBuffer () override
 Returns true if we have at least one buffer resident on the GPU. More...
 
- Public Member Functions inherited from DensityFunctionWaveform
 DensityFunctionWaveform (size_t width, size_t height)
 Initialize a new density function waveform of a given size. More...
 
 DensityFunctionWaveform (const DensityFunctionWaveform &)=delete
 
DensityFunctionWaveformoperator= (const DensityFunctionWaveform &)=delete
 
virtual void Rename (const std::string &name="") override
 Assings a human readable name to the waveform for debug purposes. More...
 
float * GetData ()
 Returns a pointer to the CPU-side sample data buffer.
 
AcceleratorBuffer< float > & GetOutData ()
 Returns a reference to the output data buffer object.
 
size_t GetHeight ()
 Returns the height of the bitmap in pixels.
 
size_t GetWidth ()
 Returns the width of the bitmap in pixels.
 
virtual void clear () override
 Remove all samples from this waveform. More...
 
virtual void Resize (size_t unused) override
 Reallocates buffers so the waveform contains the specified number of samples. More...
 
virtual void PrepareForCpuAccess () override
 Indicates that this waveform is going to be used by the CPU in the near future. More...
 
virtual void PrepareForGpuAccess () override
 Indicates that this waveform is going to be used by the CPU in the near future. More...
 
virtual void MarkSamplesModifiedFromCpu () override
 Indicates that this waveform's sample data has been modified on the CPU and the GPU-side copy is no longer coherent. More...
 
virtual void MarkSamplesModifiedFromGpu () override
 Indicates that this waveform's sample data has been modified on the GPU and the CPU-side copy is no longer coherent. More...
 
virtual void MarkModifiedFromCpu () override
 Indicates that this waveform's sample data and timestamps have been modified on the CPU and the GPU-side copy is no longer coherent. More...
 
virtual void MarkModifiedFromGpu () override
 Indicates that this waveform's sample data and timestamps have been modified on the GPU and the CPU-side copy is no longer coherent. More...
 
virtual size_t size () const override
 Returns the number of samples in this waveform. More...
 
- Public Member Functions inherited from WaveformBase
 WaveformBase ()
 Creates an empty waveform.
 
 WaveformBase (const WaveformBase &rhs)
 Creates a waveform, copying metadata from another.
 
virtual void Rename (const std::string &name="")=0
 Assings a human readable name to the waveform for debug purposes. More...
 
virtual void clear ()=0
 Remove all samples from this waveform. More...
 
virtual void Resize (size_t size)=0
 Reallocates buffers so the waveform contains the specified number of samples. More...
 
virtual size_t size () const =0
 Returns the number of samples in this waveform. More...
 
virtual bool empty ()
 Returns true if this waveform contains no samples, false otherwise.
 
virtual std::string GetText (size_t i)
 Returns the text representation of a given protocol sample. More...
 
virtual std::string GetColor (size_t)
 Returns the displayed color (in HTML #rrggbb or #rrggbbaa notation) of a given protocol sample. More...
 
virtual uint32_t GetColorCached (size_t i)
 Returns the packed RGBA32 color of a given protocol sample calculated by CacheColors() More...
 
virtual void PrepareForCpuAccess ()=0
 Indicates that this waveform is going to be used by the CPU in the near future. More...
 
virtual void PrepareForGpuAccess ()=0
 Indicates that this waveform is going to be used by the CPU in the near future. More...
 
virtual void MarkSamplesModifiedFromCpu ()=0
 Indicates that this waveform's sample data has been modified on the CPU and the GPU-side copy is no longer coherent. More...
 
virtual void MarkSamplesModifiedFromGpu ()=0
 Indicates that this waveform's sample data has been modified on the GPU and the CPU-side copy is no longer coherent. More...
 
virtual void MarkModifiedFromCpu ()=0
 Indicates that this waveform's sample data and timestamps have been modified on the CPU and the GPU-side copy is no longer coherent. More...
 
virtual void MarkModifiedFromGpu ()=0
 Indicates that this waveform's sample data and timestamps have been modified on the GPU and the CPU-side copy is no longer coherent. More...
 
virtual void CacheColors ()
 Updates the cache of packed colors to avoid string parsing every frame.
 
virtual void FreeGpuMemory ()=0
 Free GPU-side memory if we are short on VRAM or do not anticipate using this waveform for a while. More...
 
virtual bool HasGpuBuffer ()=0
 Returns true if we have at least one buffer resident on the GPU. More...
 

Public Attributes

float m_uiWidth
 Nominal unit interval width of the eye. More...
 
float m_saturationLevel
 Saturation level for normalization. More...
 
- Public Attributes inherited from WaveformBase
int64_t m_timescale
 The time scale, in X axis units (usually femtoseconds) per timestep, used by this channel. More...
 
time_t m_startTimestamp
 Start time of the acquisition, integer part.
 
int64_t m_startFemtoseconds
 Start time of the acquisition, fractional part (femtoseconds since since the UTC second)
 
int64_t m_triggerPhase
 Offset, in X axis units (usually femtoseconds), from the trigger to the sampling clock. More...
 
uint8_t m_flags
 Flags that apply to this waveform. Bitfield containing zero or more WaveformFlags_t values.
 
uint64_t m_revision
 Revision number. More...
 

Protected Attributes

int64_t * m_accumdata
 Accumulator buffer.
 
size_t m_totalUIs
 Total UIs integrated.
 
size_t m_totalSamples
 Total samples integrated.
 
float m_centerVoltage
 Voltage of the vertical midpoint of the plot.
 
float m_maskHitRate
 Mask hit rate.
 
EyeType m_type
 Type of the eye pattern.
 
- Protected Attributes inherited from DensityFunctionWaveform
size_t m_width
 Buffer width, in pixels.
 
size_t m_height
 Buffer height, in pixels.
 
AcceleratorBuffer< float > m_outdata
 Pixel buffer.
 
- Protected Attributes inherited from WaveformBase
AcceleratorBuffer< uint32_t > m_protocolColors
 Cache of packed RGBA32 data with colors for each protocol decode event. Empty for non-protocol waveforms.
 
uint64_t m_cachedColorRevision
 Revision we last cached colors of.
 

Detailed Description

An eye-pattern waveform.

May be generated by a filter or directly measured by a BERT, sampling oscilloscope, etc.

The internal data is integrated as int64 to avoid loss of precision, then normalized to float32 by Normalize() after being updated.

The raw accumulator buffer is scaled by EYE_ACCUM_SCALE to enable antialiasing where a sample fits between two rows of samples. In other words, a single sample will produce a total of EYE_ACCUM_SCALE counts in the buffer, often split between several pixel locations.

Constructor & Destructor Documentation

◆ EyeWaveform()

EyeWaveform::EyeWaveform ( size_t  width,
size_t  height,
float  center,
EyeWaveform::EyeType  etype 
)

Create a new blank eye waveform.

The eye is initialized to all zeroes.

Parameters
widthWidth of the buffer, in pixels
heightHeight of the buffer, in pixels
centerCenter voltage
etypeType of the eye (BER or normal integrated samples)

Member Function Documentation

◆ FreeGpuMemory()

virtual void EyeWaveform::FreeGpuMemory ( )
inlineoverridevirtual

Free GPU-side memory if we are short on VRAM or do not anticipate using this waveform for a while.

Implements WaveformBase.

◆ GetBERAtPoint()

double EyeWaveform::GetBERAtPoint ( ssize_t  pointx,
ssize_t  pointy,
ssize_t  xmid,
ssize_t  ymid 
)

Gets the BER at a single point, relative to the center of the eye opening.

Parameters
pointxX coordinate of the point
pointyY coordinate of the point
xmidX coordinate of the center of the eye
ymidY coordinate of the center of the eye

BER is calculated by drawing a vector from the eye center to the point, then continuing to the edge of the eye and calculating what fraction of the points are before vs after the given point.

TODO: if we have multiple eye openings (MLT/PAM) we should stop at the adjacent levels, not the edge of the eye

◆ GetCenterVoltage()

float EyeWaveform::GetCenterVoltage ( )
inline

Get the center voltage of the eye plot (not the center of the opening)

This is normally 0 for AC coupled links but can be nonzero if there is a DC bias.

◆ HasGpuBuffer()

virtual bool EyeWaveform::HasGpuBuffer ( )
inlineoverridevirtual

Returns true if we have at least one buffer resident on the GPU.

Implements WaveformBase.

◆ IntegrateUIs()

void EyeWaveform::IntegrateUIs ( size_t  uis,
size_t  samples 
)
inline

Marks a given number of UIs as integrated.

This does not actually do anything to waveform data, it just increments the symbol count.

Typically called by filters at the end of a refresh cycle.

Parameters
uisNumber of UIs integrated
samplesNumber of samples integrated

◆ SetMaskHitRate()

void EyeWaveform::SetMaskHitRate ( float  rate)
inline

Set the mask hit rate (normally called by the filter or instrument owning the waveform)

Parameters
rateHit rate

Member Data Documentation

◆ m_saturationLevel

float EyeWaveform::m_saturationLevel

Saturation level for normalization.

Saturation level of 1.0 means mapping all values to [0, 1]. 2.0 means mapping values to [0, 2] and saturating anything above 1.

◆ m_uiWidth

float EyeWaveform::m_uiWidth

Nominal unit interval width of the eye.

The entire displayed eye is two UIs wide.


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