How raghavtandonn/e20simulator works
E20 Simulator is a command-line machine-code runner: a user supplies a .bin file, the program loads it into simulated memory, executes instructions against CPU state, and prints the final PC, registers, and first 128 memory words. The single-file design combines loading, execution, instruction dispatch, state updates, and output. The excerpts show the main call sequence and representative dispatch and instruction behavior; some implementation details are omitted.
Main entry points: sim.cpp State printer
Components 12
Program input
- CLI entry
sim.cpp - Code loader
sim.cpp
CPU execution
- Machine memory
sim.cpp - Execution loop
sim.cpp - Instruction decode
sim.cpp - Opcode dispatch
sim.cpp - Instruction handlers
sim.cpp - Registers
sim.cpp - Program counter
sim.cpp
Final state
- State printer
sim.cpp
Other components
- User
- Console output
Connections 16
- User → CLI entry: runs
- CLI entry → Code loader: loads file
- Code loader → Machine memory: writes words
- CLI entry → Execution loop: starts simulation
- Execution loop → Machine memory: fetches instruction
- Execution loop → Instruction decode: executes instruction
- Instruction decode → Opcode dispatch: routes opcode
- Opcode dispatch → Instruction handlers: calls handler
- Instruction handlers → Machine memory: reads or writes
- Instruction handlers → Registers: reads or writes
- Instruction handlers → Program counter: updates
- CLI entry → State printer: prints final state
- State printer → Registers: reads
- State printer → Machine memory: reads
- State printer → Program counter: reads
- State printer → Console output: writes output