Escolar Documentos
Profissional Documentos
Cultura Documentos
slt function is defined as: 000 001 if A < B, i.e. if A B < 0 A slt B = 000 000 if A B, i.e. if A B 0 Thus, each 1-bit ALU should have an additional input (called Less), that will provide results for slt function. This input has value 0 for all but 1-bit ALU for the least significant bit. For the least significant bit Less value should be sign of A B
g. babic
Presentation F
14
B in v e r t
O p e r a tio n
1-bit ALU1-ALU30
0 1 Result
a0 b0
R e s u l t0
0 1
Less
a1 b1 0
R e s u l t1
CarryOut B in v e r t O p e r a ti o n C ar ry I n
a2 b2 0
0 1 R e s u lt
R e s u l t2
0 1
C a rr y In
Le ss
=0
O v e r f lo w d e te c t io n
a3 1 b3 1 0
C a rryI n A L U 31 L e ss
R e s u l t3 1 S et O v e r flo w
Carry Out
Binvert =1
Carry Out
g. babic
Presentation F
Figure B.5.12
+ Carry Out + Binvert
17
Multiplication
Multiplication is more complicated than addition: accomplished via shifting and addition More time and more area required We shall look at 3 hardware design versions based on an elementary school algorithm Example of unsigned multiplication:
5-bit multiplicand 5-bit multiplier 100012 = 1710 100112 = 1910 10001 10001 00000 00000 . 10001 1010000112 = 32310
Presentation F 19
10001
20
0101000011
Multiplier0 = 1 M u l t ip li c a n d S h if t le ft 6 4 b i ts
1. Test Multiplier0
Multiplier0 = 0
1a. Add multiplicand to product and place the result in Product register
M u l t ip l i e r 6 4 - b it A L U S h if t r ig h t 3 2 b i ts 3. Shift the Multiplier register right 1 bit P ro d u ct W r it e 6 4 bits 2. Shift the Multiplicand register left 1 bit
Figure 3.5
g. babic Presentation F
Figure 3.6
21
Multiplier0 = 1 M u l t i p li c a n d
1. Test Multiplier0
Multiplier0 = 0
3 2 b its 1a. Add multiplicand to the left half of the product and place the result in the left half of the Product register M u l t ip l i e r 3 2 - b it A L U S h if t r ig h t 2. Shift the Product register right 1 bit 3 2 b i ts
6 4 b it s
32nd repetition?
g. babic
Presentation F
22
3 2 b its
Product0 = 1
1. Test Product0
Product0 = 0
3 2 - b it A L U
1a. Add multiplicand to the left half of the product and place the result in the left half of the Product register
2. Shift the Product register right 1 bit P rod uc t S h if t r i g h t W rite 6 4 b it s C o n tr o l te s t 32nd repetition? No: < 32 repetitions
Figure 3.7
g. babic
Presentation F
23
Real Numbers
Representing real numbers
3.1415925610 3,155,76010 315.57610 x 104
Scientific notation:
Single digit to the left of digital point: 3.1557610 x 106
Real Numbers
Conversion from real binary to real decimal 1101.10112 = 13.687510 since: 11012 = 23 + 22 + 20 = 1310 and 0.10112 = 2-1 + 2-3 + 2-4 = 0.5 + 0.125 + 0.0625 = 0.687510 Conversion from real decimal to real binary: +927.4510 = + 1110011111.01 1100 1100 1100 .. 927/2 = 463 + LSB 0.45 2 = 0.9 + 0 MSB 463/2 = 231 + 0.9 2 = 0.8 + 1 231/2 = 115 + 0.8 2 = 0.6 + 1 115/2 = 57 + 0.6 2 = 0.2 + 1 57/2 = 28 + 0.2 2 = 0.4 + 0 28/2 = 14 + 0 0.4 2 = 0.8 + 0 14/2 = 7 + 0 0.8 2 = 0.6 + 1 7/2 = 3 + 0.6 2 = 0.2 + 1 3/2 = 1 + 0.2 2 = 0.4 + 0 1/2 = 0 + 0.4 2 = 0.8 + 0
g. babic Presentation F 25
Double precision:
63 62 s 31 Fraction E 52 51 Fraction 0 32
g. babic
Presentation F
26
|10011001100110011001100110011001| |10011001100110011001100110011010|
Presentation F 29
Figure 3.16
g. babic Presentation F 31
Figure 3.17
g. babic Presentation F 32
Booths Algorithm
Start 1b. Subtract multiplicand from the left half of the product and place the result in the left half of the Product register Product[0-1] = 11
Product[0-1] = 01
1. Test Product[0-1]
Product[0-1] = 00 or 11
Multiplicand 32 bits 1a. Add multiplicand to the left half of the product and place the result in the left half of the Product register
Product 64 bits
Control te s t
Arithmetic
32nd repetition? No: < 32 repetitions
g. babic
Presentation F
33
10
shift
g. babic
Presentation F
35
11