[Next] [Up] [Previous]

The Stack Modes

Stack Mode

In stack mode, memory-reference instructions have the following form:

and operate instructions have the same format as in normal mode.

The instructions beginning with a 0 bit consist of one halfword in which three operations are specified. These operations perform arithmetic on a stack, and are as follows:

00000        NOP    no operation
00001 00nnn  MODE   switch to the stack for values of type nnn:

                    000 byte         100 medium
                    001 halfword     101 floating
                    010 integer      110 double
                    011 long         111 quad

00010        DUP    append an extra copy of the current top item
                    on the stack to the top of the stack
00011        DROP   discard the top item on the stack
00100        ADD    replace the top two items on the stack with
                    one item containing their sum
00101        SUB
00110        MUL
00111        DIV
01000        AND
01001        OR
01010        XOR
01011        SWAP   exchange the top two items on the stack

10nnn        PUSH   append the value in register nnn to the top of
                    the stack
11nnn        POP    remove the top item on the stack, and place it
                    in register nnn

The stacks are in memory, and the scratchpad registers are used as the pointers to the stacks of the eight types.

The opcodes of the memory-reference and register-to-register instructions are split into five and two bits in the same fashion as in vector register mode, the first two bits of the opcode being moved to a later position.

The Hewlett-Packard 3000 series computers had a similar mechanism for placing two stack instructions, each six bits in length, in a single sixteen-bit word.

Short Page Stack Mode

In stack mode, memory-reference instructions have the following form:

and the special instructions have the following format, which was also used in short page mode, for the character, packed decimal, and related instructions:

and for the other special instructions:

The Selective Short Page Stack Modes

As these modes also use 4,096-byte pages, like the modes described on the preceding page, selective versions of these modes, which use the indirect bit to permit the use of one 32,768-byte page instead, are also available.

Register Stack Mode

As with mutable scratchpad mode and stateful scratchpad mode, the instruction formats of register short page stack mode and short page stack mode are identical, and the same applies to register stack mode and stack mode.

In register stack mode, the stacks are of fixed size. The supplementary registers are used to provide the required stacks; the supplementary arithmetic/index registers provide four stacks with 16 elements each for the four fixed-point types, and the supplementary floating-point registers provide four stacks with 16 elements each for the four floating-point types.

Base register zero contains the eight four-bit stack pointers used by this mode in order.


[Next] [Up] [Previous]