INDEX

VAX11

 

INDEX  COMPUTE INDEX

 

Purpose

calculation of arrays of fixed length data, bit fields, and strings

Format

opcode subscript.rl, low.rl, high.rl, size.rl, indexin.rl, indexout.wl

Operation

indexout ß {indexin + subscript} *size;

if {subscript LSS low} or {subscript GTR high} then

{subscript range trap};

Condition codes

N ß indexout LSS 0;

Z ß indexout EQL 0;

V ß 0;

C ß 0;

Exceptions

subscript range

Opcodes

OA      INDEX                        Index

Description

The indexin operand is added to the subscript operand and the sum is multiplied by the size operand. The indexout operand is replaced by the result. If the subscript operand is less than the low operand or greater than the high operand, a sub script range trap is taken.

Notes

1. No arithmetic exception other than subscript range can result from this instruction. Thus no indication is given if overflow occurs in either the add or multiply steps. If overflow occurs on the add step the sum is the low order 32 bits of the true result. It overflow occurs on the multiply step the indexout operand is replaced by the low order 32 bits of the true product of the sum and the subscript operand. In the normal use of this instruction, overflow cannot occur without a subscript range trap occurring.

2. The index instruction is useful in index calculations for arrays of the fixed length data types (integer and floating) and for index calculations for arrays of bit fields, character strings, and decimal strings. The indexin operand permits cascading INDEX instructions for multidimensional arrays. For one-dimensional bit field arrays it also permits introduction of the constant portion of an index calculation which is not readily absorbed by address arithmetic.