English
Language : 

GMS30C2116 Datasheet, PDF (91/322 Pages) Hynix Semiconductor – USERS MANUAL
INSTRUCTION SET
3-27
3.18 Check Instructions
The destination operand is checked and a trap to Range Error occurs
at CHK if the destination operand is higher than the source operand,
at CHKZ if the destination operand is zero.
All registers and all condition flags remain unchanged. All operands are interpreted as
unsigned integers.
CHKZ shares its basic OP-code with CHK, it is differentiated by denoting the SR as source
operand.
Format Notation
Operation
RR
CHK Rd, Rs
if Rs does not denote SR and Rd > Rs then
trap ⇒ Range Error;
RR
CHKZ Rd, 0
if Rs denotes SR and Rd = 0 then
trap ⇒ Range Error;
When Rs denotes the PC, CHK traps if Rd ≥ PC. Thus, CHK, PC, PC always traps. Since
CHK, PC, PC is encoded as 16 zeros, an erroneous jump into a string of zeros causes a trap
to Range Error, thus trapping some address errors.
Note: CHK checks the upper bound of an unsigned value range, implying a lower bound of
zero. If the lower bound is not zero, it can be mapped to zero by subtracting it from the
value to be checked and then checking against a corrected upper bound (lower bound also
subtracted). When the upper bound is a constant not exceeding the range of lim, the Index
instructions may be used for bound checks.
CHKZ may be used to trap on uninitialized pointers with the value zero.
3.19 No Operation Instruction
The instruction CHK, L0, L0 cannot cause any trap. Since CHK leaves all registers and
condition flags unchanged, it can be used as a No Operation instruction with the notation:
Format Notation
Operation
RR
NOP
no operation;
Note: The NOP instruction may be used as a fill instruction.