Beruflich Dokumente
Kultur Dokumente
0 1 1 0 0 1 -- A=2510 multiplicant
1 0 1 1 0 1 -- B=-1910 multiplier
B5B4B3B2B1B0
P = AB = 32(B5B4)A 16(B4B3)A
8(B3B2)A 4(B2B1)A
2(B1B0)A 1(B00)A
= 32+16+04+21
ECE152B AU 2
Multiplicand Multiplier
8 0 8
PIER_LD D7 D1 D0
8-bit register D 1-bit Q
PIER_CLK 8-bit shift
PCAND_CLK register FF
8 D0
Bi Bi-1
7
D7 Combo
logic
S3 4
8-bit ALU
S1
7
8 1
prod_clr
8-bit register 8-bit register
prod_clk D7 D1 D0 D7 . D1 D0
7 7
ECE152B AU 3
ECE152B AU 4
Multiplication
A3 A2 A1 A0
B3 B2 B1 B0
R0,3 R0,2 R0,1 R0,0
R1,3 R1,2 R1,1 R1,0
R2,3 R2,2 R2,1 R2,0
R3,3 R3,2 R3,1 R3,0
Sum of partial products
ECE152B AU 5
Using adders
to add rows
ECE152B AU 6
Multiplication Using Adders
A3 A2 A1 A0
B3 B2 B1 B0
R0,3 R0,2 R0,1 R0,0 1st level
adder
R1,3 R1,2 R1,1 R1,0
R2,3 R2,2 R2,1 R2,0
R3,3 R3,2 R3,1 R3,0
Sum of partial products
ECE152B AU 7
A3 A2 A1 A0
B3 B2 B1 B0
R0,3 R0,2 R0,1 R0,0
R1,3 R1,2 R1,1 R1,0 2nd level
adder
R2,3 R2,2 R2,1 R2,0
R3,3 R3,2 R3,1 R3,0
Sum of partial products
ECE152B AU 8
Multiplication Using Adders
A3 A2 A1 A0
B3 B2 B1 B0
R0,3 R0,2 R0,1 R0,0
R1,3 R1,2 R1,1 R1,0
3rd level
R2,3 R2,2 R2,1 R2,0 adder
R3,3 R3,2 R3,1 R3,0
Sum of partial products
ECE152B AU 9
A3 A2 A1 A0
B3 B2 B1 B0
R0,3 R0,2 R0,1 R0,0
R1,3 R1,2 R1,1 R1,0
R2,3 R2,2 R2,1 R2,0
R3,3 R3,2 R3,1 R3,0
Sum of partial products
ECE152B AU 10
Using Carry Save Adders
ECE152B AU 11
A3 A2 A1 A0
B3 B2 B1 B0
R0,3 R0,2 R0,1 R0,0
R1,3 R1,2 R1,1 R1,0 1st level adder
(row-reduction unit)
R2,3 R2,2 R2,1 R2,0
R3,3 R3,2 R3,1 R3,0
Sum of partial products
ECE152B AU 12
Row Reduction Method for Multiplication
A3 A2 A1 A0
B3 B2 B1 B0
R0,3 R0,2 R0,1 R0,0
R1,3 R1,2 R1,1 R1,0 1st level adder
(row-reduction unit)
R2,3 R2,2 R2,1 R2,0
F5 F4 F3 F2 F1 F0 Outputs of 1st
level adder
C5 C4 C3 C2 C1 C0
ECE152B AU 13
MULTIPLICAND
MULTIPLIER
Intermediate
Partial Partial
Product Product Sums
Array Formed in
Parallel
then Summed
PRODUCT
ECE152B AU 15
15-4
15-4
56
PARTIAL 15-4 PRODUCT
7-3 3-2 FA
PRODUCT 15-4
ROWS
15-4
ECE152B AU 16
DELAY: 1 + 2 T15-4 rru + T7-3 rru + T3-2rru + TLACA
to 2+4(log8(112) -1)
row
form = 2+4(3-1)
reduction
partial = 10 gate delay
unit
product
ECE152B AU 17
X3 X2 X1 X0
Y3 Y2 Y1 Y0
R0,3 R0,2 R0,1 R0,0
R1,3 R1,2 R1,1 R1,0
R2,3 R2,2 R2,1 R2,0
R3,3 R3,2 R3,1 R3,0
P7 P6 P5 P4 P3 P2 P1 P0
ECE152B AU 18
X7 X6 X5 X4 X3 X2 X1 X0
Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
R0,7 R0,6 R0,5 R0,4 R0,3 R0,2 R0,1 R0,0
P3 R1,7 R1,6 R1,5 R1,4 R1,3 R1,2 R1,1 R1,0
R R R R R R R R P1 =
R R R R R R R R X3-0 Y3-0
P4
R R R R R R R R
R R R R R R R R
R R R R R R R R
R R R R R R R R P2 = X7-4xY3-0
P1,7 P1,6 P1,5 P1,4 P1,3 P1,2 P1,1 P1,0
P2,7 P2,6 P2,5 P2,4 P2,3 P2,2 P2,1 P2,0
P3,7 P3,6 P3,5 P3,4 P3,3 P3,2 P3,1 P3,0
P4,7 P4,6 P4,5 P4,4 P4,3 P4,2 P4,1 P4,0
ECE152B AU 19
ECE152B AU 20
Division
DD = Q DS + R
ECE152B AU 21
Example:
1011 Quotient, Q
Divisor,DS 101) 111010 dividend, DD
101 Q3Ds
10010 R>Ds, continue
000 Q2Ds, shifted
10010 R>Ds, continue
101 Q1Ds, shifted
1000 R>Ds, continue
101 Q0Ds, shifted
11 R<Ds, done
ECE152B AU 22
A block diagram for such a divider:
INPUT INPUT
bit
DS R Q from
control
ALU
(subtract) Termination: Quotient in Q
Remainder in R
ECE152B AU 23
Load Ds, Q
clear Cout INPUT INPUT
clear R
DS R Q
begin
shift Q,R
left one bit ALU
inc count (subtract)
is
R-Ds Yes
positive
?
No prepare 1
prepare 0 for Q reg
for Q reg R=R-Ds
is shift Q,R
No count Yes
left one bit Done
N?
ECE152B AU 24
Fig 6.10 Parallel Array Divider
d1 D1 d2 D2 dm Dm D m+1 D 2m
d D
q1 bo bi 0
c c
R d
q2 0
Borrow always qm 0
computed
R := (c D: r1 r2 rm
c (D-d-bi) mod 2):
ECE152B AU 25
ECE152B AU 26
For simplicity, assume DD & DS are positive
normalized fraction: DS=1-x where x<1.
Set f0 = 1+x
=> DSf0=1-x2 (closer to 1 than DS)
=> Q= (DD(1+x) )/(1-x2 )
Set f1 =1+x2
=> DS f0 f1 =1-x4 (even closer to 1)
=> Q= (DD(1+x) (1+ x2) )/(1-x4 )
f0 =1+x = 1+(1- DS) = 2-DS (2s complement of DS)
f1= 1+x2 = 1+(1-DSf0) = 2- DSf0 = 2-DS0
=>fi =2- DSf0 fi-1 =2-DS(i-1)
ECE152B AU 27
ECE152B AU 28
(2). 0.7/0.4:
DD0 0.7000000 DS0 0.4000000 f0 1.5999999
DD1 1.1199999 DS1 0.6400000 f1 1.3599999
DD2 1.5231999 DS2 0.8704000 f2 1.1295999
DD3 1.7206066 DS3 0.9832038 f3 1.0002821
DD4 1.7495062 DS4 0.9997178 f4 1.0002821
DD5 1.7499998 DS5 0.9999999 f5 1.0000001
DD6 1.7499999 DS6 1.0000000
(3). 0.1/0.15:
DD0 0.1000000 DS0 0.1500000 f0 1.8499999
DD1 0.1850000 DS1 0.2775000 f1 1.7224999
DD2 0.3186625 DS2 0.4779938 f2 1.5220062
DD3 0.4850063 DS3 0.7275094 f3 1.2724905
DD4 0.6171659 DS4 0.9257489 f4 1.0742511
DD5 0.6629912 DS5 0.9944868 f5 1.0055132
DD6 0.6666464 DS6 0.9999696
ECE152B AU 29
ECE152B AU 30
Suppose ROM has 28 words
(a) If DS is 8-bit, one iteration is sufficient
=> f0 = 1/DS
(b) If DS is > 8-bit, more than one iteration is
required, DS f0=1-x & x< 2-8
At the 2nd iteration, Ds f0 f1= 1-x2
cthe difference from 1 is <2-16
At the ith iteration (i>2)
Dsf0f1fi-1= Dsi-1 = 1-x2(i-1)
c the difference from 1 is < (2-8)2(i-1)
(3rd iteration error < 2-32)
(4th iteration error < 2-64)
ECE152B AU 31
DD Q
mult mult mult
f0 2s f1 2s f2
ROM comp comp
DS mult mult
ECE152B AU 32
Fig 6.14 Floating-Point
Number Format
Sign Exponent Fraction
s e f
1 me mf
m bits
1 + me + mf = m, Value(s, e, f ) = ( 1)s f 2e
ECE152B AU 34
This involves determining which operand
value is smaller, and then aligning the
mantissa of that operand appropriately with
the mantissa of the larger operand.
The alignment is accomplished by shifting
the mantissa of the smaller operand to line
up with the digits of the same significance in
the larger operand.
The amount of the alignment, i.e. the # of
positions to shift, is determined by the
difference in the exponents.
ECE152B AU 35
A block diagram:
Select
Select and align
Exponent
Compare
Add/Subtract
Exponent
Post Normalization
Adjust
0.8045
0.8032
ECE152B 0.0012 AU 37
ECE152B AU 38
Floating-point adder of IBM system/360 Model 91
Input Bus Exponent
E1 E2 M1 M2 Comparison and
Mantissa
Alignment
Adder 1 Shifter 1
E1-E2 Mantissa
Adder 2
addition-subtraction
Zero digit R
Result
checker
normalization
Adder 3 Shifter 2
Output Bus
E3 M3
ECE152B AU 39
ECE152B AU 40
Fig 6.11 A N N Bit Crossbar Design for
Barrel Rotator
y0 y1 y2 y3 y4 y5
x0
x1
S h ift
co unt
x2
D eco de r
x3
x4
x5
x - in p u t
y - o utp u t
ECE152B AU 41
ECE152B AU 42
Logarithmic Barrel Shifter
Input word
x0 x1 x2 x29 x30 x31
Shift count
s4 s3 s2 s1 s0 One shift/
bypass cell
Bypass/shift 1 bit right
Shift/bypass
ECE152B AU 43
ECE152B AU 44
Floating Point Multiplication
A = BC
= MB rS EBxMC rS Ec
= MB MC rSEB+Ec
Exponent B Exponent C Mantissa B Mantissa C
Exponent
Add
Multiply
Exponent
Post Normalization
Adjust
Exponent
subtract
Divide
Exponent
Post-Normalization
Adjust
ECE152B AU 47
Largest / smallest
Base 2 Base 10
0.1111 0.9999
0.1000 0.1000 N ot aligned pr oper ly,
1.1110 9.9990 =>postnor malization is
r equir ed.
Smallest / Lar gest
Base 2 Base 10
0.1000 0.1000
0.1111 0.9999 A ligned pr oper ly,
0.1000 0.1000 =>no postnor malization.