SAPsim package
Subpackages
- SAPsim.utils package
- Submodules
- SAPsim.utils.exceptions module
ARegisterNegativeIntARegisterNotEnoughBitsArgButNoMnemonicBRegisterNegativeIntBRegisterNotEnoughBitsDroppedOffBottomDuplicateAddressFirstHexitGreaterThan15FirstHexitNegativeInstructionRequiresArgInvalidAddressInvalidArgInvalidFileExtensionInvalidFirstHexitInvalidInstructionStringInvalidMnemonicJumpToNegativeAddressLoadFromUnmappedAddressMnemonicButNoArgMoreThan16MappedAddressesNegativeAddressNonNumericalAddressRowWithNoAddressSecondHexitGreaterThan15SecondHexitNegativeprint_debug_info()
- SAPsim.utils.execute module
- SAPsim.utils.globs module
- SAPsim.utils.helpers module
- SAPsim.utils.instructions module
- SAPsim.utils.parser module
- Module contents
Module contents
- SAPsim.run(prog_path: str, **kwargs) None[source]
Run given .csv program.
- 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 (
str) – Comma-separated list of changes to RAM
Useful for debugging programs (edit a value without changing CSV)
Also useful for autograding programs (overwrite a reserved instruction/data value)
Format: <addr>:<base-10 value>,<addr>:<base-10 value>, …
- change (
- format (
str) – Table format
Options: https://github.com/astanin/python-tabulate#table-format
- format (
- bits (
int) – Number of bits in unsigned registers
Default 8
- bits (
- Returns:
dictcontaining all final values in globs.py, used for autograding- Return type:
dict
- SAPsim.run_and_return_state(prog_path: str, **kwargs) dict[str, Any][source]
Run given .csv program and return final state. Just a wrapper around
run()that can be used for autograding.The rest of the docstring is identical to that of run().
- 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)
- debug (
- change (
str) – Comma-separated list of changes to RAM
Useful for debugging programs (edit a value without changing CSV)
Also useful for autograding programs (overwrite a reserved instruction/data value)
Format: <addr>:<base-10 value>,<addr>:<base-10 value>, …
- change (
- format (
str) – Table format
Options: https://github.com/astanin/python-tabulate#table-format
- format (
- bits (
int) – Number of bits in unsigned registers
- bits (
- Returns:
dictcontaining all final values in globs.py, used for autograding- Return type:
dict