paul miller
New Member
Offline
Posts: 4
|
I am using a holding register to hold values in a testbench so that I do not have to remember them all myself (probably a good thing, I'm forgetful).
below is a code snippet from what I'm using
REG [4:0] USER_REG1_UI; assign user_reg1_ui = {value4, value3, value2, value1, value0};
initial begin value4 =0; value3 =0; value2 =0; value1 =0; value0 =0; end
initial begin #(startup delays);
value4 = 1; value2 = 1; value1 = 1;
`WR(USER_REG1_UI, user_reg1_ui)
end
`WR is a defined task that writes my device with the address for the first argument and the value as the second argument.
I would expect this to write USER_REG1_UI with a 5'b10110; what it is actually occuring is that it is writing a 5'b00000;
it correctly writes the 5'b10110 when I modify by adding a delay in after updating my control register. (see below)
REG [4:0] USER_REG1_UI; assign user_reg1_ui = {value4, value3, value2, value1, value0};
initial begin value4 =0; value3 =0; value2 =0; value1 =0; value0 =0; end
initial begin #(startup delays);
value4 = 1; value2 = 1; value1 = 1;
#(1ps) <---- 1 ps delay.
`WR(USER_REG1_UI, user_reg1_ui)
end
Is this expected? If so, how do I do this without needing the 1ps delay? I would like to remove the delay because if I do this enough times, I end up losing a clock cycle.
|