The ALU and Basic Arithmetic
Last Edit November 1, 1996; May 1, 1999 ; July 18, 2001
Multiplication with the Am2901
To implement the above algorithm using the Am2901,
the bits of the multiplier need to be examined one at a time. To
perform the addition, shifting down is necessary to maintain alignment.
To conditionally ass the multiplicand or 0, control of the source-operand
pair (A, B) or (A, 0) is required and a method of conditional subtraction
is needed.
The functional diagram of the multiply operation is
given in Figure 6-6. The actual schematic of a 16-bit Am2901
ALU is shown in Figure 6-7.
Figure 6-6 Am2901A Multiply functional diagram
Figure 6-7 Specific interconnections for 16-bit
multiply - ripple carry
The additional hardware provides the following connections:
- When Q is loaded and after each instance when it is shifted,
Q0, is inverted and connected to a MUX which is controlled
from the CCU. Under multiply, the MUX selects Q0; under
normal operation, the MUX selects 1i. Q0
operates to control the source operands so that:
Q0
|
Ii
|
Source Pair
|
0
|
1
|
B + 0
|
1
|
0
|
B + A
|
- When RB is shifted down (RB is any scratchpad
register), RB0 is shifted into Q3
of the most significant slice.
- When RB is shifted down SIGN OVR is shifted into
RB3 of the most significant slice. This
is equivalent to:
RB3 = F3 EXOR Cn+4
EXOR Cn+3
The Algorithm
The microcode algorithm is as follows:
The result is across registers RB and Q,
and the result is sign-extended to produce the proper number of
bits so that multiplication with any two 8-bit two's complement
numbers always produces a 16-bit result.
A sample 8 x 8 bit multiply is shown in Figures 6-8
and 6-9. Figure 6-9 shows the step-by-step walk through of the problem.
Sample microcode is given in the Am2900 Family Data Book
and the 2900 Family Study Guide. [Rare books at this point.]
Figure 6-8 Example: 8 x 8 bit multiply two's complement
(B = -b, A = -a)
Figure 6-9 Walking through the Am2901A algorithm.
The Am2901A algorithm takes advantage of added hardware to eliminate
conditional jumps and therefore improve speed and reduce microcode
Am2903 Multiply
Unsigned Multiply
The Am2903 has unsigned multiplication implemented
as one of its special functions. To perform multiplication, zero
out the RAM register which, with Q, will contain the final result.
If it is not already present, load the multiplicand into another
RAM register. Load the multiplier into the Q register. The shift
connection should tie the LSB (least significant bit) of the RAM
register (S0) to the MSB (most significant bit) of the
Q register (Q3) of the most significant slice.
The actual microcode is two microwords
- load the Am2910 counter with the number of bits minus 1 (for
16 x 16, load with 15) and place the multiplier into Q
- use RCPT for the Am2910 to repeat the actual multiply operation
Two's Complement Multiply
The Am2903 has two other special functions which enable
multiplication of a signed number. Two's complement multiply requires
three microwords for any width multiplication.
The same initialization is required, with the multiplier
being replaced into the Q register. The counter is this case is
loaded with the number of bits minus 2 (for 16x16, load with 14).
The repeat loop instruction is the same as before. The added step
is effectively the sign bit "correction" which was the
last step in the Am2901 algorithm. The required interconnect of
the slices is the same as before, with the addition of the Z status
line tied to Cin.
|