Patent GB-1512476-A (GB)
Title: Arithmetic units
IPC: G06F7/494
Filed: 1976-05-06
Abstract: 1512476 Arithmetic units INTERNATIONAL BUSINESS MACHINES CORP 6 May 1976 [17 June 1975] 18555/76 Heading G4A An arithmetic unit capable of operating on operands in zoned or packed BCD format as well as binary comprises an adder 20 having input modifying circuitry 23, 33 which so modifies the zone and/or sign fields of the zoned or packed BCD operands that carries can be propagated through those fields, and an output corrector 50 which restores the original zone and/or sign field coding. The sign fields of the two input operands A, B are examined in a sign handler together with the requested add/subtract operation command to control complementing-circuits in the B operand modifier 33 according to whether or not two operands of the same or different signs are to be added or subtracted. In the zoned (EBDIC) format, 4-bit digit fields alternate with 4-bit zone fields coded 1111, the zone field in the lowest order byte being a sign field which is coded 1111 (hex F) for positive and 1101 (hex D) for negative. For operation in zoned format the A operand modifier forces the zone and sign fields to 0000 whereas the B operand modifier forces the sign field to 1111 and leaves the zone fields unchanged at the same code. The digit codes are unchanged for the A operand and are either complemented (for subtraction) or augmented by six (for decimal addition) for the B operand. In the packed BCD format the lowest order 4-bit field is coded 1100 (hex C) for positive and 1101 (hex D) for negative, and the A and B operand modifiers force the sign fields to 0000 and 1111 (hex F) respectively. The adder 20 is a conventional carry look-ahead parallel binary adder (or subtractor), e.g. 4 bytes wide and provides inter-field carries C0-C7. Any odd numbered carry produced from the combination of a pair of zoned digit fields can propagate through the intervening zone field to the next digit field, and a carry in CIN can propagate through the packed BCD sign field to the lowest order digit field. The output corrector 50 has control inputs 26-28, 46 which cause it to force all zone fields to 1111 and/or the sign field to the appropriate code (normally the same as the A operand) as appropriate for zoned or packed BCD operation, and to leave unchanged each digit field or to subtract 6 (or add 10) according to the presence or absence of corresponding carries. In the case where B is numerically greater than A and subtraction is performed, the absence of CO is detected at 65 and causes a recomplementing operation to be performed in which the contents of the output register 53 are loaded into the B register, the A modifier forces all A operand bits to zero, the B modifier complements and the output corrector 50 inverts the original sign of the output. For operation with operands of greater width than the adder, two or more passes are made using different parts of the operands, the operation of modifiers 23, 33 being changed for the second and any subsequent passes to allow for the fact that the sign fields are only present in the first pass. The status of CO is stored in a latch 70 after each pass to form the input CIN for the next pass if any.