I am facing a strange problem. The code is for a simple ALU. Only code of interest is pasted here:
always @(posedge clk or posedge rst)
begin
if (rst == 1) begin
mul_valid_shr = 3'b000;
end else begin
if (op_mul_i == 1) begin
mul_valid_shr = 3'b111;
end else begin
mul_valid_shr <= mul_valid_shr << 1;
end
end
end
And outside the always block:
assign mul_valid = mul_valid_shr[2];
The POST SYNTHESIS FUNCTIONAL SIMULATION with my test bench has following results:
The reset is already low, why is the sim not working for the first time but working fine for 2nd and third time? If I trigger the op_mul_i
before 100ns mark, even if rst
is low, even the mul_result
stops working on the first time.
Any guesses are welcome.
UPDATE: FULL CODE HERE: https://www.edaplayground.com/x/28Hx