Operators & Logic Questions

01

Logical Shift (<<) vs Arithmetic Shift (<<<)?

+
  • Logical Shift (<<,>>): Shifts in 0s. Does not preserve sign. Used for Unsigned numbers.
  • Arithmetic Shift (<<<,>>>): Preserves the sign bit (MSB) when shifting right. Used for Signed numbers to maintain 2's complement correctness.
02

Difference between == and ===?

+

== (Logical Equality): If any operand is X or Z, the result is X (unknown).

=== (Case Equality): Checks for exact match, including X and Z states. Returns 0 or 1. Essential for verification but not synthesizable.