Lecture 1
Lecture 1
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
Assembly Language
Processors
Arithmetic Finite State
Logic Units Machines
Devices Flip-flops
Circuits
Logic Gates
▪
▪
▪
▪
▪
▪
▪
What is a computer?
do you need
electricity for a
computer?
CSCB58 Asks the Big Questions
▪ What is a computer?
▪ What is memory? How does a computer
store information
▪ Why do computers work in binary?
▪ how does a computer actually…
compute?
▪ How does the code we write in
Python/Java/C++/etc actually translate
into things happening?
Why take CSCB58?
▪ To better understand computers!
▪ See what's going on "under the hood"
▪ Open the black box, get rid of the mystery
▪ Understand the whole pipeline, from
atoms to assembly
Everything above assembly is virtualization
and abstraction
Everything else is an illusion!
▪ Build a cool software-based project!
CSCB58 Course Goals
▪ Learn to build computers…
Understand and design the underlying
architecture of computer systems.
▪ … and how they work.
How programs use digital structures to do
computation.
▪ Learn engineering.
Build systems from components, understand
abstractions, make tradeoffs.
▪ Learn there is no magic!
There is nothing you cannot understand.
CSCB58 Course Goals
▪ …in Minecraft
▪ …inside an iMessage
to break into iPhones**
** also unethical.
https://villains.fandom.com/wiki/Vogons
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
▪
This week
Assembly Language
Processors
Arithmetic Finite State
Logic Units Machines
Devices Flip-flops
Circuits
Logic Gates
Transistors
You already know some important concepts…
Boolean Logic from CSCA67
▪ Example: Create an expression that is true if
both variables A and B are true, or if both C and
D are true.
G = A & B | C & D
A
B
G
C
D
Logic Gates
▪ If you know how to create A
Y
B
simple logical expressions,
you already know the basics A
Y
B
of putting logic gates
together to form simple
A Y
circuits.
▪ Just need to know which
A
Y
logic operations are B
A
Y
B
inputs outputs
truth table A B Y
For every
combination of 0 0 0
inputs, what are 0 1 0 If the truth table
the outputs? for two circuits is
1 0 0 the same, they
1 1 1 are equivalent
OR Gate
A
Y
B
A B Y
0 0 0
0 1 1
1 0 1
1 1 1
NOT Gates
Bubble signifies
‘NOT’
A Y
A Y
0 1
1 0
XOR Gates
A
Y
B
A B Y
0 0 0
0 1 1
1 0 1
1 1 0
NAND Gates
Bubble signifies
‘NOT’
A
Y
B
A B Y
0 0 1
0 1 1
1 0 1
1 1 0
NOR Gates
A
Y
B
A B Y
0 0 1
0 1 0
1 0 0
1 1 0
Buffer
A Y
Assembly Language
Processors
Arithmetic Finite State
Logic Units Machines
Devices Flip-flops
Circuits
Gates
Transistors
Making logic with gates
▪ Logic gates create an output value, based on
one or more input values.
▪ These correspond to Boolean logic that we’ve
seen before in CSCA08/A48/A67:
AND OR NOT
A Y A
Y A Y
B B
A B Y A B Y A Y
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
Other gates
XOR NAND NOR
A A A
Y Y Y
B B B
A B Y A B Y A B Y
0 0 0 0 0 1 0 0 1
0 1 1 0 1 1 0 1 0
1 0 1 1 0 1 1 0 0
1 1 0 1 1 0 1 1 0
Aside: notation
▪ While we’re talking about notation…
AND operations are denoted in these expressions by
the multiplication symbol.
e.g. A·B·C or ABC or A*B*C A˄B˄C
OR operations are denoted by the addition symbol.
e.g. A+B+C A˅B˅C
NOT is denoted by multiple symbols.
e.g. !A or ~A or A or A’ or ¬A
XOR occurs rarely in circuit expressions.
e.g. A B
Making Boolean expressions
▪ So how would you represent boolean
expressions using logic gates?
▪ Like so: A
B
A
B
C
Now you are here
Assembly Language
Processors
Arithmetic Finite State
Logic Units Machines
Devices Flip-flops
Circuits
Gates
Transistors
Creating complex circuits
▪ What do we do in the case of more complex
circuits, with several inputs and more than
one output?
If you’re lucky, a truth
table is provided to
express the circuit.
Usually the behaviour of
the circuit is expressed in
words, and the first step
involves creating a truth
table that represents the
described behaviour.
Circuit example
▪ The circuit on the
right has three A X
B
Logic
inputs (A, B and C) Circuit Y
and two outputs C
(X and Y).
▪ What logic is needed to set X high when all
three inputs are high?
▪ What logic is needed to set Y high when the
number of high inputs is odd?
Combinational circuits
▪ Small problems can be solved easily.
A A
B B
X Y
C C
A’B’C’
ABC
A’BC
ABC’
51
Answers to Warm-Up Exercise
For each of the following logic expressions, what are the
A, B, C values that make the expression evaluate to 1 ?
A’B’C’
▪ A=0, B=0, C=0 , and only this!
ABC
▪ 111 and only this!
A’BC
▪ 011 and only this!
ABC’
▪ 110 and only this!
52
Maxterms, informally
▪ Assume a standard truth table format.
Sort rows as if input ABC is binary number.
▪ Maxterms tell us which rows have low output.
These rows are referred to as maxterms.
▪ Express circuit behaviour by listing those rows.
In this example, we only need maxterms M0 M5 M7
A single minterm 3 0 0 1 1 0
4 0 1 0 0 0
indicates a set of inputs 5 0 1 0 1 0
that will make the 6 0 1 1 0 0
output go high. 7 0 1 1 1 0
8 1 0 0 0 0
Example: m2 9 1 0 0 1 0
output. 13 1 1 0 1 0 0 0
14 1 1 1 0 0 0 0
15 1 1 1 1 0 0 0
Creating Boolean expressions
▪ Two canonical forms of Boolean expressions:
▪ Sum-of-Minterms (SOM):
Since each minterm corresponds to a single high
output in the truth table, the combined high outputs
are a union of these minterm expressions.
Also known as: Sum-of-Products.
▪ Product-of-Maxterms (POM):
Since each maxterm only produces a single low output
in the truth table, the combined low outputs are an
intersection of these maxterm expressions.
Also known as Product-of-Sums.
Y = m2 + m6 + m7 + m10 (SOM)
A B C D m2 m6 m7 m10 Y
0 0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0 0
2 0 0 1 0 1 0 0 0 1
3 0 0 1 1 0 0 0 0 0
4 0 1 0 0 0 0 0 0 0
5 0 1 0 1 0 0 0 0 0
6 0 1 1 0 0 1 0 0 1
7 0 1 1 1 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 1 0 0 1 1 1 1 1 1
0 1 0 1 1 0 1 1 1 0
0 1 1 0 1 1 1 1 1 1
0 1 1 1 1 1 0 1 1 0
1 0 0 0 1 1 1 1 1 1
1 0 0 1 1 1 1 1 1 1
1 0 1 0 1 1 1 0 1 0
1 0 1 1 1 1 1 1 1 1
1 1 0 0 1 1 1 1 1 1
1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 1 1 0 0
1 1 1 1 1 1 1 1 1 1
Using Sum-of-Minterms
▪ Sum-of-Minterms is a way of expressing which inputs cause the
output to go high. Product-of-Maxterms is a way of expression
which inputs cause the output to go low.
Assumes that the truth table columns list the inputs according to some
logical or natural order.
▪ Minterm and maxterm expressions are used for efficiency reasons:
More compact that displaying entire truth tables.
Sum-of-minterms (SOM) are useful when very few input combinations that
produce high output.
Product-of-maxterms (POM) useful when expressing truth tables that have
very few low output cases.
Converting SOM to gates
▪ Once you have a Sum-of-Minterms expression, it is easy to
convert this to the equivalent combination of gates:
¬A
¬B
¬C
m0 + m1 + m2 + m3 =
¬A
¬B
C
A·B·C + A·B·C + ¬A Y
A·B·C + A·B·C = B
¬C
¬A
B
C