Simulation of SAP (Simple As Possible) computer programs from COMP311 (Computer Organization) @ UNC
Project description
SAPsim
Simulation of SAP (Simple As Possible) computer programs from COMP311 (Computer Organization) @ UNC.
Install
pip install SAPsim
Your Python version needs to be 3.9+. Check with python --version
.
If python
doesn't work, try python3
. If pip
doesn't work, try pip3
.
Usage
Write a SAP program in the CSV file format shown below (templates are provided in COMP311's SAP assignment).
You may edit the .csv
file with any program (Microsoft Excel, Google Sheets, etc.).
To run the SAP program, use run()
. Note: There is a debug (step) mode, as shown below.
>>> from SAPsim import run
>>> run("ex1.csv") # Run ex1.csv at full speed (default)
...
>>> run("ex1.csv", debug=True) # Run ex1.csv in debug (step) mode
...
If you want a blank template, use create_template()
.
>>> from SAPsim import create_template
>>> create_template()
template.csv successfully created.
Settings
Here's a list of additional settings.
change
allows you to modify values in the SAP program without editing the CSV, which is convenient.
table_format
allows you to customize the appearance of the printed tables.
Rules
It's easy to just mimic the example programs, but if you need it, here's the list of rules for SAPsim programs.
SAP instruction set
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.