Skip to Content

Logic Circuits and Flip Flops

Combinational Circuits, Boolean Algebra, and Flip Flops


In this class we have seen basic bit, or boolean, operations -- AND, OR, NOT, and XOR. We said that these operations are not only useful for logical conditions (in high level programmig languages), but are also useful at the bit level -- for testing and changing individual bits. Since a bit is a 1 or a 0, and a logic value is True or False, these operations are equivalent whether you are talking about bits or logical values.

Actually, these basic operations are also the basic components that the physical circuits on a chip are built out of -- and in digital electronic terms, they are called gates. Well, actually the lowest level on a chip are transistors -- essentially electronic switches, but then these are used to build gates. So, all of the CPU operations that we can program at assembly level are basically designed into the hardware in terms of gates. And it takes alot of gates -- CPU's like the Pentium have millions of gates.

These basic boolean operations form a discrete mathematical system called boolean algebra. It obeys many of the properties that we are used to seeing in math, and more:

OR is represented by a plus sign, AND by a dot (or nothing, like multiplication). NOT is a bar over the term (but sometimes a prime mark), and XOR is most often a plus sign inside of a circle

like integer math's plus operator, 0 is the boolean identity value for OR -- that is, anything OR'd with zero is itself.

like integer math's multiply operator, 1 is the boolean identity value for AND -- that is, anything AND'd with 1 is itself.

AND and OR are associative, commutative, and distributive.

NOT defines an inverse value

DeMorgan's Laws

  1. NOT( AND(A, B)) is the same as OR( NOT(A), NOT(B))
  2. NOT( OR(A, B)) is the same as AND( NOT(A), NOT(B))

Just like in regular math, we can write down formulas in boolean math.

(in class examples)

Since circuit designers like to draw their circuits rather than just write formulas, there are a set of diagrams for each operator in Boolean logic:

Basic Digital Gates{width=“556” height=“101”}

As an example for how these gates can be constructed out of switches (or transistors), the following diagram shows an AND gate and an OR gate made out of switches.

{width=“379” height=“324”}

Flip Flops

Ok, the basic boolean operators let you compute values, but with a computer we also like to store values -- i.e., have some memory that we can work with. So how do we do that?

Well, what happens if we connect some logic gates in a special circular fashion?

RS Latch{width=“306” height=“151”}

This circuit essentially stores one bit of data! But we don't have a "data" line into it, we just have two controls (set and reset). To make a data-in line and a data-out line takes a little more doing:

D Flip-flop{width=“476” height=“136”}

This circuit is essentially a one-bit storage circuit. If you put eight of them in parallel, you have the A register on the HC11!