Settings
See the keyword arguments of run().
For example, to run in debug (step) mode, use run(path, debug=True).
- SAPsim.run(prog_path: str, **kwargs) None | dict[str, Any][source]
Run given .csv program in SAPsim format.
- Parameters:
prog_path (
str) – .csv file in SAPsim format.**kwargs – See below
- Keyword Arguments:
- debug (
bool) – Whether to run in debug mode (True) or at full speed (False)
Default is full speed
- debug (
- change (
dict[int, int]) – dict[address, byte] of values to change in RAM
The value at each address (0 to 15) will be overwritten to that byte
Useful for debugging programs (edit a value without changing the CSV)
Useful for autograding programs (overwrite a reserved instruction/data value)
- change (
- table_format (
str) – Printed table format
Options: https://github.com/astanin/python-tabulate#table-format
Default value in
global_varsis"simple_outline"
- table_format (
- The rest of the parameters are pretty much exclusively for unit testing, and you should not use these
- return_state (
bool) – If
True, then program state will be returnedSee
utils.helpers.get_state()Will probably cause type warnings since the return type is
Union[None, dict[str, Any]]To avoid type warnings, use
run_and_return_state
- return_state (
- non_blocking (
bool) – This is used to unit test debug mode of
run(), you likely don’t have a need for thisIf
True, thenrun()won’t block on inputinput()won’t be called in debug mode (i.e., don’t have to press enter to continue execution)If this is
True, then debug mode will be on even ifdebugisn’t in kwargs
- non_blocking (
- no_print (
bool) – This is used to save computation time during unit testing
If
True, thenprint_RAM()andprint_info()won’t be calledIn debug mode, “Program halted.” will still be printed
- no_print (
- bits (
int) – You should not modify this
Number of bits in registers
Default value in
global_varsis 88 is also the maximum value since everything in RAM should fit in a byte
- bits (
- Returns:
Noneor program state ifreturn_state- Return type:
Union[None, dict[str, Any]]