CS 273: Digital Logic and Boolean Algebra

Digital Logic and Boolean Algebra

It's probably worth while to give a little bit of information on digital logic, and how it relates to boolean algebra. note: what I'm going to say below is reasonably correct for a particular logic family called "open-collector TTL".

First Step: the NOT Gate

Let's start with what we might call the most most basic of digital circuits: the NOT gate

NOT Gate

As we look at this, we can see the following basic parts, which we'll be reusing in the later discussion:

Terminal
Terminals The terminals show where this circuit element connects to other circuit elements: there's one labelled In, one labelled Out, and one labelled +5. There's also a special one for the "ground", which is where 0V is connected (there are so many connections to ground in a typical circuit that we need a shorthand to simplify the diagrams.
Resistor
Resistor

A "resistor" does just the name implies: it resists the flow of electricity, but doesn't shut it off all the way. If we were to put a wire between power and ground we'd just burn out the wire; if we put a resistor in between then current will flow, but not too much.
Voltage-Controlled Switch
Voltage-controlled switch

The switch is "open" (which means no electricity can flow through it) when its input is at 0V (or ground), and it's "closed" (which means electricity can flow) when its input is at +V.

Note: this switch is actually a transistor, and I'm using a comletely non-standard symbol for it to emphasize how we're using it. There are several different symbols in common use for a transistor, depending on just what type of transistor it is.

So, how does this work? Let's ask two questions: what happens when +V is applied to the input, and what happens if 0V is applied to the input?

  1. Not-Gate with +V applied When +V is applied to the input, the switch is closed: electrically, it might as well be a wire. Because there's a "wire" connecting Out to ground, Out is at 0V just like ground is. There is some current flowing through the resistor, but not enough to cause any damage. So the result is that if In os at +V, Out is at 0V.

  2. Not-Gate with 0V applied When 0V is applied to the input, the switch is open: electrically, there is no connection between the output terminal and ground.

    Now, there's nothing trying to "pull" Out down, but there is something to pull it up: the resistor. As long as we don't have Out connected to anything that's got too low a resistance to ground, it'll be at a voltage close enough to +V that we can just treat it like that is its voltage. So the result is that if In os at 0V, Out is at +V.

So, how can we relate this to logical operations? Suppose we decide that +V means "T", and 0V means "F". Then we can draw a table showing the relationship between the input terminal and the output terminal:

InOut
FT
TF

This circuit implements the logical NOT operation. There's even a special circuit symbol that the engineers use to denote this circuit:

Not Symbol

Second Step: a NOR Gate

For our second step, we'll create another circuit, but with two switches:

NOR Gate

(note: the gap in the wire for In2 is meant to show that it's passing behind the wire that's crossing it — it isn't actually broken there

This time, if either In1 or In2 has +V on it, the Out will be pulled to 0V. Here's the truth table for this one:

In1In2Out
FFT
FTF
TFF
TTF

Looking at this table, the output is F if either of the inputs is T — so this is a "negated OR", frequently called a NOR. It's also got its own symbol:

NOR Symbol

Combining NOR and NOT to make OR

Now, this isn't the way we're used to dealing with logic: we're used to using OR, not NOR. Well, we can wire up an OR gate pretty easily: just do a NOR, and then a NOT. Like this:

OR gate

NAND Gate

We can also wire up a NAND Gate:

NAND gate

This time, both of the switches need to be turned on to pull the output to ground. So this implements a NOT-AND, or NAND, gate.


Last modified: Wed Jan 30 09:08:28 MST 2008

Valid HTML 4.01 Transitional