Professional Documents
Culture Documents
CONTENT
I.
Number Representation
1.
2.
3.
4.
5.
6.
II.
3
3
3
4
5
5
5
6
7. Simple Adders
8. Carry Propagation Networks
Design of ripple carry adder
Design of Carry Lookahead Adders
9. Counting and Incrementation
10. Design of Fast Adders
11. Logic and Shift Operations
12. Multifunction ALUs
III.
8
8
8
8
8
9
9
10
11
11
Rounding Modes
Special Values and Exceptions
Floating-Point Addition
Other Floating-Point Operations
Floating-Point Instructions
11
11
11
13
14
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
I. NUMBER REPRESENTATION
Numbers smaller
than max
Numbers larger
than max
Finite set of representable numbers
Overflow regions in finite number representation systems. For unsigned representations, max = 0.
Conventional and unconventional digit sets
Decimal digits in [0, 9]; 4-bit BCD, 8-bit ASCII
Hexadecimal, or hex: digits 0-9 & a-f
Conventional ternary digit set in [0, 2]
Conventional digit set for radix r is [0, r 1]
Symmetric ternary digit set in [1, 1]
Conventional binary digit set in [0, 1]
Redundant digit set [0, 2], encoded in 2 bits
( 0 2 1 1 0 )two and ( 1 0 1 0 2 )two represent 22
2.
3.
4.
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
y31
c32
x1
c31
FA
. . .
y1
x0
c2
y0
c1
c0
FA
FA
s1
s0
cout
s31
cin
The layout of ripple carry adder is simple, which allows for fast design time; however, the ripple carry adder is
relatively slow, since each full adder must wait for the carry bit to be calculated from the previous full adder. The gate
delay can easily be calculated by inspection of the full adder circuit. Each full adder requires three levels of logic.In a
32-bit [ripple carry] adder, there are 32 full adders, so the critical path (worst case) delay is 31 * 2(for carry
propagation) + 3(for sum) = 65 gate delays.
Design Issues:
The corresponding boolean expressions are given here to construct a ripple carry adder. In the half adder circuit the
sum and carry bits are defined as
sum = A B
carry = AB
In the full adder circuit the the Sum and Carry outpur is defined by inputs A, B and Carryin as
Sum=ABC + ABC + ABC + ABC
Carry=ABC + ABC + ABC + ABC
Having these we could design the circuit. But, we first check to see if there are any logically equivalent statements that
would lead to a more structured equivalent circuit.
With a little algebraic manipulation,
Sum= ABC + ABC + ABC + ABC
= (AB + AB) C + (AB + AB) C
= (A B) C + (A B) C =A B C
Carry= ABC + ABC + ABC + ABC
= AB + (AB + AB) C
= AB + (A B) C
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
gi pi
Carry is:
0
0
1
1
annihilated or killed
propagated
generated
(impossible)
0
1
0
1
g k1 p k1
xi
g k2 p k2
g i+1 p i+1
yi
gi
pi
...
...
g1 p1
g0 p0
c0
Carry network
ck
c k1
...
c k2
ci
...
c1
c i+1
c0
si
Carry Propagation Networks -- The main part of an adder is the carry network. The rest is just a set of gates
to produce the g and p signals and the sum bits.
DESIGN OF CARRY LOOKAHEAD ADDERS :
To reduce the computation time, there are faster ways to add two binary numbers by using carry lookahead
adders. They work by creating two signals P and G known to be Carry Propagator and Carry Generator. The carry
propagator is propagated to the next level whereas the carry generator is used to generate the output carry ,
regardless of input carry. The block diagram of a 4-bit Carry Lookahead Adder is shown here below -
The number of gate levels for the carry propagation can be found from the circuit of full adder. The signal from input
carry Cin to output carry Cout requires an AND gate and an OR gate, which constitutes two gate levels. So if there are
four full adders in the parallel adder, the output carry C5 would have 2 X 4 = 8 gate levels from C1 to C5. For an n-bit
parallel adderr, there are 2n gate levels to propagate through.
Design Issues :
The corresponding boolean expressions are given here to construct a carry lookahead adder. In the carry-lookahead
circuit we ned to generate the two signals carry propagator(P) and carry generator(G),
Pi = Ai Bi
Gi = Ai Bi
The output sum and carry can be expressed as
Sumi = Pi Ci and Ci+1 = Gi + ( Pi Ci)
Having these we could design the circuit. We can now write the Boolean function for the carry output of each stage
and substitute for each Ci its value from the previous equations:
C1 = G0 + P0 C0
C2 = G1 + P1 C1 = G1 + P1 G0 + P1 P0 C0
C3 = G2 + P2 C2 = G2 P2 G1 + P2 P1 G0 + P2 P1 P0 C0
C4 = G3 + P3 C3 = G3 P3 G2 P3 P2 G1 + P3 P2 P1 G0 + P3 P2 P1 P0 C0
4
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
Third Carry Speed-Up Method: Carry Select -- Allows doubling of adder width with a single-mux additional
x
y
delay
[a, b]
[a, b]
c out
Adder
c in
c out
Version 0
of sum bits
Adder
c in
Version 1
of sum bits
a
[a, b]
9. Counting and Incrementation (Refer page no. 183 - 185 in text book B.Parhami)
k
/
Data in
IncrInit
k
/
k
/
Count
register
D
k
/
c in
_
C
Adder /
k
Update
a
(Increment
amount)
c out
A circuit with flip-flops is considered a sequential circuit even in the absence of combinational logic. Circuits that
include flip-flops are usually classified by the function they perform. Two such circuits are registers and counters:
1. Register is a group of flip-flops. Its basic function is to hold information within a digital system so as to make it
available to the logic units during the computing process.
2. Counter is essentially a register that goes through a predetermined sequence of states.
There are various different kind of Flip-Flops. Some of the common flip-flops are: R-S Flip-Flop, D FlipFlop, J-K Flip-Flop, T Flip-Flop. The block diagram of different flip-flops are shown here -
1. RS flipflop If R is high then reset state occurs and when S=1 set state.the both cannot be high simultaneouly.
this input combination is avoided.
2. JK flipflop If J and K are both low then no change occurs. If J and K are both high at the clock edge then the
output will toggle from one state to the other
3. D flipflop The D flip-flop tracks the input, making transitions with match those of the input D.
4. Tflipflop The T or "toggle" flip-flop changes its output on each clock edge,
5
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
Design Issues:
The four different types of flip-flops are supplied here. One can easily build any register or counter using those flipflop and different logic gates. But the automatic clock input is under development, so to build any registers or counters
user can use the manual clock or Dip Switch which toggles on double click over the component.
10.
11.
Left-shifted
values
00...0, x[31]
RightLeft
Shift amount
00, x[30, 2]
0, x[31, 1]
x[31, 0]
32
32 32
x[30, 0], 0
x[31, 0]
. . .
x[0], 00...0
x[1, 0], 00...0
32
32
31
32
32
. . .
33
32
62
32
63
Multiplexer
32
ARITHMETIC SHIFTS
Purpose: Multiplication and division by powers of 2
sra $t0,$s1,2
# $t0 ($s1) right-shifted by 2
srav $t0,$s1,$s0
# $t0 ($s1) right-shifted by ($s0)
31
op
25
31
op
rt
15
rd
10
sh
fn
Unused
25
rs
Source
register
20
rt
Destination
register
15
rd
Shift
amount
10
sh
sra = 3
fn
0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1
ALU
instruction
12.
20
0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1
ALU
instruction
rs
Amount
register
Source
register
Destination
register
Unused
srav = 7
MULTIFUNCTION ALUS
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
ConstVar
Shift function
Constant
5
amount
Amount
Variable
amount
00
01
10
11
No shift
Logical left
Logical right
Arith right
Shifter
Function
class
32
5 LSBs
00
01
10
11
Shift
Set less
Arithmetic
Logic
Shifted y
0
Adder
y
0 or 1
c0
32
32
k
/
c 31
xy
MSB
32
32
Shorthand
symbol
for ALU
Control
c 32
x
Func
AddSub
s
ALU
AND
OR
XOR
NOR
00
01
10
11
Ovfl
32input
NOR
Logic
unit
Zero
Logic function
Zero
Ovfl
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
III.
DESIGN OF MULTIPLIERS AND DIVIDERS (Refer page no. 197 - 214 in text book B.Parhami)
13. SHIFT-ADD MULTIPLICATION for examples refer page no. 199 in text book b.parhami
Multiplicand
Multiplier
x
y
Partial
products
bit-matrix
y0
y
1
y2
y3
Product
x
x
x
x
20
21
22
23
14.
14.1 COMBINATIONAL MULTIPLIER WITH CARRY SAVE ADDITION PAGE NO. 70 IN XEROX
15.
Mux
yj
Enable
Select
c out
Adder
c in
AddSub
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
TREE MULTIPLIERS
ARRAY MULTIPLIER:
x3 0
0
x2 0
0
x1 0
0
x0 0
MA
MA
MA
MA
MA
MA
MA
MA
MA
MA
MA
MA
MA
MA
MA
MA
FA
FA
FA
HA
z7
z6
z5
y0
0
y1
z0
Our original
dot-notation
representing
multiplication
0
y2
z1
0
y3
z2
0
z3
16.
Straightened
dots to depict
array multiplier
to the left
z4
PROGRAMMED MULTIPLICATION
SHIFT-SUBTRACT DIVISION. for examples refer page no. 208 in text book B.PARHAMI
x
Divisor
Subtracted
bit-matrix
Quotient
z
Dividend
y 3 x 23
y 2 x 22
y 1 x 21
y 0 x 20
s
Remainder
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
SIGNED DIVISION:
Method 1 (indirect): strip operand signs, divide, set result signs
Dividend
z=5
z=5
z = 5
z = 5
Divisor
x=3
x = 3
x=3
x = 3
Quotient
y=1
y = 1
y = 1
y=1
Remainder
s=2
s=2
s = 2
s = 2
Method 2 (direct 2s complement): develop quotient with digits 1 and 1, chosen based on signs, convert to digits 0
and 1
Restoring division: perform trial subtraction, choose 0 for q digit if partial remainder negative
Nonrestoring division: if sign of partial remainder is correct, then subtract (choose 1 for q digit) else add (choose 1)
18.
HARDWARE DIVIDERS
Shift
yk j
Quotient y
Partial remainder z (j) (initially z)
Load
Shift
Quotient
digit
selector
Divisor x
Enable
0 Mux 1
Select
c out
Adder
c in
1
(Always
subtract)
Trial difference
ARRAY DIVIDERS:
z7
y3
x3
z6
MS
x2
x1
z5
MS
x0
z4
MS
MS
z3
0
z2
y2
MS
MS
MS
MS
z1
y1
MS
MS
MS
MS
Our original
dot-notation
for division
z0
y0
MS
s3
MS
s2
MS
s1
MS
0
Straightened
dots to depict
an array divider
s0
10
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
19.
PROGRAMMED DIVISION
max
Negative numbers
FLP
Sparser
min
Denser
Overflow
region
min +
Positive numbers
FLP +
Denser
Sparser
Underflow
regions
Midway
example
max +
Overflow
region
Underflow
example
Typical
example
Overflow
example
11
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
Input 2
Unpack
Signs Exponents
Significands
AddSub
Mu x
Sub
Possible swap
& complement
Align
significands
Control
& sign
logic
Add
Normalize
& round
Sign
Exponent
Significand
Pack
Output
12
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
Input 1
Input 2
Unpack
Signs Exponents
Significands
MulDiv
Multiply
or divide
Control
& sign
logic
Normalize
& round
Sign
Exponent
Significand
Pack
Output
13
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
31
ex
25
ft
20
15
fs
fd
10
fn
0 1 0 0 0 1 0 0 0 0 x 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 x x x
Floating-point
instruction
s=0
d=1
Source
register 2
Source
register 1
Destination
register
add.* = 0
sub.* = 1
mul.* = 2
div.* = 3
neg.* = 7
31
ex
25
ft
20
fs
15
10
fd
fn
0 1 0 0 0 1 0 0 0 0 x 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 x x x
Floating-point
instruction
*.w = 0
w.s = 0
w.d = 1
*.* = 1
Unused
Source
register
Destination
register
To format:
s = 32
d = 33
w = 36
op
25
ft
20
fs
15
fd
10
fn
0 1 0 0 0 1 0 0 0 0 x 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0
Floating-point
instruction
31
ex
op
rs
25
s=0
d=1
20
rt
Unused
15
rd
Source
register
sh
10
Destination
register
fn
mov.* = 6
0 1 0 0 0 1 0 0 x 0 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Floating-point
instruction
mfc1 = 0
mtc1 = 4
Source
register
Destination
register
Unused
Unused
14
CMageshKumar_AP_AIHT
CS2071_Computer Architecture
31
op
25
ft
20
15
fs
10
fd
fn
0 1 0 0 0 1 0 0 0 0 x 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0
Floating-point
instruction
31
ex
op
s=0
d=1
25
rs
Source
register 2
20
rt
Source
register 1
15
Unused
operand / offset
c.eq.* = 50
c.lt.* = 60
c.le.* = 62
0
0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 x 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 1
Floating-point
instruction
bc1? = 8
true = 1
false = 0
Offset
15
CMageshKumar_AP_AIHT
CS2071_Computer Architecture