gumnut_simulator.simulator¶
Module Contents¶
Classes¶
Enum where members are also (and must be) ints |
|
Class which holds simulator data and CPU |
Functions¶
|
- class gumnut_simulator.simulator.SimulatorState¶
Bases:
enum.IntEnumEnum where members are also (and must be) ints
- halt = 0¶
- idle = 1¶
- breakpoint = 2¶
- class gumnut_simulator.simulator.GumnutSimulator¶
Class which holds simulator data and CPU
- reset(self)¶
Reset the simulator and the CPU
- setup(self, source)¶
Initialize the CPU
- step(self)¶
Triggers a single step of the CPU
- get_flags(self)¶
Return CPU flags as a dict
- Returns
{'CARRY': False, 'ZERO': True, 'WAIT': False, 'STBY': False, 'IEN': False}
- get_register(self)¶
Return CPU register as a dict
- Returns
{'r0': 0x01, 'r1': 0x20, ... , 'r7': 0xFF, 'PC': 0x34, 'SP': 0xA0, 'RAS': [0xF8, 0xF4, 0xB5', 0xF7, 0xC1 ]}
- get_instruction_memory(self)¶
Return CPU instruction memory as a list
- Returns
[F8, F4, B5, F7, C1, 97, ... , D8, D4, 86, 94, 9B]
- get_data_memory(self)¶
Return CPU data memory as a list
- Returns
[F8, F4, B5, F7, C1, 97, ... , D8, D4, 86, 94, 9B]
- get_IO_controller_register(self)¶
Return IO controller register as a list
- set_IO_controller_register(self, address, value)¶
- get_current_line(self)¶
Return the current line number by looking up the current instruction memory pointer
- get_simulator_data(self)¶
Return some debug/additional information
- toggle_breakpoint(self, line_number)¶
- get_breakpoints(self)¶
Return current breakpoints
- get_state(self)¶
Return current simulator state
- to_JSON(self)¶
- _get_source_line_from_address(self, address)¶
- trigger_interrupt(self)¶
Triggers an CPU interrupt by setting the internal flag
- gumnut_simulator.simulator.main()¶