chipmunk-project / chipmunk-tofino

12 stars 2 forks source link

Chipmunk (this version includes support for Tofino code generation)

Build status

Installation

How to

Develop

If you have installed it as above, first re-install via following command.

pip3 install -r requirements-dev.txt -e .
pre-commit install

Note that there is -e in install command. It will install this package in development mode, and simply link actual chipc directory to your Python's site-packages directory.

  1. Make changes to python code
  2. Consider implementing tests and run tests python3 -m unittest
  3. Run your desired binary like python chipc/chipmunk.py ...

This way you don't have to keep installing and uninstalling whenever you make a change and test. However, still you have to run via python3 chipc/chipmunk.py instead of using the installed binary.

Also consider using venv, virtualenv or pipenv to create an isolated Python development environment.

Iterative solver

iterative_solver example_specs/simple.sk example_alus/stateful_alus/raw.alu example_alus/stateless_alus/stateless_alu.alu 2 2 "0,1,2,3" 10 --hole-elimination
iterative_solver example_specs/simple.sk example_alus/stateful_alus/raw.alu example_alus/stateless_alus/stateless_alu.alu 2 2 "0,1,2,3" 10 --parallel --parallel-sketch --hole-elimination

Test

Run:

You need to run setup in editable mode (with -e) to generate lexer and parser in this directory.

pip3 install -r requirements-dev.txt -e .
python3 -m unittest

If you want to add a test, add a new file in tests directory or add test cases in existing test_*.py file.