[Math] Karnaugh map and Circuit of a full adder

boolean-algebradiscrete mathematics

I have the following task:

The addition can be implemented by the rules

0 + 0 = 0,  0 + 1 = 1,  1 + 0 = 1,  1 + 1 = 10.

Full addition requires carry-in and carry-out bits. In general, you must be able to add two terms (bits) a and b, and a carry-in bit Cin to compute a sum bit S and a carry-out bit Cout.

a.)Complete the truth table that describes a full adder: The Boolean function that adds two bits A, B, and a carry-in bit Cin to produce a sum bit S and a carry-out bit Cout.

b.)Using Karnaugh maps find Boolean expressions that represent the sum function S and the carry-out function Cin.

c.)Draw the circuit of the full adder

I need help with the second and the third part of the question.

Best Answer

Note that using Karnaugh maps is a bit of an art, it is particularly useful when you have only and/or/not. Generally you need to be able to spot patterns and map these back to the algebraic expression.

Note that while Karnaugh maps are a useful tool for learning, understanding and writing expressions for a few variables, in digital design one relies on logic compilers to deal with the actual map of functionality into gates (and timing, which is important, though functionally irrelevant in this context. However, the gray code aspect in the Karnaugh map arises because of the timing issue).

You can also use a modified Karnaugh map as I will show below.

Here is a Karnaugh map for $S$: $$\begin{array}{c|c|c||c|c} C_\text{in} \setminus AB & 00 & 01 & 11 & 10 \\ \hline 0 & 0 & 1 & 0 & 1 \\ \hline 1 & 1 & 0 & 1 & 0 \\ \hline \end{array}$$ In terms of and/or/not gates this doesn't help since there are none of the usual patterns, so this would require four minterms to represent the 'on' condition.

If I fix $A=0$ I recognise the xor pattern, and note that I get the same with $A=1$ (but reversed, because of the Gray coding that people using in Karnaugh maps). This suggests $S = \bar{A} (B \oplus C_\text{in}) + A (\overline{B \oplus C_\text{in}})$ which we recognise as $S= A \oplus (B \oplus C_\text{in})$ (order does't matter here since $\oplus$ is commutative). The circuit for $S$ should be fairly straightforward to create from this expression.

Another way to recognise this is to draw a Karnaugh map but a 'functional' one: That is, fix $AB$ and place the function of $C_\text{in}$ in the corresponding box: $$\begin{array}{c|c|c|} A \setminus B & 0 & 1 \\ \hline 0 & C_\text{in} & \overline{C_\text{in}} \\ \hline 1 & \overline{C_\text{in}} & C_\text{in} \\ \hline \end{array}$$ Here the xor pattern is more obvious, and gives, or course, the same result.

For $C_\text{out}$, the same idea follows (only this time it is a more straightforward use of the Karnaugh map). We have the map for $C_\text{out}$: $$\begin{array}{c|c|c||c|c} C_\text{in} \setminus AB & 00 & 01 & 11 & 10 \\ \hline 0 & 0 & 0 & 1 & 0 \\ \hline 1 & 0 & 1 & 1 & 1 \\ \hline \end{array}$$ You can see the bottom row can be represented by $C_\text{in} (A + B)$ and the column before the last can be represented by $A B$, so we can write $C_\text{out} = AB + C_\text{in} (A + B)$, which can be implemented in a straightforward way.

However, since we already have $A \oplus B$ to compute $S$, we might note that since the $C_\text{in} AB$ entry is covered by $AB$ the remaining two terms can be written as $C_\text{in} (A \oplus B)$, which gives $C_\text{out} = AB + C_\text{in} (A \oplus B)$, thus sharing a gate with $S$.

So, you see that there isn't (in many cases) a single answer, and that the Karnaugh map may be useful for spotting patterns, but you need to eyeball the results and look for further sharing/simplifications.

Note that from a digital design perspective there is typically a tradeoff between sharing (number of gates) and timing (propagation delay, power) which the Karnaugh map can't help you with.

Related Question