ngscopeclient v0.1-rc1
|
Helper class for generating test waveforms. More...
#include <TestWaveformSource.h>
Public Member Functions | |
TestWaveformSource (std::minstd_rand &rng) | |
TestWaveformSource (const TestWaveformSource &)=delete | |
TestWaveformSource & | operator= (const TestWaveformSource &)=delete |
void | GenerateNoisySinewave (vk::raii::CommandBuffer &cmdBuf, std::shared_ptr< QueueHandle > queue, UniformAnalogWaveform *wfm, float amplitude, float startphase, float period, int64_t sampleperiod, size_t depth, float noise_stdev=0.01) |
Generates a sinewave with AWGN added. More... | |
void | GenerateNoisySinewaveSum (vk::raii::CommandBuffer &cmdBuf, std::shared_ptr< QueueHandle > queue, UniformAnalogWaveform *wfm, float amplitude, float startphase1, float startphase2, float period1, float period2, int64_t sampleperiod, size_t depth, float noise_stdev=0.01) |
Generates a sum of two sinewaves with AWGN added. More... | |
void | GeneratePRBS31 (vk::raii::CommandBuffer &cmdBuf, std::shared_ptr< QueueHandle > queue, UniformAnalogWaveform *wfm, float amplitude, float period, int64_t sampleperiod, size_t depth, bool lpf=true, float noise_stdev=0.01) |
Generates a PRBS-31 waveform through a lossy channel with AWGN. More... | |
void | Generate8b10b (vk::raii::CommandBuffer &cmdBuf, std::shared_ptr< QueueHandle > queue, UniformAnalogWaveform *wfm, float amplitude, float period, int64_t sampleperiod, size_t depth, bool lpf=true, float noise_stdev=0.01) |
Generates a K28.5 D16.2 (1000base-X / SGMII idle) waveform through a lossy channel with AWGN. More... | |
WaveformBase * | GenerateStep (float vlo, float vhi, int64_t sampleperiod, size_t depth) |
Generates a step waveform. More... | |
void | DegradeSerialData (UniformAnalogWaveform *cap, int64_t sampleperiod, size_t depth, bool lpf, float noise_stdev, vk::raii::CommandBuffer &cmdBuf, std::shared_ptr< QueueHandle > queue) |
Takes an idealized serial data stream and turns it into something less pretty. More... | |
Protected Member Functions | |
void | InterpolateSparameters (float bin_hz, size_t nouts) |
Recalculate the cached S-parameters used for channel emulation. More... | |
Protected Attributes | |
std::minstd_rand & | m_rng |
Random number generator. | |
AcceleratorBuffer< float > | m_forwardInBuf |
Input buffer for FFTs. | |
AcceleratorBuffer< float > | m_forwardOutBuf |
Output buffer for FFTs. | |
AcceleratorBuffer< float > | m_reverseOutBuf |
Output buffer for IFFTs. | |
std::unique_ptr< VulkanFFTPlan > | m_vkForwardPlan |
FFT plan. | |
std::unique_ptr< VulkanFFTPlan > | m_vkReversePlan |
Inverse FFT plan. | |
double | m_cachedBinSize |
FFT bin size, in Hz. | |
AcceleratorBuffer< float > | m_resampledSparamSines |
Serial channel S-parameter real part. | |
AcceleratorBuffer< float > | m_resampledSparamCosines |
Serial channel S-parameter imaginary part. | |
ComputePipeline | m_rectangularComputePipeline |
Compute pipeline for our window function. | |
ComputePipeline | m_channelEmulationComputePipeline |
Compute pipeline for channel emulation. | |
ComputePipeline | m_noisySineComputePipeline |
Compute pipeline for noisy sinewave generation. | |
ComputePipeline | m_noisySineSumComputePipeline |
Compute pipeline for noisy sinewave sum generation. | |
ComputePipeline | m_degradeComputePipeline |
Compute pipeline for DegradeSerialData. | |
SParameters | m_sparams |
S-parameters of the channel. | |
size_t | m_cachedNumPoints |
FFT point count as of last cache update. | |
size_t | m_cachedRawSize |
Input size of FFT as of last cache update. | |
Helper class for generating test waveforms.
Used by DemoOscilloscope as well as various unit tests
void TestWaveformSource::DegradeSerialData | ( | UniformAnalogWaveform * | cap, |
int64_t | sampleperiod, | ||
size_t | depth, | ||
bool | lpf, | ||
float | noise_stdev, | ||
vk::raii::CommandBuffer & | cmdBuf, | ||
std::shared_ptr< QueueHandle > | queue | ||
) |
Takes an idealized serial data stream and turns it into something less pretty.
The channel is a combination of a lossy S-parameter channel (approximately 300mm of microstrip on Shengyi S1000-2M) and AWGN with configurable standard deviation
cap | Waveform to degrade |
sampleperiod | Period of the input waveform |
depth | Number of points in the input waveform |
lpf | True to perform channel emulation, false to only add noise |
noise_stdev | Standard deviation of the AWGN, in volts |
cmdBuf | Vulkan command buffer to use for channel emulation |
queue | Vulkan queue to use for channel emulation |
void TestWaveformSource::Generate8b10b | ( | vk::raii::CommandBuffer & | cmdBuf, |
std::shared_ptr< QueueHandle > | queue, | ||
UniformAnalogWaveform * | wfm, | ||
float | amplitude, | ||
float | period, | ||
int64_t | sampleperiod, | ||
size_t | depth, | ||
bool | lpf = true , |
||
float | noise_stdev = 0.01 |
||
) |
Generates a K28.5 D16.2 (1000base-X / SGMII idle) waveform through a lossy channel with AWGN.
cmdBuf | Vulkan command buffer to use for channel emulation |
queue | Vulkan queue to use for channel emulation |
amplitude | P-P amplitude of the waveform in volts |
period | Unit interval, in femtoseconds |
sampleperiod | Interval between samples, in femtoseconds |
depth | Total number of samples to generate |
lpf | Emulate a lossy channel if true, no channel emulation if false |
noise_stdev | Standard deviation of the AWGN in volts |
downloadCallback | Callback for download progress |
void TestWaveformSource::GenerateNoisySinewave | ( | vk::raii::CommandBuffer & | cmdBuf, |
std::shared_ptr< QueueHandle > | queue, | ||
UniformAnalogWaveform * | wfm, | ||
float | amplitude, | ||
float | startphase, | ||
float | period, | ||
int64_t | sampleperiod, | ||
size_t | depth, | ||
float | noise_stdev = 0.01 |
||
) |
Generates a sinewave with AWGN added.
cmdBuf | Vulkan command buffer to use |
queue | Vulkan queue to use |
wfm | Waveform to fill |
amplitude | P-P amplitude of the waveform in volts |
startphase | Starting phase in radians |
period | Period of the sine, in femtoseconds |
sampleperiod | Interval between samples, in femtoseconds |
depth | Total number of samples to generate |
noise_stdev | Standard deviation of the AWGN in volts |
void TestWaveformSource::GenerateNoisySinewaveSum | ( | vk::raii::CommandBuffer & | cmdBuf, |
std::shared_ptr< QueueHandle > | queue, | ||
UniformAnalogWaveform * | wfm, | ||
float | amplitude, | ||
float | startphase1, | ||
float | startphase2, | ||
float | period1, | ||
float | period2, | ||
int64_t | sampleperiod, | ||
size_t | depth, | ||
float | noise_stdev = 0.01 |
||
) |
Generates a sum of two sinewaves with AWGN added.
cmdBuf | Vulkan command buffer to use |
queue | Vulkan queue to use |
wfm | Waveform to fill |
amplitude | P-P amplitude of the waveform in volts |
startphase1 | Starting phase of the first sine in radians |
startphase2 | Starting phase of the second sine in radians |
period1 | Period of the first sine, in femtoseconds |
period2 | Period of the second sine, in femtoseconds |
sampleperiod | Interval between samples, in femtoseconds |
depth | Total number of samples to generate |
noise_stdev | Standard deviation of the AWGN in volts |
void TestWaveformSource::GeneratePRBS31 | ( | vk::raii::CommandBuffer & | cmdBuf, |
std::shared_ptr< QueueHandle > | queue, | ||
UniformAnalogWaveform * | wfm, | ||
float | amplitude, | ||
float | period, | ||
int64_t | sampleperiod, | ||
size_t | depth, | ||
bool | lpf = true , |
||
float | noise_stdev = 0.01 |
||
) |
Generates a PRBS-31 waveform through a lossy channel with AWGN.
cmdBuf | Vulkan command buffer to use for channel emulation |
queue | Vulkan queue to use for channel emulation |
wfm | Waveform to fill |
amplitude | P-P amplitude of the waveform in volts |
period | Unit interval, in femtoseconds |
sampleperiod | Interval between samples, in femtoseconds |
depth | Total number of samples to generate |
lpf | Emulate a lossy channel if true, no channel emulation if false |
noise_stdev | Standard deviation of the AWGN in volts |
downloadCallback | Callback for download progress |
WaveformBase * TestWaveformSource::GenerateStep | ( | float | vlo, |
float | vhi, | ||
int64_t | sampleperiod, | ||
size_t | depth | ||
) |
Generates a step waveform.
The waveform starts at vlo for half of the total duration, the instantly transitions to vhi and remains at vhi for the remainder of the total length.
vlo | Starting voltage |
vhi | Ending voltage |
sampleperiod | Interval, in femtoseconds, between samples |
depth | Number of points in the waveform |
|
protected |
Recalculate the cached S-parameters used for channel emulation.
bin_hz | Size of each FFT bin, in Hz |
nouts | Number of FFT bins |