Languages

CommunityCategory: XMODELCan’t observe the noise from a ‘noise_gen’ primitive
SA Support Team Staff asked 3 years ago

According to its documentation, the 'noise_gen' primitive generates a white Gaussian noise with the specified mean and variance. However, with the testbench listed below, I could not confirm that the primitive generates noise. The simulated waveform viewed with XWAVE shows that the 'noise_gen' primitive is just producing a constant output equal to the specified mean value. What am I missing?

module TB;

xreal sig;

noise_gen #(.stddev(1e-3)) INST (sig);

initial begin
    $xmodel_dumpfile();
    $xmodel_dumpvars();
end

endmodule

1 Answers
Best Answer
SA Support Team Staff answered 3 years ago

You are correct that the 'noise_gen' primitive of XMODEL does not produce a series of randomized sample values for its output signal. If it did, the XMODEL simulation propagating such a signal to the rest of the system model would be very slow, since the number of events triggered during the simulation would be very high.

Although the noise is not visible to your naked eyes, it is there. And the XMODEL primitives receiving this noisy signal as inputs will produce outputs considering the noise. For more information, the noise value is included in the signal's conditional probability density function (CPDF), which is taken into account when the statistical simulation capability of XMODEL is enabled. Please refer to this Q&A posting for more details. In other words, the noise takes effect only when you enable the statistical simulation capability by providing the '--stat' option when launching the XMODEL simulation as shown below:

xmodel TB.sv --top TB --stat

Yet, you can't see the noise on its normal waveform. A rather indirect way to view its noise to plot an eye diagram with it. On the XWAVE waveform viewer, add a new analysis page by clicking the '+' tab. Then click the '+ Add Analysis' button located at the bottom of the new page. When the 'Analysis Browser' window pops up, select the noisy signal as your source signal and select 'Eye Diagram' as the analysis. Make sure that the 'Stat. Mode' field is checked as shown below. Now, press the 'Apply' button to plot the eye diagram.

From the plotted eye diagram, you can confirm that the noise is indeed present in the signal.