All books

Professional

Apps About Coach Log in Start reading

Computer Science · Glossary

What is Simulator?

Definition 21.2 High School Computer Science · Chapter 21 — Project: An Assembler and Simulator for the Toy Machine

A simulator is a program that imitates a machine: it keeps the machine’s state in its own variables and changes it, step by step, as the machine would.

Decoding the instruction at address 6 of sum_array.toy. The top six bits of the first byte are the operation code, the bottom two the register: LOADR R3, R1.
Decoding the instruction at address 66 of sum_array.toy. The top six bits of the first byte are the operation code, the bottom two the register: LOADR R3, R1.
The simulator’s loop. Each step fetches two bytes, adds 2 to PC, decodes and executes; it stops at HALT, or with an error that names the cause.
The simulator’s loop. Each step fetches two bytes, adds 22 to PC, decodes and executes; it stops at HALT, or with an error that names the cause.
Read in context →