• Keine Ergebnisse gefunden

The Algorithms of Arithmetic

Im Dokument The Computer Concepts (Seite 45-52)

The heart of the hand calculator is the accumulator unit, which oper-ates on the principle of the toothed gear. Addition is usually accomplished by rotating the gear in one direction. As the gear reaches a maximum position it flips an adjacent gear. In this way carries are propagated in the addition process. Subtraction· is accomplished by rotating the gear in a direction opposite to that of addition. Multiplication can be con-sidered as successive addition, and division as a process of iterative subtraction. The 1620 has no accumulator and does not operate on the principle of the toothed gear. Consequently, an alternate method of performing the basic functions of mathematics must be used. The basic operations of the 1620 are addition and multiplication, and certain areas of core storage are reserved for addition and multiplication tables. These operations are done serially, digit by digit, and the computer "looks up"

the result of an operation in these tables. Subtraction utilizes the addition table but prepares the subtrahend digit before entry into the addition table. This preparation takes the form of tens or nines complementation.

The process of division is discussed in a special chapter.

The addition table occupies core positions 00300-00399 (see Table 4.1).

Looking at this table, the reader will notice that the number 7 appears at the following 8 locations: 00307, 00316, 00325, 000334, 00343, 00352, 00361, and 00370. The reader will also notice that a flagged 7 (7) appears at core positions 00389 and 00398.

You have probably noticed that the sum of the digits in the units and tens positions of the address is the digit located in that core position.

26

The Algorithms of Arithmetic

It is also obvious in the case of the two flagged 7's that the flag is present for the purpose of propagation of carries. Addition is accomplished in the 1620 by literally attaching data digits to a machine-generated address of 003XX to form a 5-digit add table address. The answer is then "looked up" in the add table.

As a further example note that the sum of the digits 4 and 2 is found at table address 00342 or 00324.

The addition of two numbers that generates a carry-over produces the following result: the addition table address generated by the adjacent digits will be increased by 1.

If a field containing n digits is added to a field containing n

+

k digits (k>O), k zeros are inserted automatically to make the fields of equal length. These zeroS are inserted one at a time by internal circuitry of the 1620. They do not alter the field permanently. (See Fig. 4.1.)

The process of subtraction is almost identical with that of addition.

That is, an address of 003XX is generated with the data digits supplying the missing positions of the address. However, the subtrahend digit is inserted in the look-up address in its tens complement form on the first cycle and in its nines complement form thereafter. If the addition table yields a flagged digit, the address generated by the contiguous digits will be increased by 1 (see Fig. 4.2).

Multiplication in the 1620 is also accomplished by combining the digits

28

185 +52

~ Beginning Doto

~\Ik

1 8~5= ---~ ?f~\'

5t~ ---~ I I

7~\\'

I ,

Plus 1 Carry *

The Algorithms of Arithmetic

·1

Add Table ,'\\l/jy

""7-1/j\~

Add Table

~\I~

1~~

I I

1 8N% 7!~

Fig. 4.1. Schematic Diagram of Add Operation.

to be multiplied into a table address. The multiplication table, which occupies core locations OOl()()""()0299 (see Table 4.2), does not yield as obvious an algorithm as did the addition process.

The computer does not generate a base address of OOlXX as might be expected. Instead, the base address is chosen to be OOXXX. The multipli-cand digit is inserted into the tens position of the base address. The multiplier digit is routed through a special device called the doubler. The doubler is an internal device that doubles a digit. Although the multiplier digit enters the doubler as a single element, it leaves this unit as a 2-digit number (see Fig. 4.3). Mter exit from the doubler, the tens digit of the

The Algorithms of Arithmetic

Beginning Data

185 - 52

133 Add Table

-~

-~

(Units)

I 8

(Ttl~ ,Iii,

_________

--.J

5

:ot':

"/11\

(Units)

(Ten.)

(Tens)

,III,

(Hunci,ed.) "I '" 3 3 111\\

I I

(Hunci,ed.) :,11/". 5 2

1'-1"1

Fig. 4.2.

Add Table

... . ... I ] f l

-~

+1 for carry from previous cycle

Schematic Diagram of Subtract Operation.

29

number is incremented by 1 and is then routed to the hundreds digit of the base address being formed. The units digit of the doubler's effort is routed to the units digit of the base address, and this completes the construction of the multiplication table look-up address.

Unlike the addition process, the multiplication table look-up process yields not one but two digits as the product of any two elements. These are found at the table look-up address and the adjacent odd address one position higher in core. Internal machine operation causes these digits to be reversed and routed out to a product generation area (see Fig. 4.3).

30

The Algorithms of Arithmetic Table 4.2 intelligent enough to add 2 and 3, or multiply 5 and 6, without extensive coaching. Unfortunately, in the present state of computer development, the thinking machine is semifantasy, semifiction.

Some computers have accumulating units, as do hand calculators. But the methods of arithmetic are generally performed by a cleverly arranged

The Algorithms of Arithmetic

(Multipliccnd) (Multiplier)

(Units)

(Units)

(Units)

(Tens)

(Tens) 12 12

144

Multiply Table

00

"'\1/"

~---~_. ~04~ ~. - - - -__

?III~'"

31

Product Area

o 4

Multiply Tabte

r---;.~~~---~_

~ 0 0 2 4

o 0 4 4

o 1 4 4

1 4 4

Fig. 4.3. Schematic Diagram of Multiply Operation.

sequence of electronic switching circuits rather than by the use of the toothed gear principle.

32 The Algorithms of Arithmetic In general, it is not necessary for a programmer to know these arith-metic algorithms. In the 1620, however, care must be taken not to store information in the core area reserved for the adaition and multiplication table sections of memory. There is no internal circuitry to prevent entry into this area or destruction thereof during program operation.

Chapter 5

Im Dokument The Computer Concepts (Seite 45-52)