01 Lec-Intro To Digital Logic-Slides
01 Lec-Intro To Digital Logic-Slides
Organization
Original Instructor & Slides: Steve Engels, sengels@cs.toronto.edu
Course outcomes:
Understand the underlying
architecture of computer
systems.
Learn how to best use this
architecture to store data
and create behaviour.
Use the principles of
hardware design to create
digital logic solutions to
given problems.
“What is the point of this course?”
if x:
print ‘Hello World’
# what values of x will make
# this print out “Hello World”?
What if x is a boolean?
All comes down to
What if x is an int?
hardware in the end!
What if x is a string?
Example #2: Integers
How are int values stored?
Again, as ones and zeroes.
12345 0011000000111001
However…
For CSC258, be prepared to let that all go.
Verilog → specification language
Assembly → low-level programming
Trying to connect these languages to CSC148 will
only hold you back.
Embrace new ways of thinking!
Logic from CSC165
Thanks to CSC165, you’re already familiar with the
first piece of CSC258: basics of logic gates.
CSC165 example: Create an expression that is true
if the variables A and B are true, or C and D are
true.
G = A & B | C & D
A B
Y A B Y
0 0 0
+ 0 1 0
-
1 0 0
1 1 1
OR Gates A
Y
B
A
B Y
A B Y
+ 0 0 0
-
0 1 1
1 0 1
1 1 1
NOT Gates
A Y
+
-
A
A Y
Y
0 1
1 0
This is another A
transistor, which
connects the two sides
when A is turned off.
Note that its state
(on/off) is the
complement of the
other switch below.
More on this later too.
XOR Gates A
Y
B
A B
Y
+
- A B Y
0 0 0
A B
0 1 1
1 0 1
1 1 0
Bill Gates
A A B Y
0 0 1
B
0 1 1
1 0 1
1 1 0
NOR Gates A
Y
B
+
- A
A B Y
A B 0 0 1
0 1 0
1 0 0
1 1 0
Buffer
A Y
Y
+ A Y
-
0 0
1 1
From gates back to CSC165 (the little
circle here
acts like a
Given a logic problem A NOT gate)
Y 1 1 0
1 1 1
From expressions to circuits
Creating and expressing circuit logic is similar to
working with boolean logic in Python, C or Java:
¬A
¬B
¬C
¬A
B Y
C
A
B
C
Things you might not know yet
Thinking in hardware
Although CSC258 has elements
that are similar to other
courses, it is very different
in significant ways.
Unlike software courses,
CSC258 is not about creating
programs and algorithms, but
rather devices and machines.
Very important concept to
grasp early in this course!
For instance: We need to understand what certain terms
mean in the context of hardware.
“True” and “False” in CSC258
If a circuit performs a logical operation, how
does it represent “true” and “false”?
In hardware, these boolean values are represented as
electrical voltage values on a wire:
“False” (aka zero): little to no voltage at that point.
“True” (aka one): typically a voltage difference of 5
volts, relative to the ground.
+ +
-
R vR -
R vR
Behind gates
For electricians, switches
are physical devices for +
R vR =0
manually closing a circuit. -
Assembly Language
Processors
Arithmetic Finite State
Logic Units Machines
Devices Flip-flops
Circuits
Gates
Transistors
Starting from the bottom
Gates can combine values together like
logical operators in C or Java.
But how do gates work?
First, we need to
understand electricity.
Then, we need to
understand transistors.
Resources put for you on
Quercus
Course infosheet
Quercus/Canvas: https://q.utoronto.ca
Login with your UTORid
Go to CSC258 course
Under the Modules menu
Lab breadboard demo
DE1-SoC pin assignment file
Many more: educational videos, Quartus
installation and usage guides, Verilog tutorials,…