The Dauug House Wright State University logo
Dauug|36 minicomputer documentation

Array check instruction

Opcode P/U Category Description
BOUND user ALU: array check bound

BOUND Bound

Syntax
bound i < lim
Register Signedness
i ignored
lim unsigned or signed
2 opcodes total
Generate interrupt if and only if
i < 0 or ilim

This instruction provides a two-sided array boundary check in one CPU cycle. The array presumably has less than 2**35 elements, which is guaranteed to be the case if less than 144 Gibytes of RAM is installed. This allows index i to have any signedness, because it will be unconditionally out of bounds—either because negative or excessively positive—whenever the leftmost bit is set.

The upper limit lim may be signed or unsigned, and represents the number of elements that may be safely accessed. If lim ≤ 0, index i is always out of bounds, because there is no safe memory location for access. Otherwise, the maximum permitted index is lim − 1. If i is out of bounds, this instruction generates an interrupt, otherwise this instruction does nothing. In any event, no registers are written to, and no flags change.

The required < in the syntax is to remind the programmer of the operand positions.

Limitations of BOUND

BOUND is a candidate for removal from the architecture. Although the present netlist does produce an “interrupt” flag from the zeta RAM when a BOUND check fails, nothing happens to that flag. Although circuitry could be added such that the interrupt flag hijacks the control decoder and informs the operating system that an array boundary check failed, little other diagnostic information would be available. In particular, the instruction address where the BOUND was out of range wouldn’t be available, because Dauug|36 does not at this time have an actual or planned electrical mechanism for querying the instruction pointer’s value.


Marc W. Abel
Computer Science and Engineering
College of Engineering and Computer Science
marc.abel@wright.edu
Without secure hardware, there is no secure software.
937-775-3016