this is my code:
module zero(out,A,B); output signed[5:0] out; input signed[5:0] A,B; assign out = A[5:0]<<<2 + B[5:0]>>>1; endmodule
but the output is always zero.
is there anything wrong?
(I don't want to use @always)
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.Sign up to join this community
From our discussion in comments, it seems the problem is operator precedence. According to this,
+ has higher precedence than
<<<, so your expression will calculate
(A <<< (2 + B)) >>> 1 rather than what you might expect.
This can be solved by adding parentheses to ensure the expected order of operations.