An open API service indexing awesome lists of open source software.

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

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).