If I have a 32 bit two’s complement number and I want to know what is the easiest way to know of two numbers are equal… what would be the fastest bitwise operator to know this? I know xor’ing both numbers and check if the results are zero works well… any other one’s?
how about if a number is greater than 0?? I can check the 31’st bit to see if it’s greater or equal to 0..but how about bgtz?
Contrary to your comments, ‘==’ is part of Verilog, and unless my memory is a lot worse than usual tonight, it should synthesize just fine. Just for example, you could write something like:
Verilog also supports the other comparison operators you’d normally expect (!=, <=, etc.). Synthesizers are fairly “smart”, so something like
x != 0will normally synthesize to an N-input OR gate instead of a comparator.