I am making a range limiter with upper and lower boundaries. My code works for the most part. But when I am trying to compare negative numbers I don't get the correct output.
When I compare a negative number with the lower boundary I want to output -1 but that doesn't happen.
Can someone help me understand how this works ?
always @ (a)
begin
if (a >= 4'b0110) //4'b0110, 4 bit number = 6
y = 4'b1; //upper boundary
else if (a <= 4'b0011) //4'b0011 4 bit number = 3
y = 4'b1111; //4 bit number = -1; //bottom boundary
else
y = a; // if a is inbetween boundaries, output a
end
Thank you