adfba876d2
- setup new UI layout using tiling and an action/message based system for updating global state based on interactions with individual tiles and vice versa - added custom dialogs and UI helpers to create a more cohesive UI - added a disassembler widget (WIP) - added a documentation widget (WIP) - refactored backend halt/pause logic to fix bugs. - started emulator implementation documentation (to complement the ISA spec)
2.2 KiB
2.2 KiB
States
Definitions
- Model
- Private - internal state of the processor, always up to date.
- time: Duration,
- state: Running | Paused | Halted | Shutdown | Breakpoint
- Shared - shared across threads. updated periodically
- time: Duration
- cycles: Integer
- Private - internal state of the processor, always up to date.
Running
the running state is the main loop of the emulator.
Responsibilities:
- run fetch-decode-execute cycle
- handle interrupts
- go to paused state if requested by UI.
- go to the halted state if it hits that instruction
- keep the UI updated occasionally, but prioritise extremely high throughput
Transitions:
- to
Paused- when the
pausesignal is received
- when the
- to
Halted- when hitting the
Hltinstruction.
- when hitting the
- to
Shutdown- when the
shutdownsignal is received
- when the
DEBUG IMPLEMENTATION ONLY
- to
Breakpoint- when hitting a breakpoint
Paused
the paused state is started and ended by the UI thread.
Responsibilities:
- update the UI when requested
- reset when requested by the UI
- save the running-time and executed instructions since the last pause state.
- add
private.timetoshared.time - reset
private.time, shared.time, shared.cycleson state exit
- add
Transitions
- to
Halted- when the
runsignal is received and the previous state wasHalted
- when the
- to
Running- when the
runsignal is received
- when the
- to
Shutdown- when the
shutdownsignal is received
- when the
Halted
the state reached when the emulator has hit a Hlt instruction and is waiting to continue
Responsibilities:
- update the UI when requested
- unpause when an interrupt is received
- keep track of the time spent in the running state across multiple hlt/interrupt cycles
- add
private.timetoshared.time - reset
private.timeon state exit - preserve
sharedon state exit
- add
Transitions
- to
Running- when the
interruptsignal is received
- when the
- to
Paused- when the
pausesignal is received
- when the
- to
Shutdown- when the
shutdownsignal is received
- when the
Shutdown
the shutdown state is a terminal state. the emulator cleans up its memory and exits.
Breakpoint
debug state used only in the debugger implementation of the emulator
Transitions
- to
Running- when the
runsignal is received
- when the