Tooling package for the computer architecture course (aka Rechnerorganisation) at
`Graz University of Technology <https://www.tugraz.at>`_.
This package provides utilities and tooling for working with textual and binary assembly variants.
In more detail, we provide comparable simple implementations of standard tools (e.g., assemblers,
instruction set simulators) that are required for experimenting with self-written processors.
Given that the tools are used for teaching, the focus of the package is correctness and
extensibility. As instruction set architecture, Princeton's
`TOY <https://introcs.cs.princeton.edu/java/62toy/>`_, incl. various extensions, and a subset of the
`RISC-V RV32I <https://riscv.org/specifications/>`_ are currently supported.
Quick and Dirty Usage of the Tools
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For fast experimentation, executable entry points for the most important tools like ``toyasm-ng.py``
and ``toysim-ng.py`` are provided next to this README. Subsequently, it is possible to directly
use these applications like in one of the following examples:
.. code-block:: bash
$ python3 ./relative/pkg_path/toyasm-ng.py some_input_file.asm
$ python3 /absolute/pkg_path/toyasm-ng.py some_input_file.asm
Given that the entry points are marked as executable (i.e., ``chmod +x ...``) and have a proper
`shebang <https://en.wikipedia.org/wiki/Shebang_(Unix)>`_, on unix-like systems, also direct
execution is possible:
.. code-block:: bash
$ ./relative/pkg_path/toyasm-ng.py some_input_file.asm
$ /absolute/pkg_path/toyasm-ng.py some_input_file.asm
Finally, when the root directory of this package is part of the ``PATH``
(e.g., ``export PATH=/absolute/pkg_path:$PATH``) environment variable, execution of the tools
simply by name is working too.
.. code-block:: bash
$ toyasm-ng.py some_input_file.asm
Proper Installation and Usage of the Package
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*asmlib* is a proper python package and can also be installed via the standard package manager
(e.g., ``pip3 install --user /absolute/pkg_path``). Note that, when development on to the package is
planned, installing the package as editable by adding the ``-e`` command line flag is recommended.
Additionally, `virtual environments <https://docs.python.org/3.6/library/venv.html>`_
(e.g., ``python3 -m venv _venv && source_venv/bin/activate``) can be used too.
Either way, this automatically installs the entry points into the correct directories and the tools
can directly be used on the command line (i.e., ``toyasm-ng.py some_input_file.asm``).
Building the Sphinx Documentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When Sphinx is installed (i.e., ``pip3 install sphinx sphinx-autodoc-typehints``), the HTML API
documentation for this package can be built via the following ``sphinx-build`` invocation:
.. code-block:: bash
$ sphinx-build doc doc/_build/html
Alternatively, the ``sphinx`` command on the setup.py file can be used.
.. code-block:: bash
$ python3 ./setup.py sphinx
Either way, the API documentation gets automatically generated by executing ``sphinx-apidoc`` first.
The resulting HTML output can be found in the ``doc/_build/html`` directory.