-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
114 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# AES | ||
|
||
There are two weird machines in this example: | ||
|
||
1. [AES round](./aes_round.c): one round of the AES encryption. It does not compute the complete AES block. | ||
2. [AES block](./aes_block.c): the complete AES encryption with one block. | ||
|
||
## Compile the weird machine | ||
|
||
Follow the steps in "[Compile a weird machine](../../README.md#compile-a-weird-machine)" from the [readme](../../README.md) of Flexo to compile these weird machines. | ||
There are two weird machines inside this folder, [aes_round.c](./aes_round.c) and [aes_block.c](./aes_block.c). | ||
Use the [Makefile](./Makefile) to compile them into LLVM IR, and then move on to the second step of the compilation process. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# ALU | ||
|
||
This folder contains the implementation of a 4-bit ALU. | ||
We implement this weird machine using Verilog, and the circuit file is [`ALU.v`](./ALU.v). | ||
The C++ program ([`ALU.cpp`](./ALU.cpp)) triggers this weird machine and measures its accuracy and runtime. | ||
This demonstrates that the Flexo compiler also allows developers to create a µWM using a Verilog circuit if they prefer to control the low-level details of a weird machine circuit. | ||
|
||
## Compile the weird machine | ||
|
||
Since this weird machine is implemented using Verilog, the compilation process is slightly different from the steps outlined in "[Compile a weird machine](../../README.md#compile-a-weird-machine)". | ||
Specifically, in step 2, it is required to add an environment variable to configure the Flexo compiler so that it will read the Verilog file. | ||
To do this, modify line 15 of [`compile.sh`](../../compile.sh) to the following line: | ||
|
||
```sh | ||
export RET_WM_DIV_ROUNDS=5 WR_OFFSET=576 WM_CIRCUIT_FILE=./circuits/ALU/ALU.v | ||
``` | ||
|
||
The `WM_CIRCUIT_FILE` variable is set to the path of the Verilog file, and the Flexo compiler will then use it as the weird machine circuit during the compilation process. | ||
|
||
After that, follow the original step 3 to create an executable file of this weird machine. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Examples of Flexo weird machines | ||
|
||
We implemented several Flexo weird machines for the experiments in our paper and to show how to implement a microarchitectural weird machine using C/C++. This includes: | ||
|
||
- [`gates/`](./gates/): basic logic gates. This is the simplest weird machine and a great starting point to learn how to create µWMs. | ||
- [`arithmetic`](./arithmetic/): adders and multipliers. | ||
- [`ALU`](./ALU/): a small 4-bit ALU. This examples shows how to implement a µWM using Verilog and use a C/C++ program to execute the weird machine. | ||
- [`SHA1`](./SHA1/): the SHA-1 hash function. | ||
- [`AES`](./AES/): the AES block cipher. | ||
- [`Simon`](./Simon/): the Simon block cipher. | ||
|
||
## Build and run the examples | ||
|
||
We provide a [Makefile](./Makefile) to compile every examples here. | ||
However, this [Makefile](./Makefile) only compiles the examples into LLVM IR. | ||
After that, it is still required to run steps 2 and 3 of ["Compile a weird machine"](../README.md#compile-a-weird-machine) to build the weird machines into executable files. | ||
For more information regarding how to build and run each example, please refer to readme file under their own folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SHA-1 | ||
|
||
There are two weird machines in this example: | ||
|
||
1. [SHA-1 round](./sha1_round.c): the first round of the SHA-1 hash function. It does not compute the complete SHA-1 hash function. | ||
2. [SHA-1 2 blocks](./sha1_2blocks.c): the complete SHA-1 hash function with two input blocks. | ||
|
||
## Compile the weird machine | ||
|
||
Follow the steps in "[Compile a weird machine](../../README.md#compile-a-weird-machine)" from the [readme](../../README.md) of Flexo to compile these weird machines. | ||
There are two weird machines inside this folder, [sha1_round.c](./sha1_round.c) and [sha1_2blocks.c](./sha1_2blocks.c). | ||
Use the [Makefile](./Makefile) to compile them into LLVM IR, and then move on to the second step of the compilation process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Simon | ||
|
||
This weird machine computes [the Simon block cipher](https://ieeexplore.ieee.org/document/7167361). | ||
|
||
## Compile the weird machine | ||
|
||
Follow the steps in "[Compile a weird machine](../../README.md#compile-a-weird-machine)" from the [readme](../../README.md) of Flexo to compile these weird machines. | ||
There is one weird machine inside this folder, [simon32.c](./simon32.c). | ||
Use the [Makefile](./Makefile) to compile it into LLVM IR, and then move on to the second step of the compilation process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Arithmetic circuits: adders and multipliers | ||
|
||
There are two weird machines in this example: | ||
|
||
1. [Adders](./adder.cpp): input size range is 2-bit to 64-bit | ||
2. [Multipliers](./mul.cpp): input size range is 2-bit to 16-bit | ||
|
||
## Compile the weird machine | ||
|
||
Follow the steps in "[Compile a weird machine](../../README.md#compile-a-weird-machine)" from the [readme](../../README.md) of Flexo to compile these weird machines. | ||
There are two weird machines inside this folder, [adder.cpp](./adder.cpp) and [mul.cpp](./mul.cpp). | ||
Use the [Makefile](./Makefile) to compile them into LLVM IR, and then move on to the second step of the compilation process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters