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
- "Low" voltage
Physicality of Circuits
In terms of Circuits, everything is a switch.
- "Input"
- "Output"
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:
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 (), OR (), NOT():
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
Truth Table for AND
| A | B | |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR
Truth Table for OR
| A | B | |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT
Truth Table for NOT
| A | |
|---|---|
| 0 | 1 |
| 1 | 0 |
NAND
"|" = Sheffer Stroke
Truth Table for NAND
| A | B | |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR
"" = Pierce Arrow
Truth Table for NOR
| A | B | |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XOR
Truth Table for XOR
| A | B | |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
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:
Identity:
Commutativity:
Annihilation:
Distributivity:
Idempotence:
Absorption:
Double Negation:
De Morgan's Laws:
Complementation:
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 | |||||
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Simplifying Expressions with Boolean Algebra
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Sometimes a Truth Table is too challenging...
- For variables a truth table has rows
Instead, we can simplify using the laws of Boolean Algebra:
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) ORs of ANDs
- "Product of Sums"
- Conjunctive Normal Form (CNF) ANDs of ORs
- "Sum of Products"
DNF Example:
CNF Example:
EVERY Boolean Expression can be converted to a Canonical Form! (DNF is more useful, practical and easier to create... because of Truth Tables!)
Example:
- , , are inputs, is output.
- Create one product term for every entry in the table with
- Put in product if is False in that row
- Put in product if is True in that row
- OR all products together (connect them with a or )
| a | b | c | f |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
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:
- 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 (NOR) and (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 .
NAND =
NOR =
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!