Use five cascaded banks of 32 two-input multiplexers, for optional shifts of bits. The original circuit schematic below shows one bank per shift-amount bit; this is a left bit shift with zero fill, not a bit rotation.
Figure 1.
Five optional power-of-two shifts implement every 32-bit logical left-shift distance
. Details.
If , stage selects either its unchanged input or that input shifted left by . For bit position , the shifted candidate comes from position when it exists, and otherwise from zero. Composing the chosen stages shifts by the sum of their distances, so each amount from to is represented exactly by its five binary control bits. There are one-bit multiplexers, with five multiplexer delays along a bit path.
A one-bit multiplexer with selector , unselected input and selected input has output . It can be made from one NOT gate, two AND gates and an OR gate; a bank can share the selector inversion. The two possible selector values directly verify its behaviour.
Compute the two complements with the two NOT gates, then form and with the two AND gates. Feed those outputs to the OR gate:
Exactly one product is one when the inputs differ; both products are zero when the inputs agree. This uses precisely the allowed two inverters, two two-input AND gates and one two-input OR gate.
The minority Boolean function is one at input assignments . Put on the rows and in Gray code order on the columns. The Karnaugh map has rows and . Pair the cell with each of its three one-cell neighbours; the horizontal pair across the two map edges is valid because those columns are adjacent.
Figure 1.
Three essential pairs in the three-input minority Karnaugh map
. Details.
The pairs give
Generate with three NOT gates. Then use
De Morgan laws show that the final NAND gate computes the required disjunction of the three products. This uses three two-input NAND gates and one three-input NAND gate, besides the input inverters. If only two-input NAND gates are available, replace the final three-input gate by , , .
The three pairs are essential: the one-input assignments each have only as an adjacent one-cell, so no pair can be omitted from this disjunctive normal form.
The five maximal four-cell groups give the disjunctive normal form
For example, the group wraps between columns and in the bottom two rows. No group of eight cells is entirely one. The five terms are precisely the prime implicants, and each is essential: respectively, the cells are covered by no other prime implicant. Any disjunctive normal form can have its terms enlarged to prime implicants without increasing its size. Therefore all five displayed terms are necessary, proving minimality in number of products; each needs two literals, also giving ten literals in a minimal cover.
For an implementation with AND gates and NOT gates, call these five products . Form the shared complements , calculate each with an AND gate, invert every , and use
A five-input conjunction can be replaced by four two-input AND gates. This direct implementation uses nine two-input AND gates and eight NOT gates. That is a valid realization of the minimal disjunctive normal form, rather than a claim that this particular gate count is globally optimal among all factored circuits.