Let's say we have these two if conditions assigning values to the same variable and both if statements can be true at the same time. What value will x have? Lets say z and y are equal to 0.
From my testing in simulator, the if statement that was written lower in the code had precedence. The value of x was 1 when I simulated the code below with values of z and y equal to 0. When I had the if conditions swapped (the if condition with "!z" came at the end), then the value of x came out to be 0 in the simulation.
Is there a rule when such a condition happens in Verilog?
always @ (posedge clk) begin
x <= 1'b0;
if (!z) begin
x <= 0;
end
if (!y) begin
x <= 1;
end
end