Forum Discussion
Altera_Forum
Honored Contributor
12 years agoYes, the result of the two assign statements are the same. A couple of things you need to watch out for in more complex expressions.
The precedence of the bitwise and &, and the bitwise or | operators are both higher than both the logical operators && and ||. This gets very confusing when you mix these operators in the same expression. I tend to only use the logical operators unless you really need the bitwise functionality - it is a clearer description of your design intent. You could also have written assign c = a==2'b02 && b; Another issue for non-synthesizable code is that the && and || operators may use short-circuit evaluation. That means if you have expression a && functioncall(b) the functioncall may not get called if a is 0.