The software for the course can be dowmloaded from here.
Module 1: Boolean Functions and Gate Logic Roadmap
In this module, we will be looking at Boolean algebra and the implementation of Boolean functions using logic gates. We will also learn how to use a Hardware Description Language (HDL) to specify gates and chips. This will lead on to project 1 where we will build, simular and test 15 elementary logic gates which will later be used to build the ALU for our computer.
Unit 1.1: Boolean Logic
We can extend Boolean logic to express Boolean functions such as
f(x, y, z) = (x AND y) OR (NOT(x) AND z)
As an example, let's assume that x = 1, y = 1 and z = 0. If we start by evaluating the expression in the first parentheses (let's call that subexpression 1), a AND y, this returns a 1 and we can actualy stop there because whether the expression in the second parentheses (subexpression 2) returns a 1 or a 0, the overall expression will return a 1. We know this because, regadrless of how complex the expressions in the parentheses might be, it comes down to an OR statement where the result of the expression will return a 1 if either subexpression 1 or subexpression 2 returns a 1. We already know that the subexpression 1 returns a 1 so the whole expression must return a 1.
Let's try another example where x = 0, y = 0 and z = 1. This time subexpression 1 returns a 0. In essence, that means whatever value is returned by subepxression 2 will be returned by the expression. In other words, if subexpression 2 returns a 0, the expression becomes 0 OR 0 and so 0 is returned. If it returns a 1, the expression becomes 0 OR 1 and a 1 is returned. Subexpression 2 has two stages. The first is NOT(x) which in this case returns a 1. We then take this value and AND it with z which gives us 1 and 1 so subexpression 2 returns a 1.
This means that the expression simplifies down to 0 OR 1 and so it returns a 1.
These results tell us a little bit about the function but if we want to know precisely what this function is doing (that is, what is it for) a useful starting point is to list all the possible input and all the possible outputs.
x y z f 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1
So, here we have essentially two definitions of the same expression, the first in the form of a formula and the second in the form of a truth table
Boolean logic contains some of the same laws as are found in arithmetic.
Commutative Laws
• (x AND y) = (y AND x) • (x OR y) = (y OR x)
Associative Laws
• (x AND (y AND z)) = ((x AND y) AND z) • (x OR (y OR z))= ((x OR y) OR z)
Distributive Laws
• (x AND (y OR z)) = (x AND y) OR (x AND z) • (x OR (y AND z)) = (x OR y) AND (x OR z)
De Morgan Laws
• NOT(x AND y) = NOT(x) OR NOT(y) • NOT(x OR Y) = NOT(x) AND NOT(y)
We can use these idenities to simplify or change a Boolean expression.
Example
NOT(NOT(x) AND NOT(x OR y))
Step 1
We can useDe Morgans law to change the last part of the expression - the NOT(x OR y). We can express this as NOT(x) AND NOT(y) so this gives us
NOT(NOT(x) AND NOT(x) AND NOT(y))
According to the associative law, we can evaluate the part in the brackets as NOT(x) AND (NOT(x) AND NOT(y)) or (NOT (x) AND NOT(x)) AND NOT(y). If we take the latter expression, this means that we will start by evaluating NOT(x) AND NOT(x)
Now, if x = 0, NOT (x)=1
NOT(x) AND NOT(x) will also return 1 (since we are effectively ANDing x with itself the result is x) so similarly, if x = 1, NOT(x) will return 0 as will NOT(x) AND NOT(x) so we can rewrite NOT(x) and NOT(x) as simply NOT(x). This is referred to as the Idempotence Law. Our formula then becomesNOT(NOT(x) AND NOT(y))
Here, we can use De Morgans Law again so the expression becomes
NOT(NOT(x) OR NOT(NOT(y))
The next part should be fairly obvious. NOT(x) inverts the value of x so 0 becomes 1 and 1 becomes 0. NOT(NOT(x)) inverts it twice so 0 becomes 1 becomes 0 and 1 becomes 0 becomes 1 (the Double Negation Law). So, we can say that NOT(NOT(x)) is just x and the same applies for y so our expression then becomes
x OR y
Now, let's consider the truth table for this expression. We will assume that f is the result of evaluating the expression
x y f 0 0 0 0 1 1 1 0 1 1 1 1
This shows us that the expression is equivalent to x OR y since it produces the same truth table.
A truth table won't always give you a clear and obvious result as we have here, so sometimes a bit of algebraic manipulation may be required and this manipulation may also not yield a nice simple result, we may well end up with a complicated formula. However, both techniques allow to find alternative forms of the same Boolean expression.