Using the Assembler


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/

to run the assembler.


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] …]


-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)


print out the organized variables for debugging purposes


print out the organized program lines for debugging purposes

--log logname

redirect the above output into the given logname file

Example invocation:

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