An emulator executes the hypothetical machine's instructions using a program running on the host. ivss reads a linked hex-serialized object and interprets its code:
$ ./emulator program.hex
The emulator initializes %pc to 0x40000000 and %sp to 0x80000000, loads sections, and applies relocations. It then repeatedly fetches four instruction bytes, decodes their fields, and updates the simulated registers or memory.
A halt instruction ends execution and produces a register-state report. A simple addition program can therefore be checked by examining %r1 in that report rather than expecting a native executable to run on the host CPU.
Optional behavior is explicit:
$ ./emulator -debug -timer -terminal program.hex
-debug prints instruction and register information. -timer and -terminal start host threads that supply device events; they are not needed for ordinary arithmetic programs. The program must install a handler to receive interrupts. Memory-mapped I/O connects its loads and stores to device behavior.
Source: emulator.c.