Skip to content

Assembler, Emulator and Utilities for the Super32 Educational Processor

License

Notifications You must be signed in to change notification settings

MaxAtoms/Super32

 
 

Repository files navigation

Super32 - Designing our own Microprocessor

This repository contains the source code for a simple assembler/compiler for our educational processor as well as an emulator.

super32assembler is an assembler, written in Python. super32emu is an emulator, written in Python as well. Qt is used for the GUI.

Getting Started

These instructions will help you to get your environment ready to build, develop and run the project on your local machine.

Installation

You'll need Python and Pip installed on your machine.

The Python packages are currently not available via PyPi. To install the package you first have to clone the git repository:

git clone https://github.com/xsjad0/Super32.git

After you successfully cloned the repository, switch to the latest release and run the installation process via pip

git checkout X.Y.Z
pip install ./super32utils ./super32assembler ./super32emu

Alternatively, use the provided packages.py script:

git checkout X.Y.Z
python packages.py -i

Write assembler code

Take a look at the instructionset of the Super32 processor. Also, feel free to include these fancy assembler directives to improve your code.

Here are some rules you always have to keep in mind when you write some assembler code:

Your code always has to start with

ORG [address]
START

and end with an

END

assembler directives, where address MUST be greater than and be able to divide by 4.

Define constants in your memory like this:

DEFINE 0

For easier referencing the constants in your code, put a label in front of your constant:

[constantname]: DEFINE [value]

See the examples/ directory

Usage

Assembler

Provide the path to an assembler code file as command line argument:

super32assembler example_code.s32

If you want to define a custom output name / path, use the '-o' argument flag. All available options are listed in the table below.

Option Default Description
-h/--help - Display help information
-o/--output <input-file>.o Custom output name / path
-g/--generator lines Specify output format. use lines to generate 32bit machine-code each line. Use stream to generate one single line machine-code.
-a/--architecture single Specify processor architecture. use single to select single-memory architecture. Use multi to select dual-memory architecture.

Emulator

Start it with:

super32emu

Super32Emu

Development

Setup

Install the required packages:

pip install -r requirements.txt
pip install -r requirements/development.txt

Install our packages as well (Super32 Emulator has dependencies on assembler and utils):

pip install ./super32utils ./super32assembler

Running our modules

cd super32assembler && python -m super32assembler

or

cd super32emu && python -m super32emu

Running the tests

We use pytest for testing. To run these test use:

pytest test_{test_name}.py

Building a standalone executable with PyInstaller

Run this command on the operating system for which you would like to create a standalone executable for:

python packages.py -s

Versioning

We use SemVer for versioning. For the versions available, see the releases on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

About

Assembler, Emulator and Utilities for the Super32 Educational Processor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 97.5%
  • VHDL 2.3%
  • Shell 0.2%