Reputation: 217
I am currently having issues when trying to store a 16bit number coming from the input of my module into one of my logic variables. When I set all the bits high in my test bench I get a value: 0000000000000001. Hope you can help! PS: Sorry, dont know how to insert code on here....
My code is shown below:
Upvotes: 0
Views: 561
Reputation: 6978
I think your problem is likely with this line:
regy = (!regy)+1;
regy
is a 16-bit value. Using the negation operator (!)
on a multi-bit value is equivalent to (value != 0)
. So for any value of regy
other than zero will set regy
to 1.
If you are trying to invert all the bits and add 1, you need to use the ~
operator.
Example:
regy = (~regy)+1;
Upvotes: 1