I cannot figure out a puzzle which is to create a 4-bit bit counter using basic logic gates (NOT, OR, AND, NOR, NAND, XOR, XNOR, MUX, FULL ADDER). A bit counter tells how many bits are set in a value. So, for example, the value '1011' would have the result '011' because three bits are set and '011' means 3 in binary.
I bought a book called "Digital Principles" by Schaum's Outlines and nowhere in this book does it tell how to make a bit counter out of logic gates. I also have the book Hill & Horowitz, used to teach digital logic. Nowhere in this book does it tell how to make a bit counter out of logic gates. I find it extremely frustrating that making basic combinatorial logic circuits is some kind of black voodoo that is undocumented.
Is there any book that COMPREHENSIVELY describes the construction of all common combinatorial circuits, such as bit counters, adders, etc, using basic logic gates?
Note: figuring out how to do this is not easy. This is a 16-row truth table with 3 columns of outputs. If you try to write that all out and simplify it, it will be very complex and a lot of opportunity for making errors. The truth table for a 4-bit bit counter looks like this (inputs on left, output on right):
I tried solving this using a Karnaugh map, but it is still resulting in an expression that is way too big for the puzzle solution area. For example, for the second output column, I got the following Karnaugh map:
which has the following expression:
A'B'CD + A'BD + ABC' + AB'D + BCD' + AB'CD'
Representing this in the puzzle would require 6 4-way ANDs, 1 4-way OR, and 3 2-way ORs. All these components would not even fit in the available area for the puzzle solution.