Multiply Instructions

Microcode for the single-word Multiply and Add instruction:
# OPCODE L STAT : SHS EOI  RFA XSEL CMX YSEL CARRY WRF ODD SS1 MSW LSW MMSW MLSW WMEM MISC  INCMS UBCOND UBADDR

# V - Multiply and add
11111 0 0001 : SHS - 00 X0 - Y0 CY0 -- - - - - - - - --- - --- ---- # Read multiplier into S
11111 0 0010 : - - 01 X0 - YPR CY0 WPR - - - LSW MMSW MLSW - RSH - --- ---- # Multiply step word 2
11111 0 0011 : - - 11 XMUL - YPR CY0 WPR - SS1 MSW - MMSW MLSW - RSH INCMS 010 0100 # Multiply step word 3
11111 0 0100 : - - 01 XAC - YPR CY0 WAC - - - LSW - - - --- - --- ---- # Add product to AC word 2
11111 0 0101 : - EOI 11 XAC - YPR CY0 WAC - - MSW - - - - --- - --- ---- # Add product to AC word 3
When I came to do the double-word version, I discovered an error in the ALU. It was treating bit 17 of the low word of the multiplicand as a sign bit and triggering subtraction. The following ALU update fixes this by gating MLAST with MMSW.



The microcode for double-word Multiply and Add consists of two four-cycle loops, one for each half of the multiplicand, followed by a final four cycles to add the Product Register to the Accumulator.
   11111 1 0001 : SHS  -   00  ---   -  --    --   --  EVN  -   -   -   -    -    -   ---     -   ---    ----    # Read LSW of multiplier into S
11111 1 0010 : - - 00 X0 - YPR CY0 WPR - - - LSW - MLSW - RSH - --- ---- # Multiply step word 0
11111 1 0011 : - - 10 X0 - YPR -- WPR - - - - - MLSW - RSH - --- ---- # Multiply step word 1
11111 1 0100 : - - 01 XMUL - YPR -- WPR - - - - - MLSW - RSH - --- ---- # Multiply step word 2
11111 1 0101 : - - 11 XMUL - YPR -- WPR - SS1 MSW - - MLSW - RSH INCMS BNLMS 0100 # Multiply step word 3
11111 1 0110 : SHS - 00 --- - -- -- -- ODD - - - - - - --- - --- ---- # Read MSW of multiplier into S
11111 1 0111 : - - 00 X0 - YPR CY0 WPR - - - LSW MMSW - - RSH - --- ---- # Multiply step word 0
11111 1 1000 : - - 10 X0 - YPR -- WPR - - - - MMSW - - RSH - --- ---- # Multiply step word 1
11111 1 1001 : - - 01 XMUL - YPR -- WPR - - - - MMSW - - RSH - --- ---- # Multiply step word 2
11111 1 1010 : - - 11 XMUL - YPR -- WPR - SS1 MSW - MMSW - - RSH INCMS BNLMS 1110 # Multiply step word 3
11111 1 1011 : - - 00 XAC - YPR CY0 WAC - - - LSW - - - --- - --- ---- # Add product to AC word 0
11111 1 1100 : - - 10 XAC - YPR -- WAC - - - - - - - --- - --- ---- # Add product to AC word 1
11111 1 1101 : - - 01 XAC - YPR -- WAC - - - - - - - --- - --- ---- # Add product to AC word 2
11111 1 1110 : - EOI 11 XAC - YPR -- WAC - - MSW - - - - --- - --- ---- # Add product to AC word 3
The Multiply and Subtract instructions are identical except for subtracting the product from the accumulator.
# N - Multiply and subtract
10110 0 0001 : SHS - -- --- - -- -- -- - - - - - - - --- - --- ---- # Read multiplier into S
10110 0 0010 : - - 01 X0 - YPR CY0 WPR - - - LSW MMSW MLSW - RSH - --- ---- # Multiply step word 2
10110 0 0011 : - - 11 XMUL - YPR -- WPR - SS1 MSW - MMSW MLSW - RSH INCMS BNLMS 0100 # Multiply step word 3
10110 0 0100 : - - 01 XPR CMX YAC CY1 WAC - - - LSW - - - --- - --- ---- # Subtract product from AC word 2
10110 0 0101 : - EOI 11 XPR CMX YAC -- WAC - - MSW - - - - --- - --- ---- # Subtract product from AC word 3

10110 1 0001 : SHS - 00 --- - -- -- -- EVN - - - - - - --- - --- ---- # Read LSW of multiplier into S
10110 1 0010 : - - 00 X0 - YPR CY0 WPR - - - LSW - MLSW - RSH - --- ---- # Multiply step word 0
10110 1 0011 : - - 10 X0 - YPR -- WPR - - - - - MLSW - RSH - --- ---- # Multiply step word 1
10110 1 0100 : - - 01 XMUL - YPR -- WPR - - - - - MLSW - RSH - --- ---- # Multiply step word 2
10110 1 0101 : - - 11 XMUL - YPR -- WPR - SS1 MSW - - MLSW - RSH INCMS BNLMS 0100 # Multiply step word 3
10110 1 0110 : SHS - 00 --- - -- -- -- ODD - - - - - - --- - --- ---- # Read MSW of multiplier into S
10110 1 0111 : - - 00 X0 - YPR CY0 WPR - - - LSW MMSW - - RSH - --- ---- # Multiply step word 0
10110 1 1000 : - - 10 X0 - YPR -- WPR - - - - MMSW - - RSH - --- ---- # Multiply step word 1
10110 1 1001 : - - 01 XMUL - YPR -- WPR - - - - MMSW - - RSH - --- ---- # Multiply step word 2
10110 1 1010 : - - 11 XMUL - YPR -- WPR - SS1 MSW - MMSW - - RSH INCMS BNLMS 1110 # Multiply step word 3
10110 1 1011 : - - 00 XPR CMX YAC CY0 WAC - - - LSW - - - --- - --- ---- # Subtract product from AC word 0
10110 1 1100 : - - 10 XPR CMX YAC -- WAC - - - - - - - --- - --- ---- # Subtract product from AC word 1
10110 1 1101 : - - 01 XPR CMX YAC -- WAC - - - - - - - --- - --- ---- # Subtract product from AC word 2
10110 1 1110 : - EOI 11 XPR CMX YAC -- WAC - - MSW - - - - --- - --- ---- # Subtract product from AC word 3