Trap if equal : Raises a trap exception if $t1 == $t2. In MARS this halts execution. On real hardware it triggers a trap handler. Useful as a guarded assertion or to catch forbidden conditions (e.g., division by zero guard).
teq
Operands
$reg, $regVariants
- Trap if equal : Raises a trap exception if $t1 == $t2. In MARS this halts execution. On real hardware it triggers a trap handler. Useful as a guarded assertion or to catch forbidden conditions (e.g., division by zero guard). teq $t1,$t2
# This named trap is expected to stop execution when its predicate is true.
li $t0, 5
li $t1, 5
teq $t0, $t1
li $t2, 99 # not reached