I was implementing the ALU from the specs given in my The Elements of Computing systems book. I am stuck on only one problem. How do I find if a given number is zero or not. One thing I can do is or every bit in the bus, and then apply a not gate on that. But there has to be some other elegant solution.

# Electronic – How to find out if a binary number is zero

alu

###### Related Topic

- How to reduce an ALU logic with the minimum logic possible? Its very challenging
- Choosing ALU functions
- Electronic – How was the Zero Flag implemented on Z80 ALU
- Electrical – How to find out if a binary number is zero or not using logic gates
- Electronic – How many ALUs (and threads) are in a Pentium CPU
- Electronic – I have a problem with understanding the attached ALU (6 control bits)

## Best Answer

There's simply no way around ORing all the bits, as unsatisfying as that may seem. However, you are not restricted to two input gates in silicon either. You can build a 4-input NOR gate in CMOS logic by putting 4 series p-type transistors in the pullup network and 4 parallel n-type transistors in the pulldown network. That reduces the depth of your tree topology and therefore your propagation delay. You can only take that theory so far though before the cumulative voltage drop across the series transistors makes the pull-up not pull-up enough to be a "1"... four is a good rule of thumb if I remember correctly.