← Back

Synchronous Circuits

Part 1: Gates, Switches, and Boolean Algebra

Layers of Abstraction

We are now going to be looking at the lowest level of the hierarchy (BUT NOT TRANSISTORS!).

Digital (Logic) Design: Using circuits to implement some logic

Circuit Design: The Design of individual circuits

Circuit Design

Why do we care? (good question)

  • Appreciate the limitations of hardware.
  • Understand why some things are fast and some things are slow.
  • Need circuit design to understand logic design.
  • Need logic design to understand CPU Datapath

Digital Circuits

NOT DIGITAL (LOGIC) DESIGN!!!

This just talks about how everything to do with circuits is digital in the sense that they are represented by discrete, individual values (so no gray areas or ambiguity).

However, this means that we must convert an analog: take a continuous variable (in our case electricity) and change that signal to digital

In other words we take the analog signal, electricity (voltage) and covert it into binary (0's and 1's)

  • "High" voltage ⇒1\Rightarrow 1
  • "Low" voltage ⇒0\Rightarrow 0

Physicality of Circuits

In terms of Circuits, everything is a switch.

  • "Input" ⇒A\Rightarrow A
  • "Output" ⇒Z\Rightarrow Z

I don't really need to explain this but I got some time right now so...

If A is 0 (false) then the switch is open and Z is off. If A is 1 (true) then the switch is closed and Z is on.

So, since the state of A is equal to the state of Z, we can summarize and say that this circuit implements:

A≡ZA \equiv Z

Transistors: Electrically Controlled Switches

Like I said, we don't care about transistors so nothing more needs to be said here. Maybe learn it for midterm or exam (idk)

Logic as Circuits

Propositional Logic: A set of propositions (mathematical sentences that are either true or false) combined by some Logical Connectives.

  • Each proposition is represented by a binary digital signal (0 or 1 as false and true respectively).
  • Local Connectives are presented by Logic Gates.

Logic Gate: A circuit mapping a number of propositions to one (sometimes more) proposition(s).

The Basics: AND (∧\wedge), OR (∨\vee), NOT(¬\neg):

Arity: The number of input signals a gate/function has (AND = 2, OR = 2, NOT = 1)

Gates as Switches

When it comes to implementing Logic Gates as Switches, we can just think of the switches as Boolean Integers:

Logic Gates in Detail

AND

  • A∧B≡CA \wedge B \equiv C
  • A⋅B≡CA \cdot B \equiv C

Truth Table for AND

ABA∧B≡CA \wedge B \equiv C
000
010
100
111

OR

  • A∨B≡CA \vee B \equiv C
  • A+B≡CA + B \equiv C

Truth Table for OR

ABA∨B≡CA \vee B \equiv C
000
011
101
111

NOT

  • ¬A≡C\neg A \equiv C
  • Aˉ≡C\bar{A} \equiv C

Truth Table for NOT

A¬A≡C\neg A \equiv C
01
10

NAND

  • ¬(A∧B)≡C\neg (A \wedge B) \equiv C
  • A⋅B‾≡C\overline{A \cdot B} \equiv C
  • A ∣ BA \ | \ B

"|" = Sheffer Stroke

Truth Table for NAND

ABA⋅B‾≡C\overline{A \cdot B} \equiv C
001
011
101
110

NOR

  • ¬(A∨B)≡C\neg (A \vee B) \equiv C
  • A+B‾≡C\overline{A + B} \equiv C
  • A↓BA \downarrow B

"↓\downarrow" = Pierce Arrow

Truth Table for NOR

ABA+B‾≡C\overline{A + B} \equiv C
001
010
100
110

XOR

  • A⊕B≡CA \oplus B \equiv C

Truth Table for XOR

ABA⊕B≡CA \oplus B \equiv C
000
011
101
110

The Algebra of Logic Gates

Due to the equivalence of Truth Tables and Binary Digital Signals, Boolean Algebra is heavily used when discussing Circuitry.

Associativity:

  • (A+N)+C≡A+(B+C)(A + N) + C \equiv A + (B + C)
  • (A⋅B)⋅C≡A⋅(B⋅C)(A \cdot B) \cdot C \equiv A \cdot (B \cdot C)

Identity:

  • A+0≡AA + 0 \equiv A
  • A⋅1≡AA \cdot 1 \equiv A

Commutativity:

  • A+B≡B+AA + B \equiv B + A
  • A⋅B≡B⋅AA \cdot B \equiv B \cdot A

Annihilation:

  • A+1≡1A + 1 \equiv 1
  • A⋅0≡0A \cdot 0 \equiv 0

Distributivity:

  • A+(B⋅C)≡(A+B)⋅(A+C)A + (B \cdot C) \equiv (A + B) \cdot (A + C)
  • A⋅(B+C)≡(A⋅B)+(A⋅C)A \cdot (B + C) \equiv (A \cdot B) + (A \cdot C)

Idempotence:

  • A+A≡AA + A \equiv A
  • A⋅A≡AA \cdot A \equiv A

Absorption:

  • A+(A⋅B)≡AA + (A \cdot B) \equiv A
  • A⋅(A+B)≡AA \cdot (A + B) \equiv A

Double Negation:

  • A‾‾≡A\overline{\overline{A}} \equiv A

De Morgan's Laws:

  • A+B‾≡A‾⋅B‾\overline{A + B} \equiv \overline{A} \cdot \overline{B}
  • A⋅B‾≡A‾+B‾\overline{A \cdot B} \equiv \overline{A} + \overline{B}

Complementation:

  • A+A‾≡1A + \overline{A} \equiv 1
  • A⋅A‾≡0A \cdot \overline{A} \equiv 0

Proving De Morgan's Laws

We have seen this a billion times but whatever, here we go again!

Proof By Exhaustion: The easiest way to prove something is to write out each expression's truth table.

A+B‾≡A‾⋅B‾\overline{A + B} \equiv \overline{A} \cdot \overline{B}
ABA+BA + BA+B‾\overline{A + B}A‾\overline{A}B‾\overline{B}A‾⋅B‾\overline{A} \cdot \overline{B}
0001111
0110100
1010010
1110000

Simplifying Expressions with Boolean Algebra

xy‾ z‾+xy‾ z‾\overline{xy} \ \overline{z} + \overline{xy} \ \overline{z} xy‾ z‾+xy‾ z‾≡xy‾(z‾+z)Factor xy‾≡xy‾(1)Complementation of z≡xy‾Identity with xy‾\begin{aligned} \overline{xy} \ \overline{z} + \overline{xy} \ \overline{z} &\equiv \overline{xy}(\overline{z} + z) \qquad \text{Factor} \ \overline{xy} \\ &\equiv \overline{xy}(1) \qquad \text{Complementation of} \ z \\ &\equiv \overline{xy} \qquad \text{Identity with} \ \overline{xy} \\ \end{aligned}
xxyyzzxyxyxy‾\overline{xy}xy‾ z‾\overline{xy} \ \overline{z}xy‾ z\overline{xy} \ zxy‾ z‾+xy‾ z\overline{xy} \ \overline{z} + \overline{xy} \ z
00001101
00101011
01001101
01101011
10001101
10101011
11010000
11110000

Sometimes a Truth Table is too challenging...

  • For vv variables a truth table has 2v2^{v} rows
(x‾+z‾)‾(abcd+xz)⟹ 6 variables, 64 rows\overline{(\overline{x} + \overline{z})}(abcd + xz) \Longrightarrow \ \text{6 variables, 64 rows}

Instead, we can simplify using the laws of Boolean Algebra:

(x‾+z‾)‾(abcd+xz)≡xz‾‾(abcd+xz) De Morgan’s Law≡xz(abcd+xz) Double negation of x and z≡xz Absorption\begin{aligned} \overline{(\overline{x} + \overline{z})}(abcd + xz) &\equiv \overline{\overline{xz}}(abcd + xz) \qquad \ \text{De Morgan's Law} \\ &\equiv xz(abcd + xz) \qquad \ \text{Double negation of} \ x \ \text{and} \ z \\ &\equiv xz \qquad \ \text{Absorption} \end{aligned}

Simplifying Expressions for Simplified Circuits

We can do the same with Circuits:

Canonical Forms

From 2209 we know that there are 2 canonical forms:

  • Disjunctive Normal Form (DNF) ⇒\Rightarrow ORs of ANDs
    • "Product of Sums"
  • Conjunctive Normal Form (CNF) ⇒\Rightarrow ANDs of ORs
    • "Sum of Products"

DNF Example: (A∗B)+(C∗D)+(E∗F)(A * B) + (C * D) + (E * F)

CNF Example: (A+B)∗(C+D)∗(E+F)(A + B) * (C + D) * (E + F)

EVERY Boolean Expression can be converted to a Canonical Form! (DNF is more useful, practical and easier to create... because of Truth Tables!)

Example:

  1. aa, bb, cc are inputs, ff is output.
  2. Create one product term for every entry in the table with f≡1f \equiv 1
  3. Put x‾\overline{x} in product if xx is False in that row
  4. Put xx in product if xx is True in that row
  5. OR all products together (connect them with a ∨\vee or ++)
abcf
0001
0010
0101
0110
1001
1010
1100
1111

∴ a‾b‾c‾+a‾bc‾+ab‾c‾+abc\therefore \ \overline{a}\overline{b}\overline{c} + \overline{a}b\overline{c} + a\overline{b}\overline{c} + abc

Functional Completeness

A Formula whose outcomes and operations can be adequately described by a set of functions (operators) is called Functionally complete.

  • For Boolean Algebra, the classical set of operators: {+,⋅,¬}\lbrace{+, \cdot, \neg\rbrace}
  • is functionally complete but NOT minimal
  • Minimal: Removing any one of the operators would make the set functionally incomplete!
  • However, thanks to the goat De Morgan, we only need one of AND or OR.
  • The sets {+,¬}\lbrace{+, \neg\rbrace} (NOR) and {⋅,¬}\lbrace{\cdot, \neg\rbrace} (NAND) are both Functionally Complete AND Minimal.

NAND & NOR (Functional Completeness)

To Prove Functional Completeness, we need to show that the operators of the set can mimic the functionality of the set {+,⋅,¬}\lbrace{+, \cdot, \neg\rbrace}.

NAND = ∣|

  • ¬X≡X ∣ X\neg X \equiv X \ | \ X
  • X⋅Y≡X ∣ Y‾≡(X ∣ Y) ∣ (X ∣ Y)X \cdot Y \equiv \overline{X \ | \ Y} \equiv (X \ | \ Y) \ | \ (X \ | \ Y)
  • X+Y≡X+Y‾‾≡X‾⋅Y‾‾≡(X ∣ X) ∣ (Y ∣ Y)X + Y \equiv \overline{\overline{X + Y}} \equiv \overline{\overline{X} \cdot \overline{Y}} \equiv (X \ | \ X) \ | \ (Y \ | \ Y)

NOR = ↓\downarrow

  • ¬X≡X↓X\neg X \equiv X \downarrow X
  • X+Y≡X ↓ Y‾≡(X ↓ Y) ↓ (X ↓ Y)X + Y \equiv \overline{X \ \downarrow \ Y} \equiv (X \ \downarrow \ Y) \ \downarrow \ (X \ \downarrow \ Y)
  • X⋅Y≡X⋅Y‾‾≡X‾+Y‾‾≡(X ↓ X) ↓ (Y ↓ Y)X \cdot Y \equiv \overline{\overline{X \cdot Y}} \equiv \overline{\overline{X} + \overline{Y}} \equiv (X \ \downarrow \ X) \ \downarrow \ (Y \ \downarrow \ Y)

Summary

Boolean Algebra can simplify circuits.

  • Remove variables that the output does not depend on.
  • Simplifies expression, removing needless gates.
  • Space and time complexity improved!

Truth Tables, Canonical Forms, and Functional Completeness are all related in one happy family. Yay!