0% found this document useful (0 votes)
38 views78 pages

Datapath Components

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)
38 views78 pages

Datapath Components

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/ 78

Digital Design

Chapter 4:
Datapath Components
Slides to accompany the textbook Digital Design, First Edition,
by Frank Vahid, John Wiley and Sons Publishers, 2007.
http://www.ddvahid.com

Copyright © 2007 Frank Vahid


Instructors of courses requiring Vahid's Digital Design textbook (published by John Wiley and Sons) have permission to modify and use these slides for customary course-related activities,
Digital
subject to keeping Design
this copyright notice in place and unmodified. These slides may be posted as unanimated pdf versions on publicly-accessible course websites.. PowerPoint source (or pdf
with animations) may not be posted to publicly-accessible websites, but may be posted for students on internal protected sites or distributed directly to students by other electronic means.
Copyright © 2006 1
Instructors may make printouts of the slides available to students for a reasonable photocopying charge, without incurring royalties. Any other use requires explicit permission. Instructors
Franksource
may obtain PowerPoint Vahidor obtain special use permissions from Wiley – see http://www.ddvahid.com for information.
4.1

Introduction
• Chapters 2 & 3: Introduced increasingly complex digital building
blocks
– Gates, multiplexors, decoders, basic registers, and controllers
• Controllers good for systems with control inputs/outputs
– Control input: Single bit (or just a few), representing environment event or
state
• e.g., 1 bit representing button pressed
– Data input: Multiple bits collectively representing single entity
• e.g., 7 bits representing temperature in binary
• Need building blocks for data si ansis
– Datapath components, aka register-transfer-level (RTL) components,
store/transform data
ez
• Put datapath components together to form a datapath
• This chapter introduces numerous datapath components, and simple
datapaths
– Next chapter will combine controllers and datapaths into “processors”
Digital Design
Copyright © 2006 2
Frank Vahid Note: Slides with animation are denoted with a small red "a" near the animated items
4.2

Registers
b x
• Can store data, very common in datapaths Combinational n1
logic
• Basic register of Ch 3: Loaded every cycle s1 s0
n0

– Useful for implementing FSM -- stores encoded state clk State register
– For other uses, may want to load only on certain
cycles
a
I3 I2 I1 I0
load 4-bit register
I3 I2 I1 I0
D D D D
reg(4)
Q Q Q Q
si ansis
clk Q3 Q2 Q1 Q0

Q3 Q2 Q1 Q0
ez
Basic register loads on every clock cycle
How extend to only load on certain cycles?

Digital Design
Copyright © 2006 3
Frank Vahid
Register with Parallel Load
• Add 2x1 mux to front of each flip-flop
• Register’s load input selects mux input to pass
– Either existing flip-flop value, or new value to load

Digital Design
Copyright © 2006 4
Frank Vahid
Basic Example Using Registers
a3 a2 a1 a0

1 ld I3 I2 I1 I0
• This example will show how clk R0
registers load simultaneously Q3 Q2 Q1 Q0

on clock cycles
– Notice that all load inputs set to
1 in this example -- just for
demonstration purposes
1 ld I3 I2 I1 I0 1 ld I3 I2 I1 I0
R1 R2
Q3 Q2 Q1 Q0 Q3 Q2 Q1 Q0

Digital Design
Copyright © 2006 5
Frank Vahid
Basic Example Using Registers

a3 a2 a1 a0

1 ld I3 I2 I1 I0
clk R0
Q3 Q2 Q1 Q0

1 ld I3 I2 I1 I0 1 ld I3 I2 I1 I0
R1 R2
Q3 Q2 Q1 Q0 Q3 Q2 Q1 Q0

Digital Design
Copyright © 2006 6
Frank Vahid
Register Example using the Load Input:
Weight Sampler
• Scale has two displays
– Present weight
– Saved weight Scale Weight Sampler

– Useful to compare 0 0 1 01
present item with previous
item Save
3 pounds
2
b 1 load
I3 I2 I1 I0 a

• Use register to store clk


0011
Present weight Q3 Q2 Q1 Q0
weight
– Pressing button causes
present weight to be 3 pounds
stored in register Saved weight
• Register contents
always displayed as
“Saved weight,” even
when new present
weight appears
Digital Design
Copyright © 2006 7
Frank Vahid
Register Example: Temperature History Display
• Recall Chpt 3 example
– Timer pulse every hour
– Previously used as clock. Better design only connects oscillator to
clock inputs -- use registers with load input, connect to timer pulse.

a4 a3 a2 a1 a0 b4 b3 b2 b1 b0 c4 c3 c2 c1 c0
a4 a3 a2 a1 a0 b4 b3 b2 b1 b0 c4 c3 c2 c1 c0
I4 Q4 I4 Q4 I4 Q4
t4 I4 Q4 I4 Q4 I4 Q4
x4 I3 Q3 I3 Q3 I3 Q3
t3 I3 Q3 I3 Q3 I3 Q3
x3 I2 Q2 I2 Q2 I2 Q2
t2 I2 Ra Q2 I2 Rb Q2 I2 RcQ2
x2 I1 Q1 I1 Q1 I1 Q1
t1 I1 Q1 I1 Q1 I1 Q1
x1 I0 Q0 I0 Q0 I0 Q0
t0 I0 Q0 I0 Q0 I0 Q0
x0
ld ld ld
Clk Ra Rb Rc
osc C
C TemperatureHistoryStorage
a timer new line TemperatureHistoryStorage

Digital Design
Copyright © 2006 8
Frank Vahid
Register Example: Above-Mirror Display
8

Shorthand notation

0001010
a
To t
C 8 Loaded on clock edge
et r d0 load reg0 T
mir
r
ompu
c 2 4
8
i0

o art l the 0car's 1


• Ch2 example: Four rF m n
ec a0
d1 load reg1 A
8-bit
4×1
0001010 y
ao
simultaneous values from i0
i1
car’s computer 1 i1 8
a1 d D
• To reduce wires: Computer d2 load reg2 I 8
writes only 1 value at a time, i2
loads into one of four 8
registers d3 load reg3 M
e
– Was: 8+8+8+8 = 32 wires 1
load i3 s1 s0
– Now: 8 +2+1 = 11 wires 8
Digital Design
x y
Copyright © 2006 9
Frank Vahid
Register Example: Computerized Checkerboard
• Each register
holds values for
one column of
lights
– 1 lights light
• Microprocessor
loads one
register at a time
– Occurs fast
enough that
user sees
entire board
change at once

Digital Design
Copyright © 2006 10
Frank Vahid
Register Example: Computerized Checkerboard
LED

lit LED

R7 R6 R5 R4 R3 R2 R1 R0
10100010 10100010 10100010 10100010
01000101 01000101 01000101 01000101

D 10100010 010000101 10100010 010000101 10100010 010000101 10100010 010000101

i2,i1,i0 000 (R0) 001 (R1) 010 (R2) 011 (R3) 100 (R4) 101 (R5) 110 (R6) 111 (R7)

e
clk

Digital Design
Copyright © 2006 11
Frank Vahid
Shift Register
Register contents
1 1 0 1
• Shift right 0
before shift right
a

– Move each bit one position right 0 1 1 0


Register contents
after shift right
– Shift in 0 to leftmost bit

Q: Do four right shifts on 1001, showing value after each shift


a
A: 1001 (original)
0100
• Implementation: Connect flip-flop
0010 output to next flip-flop’s input
0001 a
shr_in
0000

Digital Design
Copyright © 2006 12
Frank Vahid
Shift Register
• To allow register to either shift or retain, use 2x1 muxes
– shr: 0 means retain, 1 shift
– shr_in: value to shift in
• May be 0, or 1
• Note: Can easily design shift register that shifts left instead

Digital Design
Copyright © 2006 13
Frank Vahid
Rotate Register

Register contents
1 1 0 1
before shift right
• Rotate right: Like shift right,
Register contents
but leftmost bit comes from 1 1 1 0
after shift right

rightmost bit

Digital Design
Copyright © 2006 14
Frank Vahid
Shift Register Example: Above-Mirror Display

central computer
C 8

From the car's


• Earlier example: 8 d0 load reg0 T

mirror display
To the above
2× 4 i0
8

+2+1 = 11wires from a0


i0
d1 load reg1 A
8-bit
4× 1
i1

car’s computer to a1
i1
d2 load reg2 I
8
d
8
D

above-mirror display’s d3 load reg3 M


8
i2

four registers load


8
i3 s1 s0

x y

– Better than 32 wires,


Note: this line is 1 bit, rather than 8 bits like before
but 11 still a lot -- x y
c
want fewer for shr_in
d0 shr reg0 T
smaller wire bundles s1 s0
2 4 i0
• Use shift registers shr_in
8
4×1
shr reg1
– Wires: 1+2+1=4 d1 A
a0 i0
i1
– Computer sends one a1 i1 8
value at a time, one shr_in d D
d2 shr reg2 I 8
bit per clock cycle i2
8
shr_in
shr reg3
e d3 M
Digital Design shift i3
Copyright © 2006 8 15
Frank Vahid
Multifunction Registers
• Many registers have multiple functions
– Load, shift, clear (load all 0s)
– And retain present value, of course Functions:
• Easily designed using muxes s1 s0 Operation
0 0 Maintain present value
– Just connect each mux input to achieve 0 1 Parallel load
desired function 1 0 Shift right
1 1 (unused - let's load 0s)

Digital Design
Copyright © 2006 16
Frank Vahid
Multifunction Registers

s1 s0 Operation
0 0 Maintain present value
0 1 Parallel load
1 0 Shift right
1 1 Shift left

Digital Design
Copyright © 2006 17
Frank Vahid
Multifunction Registers with Separate Control
Inputs
ld shr shl Operation
0 0 0 Maintain present value
0 0 1 Shift left
0 1 0 Shift right
0 1 1 Shift right – shr has priority over shl
1 0 0 Parallel load
1 0 1 Parallel load – ld has priority I3 I2 I1 I0
1 1 0 Parallel load – ld has priority shr_in
1 1 1 Parallel load – ld has priority I3 I2 I1 I0
ld shr_in
combi- s1 shl_in
shl_in

?
shr national s0
Truth table for combinational circuit circuit Q3 Q2 Q1 Q0
shl
Inputs Outputs Note
ld shr shl s1 s0 Operation Q3 Q2 Q1 Q0
0 0 0 0 0 Maintain value
0 0 1 1 1 Shift left a
0 1 0 1 0 Shift right
0 1 1 1 0 Shift right
1 0 0 0 1 Parallel load s1 = ld’*shr’*shl + ld’*shr*shl’ + ld’*shr*shl
1 0 1 0 1 Parallel load
1 1 0 0 1 Parallel load s0 = ld’*shr’*shl + ld a
1 1 1 0 1 Parallel load

a
Digital Design
Copyright © 2006 18
Frank Vahid
Register Operation Table
• Register operations typically shown using compact version of table
– X means same operation whether value is 0 or 1
• One X expands to two rows
• Two Xs expand to four rows
– Put highest priority control input on left to make reduced table simple

Inputs Outputs Note


ld shr shl s1 s0 Operation ld shr shl Operation
0 0 0 0 0 Maintain value 0 0 0 Maintain value
0 0 1 1 1 Shift left 0 0 1 Shift left
0 1 0 1 0 Shift right 0 1 X Shift right
0 1 1 1 0 Shift right 1 X X Parallel load
1 0 0 0 1 Parallel load
1 0 1 0 1 Parallel load
1 1 0 0 1 Parallel load
1 1 1 0 1 Parallel load

Digital Design
Copyright © 2006 19
Frank Vahid
Register Design Process
• Can design register with desired operations using simple
four-step process

Digital Design
Copyright © 2006 20
Frank Vahid
Register Design Example
s2 s1 s0 Operation
• Desired register operations 0
0
0
0
0
1
Maintain present value
Parallel load
– Load, shift left, synchronous clear, 0 1 0 Shift left
synchronous set 0 1 1 Synchronous clear
1 0 0 Synchronous set
1 0 1 Maintain present value
Step 1: Determine mux size 1 1 0 Maintain present value
1 1 1 Maintain present value
5 operations: above, plus maintain In
1 0 from
a present value (don’t forget this one!) Qn-1
--> Use 8x1 mux s2
s1 7 6 5 4 3 2 1 0
s0
Step 2: Create mux operation table
D
Step 3: Connect mux inputs Q

Qn
Step 4: Map control lines Inputs Outputs
s2 = clr’*set clr set ld shl s2 s1 s0 Operation
0 0 0 0 0 0 0 Maintain present value
s1 = clr’*set’*ld’*shl + clr
0 0 0 1 0 1 0 Shift left
s0 = clr’*set’*ld + clr 0 0 1 X 0 0 1 Parallel load
0 1 X X 1 0 0 Set to all 1s
Digital Design 1 X X X 0 1 1 Clear to all 0s
Copyright © 2006 21
a
Frank Vahid
Register Design Example

I3 I2 I1 I0

shl I3 I2 I1 I0
s2
s1 shl_in
ld combi- s0 shl_in
national
set
circuit Q3 Q2 Q1 Q0
clr
Q3 Q2 Q1 Q0

Step 4: Map control lines Inputs Outputs


clr set ld shl s2 s1 s0 Operation
s2 = clr’*set
0 0 0 0 0 0 0 Maintain present value
s1 = clr’*set’*ld’*shl + clr
0 0 0 1 0 1 0 Shift left
s0 = clr’*set’*ld + clr 0 0 1 X 0 0 1 Parallel load
0 1 X X 1 0 0 Set to all 1s
Digital Design 1 X X X 0 1 1 Clear to all 0s
Copyright © 2006 22
Frank Vahid
4.3

Adders
• Adds two N-bit binary numbers Inputs Outputs
a1 a0 b1 b0 c s1 s0
– 2-bit adder: adds two 2-bit numbers, 0 0 0 0 0 0 0
0 0 0 1 0 0 1
outputs 3-bit result 0 0 1 0 0 1 0
– e.g., 01 + 11 = 100 (1 + 3 = 4) 0
0
0
1
1
0
1
0
0
0
1
0
1
1
• Can design using combinational 0
0
1
1
0
1
1
0
0
0
1
1
0
1
design process of Ch 2, but doesn’t 0
1
1
0
1
0
1
0
1
0
0
1
0
0
work well for reasonable-size N 1 0 0 1 0 1 1
1 0 1 0 1 0 0
– Why not? 1 0 1 1 1 0 1
1 1 0 0 0 1 1
1 1 0 1 1 0 0
1 1 1 0 1 0 1
1 1 1 1 1 1 0

Digital Design
Copyright © 2006 23
Frank Vahid
Why Adders Aren’t Built Using Standard 4.3

Combinational Design Process


• Truth table too big Inputs Outputs
a1 a0 b1 b0 c s1 s0
– 2-bit adder’s truth table shown 0 0 0 0 0 0 0
(2+2) 0 0 0 1 0 0 1
• Has 2 = 16 rows 0 0 1 0 0 1 0
0 0 1 1 0 1 1
– 8-bit adder: 2(8+8) = 65,536 rows 0 1 0 0 0 0 1
0 1 0 1 0 1 0
– 16-bit adder: 2(16+16) = ~4 billion rows 0 1 1 0 0 1 1
0 1 1 1 1 0 0
– 32-bit adder: ... 1 0 0 0 0 1 0
1 0 0 1 0 1 1
• Big truth table with numerous 1s/0s yields 1
1
0
0
1
1
0
1
1
1
0
0
0
1
big logic 1
1
1
1
0
0
0
1
0
1
1
0
1
0
– Plot shows number of transistors for N-bit 1
1
1
1
1
1
0
1
1
1
0
1
1
0
adders, using state-of-the-art automated 10000
combinational design tool
8000
Q: Predict number of transistors for 16-bit adder 6000

Transistors
A: 1000 transistors for N=5, doubles for each o
t rs
4000
increase of N. So transistors = 1000*2(N-5). Thus,
a

for N=16, transistors = 1000*2(16-5) = 1000*2048 =


arTnsis
2000

2,048,000. Way too many! 0


1 2 3 4 5 6 7 8
Digital Design N
Copyright © 2006 24
Frank Vahid
Alternative Method to Design an Adder: Imitate
Adding by Hand
• Alternative adder
design: mimic 0 1 0 1 1 1

how people do A: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
a
B: + 0 1 1 0 + 0 1 1 0 + 0 1 1 0 + 0 1 1 0
addition by hand
• One column at a
time 1 0 1 1 0 1 1 0 1 0 1

– Compute sum,
add carry to next
column

Digital Design
Copyright © 2006 25
Frank Vahid
Alternative Method to Design an Adder: Imitate
Adding by Hand
• Create 1 1 0
component for A: 1 1 1 1
B: + 0 1 1 0
each column
– Adds that a
column’s bits, 1 0 1 0 1
generates sum
1 1 0
and carry bits
A: 1 1 1 1

+ B: 0 1 1 0

b a ci b a ci b a ci b a
co s co s co s co s
1
0 1 0 1 SUM

Digital Design
Full-adders Half-adder
Copyright © 2006 26
Frank Vahid
Half-Adder
1 1 0
• Half-adder: Adds 2 bits, generates
A: 1 1 1 1
sum and carry
• Design using combinational design + B: 0 1 1 0

process from Ch 2 b a ci b a ci b a ci b a
Inputs Outputs
co s co s co s co s
a b co s 1
0 0 0 0 0 1 0 1 SUM
Step 1: Capture the function 0 1 0 1
1 0 0 1
1 1 1 0

Step 2: Convert to equations


co = ab
s = a’b + ab’ (same as s = a xor b) a b

a b

Step 3: Create the circuit Half-adder


co s
Digital Design
Copyright © 2006 co s 27
Frank Vahid
Full-Adder
1 1 0
• Full-adder: Adds 3 bits, generates
A: 1 1 1 1
sum and carry
• Design using combinational design + B: 0 1 1 0

process from Ch 2 b a ci b a ci b a ci b a
co s co s co s co s
1
0 1 0 1 SUM
Step 1: Capture the function
Step 2: Convert to equations Step 3: Create the circuit
Inputs Outputs a b ci
a b ci co s co = a’bc + ab’c + abc’ + abc
0 0 0 0 0 co = a’bc +abc +ab’c +abc +abc’ +abc
0 0 1 0 1 co = (a’+a)bc + (b’+b)ac + (c’+c)ab
0 1 0 0 1 co = bc + ac + ab
0 1 1 1 0
1 0 0 0 1 s = a’b’c + a’bc’ + ab’c’ + abc
1 0 1 1 0 s = a’(b’c + bc’) + a(b’c’ + bc)
1 1 0 1 0 s = a’(b xor c)’ + a(b xor c)
1 1 1 1 1
Full
s = a xor b xor c adder
Digital Design co s
Copyright © 2006 28
Frank Vahid
Carry-Ripple Adder
• Using half-adder and full-adders, we can build adder that adds like we
would by hand
• Called a carry-ripple adder
– 4-bit adder shown: Adds two 4-bit numbers, generates 5-bit output
• 5-bit output can be considered 4-bit “sum” plus 1-bit “carry out”
– Can easily build any size adder

a3 b3 a2 b2 a1 b1 a0 b0

a b ci a b ci a b ci a b
a3 a2 a1 a0 b3 b2 b1 b0
FA FA FA HA
4-bit adder
co s co s co s co s
co s3 s2 s1 s0

co s3 s2 s1 s0
(a)
(b)

Digital Design
Copyright © 2006 29
Frank Vahid
Carry-Ripple Adder
• Using full-adder instead of half-adder for first bit, we can
include a “carry in” bit in the addition
– Will be useful later when we connect smaller adders to form bigger
adders

a3 b3 a2 b2 a1 b1 a0 b0 ci

a b ci a b ci a b ci a b ci a3 a2 a1 a0 b3 b2 b1 b0
FA FA FA FA 4-bit adder ci
co s co s co s co s co s3 s2 s1 s0

co s3 s2 s1 s0
(a) (b)

Digital Design
Copyright © 2006 30
Frank Vahid
Carry-Ripple Adder’s Behavior
0 0 0 0 0 0 0 0 0 0 0
0

a b ci a b ci a b ci a b ci
FA FA FA FA Assume all inputs initially 0
co s co s co s co s
0 0 0
0 0 0 0 0

0 0 0 1 0 0 1 0 0 1 1 0111+0001
0
(answer should be 01000)
a b ci a b ci a b ci a b ci
a
FA FA FA FA
co s co s co s co s
0 0 10
co2 co1 co0
0 0 1 1 0 Output a fter 2 ns (1 FA del ay)

Digital Design Wrong answer -- something wrong? No -- just need more time
Copyright © 2006 for carry to ripple through the chain of full adders. 31
Frank Vahid
Carry-Ripple Adder’s Behavior
0 0 0 1 0 0 1 0 1 1 1
0 0111+0001
(answer should be 01000)
a b ci a b ci a b ci a b ci
FA FA FA FA
co s co s co s co s
0 1 1
co1 Outputs after 4ns (2 FA delays)
0 0 1 0 0
(b)
0 0 0 1 01
0 1 0 1 1 1
0

a b ci a b ci a b ci a b ci
FA FA FA FA
co s co s co s co s
1 1 1
a
co2 Outputs after 6ns (3 FA delays)
0 0 0 0 0
(c)
0 0 01 1 0 1 1 0 1 1 1
0

a b ci a b ci a b ci a b ci
FA FA FA FA
co s co s co s co s
1 1 1
0 1 0 0 0 Output after 8ns (4 FA delays)
Digital Design (d)
Copyright © 2006 Correct answer appears after 4 FA delays 32
Frank Vahid
Cascading Adders

a7 a6 a5 a4 b7b6b5b4 a3 a2 a1 a0 b3b2b1b0

a3 a2 a1 a0 b3 b2b1b0 a3 a2 a1 a0 b3 b2b1b0 a7.. a0 b7.. b0

4-bit adder ci 4-bit adder ci 8-bit adder ci

co s3 s2 s1 s0 co s3 s2 s1 s0 co s7.. s0

co s7 s6 s5 s4 s3 s2 s1 s0
(a) (b)

Digital Design
Copyright © 2006 33
Frank Vahid
4.4

Shifters
• Shifting (e.g., left shifting 0011 yields 0110) useful for:
– Manipulating bits
– Converting serial data to parallel (remember earlier above-mirror display
example with shift registers)
– Shift left once is same as multiplying by 2 (0011 (3) becomes 0110 (6))
• Why? Essentially appending a 0 -- Note that multiplying decimal number by 10
accomplished just be appending 0, i.e., by shifting left (55 becomes 550)
i3 i2 i1 i0
– Shift right once same as dividing by 2
i3 i2 i1 i0 inR
i3 i2 i1 i0 inL

in 201 201 201 201


shL s0
01 01 01 01 shR s1
in
sh
a

<<1 q3 q2 q1 q0
q3 q2 q1 q0

Symbol Left shifter q3 q2 q1 q0


Shifter with left
shift, right shift,
Shifter with left and no shift
Digital Design
Copyright © 2006 shift or no shift 34
(a)
Frank Vahid
Shifter Example: Approximate Celsius to Fahrenheit
Converter
• Convert 8-bit Celsius input to 8-bit Fahrenheit output
– F = C * 9/5 + 32
– Approximate: F = C*2 + 32
– Use left shift: F = left_shift(C) + 32

C
00001100 (12) 8 *2

<<1 0 (shift in 0)
a

8 00100000 (32)
00011000 (24) 8
8-bit adder
8
00111000 (56)
F

Digital Design
Copyright © 2006 35
Frank Vahid
Barrel Shifter i3 i2 i1 i0

• A shifter that can shift by any amount 01 01 01 01


in
sh
– 4-bit barrel left shift can shift left by 0,
1, 2, or 3 positions
– 8-bit barrel left shifter can shift left by q3 q2 q1 q0
0, 1, 2, 3, 4, 5, 6, or 7 positions Shift by 1 shifter uses 2x1 muxes. 8x1
• (Shifting an 8-bit number by 8 positions mux solution for 8-bit barrel shifter: too
is pointless -- you just lose all the bits) many wires.
Q: xyz=??? to
• Could design using 8x1 muxes and I
shift by 5? 8 00000110
lots of wires 1
– Too many wires x sh <<4 in 0
• More elegant design
8 01100000 (by 4)
– Chain three shifters: 4, 2, and 1 0 a

– Can achieve any shift of 0..7 by y sh <<2 in 0


enabling the correct combination of
those three shifters, i.e., shifts should 8 01100000
1
sum to desired amount
z sh <<1 in 0
Digital Design Net result: shift by 5:8 11000000 (by 1)
Copyright © 2006 Q 36
Frank Vahid
4.5

Comparators
• N-bit equality comparator: Outputs 1 if two N-bit numbers are equal
– 4-bit equality comparator with inputs A and B
• a3 must equal b3, a2 = b2, a1 = b1, a0 = b0
– Two bits are equal if both 1, or both 0
– eq = (a3b3 + a3’b3’) * (a2b2 + a2’b2’) * (a1b1 + a1’b1’) * (a0b0 + a0’b0’)
• Recall that XNOR outputs 1 if its two input bits are the same
– eq = (a3 xnor b3) * (a2 xnor b2) * (a1 xnor b1) * (a0 xnor b0)

a3 b3 a2 b2 a1 b1 a0 b0
0110 = 0111 ? 0 0 1 1 1 1 0 1

a3 a2 a1 a0 b3 b2 b1 b0 a
1 1 1 0
4-bit equality comparator
eq

(b)
0 eq
(a)
Digital Design
Copyright © 2006 37
Frank Vahid
Magnitude Comparator
• N-bit magnitude comparator: A=1011 B=1001
Indicates whether A>B, A=B, or
A<B, for its two N-bit inputs A and B 1011 1001 Equal
– How design? Consider how compare 1011 1001 Equal
by hand. First compare a3 and b3. If
equal, compare a2 and b2. And so on. 1011 1001 Unequal
Stop if comparison not equal -- So A > B
whichever’s bit is 1 is greater. If never
see unequal bit pair, A=B.
a

Digital Design
Copyright © 2006 38
Frank Vahid
Magnitude Comparator
• By-hand example leads to idea for design
– Start at left, compare each bit pair, pass results to the right
– Each bit pair called a stage
– Each stage has 3 inputs indicating results of higher stage, passes results to
lower stage
a3 b3 a2 b2 a1 b1 a0 b0

a b a b a b a b
Igt in_gt out_gt in_gt out_gt in_gt out_gt in_gt out_gt AgtB
Ieq in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq AeqB
Ilt in_lt out_lt in_lt out_lt in_lt out_lt in_lt out_lt AltB

Stage 3 Stage 2 Stage 1 Stage 0


(a)

0 Igt a3 a2 a1 a0 b3b2b1b0
AgtB
1 Ieq 4-bit magnitude comparator AeqB
Digital Design
0 Ilt AltB
Copyright © 2006 39
Frank Vahid
(b)
Magnitude Comparator
a3 b3 a2 b2 a1 b1 a0 b0

a b a b a b a b
Igt in_gt out_gt in_gt out_gt in_gt out_gt in_gt out_gt AgtB
Ieq in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq AeqB
Ilt in_lt out_lt in_lt out_lt in_lt out_lt in_lt out_lt AltB

Stage 3 Stage 2 Stage 1 Stage 0

• Each stage:
– out_gt = in_gt + (in_eq * a * b’)
• A>B (so far) if already determined in higher stage, or if higher stages equal but in
this stage a=1 and b=0
– out_lt = in_lt + (in_eq * a’ * b)
• A<B (so far) if already determined in higher stage, or if higher stages equal but in
this stage a=0 and b=1
– out_eq = in_eq * (a XNOR b)
• A=B (so far) if already determined in higher stage and in this stage a=b too
– Simple circuit inside each stage, just a few gates (not shown)
Digital Design
Copyright © 2006 40
Frank Vahid
Magnitude Comparator
• How does it 1011 = 1001 ?
1 = 1 0 0 1 0 1 1
work? a3 b3 a2 b2 a1 b1 a0 b0

a b a b a b a b
0 0
Igt in_gt out_gt in_gt out_gt in_gt out_gt in_gt out_gt AgtB
Ieq=1 causes this 1 1
Ieq in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq AeqB
0 0
stage to compare Ilt in_lt out_lt in_lt out_lt in_lt out_lt in_lt out_lt AltB

Stage3 Stage2 Stage1 Stage0


(a)
a

1 1 0 = 0 1 0 1 1
a3 b3 a2 b2 a1 b1 a0 b0

a b a b a b a b
0 0
Igt in_gt out_gt in_gt out_gt in_gt out_gt in_gt out_gt AgtB
1 1
Ieq in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq AeqB
0 0
Ilt in_lt out_lt in_lt out_lt in_lt out_lt in_lt out_lt AltB

Stage3 Stage2 Stage1 Stage0


Digital Design (b)
Copyright © 2006 41
Frank Vahid
Magnitude Comparator
1 1 0 0 1 > 0 1 1
1011 = 1001 ? a3 b3 a2 b2 a1 b1 a0 b0 • Final answer
appears on the
a b a b a b a b right
0 1
Igt
1
in_gt out_gt in_gt out_gt in_gt out_gt
0
in_gt out_gt AgtB
• Takes time for
Ieq in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq AeqB
0
in_lt out_lt in_lt out_lt in_lt out_lt
0
in_lt out_lt AltB
answer to
Ilt
“ripple” from left
Stage3 Stage2 Stage1 Stage0 to right
(c) • Thus called
a 1 1 0 0 1 0 1 1 “carry-ripple
a3 b3 a2 b2 a1 b1 a0 b0 style” after the
carry-ripple
a b a b a b a b adder
0 1
Igt
1
in_gt out_gt in_gt out_gt in_gt out_gt in_gt out_gt
0
AgtB – Even though
Ieq
0
in_eq out_eq in_eq out_eq in_eq out_eq in_eq out_eq
0
AeqB there’s no
Ilt in_lt out_lt in_lt out_lt in_lt out_lt in_lt out_lt AltB “carry”
involved
Stage3 Stage2 Stage1 Stage0
Digital Design (d)
Copyright © 2006 42
Frank Vahid
4.6

Counters
• N-bit up-counter: N-bit register
01
that can increment (add 1) to its cnt 4-bit up-counter
a
tc C
own value on each clock cycle
4
– 0000, 0001, 0010, 0011, ...., 1110,
01
0 0001
0000
0101
0100
0011
0010
1110
1111
0001
0000
...
1111, 0000
– Note how count “rolls over” from 1111
to 0000
4-bit up-counter
• Terminal (last) count, tc, equals1
during value just before rollover cnt
ld
4-bit register
• Internal design
a
– Register, incrementer, and N-input 4 4
AND gate to detect terminal count 4 +1
4
tc C

Digital Design
Copyright © 2006 43
Frank Vahid
Incrementer
• Counter design used incrementer
• Incrementer design
– Could use carry-ripple adder with B input set to 00...001
• But when adding 00...001 to another number, the leading 0’s
obviously don’t need to be considered -- so just two bits being
added per column
– Use half-adders (adds two bits) rather than full-adders (adds
three bits)
a3 a2 a1 a0 1
carries: 011
a b a b a b a b a3 a2 a1 a0
0011
unused HA HA HA HA +1
+ 1
co s co s co s co s
tn co s3 s2 s1 s0
0 0 10 0
co s3 s2 s1 s0
r
I (b)
Digital Design (a)
Copyright © 2006 44
Frank Vahid
Incrementer
• Can build faster incrementer a3
Inputs
a2 a1 a0 c0 s3
Outputs
s2 s1 s0
using combinational logic 0 0 0 0 0 0 0 0 1
0 0 0 1 0 0 0 1 0
design process 0 0 1 0 0 0 0 1 1
– Capture truth table 0 0 1 1 0 0 1 0 0
0 1 0 0 0 0 1 0 1
– Derive equation for each output 0 1 0 1 0 0 1 1 0
• c0 = a3a2a1a0 0 1 1 0 0 0 1 1 1
0 1 1 1 0 1 0 0 0
• ... 1 0 0 0 0 1 0 0 1
• s0 = a0’ 1 0 0 1 0 1 0 1 0

– Results in small and fast circuit 1 0 1 0 0 1 0 1 1


1 0 1 1 0 1 1 0 0
– Note: works for small N -- larger 1 1 0 0 0 1 1 0 1
N leads to exponential growth, 1 1 0 1 0 1 1 1 0
1 1 1 0 0 1 1 1 1
like for N-bit adder 1 1 1 1 1 0 0 0 0

Digital Design
Copyright © 2006 45
Frank Vahid
Counter Example: Mode in Above-Mirror Display
• Recall above-mirror display example from Chapter 2
– Assumed component that incremented xy input each time button
pressed: 00, 01, 10, 11, 00, 01, 10, 11, 00, ...
– Can use 2-bit up-counter
• Assumes mode=1 for just one clock cycle during each button press
– Recall “Button press synchronizer” example from Chapter 3

mode
cnt 2-bit up counter
tc c1c0
clk

x y

Digital Design
Copyright © 2006 46
Frank Vahid
Counter Example: 1 Hz Pulse Generator Using 256 Hz
Oscillator
• Suppose have 256 Hz
oscillator, but want 1 Hz
pulse
– 1 Hz is 1 pulse per second
-- useful for keeping time
1
– Design using 8-bit up- cnt 8-bit up-counter
counter, use tc output as tc C
osc
pulse (256 Hz) 8
• Counts from 0 to 255 (256 p (unused)
counts), so pulses tc every (1 Hz)
256 cycles

Digital Design
Copyright © 2006 47
Frank Vahid
Down-Counter
• 4-bit down-counter
4-bit down-counter
– 1111, 1110, 1101, 1100, …,
0011, 0010, 0001, 0000, cnt
1111, … ld
4-bit register
– Terminal count is 0000
• Use NOR gate to detect
– Need decrementer (-1) – 4 4
design like designed 4 –1
incrementer
tc C 4

Digital Design
Copyright © 2006 48
Frank Vahid
Up/Down-Counter
• Can count either up 4-bit up/down counter
or down
– Includes both dir
1 4-bit 2 x 1 0
incrementer and 4
decrementer
clr
– Use dir input to cnt
clr
ld 4-bit register
select, using 2x1:
dir=0 means up
– Likewise, dir selects 4 4 4 4
appropriate terminal –1 +1
4
count value
4 4
1 2x 1 0
tc C

Digital Design
Copyright © 2006 49
Frank Vahid
Counter with Parallel Load
• Up-counter that can be
L 4
loaded with external
ld
value 1 4-bit 2 x 1 0
– Designed using 2x1 mux 4
– ld input selects cnt ld
incremented value or 4-bit register
external value
– Load the internal register 4 4
when loading external +1
4
value or when counting
tc C

Digital Design
Copyright © 2006 50
Frank Vahid
Counter with Parallel Load
• Useful to create pulses at 1000
specific multiples of clock 4

– Not just at N-bit counter’s natural


wrap-around of 2N ld L
• Example: Pulse every 9 clock 1
cnt 4-bit down-counter
cycles
– Use 4-bit down-counter with clk
tc C
parallel load 4
– Set parallel load input to 8 (1000)
– Use terminal count to reload
• When count reaches 0, next cycle
loads 8.
– Why load 8 and not 9? Because 0
is included in count sequence:
• 8, 7, 6, 5, 4, 3, 2, 1, 0 → 9 counts
Digital Design
Copyright © 2006 51
Frank Vahid
Counter Example:
1 Hz Pulse Generator from 60 Hz Clock
• U.S. electricity standard
uses 60 Hz signal clr
– Device may convert that to 1 cnt 6-bit up counter
1 Hz signal to count osc tc C
seconds (60 Hz)
• Use 6-bit up-counter p
– Can count from 0 to 63
– Create simple logic to
detect 59 (for 60 counts)
• Use to clear the counter
back to 0 (or to load 0) (1 Hz)

Digital Design
Copyright © 2006 52
Frank Vahid
4.8

Subtractor
• Can build subtractor as we built carry-ripple adder
– Mimic subtraction by hand
– Compute borrows from columns on left
• Use full-subtractor component:
– wi is borrow by column on right, wo borrow from column on left
1st column 2nd column 3rd column 4th column
0 0 1 10 0 1 0
1 0 1 10 1 10 1 0 1 10 1 0 1 0 1 0
- 0 1 1 1 - 0 1 1 1 - 0 1 1 1 - 0 1 1 1
1 1 1 0 1 1 0 0 1 1

a3 b3 a2 b2 a1 b1 a0 b0 wi

a b wi a b wi a b wi a b wi a3 a2 a1 a0 b3 b2 b1 b0
FS FS FS FS 4-bit subtractor wi a

wo s wo s wo s wo s wo s3 s2 s1 s0

wo s3 s2 s1 s0
(b) (c)
Digital Design
Copyright © 2006 53
Frank Vahid
Subtractor Example: DIP-Switch Based
Adding/Subtracting Calculator
• Extend earlier DIP switches
calculator example 1
0
– Switch f indicates
whether want to
8 8 8 8
add (f=0) or 0 0
subtract (f=1) A B ci A B wi
8-bit adder 8-bit subtractor
– Use subtractor and co S wo S
2x1 mux
1 f 8 8
0 2x1 1
0
8
e
ld
8-bit register
clk
CALC
8

LEDs
Digital Design
Copyright © 2006 54
Frank Vahid
Subtractor Example:
Color Space Converter – RGB to CMYK
• Color
– Often represented as weights
of three colors: red, green, and
blue (RGB)
• Perhaps 8 bits each, so
specific color is 24 bits
– White: R=11111111,
G=11111111, B=11111111
– Black: R=00000000,
G=00000000, B=00000000
– Other colors: values in
between, e.g., R=00111111,
G=00000000, B=00001111 • Printers use opposite color scheme
would be a reddish purple – Because inks absorb light
– Good for computer monitors, – Use complementary colors of RGB:
which mix red, green, and blue Cyan (absorbs red), reflects green
lights to form all colors and blue, Magenta (absorbs green),
and Yellow (absorbs blue)
Digital Design
Copyright © 2006 55
Frank Vahid
Subtractor Example:
Color Space Converter – RGB to CMYK

R G B
• Printers must quickly convert 255
8
255
8
255
8
RGB to CMY 8 8 8

– C=255-R, M=255-G, Y=255-B


– Use subtractors as shown o
t CMY
- - -

GB
R 8 8 8
C M Y

Digital Design
Copyright © 2006 56
Frank Vahid
Subtractor Example:
Color Space Converter – RGB to CMYK

• Try to save colored inks


– Expensive
– Imperfect – mixing C, M, Y doesn’t
yield good-looking black
• Solution: Factor out the black or
gray from the color, print that part
using black ink
– e.g., CMY of (250,200,200)=
(200,200,200) + (50,0,0).
• (200,200,200) is a dark gray – use
black ink

Digital Design
Copyright © 2006 57
Frank Vahid
Subtractor Example:
Color Space Converter – RGB to CMYK
• Call black part K
R G B
8 8 8
– (200,200,200): K=200 K
– (Letter “B” already used for blue)
R G B
Y
• Compute minimum of C, R GB t o CMY o
t CM
C M Y
M, Y values GB
R
– Use MIN component 8 8 8 8
designed earlier, using C M Y
comparator and mux, to MIN
compute K 8
– Output resulting K value,
and subtract K value from MIN
C, M, and Y values 8
K
– Ex: Input of (250,200,200)
yields output of
- - -
(50,0,0,200)
8 8 8 8
C2 M2 Y2 K
Digital Design
Copyright © 2006 58
Frank Vahid
Representing Negative Numbers: Two’s
Complement
• Negative numbers common
– How represent in binary?
• Signed-magnitude
– Use leftmost bit for sign bit
• So -5 would be:
1101 using four bits
10000101 using eight bits

• Better way: Two’s complement


– Big advantage: Allows us to perform subtraction using addition
– Thus, only need adder component, no need for separate
subtractor component!

Digital Design
Copyright © 2006 59
Frank Vahid
Ten’s Complement
1 9

2 8
• Before introducing two’s complement, let’s 3 7
consider ten’s complement
4 6
– But, be aware that computers DO NOT USE TEN’S
5 5
COMPLEMENT. Introduced for intuition only.
6 4
– Complements for each base ten number shown to
right – Complement is the number that when added 7 3
results in 10 8 2

9 1

Digital Design
Copyright © 2006 60
Frank Vahid
Ten’s Complement
• Nice feature of ten’s complement
– Instead of subtracting a number, adding its complement results in answer
exactly 10 too much
– So just drop the 1 – results in subtracting using addition only

Digital Design
Copyright © 2006 61
Frank Vahid
Two’s Complement is Easy to Compute:
Just Invert Bits and Add 1
• Hold on!
– Sure, adding the ten’s complement achieves subtraction using addition
only
– But don’t we have to perform subtraction to have determined the
complement in the first place? e.g., we only know that the complement of 4
is 6 by subtracting 10-4=6 in the first place.
• True – but in binary, it turns out that the two’s complement can be
computed easily
– Two’s complement of 011 is 101, because 011 + 101 is 1000
– Could compute complement of 011 as 1000 – 011 = 101
– Easier method: Just invert all the bits, and add 1
– The complement of 011 is 100+1 = 101 -- it works!

Q: What is the two’s complement of 0101? A: 1010+1=1011 a

(check: 0101+1011=10000)
Q: What is the two’s complement of 0011? A: 1100+1=1101
Digital Design
Copyright © 2006 62
Frank Vahid
Two’s Complement Subtractor Built with an Adder
• Using two’s complement
A B
A – B = A + (-B)
= A + (two’s complement of B) N-bit
= A + invert_bits(B) + 1
• So build subtractor using A B 1
Adder cin
adder by inverting B’s bits,
and setting carry in to 1
S

Digital Design
Copyright © 2006 63
Frank Vahid
Adder/Subtractor

• Adder/subtractor: control
input determines whether
add or subtract
– Can use 2x1 mux – sub input
passes either B or inverted B
– Alternatively, can use XOR
gates – if sub input is 0, B’s
bits pass through; if sub input
is 1, XORs invert B’s bits

Digital Design
Copyright © 2006 64
Frank Vahid
Adder/Subtractor Example: Calculator
• Previous calculator DIP switches

used separate 1
0
adder and
8 8
subtractor
1 f A B
• Improve by using 0
sub 8-bit adder/subtractor
S
adder/subtractor, 8
e
and two’s ld
8-bit register
clk
CALC
complement 8
numbers 1
DIP switches

0
LEDs
8 8 8 8
A B ci 0 A B wi 0
8-bit adder 8-bit subtractor
co S wo S

1 f 8 8
0 2x1 1
0
8
e ld 8-bit register
clk CALC
8
Digital Design
Copyright © 2006 LEDs 65
Frank Vahid
Overflow
• Sometimes result can’t be represented with given number
of bits
– Either too large magnitude of positive or negative
– e.g., 4-bit two’s complement addition of 0111+0001 (7+1=8). But 4-
bit two’s complement can’t represent number >7
• 0111+0001 = 1000 WRONG answer, 1000 in two’s complement is -8,
not +8
– Adder/subtractor should indicate when overflow has occurred, so
result can be discarded

Digital Design
Copyright © 2006 66
Frank Vahid
Detecting Overflow: Method 1
• Assuming 4-bit two’s complement numbers, can detect overflow by
detecting when the two numbers’ sign bits are the same but are
different from the result’s sign bit
– If the two numbers’ sign bits are different, overflow is impossible
• Adding a positive and negative can’t exceed largest magnitude positive or
negative
• Simple circuit
– overflow = a3’b3’s3 + a3b3s3’
– Include “overflow” output bit on adder/subtractor
sign bits

0 1 1 1 1 1 1 1 1 0 0 0

+ 0 0 0 1 + 1 0 0 0 + 0 1 1 1

1 0 0 0 0 1 1 1 1 1 1 1
overflow overflow no overflow
(a) (b) (c)
If the numbers’ sign bits have the same value, which
Digital Design
differs from the result’s sign bit, overflow has occurred.
Copyright © 2006 67
Frank Vahid
Detecting Overflow: Method 2
• Even simpler method: Detect difference between carry-in to sign bit and
carry-out from sign bit
• Yields simpler circuit: overflow = c3 xor c4

1 1 1 0 0 0 0 0 0
0 1 1 1 1 1 1 1 1 0 0 0

+ 0 0 0 1 + 1 0 0 0 + 0 1 1 1

0 1 0 0 0 1 0 1 1 1 0 1 1 1 1
overflow overflow no overflow
(a) (b) (c)

If the carry into the sign bit column differs from the
carry out of that column, overflow has occurred.

Digital Design
Copyright © 2006 68
Frank Vahid
4.9

Arithmetic-Logic Unit: ALU


• ALU: Component that
can perform any of
various arithmetic (add,
subtract, increment,
etc.) and logic (AND,
OR, etc.) operations,
based on control inputs
• Motivation:
– Suppose want multi-
function calculator that
not only adds and
subtracts, but also
increments, ANDs, ORs,
XORs, etc.

Digital Design
Copyright © 2006 69
Frank Vahid
Multifunction Calculator without an ALU
• Can build multifunction
calculator using separate
DIP switches
components for each 1
operation, and muxes 0
8 8
– But too many wires, and
A B
wasted power computing
all those operations when + Ð +1 AND OR XOR NOT
Wasted
power
8
at any time you only use 8 8
8
8 8 8
one of the results 8
1 0 A lot of wires
0 1 2 3 4 5 6 7
x
s2
y 8-bit 8  1
s1
z s0
8
e
Id
8-bit reg ister
clk
CALC
8

Digital Design LEDs


Copyright © 2006 70
Frank Vahid
ALU
• More efficient design uses ALU
– ALU design not just separate components multiplexed (same problem as previous
slide!),
– Instead, ALU design uses single adder, plus logic in front of adder’s A and B inputs
• Logic in front is called an arithmetic-logic extender
– Extender modifies the A and B inputs such that desired operation will appear at output
of the adder

Digital Design
Copyright © 2006 71
Frank Vahid
Arithmetic-Logic Extender in Front of ALU

• xyz=000: Want S=A+B – just pass a to ia, b to ib, and set cin=0
• xyz=001: Want S=A-B – pass a to ia, b’ to ib, and set cin=1
• xyz=010: Want S=A+1 – pass a to ia, set ib=0, and set cin=1
• xyz=011: Want S=A – pass a to ia, set ib=0, and set cin=0
• xyz=1000: Want S=A AND B – set ia=a*b, b=0, and cin=0
• others: likewise
• Based on above, create logic for ia(x,y,z,a,b) and ib(x,y,z,a,b) for each abext, and
create logic for cin(x,y,z), to complete design of the AL-extender component
Digital Design
Copyright © 2006 72
Frank Vahid
ALU Example: Multifunction Calculator
DIP swi tches
1
0
8 8

A B

+ Ð +1 W as ted
AND OR X OR NOT p o w er
8
8 8
8
8 8 8
DIP switches
8
1 0 0 1 2 3 4 5 6 7 A lot of wi re s.
x s2
y
z
s1
s0
8-bit 8  1
1 1
8

clk
e
Id
8-bit re g is ter 0 0
C A LC
8

LEDs
8 8
A B
A B
• Design using ALU is x
y
x
ALU
y
elegant and efficient z z S
8
– No mass of wires e
ld
– No big waste of power clk
8-bit register

8 CALC

LEDs

Digital Design
Copyright © 2006 73
Frank Vahid
4.10

Register Files
• MxN register file
component provides 32
er C C
efficient access to M N- er 8 a

t d0d0 load huge mux


?t
loadreg0
bit-wide registers s ompu reg0 T
32 o th
omompu 4 162 4 i0 i0
– If we have many cathe car or mi
dis
To
c r
t l too much 8
mi T r
or
registers but only need ar om
r
l
F n the car's
d1 loadfanout
reg1
32-bit
8-bit
16x41×1 r
r t
access one or two at a F n
e
c 4 a0 A
ec i0
i1
a o
ve
time, a register file is i1 8 o
v y
dda e-D D
i3-i0
more efficient
a1
d2 load reg2 I y
328

– Ex: Above-mirror display 8


i2
congestion
(earlier example), but this d3 load reg3 M
d15
e load reg15
time having 16 32-bit e
registers load i15i3 s1 s0
load 32 8
s3-s0
• Too many wires, and x y
big mux is too slow

Digital Design
Copyright © 2006 74
Frank Vahid
Register File
• Instead, want component that has one data input and one data output,
and allows us to specify which internal register to write and which to read

32 32
W_data R_data a

4 4
W_addr R_addr

W_en R_en
16×32
register file

Digital Design
Copyright © 2006 75
Frank Vahid
Register File Timing Diagram
• Can write one
register and read
one register each
clock cycle
– May be same
register

32 32
W_data R_data
2 2
W_addr R_addr

W_en R_en
4x32
register file

Digital Design
Copyright © 2006 76
Frank Vahid
Register-File Example: Above-Mirror Display
• 16 32-bit registers that
can be written by car’s 32
OLD design
C
computer, and d0 load reg0
a

huge mux
displayed 32
i0
4 16
– Use 16x32 register file

mirror display
To the above-
32

central computer
C 32too much D

From the car′s


W_data
fanout R_data32-bit
– Simple, elegant design 4 WA 4
16x 1
4
W_addr R_addr
• Register file hides i3-i0
load
W_en R_en d D
complexity internally 16× 32
register file
1 32
RA
– And because only one congestion
register needs to be e
d15 load reg15

written and/or read at a load


i15
32 s3-s0
time, internal design is
simple
Digital Design
Copyright © 2006 77
Frank Vahid
Chapter Summary
• Need datapath components to store and operate on multibit data
– Also known as register-transfer-level (RTL) components
• Components introduced
– Registers
– Shifters
– Adders
– Comparators
– Counters
– Multipliers
– Subtractors
– Arithmetic-Logic Units
– Register Files
• Next, we’ll combine knowledge of combinational logic design,
sequential logic design, and datapath components, to build digital
circuits that can perform general and powerful computations

Digital Design
Copyright © 2006 78
Frank Vahid

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy