In Chapter 3 we described the accumulator and some of the basic accumulator instructions.
All the accumulator instructions operate on floating-point numbers. They may be divided into groups as follows:-
The only standardised rounded instruction not so far introduced is
Function | Description | Notation |
---|---|---|
360 | Standardise a, round am and check for exponent overflow | am' = a QRE |
In these instructions, L is cleared before the operation, and after the operation the result is standardised as a double-length number in A. An interrupt occurs if the exponent overflows.
Function | Description | Notation |
---|---|---|
300 | Add am and s | a' = am + s QE |
301 | Subtract s from am | a' = am - s QE |
302 | Negate am and add s | a' = -am + s QE |
The instructions are thus similar to 320-322 except that rounding does not occur.
The following instructions are like 300 and 3O1 except that L and Ls are not cleared initially.
They provide a limited form of double-length working; limited because the answer is only correct if ay ≤ sy) (i.e. the exponent of s must not be less than the accumulator exponent).
Function | Description | Notation |
---|---|---|
310 | Add s to a (pseudo double-length) | a' = a + s QE (if ay ≤ sy) |
311 | Subtract s from a (pseudo double-length) | a' = a - s QE (if ay ≤ sy) |
Before two numbers are added or subtracted in the accumulator, the one with the smaller exponent is shifted down into L and its exponent increased accordingly until the two exponents are the same.
In the 310 and 311 instructions. if ay ≤ sy then ax is shifted down correctly. If sy < ay then sx will be shifted down into L, and the original contents of L will be spoiled. In this case the definitions of 310 and 311 will be
310 am' = am + s, l spoiled. QE
311 am' = am - s, l spoiled. QE
Extracodes are provided for correct double-length working in all cases and these are described later.
Two store locations are needed to hold a double-length number and it is conventional to store both numbers as standardised numbers with the less-significant half always positive and with an exponent which is at least 13 less than that of the more-significant number.
The contents of the accumulator are
am + al . 8-13
as the floating point number al has an exponent ay which is 13 more than its true value.
The 355 instruction is provided to position al correctly
Function | Description | Notation |
---|---|---|
355 | Copy the special sign bit of L ( ls) into all bits of M, then standardise | a' = al.8-13 Q a' = a - am Q when ls = 0 |
Example:
To store the accumulator contents for double-length working in locations 100 and 101
356 0 0 100 store am 355 0 0 J4 position al * 356 0 0 101 store al.8-13 (Q)
* Note: All accumulator instructions make a reference to the store and obtain a store operand, even if the function does not use it. Any store address within the program is of course allowed, but as operands are read from the fixed-store very much faster than from the core-store it is conventional to specify the first address in the fixed-store, J4, in such instructions.
Example:
Locations 100 and 101 contain two numbers to be regarded as a double-length number. Add this number into the accumulator, using locations 98 and 99 as working space.
356 0 0 98 store am 355 0 0 J4 position al 320 0 0 101 add less-significant halves, QRE, in am. 356 0 0 99 store partial answer 324 0 0 98 replace original am 300 0 0 100 add most-significant halves, result is standardised but not rounded in a 356 0 0 98 store most significant part of this 355 0 0 J4 position the rest 300 0 0 99 add in less-significant sum 310 0 0 98 final answer in a
(This program is extracode 1500)
The following instructions complete the standardised unrounded operations.
Function | Description | Notation |
---|---|---|
340 | Standardise a, check for exponent overflow | a' = a QE |
342 | Multiply am by s, leaving the double-length product standardised in a | a' = am . s QE |
343 | As 342 but multiply negatively | a' = -am . s QE |
366 | Clear L, complement am if negative, and standardise | a' = |am| |
367 | Clear L, copy the modulus of s to Am, and standardise | a' = |s| QE |
The unstandardised instructions can be divided into four groups
6.2.1 The unstandardised instruction which store and load a are described below:-
Function | Description | Notation |
---|---|---|
356 | Copy am into S | s' = am |
357 | Copy al (that is l, ls and ay) into S | s' = al |
346 | Transfer am to S and clear A (a' = floating-point zero) | s' = am, a' = 0 |
347 | Transfer al to S and clear L and Ls | s' = al, l' = 0 |
344 | Copy the argument and sign from S into L and Ls, leaving Am, including the exponent, unchanged | l' = sx |
345 | Copy the argument from S into L and the sign bit from S into Ls and all bits of M. Leave the exponents unchanged. | l' = sx, m' = sign of s, ay' = ay |
314 | Copy s into Am leaving L and Ls unchanged | am' = s, l' = l |
315 | Copy s negatively into Am leaving L and Ls unchanged (AO will be set for s=-1.0) | am' = -s, l' = l AO |
Function | Description | Notation |
---|---|---|
372 | Multiply am by s and leave the double-length product unstandardised in A. Clear the sign bit of L. Check for exponent overflow and accumulator overflow | a' = am . s, ls' = 0 EAO |
373 | As 372 but multiply negatively | a' = -am . s, ls' = 0 EAO |
352 | Multiply am by s, leaving the double-length product unstandardised in A, and set the sign bit of 1 equal to the sign of the product. Check for E and AO | a' = am . s, ls' = sign of m EAO |
353 | As 352 but multiply negatively | a' = -am . s, ls' = sign of m EAO |
352 and 353 are identical to 372 and 373 except that they set Ls instead of clearing it. These instructions (352 and 353) are intended to form the single-length product of two unstandardised integers and leave the mantissa in L with the correct sign in Ls; they can therefore be redefined as
352 l' = m.sx E 353 l' = -m.sx E
Note, however, that the exponent ay will be applicable to the double-length product in A, and that the accumulator overflow will not be set when the product overflows into M, but only when the double-length product overflows.
There are three division instructions which give the quotient in L and the remainder in M. However, these instructions only operate correctly for numbers which obey certain conditions.
There is a large range of division and remainder extracodes provided, which use these instructions and ensure the required conditions are fulfilled. For most purposes, it is easier to use these extracodes rather than the basic instructions. The only exception to this rule is the use of the 375 instruction for division of positive fixed-point integers, and this special case will therefore be described first:-
A fixed-point integer c can be represented in a 48-bit word by a fractional mantissa sx = c × 8n, where n is normally 12 or 13, and an exponent sy, usually + 0 or + n. Provided that they are positive and that the divisor has sx < ½, which even with n = 12 allows integers up to 30,000 million, the 375 instruction can be used to divide one such number into another. The dividend should first be placed in L, with M clear: this places the dividend in Ax with an additional scale factor of 819 and ensures ax < |sx| provided that sx ≠ O. The simplest case of the 375 instruction may now be defined as follows:-
Function | Description | Notation |
---|---|---|
375 | Fixed-Point Integer Division Divide a by the modulus of s, placing the quotient in L and the remainder in M. a and s must satisfy 0 ≤ ax < |sx| < ½; the remainder will then lie in the range 0 ≤ m' < |sx|. | l' = a/ |s| E m' = remainder (0 ≤ ax < |sx| < ½) ay' = ay - sy |
After obeying the 375 instruction the remainder m' will be scaled by the same factor as the dividend, and it should therefore be assigned the same exponent. The quotient l' will be an integer scaled down by 8-13 and it must be shifted up one octal place if it is required to store it with a scale factor of 8-12.
Example:
Given two fixed-point integers 0 and d in A5 and 1A5, each stored with one octal digit after the point; e.g. 0 is stored with mantissa 8-12c in A5. Form the quotient and remainder of c/d, in the same form and with exponent 12, and store them in locations 7 and 8.
345 0 0 A5 ax' = 8-18(8-12 c) i.e. m' = 0 and l' = 8-12 c) 375 0 0 1A5 l' = 8-13 c/d m' = 8-12 × remainder 121 124 0 12U12 ay' = 12 356 0 0 8 Remainder am to location 8 364 0 0 J4 l' = 8-12 c/d 357 0 0 7 Quotient al to location 7
Function | Description | Notation |
---|---|---|
375 | Pseudo Fixed-Point Division Divide a by the modulus of s, placing the quotient in Al and a form of remainder, m', in M. If m' ≥ 0 the true remainder m" = m', but if m' < 0, which will only occur when m'' ≥ ½ then m" = m' +1.0 | al' = a/|s| E m' = "remainder" (0 ≤ ax < |sx| < 1) True remainder m" = m' if m' ≥ 0 m" = m + 1.0 if m' < 0 0 ≤ m" < |sx| |
a and s need not be standardised but they must satisfy the restriction 0 ≤ ax < |sx| < 1.0. The true remainder m" will then satisfy the constraint 0 ≤m" < |sx|. ay' is the exponent of the quotient. The exponent of the remainder is ay - 13, i. e. 13 less than that of the doub1e-length dividend a before the operation.
If sx ≤ ax < 8 |sx| or if sx = -1.0 the 375 instruction provides a quotient and remainder m" which are correct if regarded as floating-point numbers but which break the rules of fixed-point division. The remainder may be larger or smaller than with true fixed-point division, its exponent being as follows:
Condition | Exponent of Remainder |
---|---|
|sx| ≤ ax < 8 |sx| | ay - 12 |
0 ≤ ax < |sx| < 1.0 | ay - 13 |
sx = -1.0 and ax ≥ ⅛ | ay - 13 |
sx = -1.0 and ax < ⅛ | ay - 14 |
When |sx| ≤ ax the adjusted remainder m" may not be exact, because the last octal digit of the correct remainder will have been lost.
If aax < 0 then am will be negated before the division takes place but l will not be adjusted.
If a ≥ 1.0 then ax will be shifted down and its exponent increased by one before the operation.
If sx = 0 or ax ≥ 8 |sx|, the 375 instruction will not give a correct quotient or remainder.
Function | Description | Notation |
---|---|---|
376 |
Divide a by the modulus of s, placing the quotient in Al
and the remainder in M.
The dividend a must not be negative
and the divisor s must be
standardised before the 376
instruction is obeyed. The
remainder is such that:
mantissa of true remainder = m if m ≥ 0
and = m + 1.0 if m < 0 exponent of true remainder = ay - 13 if |ax| < |sx| and = ay - 12 if |ax| ≥ |sx| |
al' = a/|s| (a ≥ 0). EDO Remainder m" = m' if m' ≥ 0 and = m' + 1.0 if m' < 0 |
The quotient al' is not normally an integer; it is merely the unrounded representation of a/s to such accuracy as is possible in the 39 binary digits of L. The true remainder has no special significance other than that it represents a - s.al' and is always positive or zero. When |ax| ≥ |sx| the true remainder m" may not be exact, because the last octal digit of a - s.al' will have been lost.
Exponent overflow is checked for, and division overflow occurs if s is unstandardised or zero. If a is in standardised form before the division, al' will be a standardised quotient, but m' and m" may not be standardised.
Function | Description | Notation |
---|---|---|
377 | Divide the modulus of am by the modulus of s, placing the quotient in Al and the remainder, as defined for 376, in M. Check for E and DO. The divisor s must be standardised. If am is in standardised form before the division, al' will be a standardised quotient, but m' and m" may not be standardised. | al' = |am| / |s| EDO Remainder m" = m' if m' ≥ 0 and = m' + 1.0 if m' < 0 |
Function | Description | Notation |
---|---|---|
354 | Round by adding. Add one to the least-significant digit of m if the most-significant digit of l is a one. Accumukator overflow can occur. the contents of L are unchanged. | am' = a.R+ AO |
341 | Check for exponent overflow. a is unchanged | a' = a E |
361 | Round am and check for exponent overflow | am' = a RE |
The following four instructions are tests on the accumulator mantissa, and comparable to the tests on bt or bm. Note that bm can be used to modify the address.
Function | Description | Notation |
---|---|---|
234 | Place n in Ba if the accumulator contains zero. | ba' = n if ax = 0 |
235 | Place n in Ba if the accumulator does not contain zero. | ba' = n if ax ≠ 0 |
236 | Place n in Ba if the accumulator contents are greater or equal to zero. | ba' = n if ax ≥ 0 |
237 | Place n in Ba if the accumulator contents are less than zero. | ba' = n if ax < 0 |
For the accumulator to contain zero, both guard bits must be zero; the most-significant guard bit, rather than the sign bit, determines whether the accumulator is greater or less zero. With standardised numbers this is immaterial, as the guard digits will be copies of the sign bit, and with fixed point working the correct result might still be obtained even if accumulator overflow had occurred.
Examples:
1. Increase b3 by 0, 1 or 2 depending on whether am is >, = or < the contents of store location 16. Let A10 be the address of a register available for working space.
356 0 0 A10 store am 321 0 0 16 am = s 234 3 3 1 b3' = b3 + 1 if am = s 237 3 3 2 b3' = b3 + 2 if am < s 334 0 0 A10 restore am
2: B1 and B2 contain positive integers n1 and n2. Form: n1 × n2 in store location 5 as a fixed-point integer, represented by mantissa n1 x n2 x 812 and zero exponent. Replace b1 by the integer quotient n1/n2, and place the remainder from this division in B2. Let locations 6 and 7 be available for working space.
113 1 0 6.4 set b1, b2 in the store 113 2 0 7.4 as floating point numbers 113 0 0 6 with zero exponents 113 0 0 7 334 0 0 6 am' = n1 × 8-12 352 0 0 7 a' = n1 × n2 × 8-24 365 0 0 J4 a' = n1 × n2 × 8-25 i.e. l' n1 × n2 × 8-12 357 0 0 5 store l = n1 × n2 × 8-12 345 0 0 6 set n1 in L with m' = sign of n1 = 0. ax' = n1 × 8-25 375 1 0 7 l' = (n1/n2) × 8-13, m' = remainder × 8-12 356 0 0 6 store remainder am 364 0 0 J4 shift up quotient to integer position. l' = (n1/n2) × 8-12 357 0 0 7 store quotient l = (n1/n2) × 8-12 101 2 0 6.4 set b2' = remainder 101 1 0 7.4 set b1' = quotient
Note that in this example it is not necessary to set the exponent zero after division because ay is made zero during the multiplication and both division operands have zero exponents.