Digital Logic SystemsDavid N. Warren-Smith, MSc. South Australia |
Boolean algebra in terms of the exclusive-OR operator - Part 1
Note: You can use this list of contents and the symbols Figure 1 "The 16 possible binary operators and the 4 possible unary operators." replaced on 4 December 2001.
|
A & 0 = 0 | A + 0 = A | Basic theorems |
A & 1 = A | A + 1 = 1 | |
A & A = A | A + A = A | |
A & A' = 0 | A + A' = 1 | |
AB = BA | A + B = B + A | Commutative law |
A(BC) = (AB)C | A+(B+C) = (A+B)+C | Associative law |
A(B+C) = AB+AC | A+BC = (A+B)(A+C) | Distributive law |
The inverse of a logic function
can be obtained by replacing all + operators with & operators, replacing all & operators with + operators, priming all unprimed variables and unpriming all primed variables. |
DeMorgan's theorem | |
A + AB = A | A + A'B = A + B | Simplification relationships |
When we look at the XOR theorems we would expect to find some characteristic differences. The corresponding theorems for the XOR operator are listed below.
Summary of the theorems for the XOR operator
The XOR operator is related to the InOR operator by: x y = xy' + x'y. ( is the symbol for the XOR operator).
T1. x x = 0 | T2. x x' = 1 | Basic theorems |
T3. x 0 = x | T4. x 1 = x' | |
T5. (x y)' = x' y = x y' | T6. x' y' = x y | Inversion theorems |
T7. x y = y x | Commutative law | |
T8. (x y) z = x (y z) | Associative law | |
T9. x(y z) = xy xz | Distributive law | |
T9'. x(y z) = (x'+y) (x'+z) | Distributive law with OR function | |
T10. If: f = g h and gh = 0, then f = g + h | Disjunction theorem | |
T11. If: f = g h, then g = f h and h = g f | Transposition theorem |
The duality principle which states that "Given any of the basic theorems of Boolean algebra, changing OR operators to AND operators, AND operators to OR operators and changing 0s to 1s and 1s to 0s where these occur leads to another of the basic theorems" applies specifically to the AND and OR operators.
Take a look at the summary of the theorems for the XOR logic. Apply the inversion theorem T5 to theorem T1 and you get theorem T2. Do the same with T3 and you get T4. And the same applies when you go the other way round. This makes T1, T2 and T3, T4 dual pairs.
Now apply the transposition theorem T11 to T1 and you get T3. Apply theorem T11 to T2 and you get T4. Once again the same applies when you go the other way round. This makes T1, T3 and T2, T4 dual pairs. XOR logic has a double duality property which makes the XOR a very flexible system of logic. Any of the basic theorems can be transformed into any of the others by either inversion and/or transposition.
A consideration that we will need shortly are the following alternative representations of the basic theorems. The basic theorems are frequently labelled to reflect the duality properties.
Alternative expressions for T1 and T3 are:
T1a. | x x ... x = 0, for an even number of x |
T3a. | x x ... x = x, for an odd number of x, or |
T1b. | x y z ... = 0, if an even number of variables x, y, z ... have the value 1 |
x y z ... = 1, if an odd number of variables x, y, z ... have the value 1 |
T10 can be used for expressing a function, given in terms of the OR operator, in terms of the XOR operator. The function in terms of the OR operator is expanded to minterm form, so that all terms are disjoint (ie the product of any two terms is 0). The + operators can then be replaced with operators.
This means that any function can be expressed in XOR form directly from its truth table or K-map. A canonical form for the exclusive OR operator is therefore with three variables:
C1. f(abc) = a0a'b'c' a1a'b'c a2a'bc' a3a'bc a4ab'c' a5ab'c a6abc' a7abc
where: a i = 1,0 depending on whether the ith term is present or not. Expressions like this are sometimes referred to as Exclusive-OR Sum-Of-Products or ESOPs in the literature.
An alternative canonical form (found by expanding all primed variables with T4 (x' = x 1) multiplying out and cancelling duplicate terms with T3 and T1) is:
C2. f(abc) = b0 b1a b2b b3c b4ab b5ac b6bc b7abc
where: bi = 1,0 depending on whether the ith term is present or not.
You can generalise these expressions for an arbitrary number of variables using sigma notation. However, I will simply assume that you can get the idea from the above representations. Other canonical forms are possible, for example you can replace all unprimed variables with primed variables instead of replacing all primed variables with unprimed variables. However, the two canonical forms shown are sufficient for the purpose of this paper.
The canonical expansions imply that any Boolean function can be expressed in terms of the AND and XOR operators. XOR algebra is therefore a complete Boolean algebra.
The majority function is true in both InOR and XOR form.
ab ac bc = ab + ac + bc | Prove it for yourself by expanding out the left hand side. |
Hint: Use the disjunction theorem.
A theorem that gives exclusive OR logic an unusual degree of freedom is T11.
By means of this theorem any given term or expression can be made to be a part of any other expression of the same variables.
For example, let x = ac' a'bc and suppose that the term h = ac is to be made a part of this expression.
Then, | g = x h = ac' a'bc ac = a(c' c) a'bc = a a'bc. |
Therefore, | x = g h = a a'bc ac. |
As a check, this could have been obtained in this simple case directly from the given expression for x by replacing c' with (1 c) and expanding by T9 the distributive property.
You might want to use this idea if you want to find out if a single variable, with a single XOR operator will give an expression with fewer product terms than the original expression. Let p be the single variable in function f, then evaluate g = f p. If this expression or its inverse has fewer product terms as required then g is the required result. ie. f = g p or f = g' p'. You would need to evaluate g for each variable in turn and take the best result, or you might stop with the first good result if any. The Altera MaxPlus II system makes use of this result.
Ask your school or Uni library to purchase a copy of my book"Introduction to Digital Circuit Theory" (ISBN:
978-0-9581894-1-5).![]() |
The idea described in the previous paragraph is not limited to single variables, you can apply the idea to any desired function of the same variables. This theorem makes a good starting point for multi output circuit design with XOR functions. Another example of the use of this theorem is to construct a Gray code to binary code converter circuit. Refer to the "Electronics World" article for the details of this example. I also mention it briefly in the Boolean Algebra pages.
Problem: Express the function: f = ac + b'c + a'bc' in XOR form.
If you are observant you could solve this problem as follows:
f |
= ac + b'c + a'bc' |
= c(a + b') + a'bc' | |
= c(a'b)' + (a'b)c' | |
= c a'b |
There are many cases like this for functions of three variables. However,
often this approach may not be so easy to carry out. Fortunately the K-map technique can
be readily adapted for the purpose.
First consider the XOR function plotted on a K-map as shown in Figure 2. The K-map technique for the XOR function depends on T10 and the extended forms of T1 and T3.
Plotting the variables x and y individually on the map results in minterm xy being plotted twice, consequently by the extended form of T1, this term will disappear from the XOR form.
Similarly by the extended form of T3, where the minterm is plotted once or an odd number of times it will be retained.
Generalising this observation for the XOR form gives the rules:
Any minterm that is to be included in the function must be plotted an odd number of times.
Any minterm that is to be excluded from the function must be plotted an even (or zero) number of times.
Two examples of this result are shown in Figure 3.
The first result is the example given at the start of this section. You can see that one minterm a'bc has been plotted twice and is therefore excluded from the equation.
The second example is the function that had the same form for the XOR
operators as it had for the AND, OR, Invert operators. Here one term has been plotted
three times and is therefore included in the function. With a little practice the XOR
forms can be readily found for three variable functions and sometimes for four variable
functions. Figure 4 shows two examples of four variable XOR functions.
A procedure for using the K-map to find opportunities for simplification of a logic expression by using an XOR gate (by inspection) is to look for a grouping of 1s that could be simplified if an extra square or squares between them are filled in with 1s to combine the terms. This is applicable if only one XOR is needed to represent the function. The following examples show a more general approach where more than one XOR is needed.
To plot a function given in exclusive OR form, simply plot individual
terms by placing 1s in all squares for the term and cancel all squares that have an even
number of 1s.
Don't care conditions are treated in the K-map approach the same way as for the inclusive OR case, the don't care term is either used or not as required. For the XOR function don't care terms can be plotted an even or odd number of times.
In the case of f1 in Figure 4 the minimal XOR form of the equation may not be so easily found by inspection. Here we would like to have an algebraic simplification procedure. An easy to use and systematic procedure is described in part 2 of this paper.
Two more examples
are shown in Figures 5 and 6 where more than one XOR is required to represent the
function. These Figures shows the step by step procedure to be followed.
Consider the function plotted on the K-map shown in Figure 5a. We might start by plotting variable a as shown at 5b. This covers three of the 1s in the map but places an additional 1 at position abc. (The additional 1s in Figures 5 and 6 are shown greyed). We might next plot variable c as shown at 5c. This cancels the extra 1 at abc, covers the 1s at position a'bc and a'b'c but cancels the 1 at position ab'c. To regain a 1 at this position we place an additional 1 there and map that position as shown at 5d. This gives the final result as shown below the K-map at 5d.
From a practical point of view we might implement the resulting expression as follows (since there is generally only one XOR function available in a CPLD macrocell):
y |
= a c ab'c |
= a c(1 ab') | |
= a c(ab')' | |
= a c(a' + b) | |
= a (a'c + bc) or, | |
= a' (c(ab')')' |
The last line is for NAND gate implementation (a NAND gate has the form (ab)' )
Another example is shown in Figure 6. The same steps are taken as was done
in Figure 5. The function is shown plotted on a K-map at 6a. We start as before by
plotting variable a as shown at 6b, since this looks like a suitable starting
point. This covers two of the 1s in the function but introduces two additional 1s. Next we
plot variable b as shown in 6c. This cancels one of the unwanted 1s that were
introduced in 6b but also cancels one of the 1s that we wanted to keep and introduces an
additional 1 at a'bc. Finally we add the plot for variable c. As you can see
this restores the 1 at abc covers the 1 at a'b'c and cancels the unwanted 1s
at a'bc and ab'c. The final (well known) result is shown under the K-map at
6d as it was in Figure 5.
To summarise what we have done to find XOR forms of functions using the K-map: We started by making an arbitrary choice of first plot, which covered some of the minterms but possibly introduced unwanted minterms, we then made another choice of mapping which covered more of the required minterms and possibly eliminated some of the unwanted minterms and we continued the process until we had covered the complete function. The method is somewhat heuristic but at least in general the method gives the result in a direct way for functions with a small number of variables.
The last example will show a slightly different way of using the K-map. Assume that you entered the following expression into your CPLD Hardware Description Language software:
y = ac'd' + abc + ab'd + b'c'd + a'b'cd'
The compiler in your CPLD software has came up with the following expression for this logic function and you would like to confirm that it is the same function:
y = a (b'cd' + abc'd + a'b'c'd)
The K-map shown in Figure 7 confirms the identity. Note that we can plot all the terms in parenthesis as a function and use this as a whole with the XOR approach with the term a. A reduction of five product terms to three is achieved with this function. The use of the K-map is obviously a lot less work than expanding out the XOR function.
This is as far as we will go in this paper. However, it is possible to treat the simplification of XOR forms of equations by a systematic algebraic procedure. This procedure should be used for functions with four or more variables if the minimal form of the function is to be guaranteed. The algebraic simplification procedure is described in part 2. This paper has presented all of the preliminary requirements for the algebraic method of simplification of XOR functions. As a clue, you may recall that simplification methods for the AND, OR invert algebra depended on making systematic use of the relation: x + x' = 1 and the distributive theorem. For the XOR algebra we will make systematic use of the relation: x x' = 1 and a few rules.
This paper has demonstrated that a complete Boolean algebra can be developed in terms of the exclusive-OR operator in place of the inclusive-OR operator. Examples have been given that demonstrate the use of this approach to Boolean algebra. The exclusive-OR algebra adds to and does not replace inclusive-OR algebra. The algebra is complete with simplification methods including the use of conventional Karnaugh maps. The method of using a conventional Karnaugh map for dealing with exclusive-OR functions was shown and illustrated with examples.
Buy the second edition of the book entitled:
"Introduction to Digital Circuit Theory" (ISBN: 978-0-9581894-1-5). The book is
in the form of a monograph with comb binding, card back and clear cover in A4 format. The
current revision includes a number of inadvertent error corrections. The single copy price
is $39.95 (Australian dollars), which includes all currency fees and airmail charges if
purchased with the Buy Now link. PayPal will carry out the conversion of your
currency to Australian currency in a secure transaction and email me your order. Please
follow this link |
Boolean Algebra - Page 1 OR Navigation menu at the top of the page OR Exclusive-OR logic Part 2:
![]() |
![]() |
![]() |
(Copyright) David N. Warren-Smith, CPENG
Digital Logic Systems, South Australia
Modifications: 3 March, 1999, 6 October 2000, 25 January 2002, 16 January 2003.