https://github.com/agra-uni-bremen/opt-seq
An algorithm to merge RISC-V instruction sequences
https://github.com/agra-uni-bremen/opt-seq
asic embedded-systems hardware-optimization risc-v virtual-prototyping
Last synced: 2 months ago
JSON representation
An algorithm to merge RISC-V instruction sequences
- Host: GitHub
- URL: https://github.com/agra-uni-bremen/opt-seq
- Owner: agra-uni-bremen
- License: mit
- Created: 2024-01-12T22:12:21.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-06T21:46:13.000Z (about 2 years ago)
- Last Synced: 2025-09-09T00:59:27.002Z (7 months ago)
- Topics: asic, embedded-systems, hardware-optimization, risc-v, virtual-prototyping
- Language: C++
- Homepage:
- Size: 16.6 KB
- Stars: 2
- Watchers: 9
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Optimized Sequence
**Optimized Sequence** (Opt-Seq) is an algorithm for **merging** instruction sequences generated by
[Opt-VP](https://github.com/agra-uni-bremen/opt-vp) in order to increase their execution coverage and, for example, save
costs for building hardware accelerators.
## :dart: Features
* Support of Opt-VP's modes for providing a variety of sequences
* Merging of RISC-V instructions
## :rocket: Getting Started
First, the steps to install Opt-Seq are described. Second, it is explained how Opt-Seq can be used to merge
instruction sequences.
### :wrench: Installation
Since the sequences are generated in JSON, [nlohmann](https://github.com/nlohmann/json) is a prerequisite for parsing
them. This library can be installed, for example, by the command `brew install nlohmann-json` depending on the
operating system.
In order to compile Opt-Seq just type this command in your terminal:
```console
$ g++ -std=c++2a -Wall -Wextra -pedantic -Os -DNDEBUG -o optseq optseq.cpp
```
Alternatively, the following command can be executed for debugging purposes:
```console
$ g++ -std=c++2a -Wall -Wextra -pedantic -g -o optseq optseq.cpp
```
To uninstall Opt-Seq, simply remove the executable *optseq* and intermediate files if any exist.
### :computer: Usage
The **command line interface** of Opt-Seq can be used according to the following scheme:
```console
$ ./optseq
```
* ``: file path to sequences in JSON
* ``: 0 = default, 1 = subsequence, 2 = variant, 3 = full
Again, sequences can be generated with Opt-VP by activating a respective mode. While the default mode is described
[here](https://agra.informatik.uni-bremen.de/doc/konf/FDL2023_JZ.pdf), the other modes are explained in this
[paper](https://agra.informatik.uni-bremen.de/doc/konf/DDECS2024_RK.pdf).
## :white_check_mark: Tests
Now, the sequences (`SUB`, `ADD`, `XOR`, `DIV`, `OR`), (`ADD`, `XOR`, `XOR`, `DIV`, `SUB`, `DIV`), and
(`OR`, `SUB`, `SUB`) are optimized into one sequence by mapping instructions if possible. The sequences to be merged are
encoded in the test application called [test.json](test.json).
Assuming that these sequences were generated using the default mode, the **merged sequence** is created by the
following command:
```console
$ ./optseq test.json 0
optseq> SUB->ADD->XOR/NOP->DIV/NOP->XOR->SUB/NOP->DIV->OR
```
Depending on how Opt-Seq was compiled, the overall output may differ.
## :warning: License
Opt-Seq is licensed under the terms of the [MIT license](LICENSE.txt).