0% found this document useful (0 votes)
70 views

Digital Building Blocks: CS31 Pascal Van Hentenryck

- Digital circuits are composed of basic building blocks like decoders, multiplexers, arithmetic logic units (ALUs), and read-only memories (ROMs). - Decoders select a single output from multiple inputs. Multiplexers select a single input to pass to the output based on selection lines. ALUs perform arithmetic and logical operations. ROMs store fixed values that can be retrieved by address inputs. - These blocks are combined in processors to implement control and data paths that allow computers to operate based on instructions from memory. The document provides examples of how 1-bit and 32-bit ALUs can be constructed from basic gates.

Uploaded by

Animesh Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Digital Building Blocks: CS31 Pascal Van Hentenryck

- Digital circuits are composed of basic building blocks like decoders, multiplexers, arithmetic logic units (ALUs), and read-only memories (ROMs). - Decoders select a single output from multiple inputs. Multiplexers select a single input to pass to the output based on selection lines. ALUs perform arithmetic and logical operations. ROMs store fixed values that can be retrieved by address inputs. - These blocks are combined in processors to implement control and data paths that allow computers to operate based on instructions from memory. The document provides examples of how 1-bit and 32-bit ALUs can be constructed from basic gates.

Uploaded by

Animesh Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Digital Building

Blocks

CS31
Pascal Van Hentenryck

CS031 Lecture 5 1
Overview

Digital Building Blocks


•  Decoders and Multiplexers
•  ALU (arithmetic and logic unit)
•  ROM

ALU
•  This is the brawn of the
computer

ROM
•  Useful for implementing the
control
CS031 Lecture 5 2
The Big Picture

compiler

computer

control
input

datapath

processor memory output


CS031 Lecture 5 3
Abstraction Hierarchy

Programming Language

Assembly Language

Machine Language

Sequential Circuit

Combinational Circuit

Binary Value

Voltage

CS031 Lecture 5 4
Two Building Blocks
Decoders
•  n inputs / 2n outputs
•  Given the inputs, select a unique
output
•  Particularly useful for implementing
memories

Multiplexers (selectors)
•  2n data inputs / n selection inputs / 1
output
•  The output is the data input selected
by the selection input
•  Particularly useful for implementing
ALU and various other pieces of the
machine
CS031 Lecture 5 5
Decoders
Turn binary “coded” quantities into one
unit vector for every possible value.

do
x d1

y d2

d3

CS031 Lecture 5 6
Decoders
Turn binary “coded” quantities into one
unit vector for every possible value.

x y d0 d1 d2 d3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1

Look at (x, y) as a binary number

The decoder
•  assign d2*x+y to 1
•  all the others to zero

CS031 Lecture 5 7
Decoders
Turn binary “coded” quantities into one
unit vector for every possible value.

x y d0 d1 d2 d3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1

CS031 Lecture 5 8
More Decoders
•  Decoders can be in any size

m input n output
m by n
decoder

•  n is always 2m
•  two types of decoders: a single output 1
or a single output is 0

CS031 Lecture 5 9
Multiplexers
Choose a particular input to pass through as
specified by values on the selection (or address)
lines.

I0
output
I1

I2

I3

x y

selector

Essentially a switch in hardware


Output = l2x+y

CS031 Lecture 5 10
Multiplexers
Choose a particular input to pass through as
specified by values on the selection (or address)
lines.

S1 S2 O
0 0 I0
0 1 I1
1 0 I2
1 1 I3

CS031 Lecture 5 11
Multiplexers
Choose a particular input to pass through as
specified by values on the selection (or address)
lines.

What is inside a multiplexer?


•  can you see it?

CS031 Lecture 5 12
Multiplexers
Choose a particular input to pass through as
specified by values on the selection (or address)
lines.

What is inside a multiplexer?


•  can you see it?

CS031 Lecture 5 13
1-bit ALU
1-bit ALU with and and or

operation

result

Add addition to this ALU now.

CS031 Lecture 5 14
1-bit ALU

CS031 Lecture 5 15
32-bit ALU

CS031 Lecture 5 16
32-bit ALU
Operation
CarryIn

a0
Alu0
b0

a1
Alu1
b1

a31 Alu31
b31

CS031 Lecture 5 17
32-bit ALU
Include subtraction
•  Add the negative version of b

How to obtain the negative version


•  Invert each bit
•  Add 1

How do to that simply


•  Generalize a bit
•  Use a simple trick

This shows why 2’s complement is a


good representation

CS031 Lecture 5 18
1-bit ALU (Revisited)

CS031 Lecture 5 19
32-bit ALU

CS031 Lecture 5 20
ALU (Absolutely Lazy Unit)
A B

Binv Cin

O1
O0
function

R
Possible Modes
Operation 0: R = A + B
Operation 1: R = A – B
Operation 2: R = A and B
Operation 3: R = A or B

CS031 Lecture 4 21
Controlling the ALU

O1 O0 Binv Cin
A+B 0 0 0 0
A–B 0 1 1 1
A^B 1 0 0 x
AvB 1 1 0 x

(Look Ma! I can build an ALU)

CS031 Lecture 5 22
Implementing a Logic Function

Three main possibilities


•  Specific circuit
•  ROM
•  PLA

Specific Circuit
•  when there is a lot of structure (the
Karnaugh map, remember?)

ROM
•  when there is almost no structure

PLA
•  in between
CS031 Lecture 5 23
Read Only Memory (ROM)
Map addresses to fixed values
a1 a2 a3 O
0 0 0 V1
0 0 1 V2
0 1 0 V3
0 1 1 V4
1 0 0 V5
1 0 1 V6
1 1 0 V7
1 1 1 V8

CS031 Lecture 5 24
Modern ROMs
1

input 1
loc.output 1
input 2
“Pulldown
input 3
loc.output 2

Output

Local outputs are associated with each pulldown

The local outputs are equal to their corresponding


inputs

The output is the logical and of the local outputs

CS031 Lecture 5 25
Modern ROMs
Modern ROMs are organized around
•  a decoder
•  a multiplexer
•  an array of pulldowns

n address
bits
2n x2m
decoder array of
pulldowns

m address
bits multiplexe r
Output

CS031 Lecture 5 26
Example (stupid, I agree)
Assume that I need a ROM to store the prime
numbers from 0 to 63.

Given an integer (between 0 and 63), build a circuit


that returns 1 if the number is prime and 0
otherwise.

The integer is given as a sequence of bits


A5 A4 A3 A2 A1 A0
We use an array of 8 by 8

CS031 Lecture 5 27
Storing Primes
Put a pulldown where you want a 0.
0 1 2 3 4 5 6 7
0

decoder 3
4

A2
A5A4 A3 A1 multiplexer
A0
Address
Output
If you want more than one bit of output, just use
more ROM circuits in parallel with different stored
functions.
CS031 Lecture 5 28
Not Chaining Adders
Can we speed this up?

FAFAFAFA0x y y x y x y x S S S S C
0 0 2 2 2 2 1 1 0 1 2 3

0 S0
x0
y0 FA

S1
x1 FA
y1

S2
x2 FA
y2

S3
x3 FA
y3 C

CS031 Lecture 5 29

You might also like