HP 3000 III Series Manual page 168

Table of Contents

Advertisement

Machine Instr uctions and Stack Opera"tions
LOAD/DE LETE
After Delete
After Load
Initial Stack
Instruction
Instruction
0 - "
1
a---.
i
Q~
1
11
11
11
500
500
500
7
7
7
63
S--.
63
63
S---.
44
S---.
37
0
0
®
ADD/MUL TIPLV/SUBTRACT/NEGATE
After Add
After Multiply
After Subtract
After Negate
Instruction
Instruction
Instruction
Instruction
0---+
1
O~
1
0----'
1
0--'
1
11
11
11
11
500
500
s---+
-200
S--.
200
7
S -----..
700
s---+
100
0
CD
0
®
Figure 4-15.
Basic Arithmetric Stack Operations
To subtract (SUB),
the top element is subtracted from
the next-
to-top element.
Thus the answer at (F) is the result of 500-700,
or -200.
(As before,
only the answer remains
after computation
is performed.)
Finally,
at (G),
negation is performed.
This
simply re verses
the's ign of
the n umber of
the TOS.
In binary
form, a two's complement operation is performed.
Although the
sequence (A) through
(G) in figure 4-15 is
a very
simple series of operations, it does illustrate the advantages of
the stack technique in computation.
First,
note that regardless
of how many elements of data
there aTe or what memory cells they
occupy, the operand for each instruction is consistently the same
; the TOS.
This permits
implicit
addressing;
i.e.,
since the
operand
is understood to be the TOS, it is not necessary
to~ive
an. operand
address in the instruction
word.
Thus
(except for
LOAD which
must specify
a relative
address to load from),
the
instruction can simply say "addu,
pr "multiply",
etc.
The im-
mediate
benefit of this is that it allows code compression.
Two
instructions can
be given in
a single
word.
The sequence (D)
through (G)
for example,
can be given in two instr uction words.
Since this
reduces the number
of memory
fetches,
the speed of
computation is considerably increased.
A second point to note is
that temporary
storage of intermediate results
is automatically
provided.
For example,
once the parameters 63 and 37
(C) have
been added,
they are no longer required
and are
deleted.
The
answer however, which is substituted on the TOS, is automatically
4-38

Advertisement

Table of Contents
loading

Table of Contents