Skip to content

Commit f4a2e7f

Browse files
committed
Added Doxygen comments to TestWaveformSource. Renamed GenerateNoisySinewaveMix to GenerateNoisySinewaveSum to more accurately reflect what it does.
1 parent c5145fb commit f4a2e7f

File tree

3 files changed

+54
-9
lines changed

3 files changed

+54
-9
lines changed

scopehal/DemoOscilloscope.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ bool DemoOscilloscope::AcquireData()
539539
break;
540540

541541
case 1:
542-
waveforms[i] = m_source[i]->GenerateNoisySinewaveMix(
542+
waveforms[i] = m_source[i]->GenerateNoisySinewaveSum(
543543
0.9, 0.0, M_PI_4, 1e6, sweepPeriod, sampleperiod, depth, noise[1]);
544544
break;
545545

scopehal/TestWaveformSource.cpp

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ WaveformBase* TestWaveformSource::GenerateStep(
113113
/**
114114
@brief Generates a sinewave with AWGN added
115115
116-
@param amplitude P-P amplitude of the waveform
116+
@param amplitude P-P amplitude of the waveform in volts
117117
@param startphase Starting phase in radians
118118
@param period Period of the sine, in femtoseconds
119119
@param sampleperiod Interval between samples, in femtoseconds
120120
@param depth Total number of samples to generate
121-
@param noise_stdev Standard deviation of the AWGN
121+
@param noise_stdev Standard deviation of the AWGN in volts
122122
*/
123123
WaveformBase* TestWaveformSource::GenerateNoisySinewave(
124124
float amplitude,
@@ -147,9 +147,18 @@ WaveformBase* TestWaveformSource::GenerateNoisySinewave(
147147
}
148148

149149
/**
150-
@brief Generates a mix of two sinewaves plus some noise
150+
@brief Generates a sum of two sinewaves with AWGN added
151+
152+
@param amplitude P-P amplitude of the waveform in volts
153+
@param startphase1 Starting phase of the first sine in radians
154+
@param startphase2 Starting phase of the second sine in radians
155+
@param period1 Period of the first sine, in femtoseconds
156+
@param period2 Period of the second sine, in femtoseconds
157+
@param sampleperiod Interval between samples, in femtoseconds
158+
@param depth Total number of samples to generate
159+
@param noise_stdev Standard deviation of the AWGN in volts
151160
*/
152-
WaveformBase* TestWaveformSource::GenerateNoisySinewaveMix(
161+
WaveformBase* TestWaveformSource::GenerateNoisySinewaveSum(
153162
float amplitude,
154163
float startphase1,
155164
float startphase2,
@@ -159,7 +168,7 @@ WaveformBase* TestWaveformSource::GenerateNoisySinewaveMix(
159168
size_t depth,
160169
float noise_stdev)
161170
{
162-
auto ret = new UniformAnalogWaveform("NoisySineMix");
171+
auto ret = new UniformAnalogWaveform("NoisySineSum");
163172
ret->m_timescale = sampleperiod;
164173
ret->Resize(depth);
165174

@@ -182,6 +191,18 @@ WaveformBase* TestWaveformSource::GenerateNoisySinewaveMix(
182191
return ret;
183192
}
184193

194+
/**
195+
@brief Generates a PRBS-31 waveform through a lossy channel with AWGN
196+
197+
@param cmdBuf Vulkan command buffer to use for channel emulation
198+
@param queue Vulkan queue to use for channel emulation
199+
@param amplitude P-P amplitude of the waveform in volts
200+
@param period Unit interval, in femtoseconds
201+
@param sampleperiod Interval between samples, in femtoseconds
202+
@param depth Total number of samples to generate
203+
@param lpf Emulate a lossy channel if true, no channel emulation if false
204+
@param noise_stdev Standard deviation of the AWGN in volts
205+
*/
185206
WaveformBase* TestWaveformSource::GeneratePRBS31(
186207
vk::raii::CommandBuffer& cmdBuf,
187208
shared_ptr<QueueHandle> queue,
@@ -240,6 +261,18 @@ WaveformBase* TestWaveformSource::GeneratePRBS31(
240261
return ret;
241262
}
242263

264+
/**
265+
@brief Generates a K28.5 D16.2 (1000base-X / SGMII idle) waveform through a lossy channel with AWGN
266+
267+
@param cmdBuf Vulkan command buffer to use for channel emulation
268+
@param queue Vulkan queue to use for channel emulation
269+
@param amplitude P-P amplitude of the waveform in volts
270+
@param period Unit interval, in femtoseconds
271+
@param sampleperiod Interval between samples, in femtoseconds
272+
@param depth Total number of samples to generate
273+
@param lpf Emulate a lossy channel if true, no channel emulation if false
274+
@param noise_stdev Standard deviation of the AWGN in volts
275+
*/
243276
WaveformBase* TestWaveformSource::Generate8b10b(
244277
vk::raii::CommandBuffer& cmdBuf,
245278
shared_ptr<QueueHandle> queue,
@@ -307,7 +340,16 @@ WaveformBase* TestWaveformSource::Generate8b10b(
307340
/**
308341
@brief Takes an idealized serial data stream and turns it into something less pretty
309342
310-
by adding noise and a band-limiting filter
343+
The channel is a combination of a lossy S-parameter channel (approximately 300mm of microstrip on Shengyi S1000-2M)
344+
and AWGN with configurable standard deviation
345+
346+
@param cap Waveform to degrade
347+
@param sampleperiod Period of the input waveform
348+
@param depth Number of points in the input waveform
349+
@param lpf True to perform channel emulation, false to only add noise
350+
@param noise_stdev Standard deviation of the AWGN, in volts
351+
@param cmdBuf Vulkan command buffer to use for channel emulation
352+
@param queue Vulkan queue to use for channel emulation
311353
*/
312354
void TestWaveformSource::DegradeSerialData(
313355
UniformAnalogWaveform* cap,
@@ -438,7 +480,10 @@ void TestWaveformSource::DegradeSerialData(
438480
}
439481

440482
/**
441-
@brief Recalculate the cached S-parameters
483+
@brief Recalculate the cached S-parameters used for channel emulation
484+
485+
@param bin_hz Size of each FFT bin, in Hz
486+
@param nouts Number of FFT bins
442487
*/
443488
void TestWaveformSource::InterpolateSparameters(float bin_hz, size_t nouts)
444489
{

scopehal/TestWaveformSource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class TestWaveformSource
6464
size_t depth,
6565
float noise_stdev = 0.01);
6666

67-
WaveformBase* GenerateNoisySinewaveMix(
67+
WaveformBase* GenerateNoisySinewaveSum(
6868
float amplitude,
6969
float startphase1,
7070
float startphase2,

0 commit comments

Comments
 (0)