Computer Hardware Engineering (IS1200) Computer Organization and Components (IS1500)
Computer Hardware Engineering (IS1200) Computer Organization and Components (IS1500)
Fall 2017
Lecture 7: Combinational Logic
Optional for IS1200, compulsory for IS1500
Fredrik Lundevall
Slides by David Broman and Fredrik Lundevall
Course Structure
Module 1: C and Assembly
Module 4: Processor Design
Programming
LE1 LE2 LE3 EX1 LAB1 LE9 LE10 EX4 S2 LAB4
LE4 S1 LAB2
Application
Application Software
Software
Software
Operating
Operating System
System
Instruction
Instruction Set
Set Architecture
Architecture Hardware/Software Interface
Microarchitecture
Microarchitecture
Logic
Logic and
and Building
Building Blocks
Blocks Digital Hardware Design
Digital
Digital Circuits
Circuits
Analog
Analog Circuits
Circuits
Analog Design and Physics
Devices
Devices and
and Physics
Physics
Agenda
Part I
Gates and Boolean Algebra
Part I
Gates and Boolean Algebra
6
Logic Gates (1/3)
AND, OR, NOT, and BUF
A A
AND Y OR Y
B A B Y B A B Y
0 0 0 0 0 0
0 1 0 0 1 1
This kind of table is 1 0 0 1 0 1
called a truth table. 1 1 1 1 1 1
NOT A Y BUF A Y
A Y A Y
0 1 Looks like not, 0 0
The small circle (called a
1 0 but has no circle. 1 1
bubble) inverts the signal.
Buffer. Logically the
NOT is also called an same as a wire. Important
inverter. because of technology limitations.
Part I Part II Part III
Gates and Building Blocks: Multiplexers, Logisim
Boolean Algebra Decoders, and Adders Demo
7
8
Logic Gates (2/3)
NAND, NOR, XOR, and XNOR
A A
NAND Y NOR Y
B A B Y B A B Y
0 0 1 0 0 1
0 1 1 0 1 0
NOT AND. Note the 1 0 1 NOT OR. 1 0 0
Small bubble at the end. 1 1 0 1 1 0
A A
XOR Y XNOR Y
B A B Y B A B Y
0 0 0 0 0 1
0 1 1 0 1 0
Exclusive OR, 1 0 1 Exclusive NOT OR. 1 0 0
pronounced “ex-or”. 1 1 0 1 1 1
10
E
Combinational Circuit
1 0 This circuit is
A=1 combinational because its
1 outputs depend only on its
Y =1
inputs. The circuit is
B=0
0 memoryless, that is, it has
1
C=1
1 no memory.
We will
introduce
memory in
0 1 Lecture 8
A=0 1
0 Y =1
1 Observe that this (rather
B=1 0 useless) circuit always
C=1
1 outputs 1. As a logic formula,
this is called a tautology.
E
Problematic Circuits
Unstable circuit.
What is the value of Q?
Q
Answer: it oscillates. This circuit is
called a ring oscillator.
12
E A Y
E 0 0 Z
A Y 0 1 Z
1 0 0
1 1 1
Commonly used in buses to When the enable signal The output floats
connect multiple chips. As long is not active, the output when both output
as only one buffer at a time is is said to be floating transistors are
enabled, contention is avoided. (using symbol Z). turned off.
14
Boolean Algebra (2/4) E
Some Theorems
Theorem Dual Name
Exercise:
A•1 = A A+0 = A Identity Derive the simplest
A•0 = 0 A+1 = 1 Null Element form of expression
A A A A
B
Y = Y
B
Y = Y
B B
AB = A + B = Y A+B = A B = Y
Important law. For CMOS logic, NAND and NOR But how can we know
gates are preferred over AND and OR gates. that this theorem is true?
16
Boolean Algebra (4/4)
Proof by Perfect Induction
ABC = A + B + C
A B C ABC A+B+C
0 0 0 1 1
Proof by perfect induction.
0 0 1 1 1
Exhaustively show all cases
in a truth table. 0 1 0 1 1
0 1 1 1 1
1 0 0 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 0
Part II
Building Blocks:
Multiplexers, Decoders,
and Adders
18
Application
Application Software
Software
Software
Operating
Operating System
System
Instruction
Instruction Set
Set Architecture
Architecture Hardware/Software Interface
We can combine
Microarchitecture
Microarchitecture logic gates and form
digital building
Logic
Logic and
and Building
Building Blocks
Blocks Digital Hardware Design blocks
Digital
Digital Circuits
Circuits
Analog
Analog Circuits
Circuits
Analog Design and Physics
Devices
Devices and
and Physics
Physics
S D1 D0 Y S
0 0 0 0 2 bits for the
data input D0 0
0 0 1 1 Y 1 output
D1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0 One possible
D0
1 1 0 1 implementation.
1 1 1 1 S Y Convince
yourself of its
D1 correctness!
20
Combinational Blocks (2/3) E
Multiplexers
A multiplexer can be seen as a simple A 4:1 multiplexer can be defined
switch, selecting which signal that should hierarchically.
pass through the block.
S1 S0 S1 S0
S0
D0 D0 00
D1 D1 01
D0 0
Y Y S1
D2 D2 10 D1 1
D3 D3 11
0
S0 Y
1
4:1 multiplexer (4 inputs, 1 output).
D2 0
What is the output signal Y for the D3 1
4:1 multiplexer with these inputs?
D0 = 1, D1 = 0, D2=1, D3=0,
S1 = 1, S0 = 0 Answer: Y = 1
Part I Part II Part III
Gates and Building Blocks: Multiplexers, Logisim
Boolean Algebra Decoders, and Adders Demo
21
Combinational Blocks (3/3)
Decoders
A decoder has N inputs and 2N outputs.
Asserts exactly one output.
Decoder A1 A0 Y3 Y2 Y1 Y0
A0
00 Y0 0 0 0 0 0 1
01 Y1 0 1
A1 10 Y2
0 0 1 0
11 Y3 1 0 0 1 0 0
1 1 1 0 0 0
2:4 decoder (2 inputs, 4 output).
22
Arithmetic Circuits and Numbers (1/3) E
Half and Full Adders
A half adder has a carry out signal. A full adder has
A B
both carry out and
carry in signals.
Cout + Cin
A B How can we add
bigger numbers? S
Cout + Idea: Chain A B Cin Cout S
S adders together… 0 0 0
0 0 1
A B Cout S 0 1 0
0 1 1
0 0 0 0
1 0 0
0 1 0 1
1 0 1 Exercise:
1 0 0 1 1 1 0 Complete the
1 1 1 0 1 1 1 truth table
24
Arithmetic Circuits and Numbers (2/3)
Carry Propagate Adders
Cout + + + Cin
C30 C29 C1 C0 +
S31 S30 S1 S0
Part I Part II Part III
Gates and Building Blocks: Multiplexers, Logisim
Boolean Algebra Decoders, and Adders Demo
25
Arithmetic Circuits and Numbers (3/3)
Subtract
B B 0
N
1
A
N N A N
N
Cout + Cin = 1 Cout +
N
Coming up… N
S S
In lecture 9, we will generalize this idea
Note that setting carry in to 1 into an Arithmetic/Logic Unit (ALU), one
adds 1 to A + B. of the main components of a processor.
Part I Part II Part III
Gates and Building Blocks: Multiplexers, Logisim
Boolean Algebra Decoders, and Adders Demo
26
Part III
Logisim Demo
Logisim
Explorer Pane
Building blocks
and gates
Attribute Table
Configure
different
components
28
1 bit
input Decoder
2:4
1 bit output
30
Reading Guidelines
Reading Guidelines
See the course webpage
for more information.
Summary