This repository contains the code for our paper. Our framework consists of 3 components:
- Yosys[3], an open-source Verilog synthesis suite
- XLS[0], an open-source High-Level Synthesis toolchain
- FRESH toolchain, our work providing a convenient development experience for programming multiplicative-depth-optimized MPC circuits
We provide a Jupyter notebook fresh.ipynb
for easy testing of our
circuit compilation workflow. This notebook can be conveniently
executed in Google Colab by
uploading the fresh.ipynb
notebook.
The Jupyter notebook uses pre-built binaries in order to speed up compilation. Information on reproducing these binaries is available in the Appendix.
You can also run the notebook in a Docker container locally:
DOCKER_IMAGE=$(docker build . -q -f Dockerfile.notebook)
docker run --rm -p 8889:8888 -v "$(pwd):/home/jovyan/work" $DOCKER_IMAGE start-notebook.py --NotebookApp.token='my-token'
Then head to http://localhost:8889. The notebook also works on Ubuntu-like host systems, but be aware that it installs various dependencies such as Yosys[5].
XLS is built using the Bazel build system[1]. The Bazel website has instructions for installing Bazel on different systems: https://bazel.build/install/. Additionally the following packages are needed (exact names may vary in your distribution):
- A C++ compiler supporting C++17
python3-distutils
python3-dev
libtinfo5
python-is-python3
The FRESH toolchain requires a 0.10.0 release of the Zig[2] compiler. Assuming a x86_64 Linux machine, the following commands will download and extract a Zig compiler binary. Binaries for other systems are available under https://ziglang.org/download/.
wget https://ziglang.org/download/0.10.0/zig-linux-x86_64-0.10.0.tar.xz
tar xf zig-linux-x86_64-0.10.0.tar.xz
After running the following command, various XLS tools will be present
in the bazel-bin
directory. This may take multiple hours.
cd xls
bazel build -- //xls/dslx:ir_converter_main //xls/tools:opt_main //xls/tools:codegen_main //xls/contrib/xlscc:xlscc
The following shell command will build the FRESH toolchain. All
executables will be present in the zig-out/bin
directory.
zig-linux-x86_64-0.10.0/zig build
The following command will run the entire test suite included in the compiler subdirectory.
zig-linux-x86_64-0.10.0/zig build test
[0] https://google.github.io/xls/
[3] https://yosyshq.net/yosys/
As the build process of XLS[1] involves compiling LLVM and Clang from source, this process is time-consuming, even on powerful machines. For this reason, we provide pre-compiled binaries, which are downloaded by the Jupyter notebook. These binaries can be reproduced locally using Docker:
docker build . -f Dockerfile.xls
After completion, copy the binaries from the container image into your local system.