Using the Assembler

Installation

The assembler is written in python, and therefore requires an up-to-date installation. If you don’t have it – on Windows, head to the python downloads page and download the latest installer. On Unix, install python with your favorite package manager.

There are two dependencies for the code – numpy and antlr. They can be installed with:

$ pip install numpy
...
$ pip install antlr4-python3-runtime

Because of the limitations associated with running python code, the process is not particularly elegant (I plan to rewrite the assembler in C++). The recommended method is to clone the repository and place the “assembler” directory into the same directory as your code. You can also download the zipped assembler directory here. Then, you’d simply invoke:

$ python assembler/assembler.py

to run the assembler.

Note

Your installation of python may require you to use python3 and pip3 instead of python and pip, since the latter are often linked to python 2.7 installations.

Assembler Program

Usage: <infile> [[options] [parameters] …]

Options:

-h, --help

print the usage message

-p romname

generate a program rom hex file with the given romname for use with verilog $readmemh

-d romname

generate a data rom hex file with the given romname for use with verilog $readmemh

-P bits

specify the number of bits in the program rom address (default: 10)

-D bits

specify the number of bits in the data rom address (default: 10)

--debug-vars

print out the organized variables for debugging purposes

--debug-lines

print out the organized program lines for debugging purposes

--log logname

redirect the above output into the given logname file

Example invocation:

$ python assembler/assembler.py program.cor -p promdata -d dromdata