mahmood.n
Member level 5
Hi
There is a question about synthesizing mod/rem operators.
X mod N where N is positive:
This can be synthesized by taking the least log2(N) bits of X.
X can be positive of negative (2's complement).
How about negative N numbers?
For example, 1 mod -4 = -3
How this is synthesized?
The same question exists for rem.
-1 rem 4 = -1
-1 rem -4 = -1
There is a question about synthesizing mod/rem operators.
X mod N where N is positive:
This can be synthesized by taking the least log2(N) bits of X.
X can be positive of negative (2's complement).
How about negative N numbers?
For example, 1 mod -4 = -3
How this is synthesized?
The same question exists for rem.
-1 rem 4 = -1
-1 rem -4 = -1