Hi all,
I’ve written a SV testbench with a program block generating the stimulus for the DUT. Additionaly I added a signal in my program block which I don’t use but want to see in my Wave windows. I have the problem that it is optimized away.
Is there a possibility to keep certain signals without disable the whole optimization? Just say the simulation tool to keep certain signals?
My program:
`timescale 1ns/10ps
program automatic SlopeMeasurement_MainProg(slope_interface.TB slope_mif);
logic signed [17:0] angle = 0;
logic signal_change = 0;
real expectedAngle = 0;
initial begin : Slope_Increments
slope_mif.IncrementFactor1 = 'b0010101010101101;
slope_mif.IncrementFactor2 = 'b0010101010101101;
slope_mif.nSampleForSlope = 3;
// wait 100 us
#100_000;
slope_mif.IncrementFactor1 = 5000;
// wait 100 us
#100_000;
slope_mif.IncrementFactor1 = 10000;
// wait 100 us
#100_000;
slope_mif.IncrementFactor1 = 100000;
end
initial begin
angle = -12500*5/2;
forever begin
// rising
for (int i = 0; i < 12500; i++) begin
for (int i = 0; i < 127; i++) begin
@(posedge slope_mif.clk);
end
angle += 5;
signal_change <= 'b1;
@(posedge slope_mif.clk);
signal_change <= 'b0;
end
// falling
for (int i = 0; i < 12500; i++) begin
for (int i = 0; i < 127; i++) begin
@(posedge slope_mif.clk);
end
angle -= 5;
signal_change <= 'b1;
@(posedge slope_mif.clk);
signal_change <= 'b0;
end
end
end
assign slope_mif.angle = angle;
assign slope_mif.signal_change = signal_change;
// calculate the expected angle
initial begin : ExpectedAngle_ib
integer counter;
forever begin
@(posedge slope_mif.clk);
if (signal_change == 'b1) begin
counter = 0;
end else begin
counter++;
end
expectedAngle = angle + slope_mif.extrapol_inc1 / 128;
end
end
endprogram
The signal I want prevent from optimization is the expectedAngle!
Kind regards
Sebastian