Skip to content

davidmallasen/arithmetic_units

Repository files navigation

Arithmetic Units

Collection of arithmetic units written in SystemVerilog.

Setup

Tested in Ubuntu 22.04.

  1. Set up the python environment using one of (a) Miniconda OR (b) pip:

    • (a) Miniconda

      1. Install Miniconda.

      2. Create the environment (only the first time):

        conda env create -f environment.yml
      3. Activate the environment (every time you open a new terminal):

        conda activate arithmetic_units
    • (b) pip

      1. Check that you have the python and pip versions that are required for this project. You can find them in the environment.yml file. If you are unsure about this, follow the instructions for Miniconda.

      2. Create the environment (only the first time):

        python -m venv venv
        source venv/bin/activate
        pip install --upgrade pip
        pip install -r requirements.txt
      3. Activate the environment (every time you open a new terminal):

        source venv/bin/activate
  2. Install the Icarus Verilog simulator. We currently use version 11.0. In Ubuntu, you can do this with:

    sudo apt install iverilog
  3. Install Verible for SystemVerilog linting and formatting. We currently use version v0.0-3752-g8b64887e. In Ubuntu, you can do this with:

    export VERIBLE_VERSION=v0.0-3752-g8b64887e
    wget https:wget https://github.com/chipsalliance/verible/releases/download/${VERIBLE_VERSION}/verible-${VERIBLE_VERSION}-linux-static-x86_64.tar.gz
    tar -xf verible-${VERIBLE_VERSION}-linux-static-x86_64.tar.gz

    Then you can install it to your preferred location. For example, to install it in /home/$USER/tools, run:

    mkdir -p /home/$USER/tools/verible/${VERIBLE_VERSION}/
    mv verible-${VERIBLE_VERSION}/* /home/$USER/tools/verible/${VERIBLE_VERSION}/

    You can remove the previous download from the current path with:

    rm -rf verible-${VERIBLE_VERSION}*

    Finally, add the /home/$USER/tools/verible/${VERIBLE_VERSION}/bin to your PATH environment variable.

Running the Tests

The test setup is based on cocotb and pytest. You can find all the tests in the test folder.

To run the tests, run:

pytest

If you want the detailed output, run:

pytest -rA -v

Running SystemVerilog Formatting and Linting

When developing RTL code for this project, you should run Verible to check that it's formatted correctly and that it follows the best practices. To run the Verible formatter run:

make verible-format

To run the Verible linter run:

make verible-lint

Bibliography

[1] J.-M. Muller et al., Handbook of Floating-Point Arithmetic. Cham: Springer International Publishing, 2018. doi: 10.1007/978-3-319-76526-6.

License

This project is licensed under the CERN Open Hardware Licence Version 2 - Weakly Reciprocal or later, unless specified otherwise. The license is also included in this repository in the LICENSES directory. SPDX-License-Identifier: CERN-OHL-W-2.0+

The software (i.e. all code inside the test directory) is licensed under the GNU Lesser General Public License v3.0 or later, unless specified otherwise. The license is also included in this repository in the LICENSES directory. SPDX-License-Identifier: LGPL-3.0-or-later

About

Collection of arithmetic units written in SystemVerilog

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published