Download Generating and Verifying Signals for Digital Circuits and more Slides Computer Science in PDF only on Docsity!
Stimulus and Response
Stimulus and Response
Simple Stimulus
Verifying the Output
Self-Checking Testbenches
Complex Stimulus
Complex Response
Predicting the Output
Verilog Example 1
‘timescale 1ns/1ns Module testbench; … Reg clk; Parameter cycle = 15; Always Begin #(cycle/2); clk=1’b0; #(cycle/2); clk=1b1; End endmodule
Verilog Example 2
‘timescale 1ns/1ns Module testbench; … Reg clk; Parameter cycle = 15; Always Begin #(cycle/2.0); clk=1’b0; #(cycle/2.0); clk=1b1; End endmodule
Simple Stimulus (Cont) –
Complex Waveforms
Complex waveforms
Care must be taken not to over constrain
the waveform generation or limit it to a
subset of its possible variations.
Need to make sure that there are many
instances of absolute min and max values
Controlled Randomization
Simple Stimulus (Cont) –
Synchronized Waveforms
Synchronized Waveforms
Stimulus for a DUV is never composed of 1
signal. You must synchronize all inputs to
the DUV properly
In a synchronous design, most signals should
be aligned with the clock
Simple Stimulus (Cont) –
Generating Waveforms
We talked about Delta Cycles – Can be equivalent to
real delays.
If, due to delta cycle problems, you miss a value at one clock edge, then you will get that value on the next! Must have everything aligned!
Generating Data Waveforms
If not done properly, could produce race conditions Can’t ensure that total number of delta cycles between clock and data is maintained, or at least in favor of the data signal. Interfaces specs never specify 0-delay values, thus when generating synchronous data, always provide a real delay between active edge and transition on the data signal.
Simple Stimulus (Cont) –
Encapsulating and Abstraction
Waveform Generation
Encapsulating Waveform Generation
Generation of waves may need to be repeated
during simulation
Place then generation in a subprogram and call that subprogram with the vector to be applied as the input to the subprogram
Abstracting Waveform Generation
Using synchronous test vectors (as above) is
cumbersome and hard to interpret
(maintainability)
Easier if operations accomplished by the vectors
were abstracted!
Try to apply worst possible combinations of inputsDocsity.com
Abstraction Waveform Generation
Example (Cont)
Reset
Worst possible condition:
D0=
D1=
Sel = randomly set
Load d
Worst possible condition:
D1 is complement of d
Abstraction Waveform Generation
Example (Cont)
Task sync_reset; Begin rst<= 1’b1; d0 <= 1’b1; d1 <= 1’b1; @(posedge clk); #(Thold); {rst,d0,d1,sel} <=4’bxxxx; #(cycle-Thold-Tsetup); End endtask
Task load_d0; input data; Begin rst <= 1’b0; d0 <= data; d1 <= ~data; sel <= 1’b0; @(posedge clk); #(Thold); {rst,d0,d1,sel} <=4’bxxxx; #(cycle-Thold-Tsetup); End endtask
Verifying the Output
Generating Stimulus is only about 30%
of job, 70% is in verifying output
Most obvious method is visually
ASCII output
Waveforms
Producing Simulation Results
Which signals are significant change with
time
In order to determine what is correct, must
model this knowledge
Producing the proper simulation results
involves modeling the behavior of the signal
sampling
Sample at regular intervals (clk)
Sample on interested signals (only when they
change)
Visual Inspection of
Waveforms
Results are better (to understand) when
plotted over time
Advantage is that it plots the signal
continuously overtime, not at specified
points as in text view (the samples)
Tool dependent on how to turn on
Performance impact, want to minimize the
total number of signals to view
Mostly used for debug
Self-Checking Testbenches
Use self-checking – different techniques
Specify input and expected output for each
clock cycle
Problems
Difficult to maintain Difficult to specify Difficult to debug Require perfectly synchronous interfaces