I have a piece of code that I don't understand:
always_ff @(posedge CLK)
state <= RST || ~A[0]===1'bx || ~A[1]===1'bx ? 0 : nextstate;
A
is the input. What is this piece of code exactly doing? What is ~A[0]===1'bx
or ~A[1]===1'bx
?
My guess is that this code is checking if either one of the inputs aren't valid (1'bx
). If one of the inputs aren't valid, we jump back to the starting state 0
.
But why the negation in ~A[0]===1'bx
?