Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Trying to sketch up a circuit which will divide, say a 5-bit binary number by 5 to produce a 4-bit binary quotient. We can assume that the input doesn't actually reach 31, instead it's limited to 30, or 25.

I'd like to use only 2 ~ 4 input NAND gates. The inputs A, B, C, D, and E will be available from toggle switches. Any solution which uses 22 or fewer gates and inverters (not counting the five inverters for the inputs) is acceptable.

share|improve this question
Actually the quotient will never be more than 3 bits. – Olin Lathrop Nov 4 '12 at 23:59
Cheat! Only divide by powers of 2. Then the output is just a shifted version of the input. If you want to divide by something more arbitrary then it becomes a lot harder. Also: this sounds suspiciously like a homework question. – Kit Scuzz Nov 5 '12 at 2:46

Since you are dividing by a constant this is a trivial 5-bit -> 4-bit (actually 5-bit -> 3-bit as @OlinLathrop points out) combinational circuit.

If you are feeling too lazy to work the 5-variable Karnaugh maps by hand then get yourself a copy of the Espresso heuristic logic minimizer. (If you google "espresso logic minimizer" you may be able to find a precompiled binary (prefer the ones from .edu sites.)

Type in the truth table and run it through the tool. It will probably give you the results in sum of products form. The conversion to nand gates with 4 or fewer inputs is a trivial exercise.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.