-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #474 from vacantron/prebuilt
Automate prebuilt executable updates via GitHub Actions
- Loading branch information
Showing
50 changed files
with
288 additions
and
554 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
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,87 @@ | ||
name: Build artifact | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
detect-file-change: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Test file change | ||
id: test-file-change | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
fetch_additional_submodule_history: 'true' | ||
files: | | ||
tests/ansibench/* | ||
tests/rv8-bench/* | ||
tests/*.c | ||
- name: Set alias | ||
id: has_changed_files | ||
run: | | ||
if [[ ${{ steps.test-file-change.outputs.any_modified }} == true ]]; then | ||
echo "has_changed_files=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "has_changed_files=false" >> $GITHUB_OUTPUT | ||
fi | ||
outputs: | ||
has_changed_files: ${{ steps.has_changed_files.outputs.has_changed_files }} | ||
|
||
build-artifact: | ||
needs: [detect-file-change] | ||
if: ${{ needs.detect-file-change.outputs.has_changed_files == 'true' || github.event_name == 'workflow_dispatch' }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update -q -y | ||
sudo apt-get upgrade -q -y | ||
sudo apt-get install -q -y gcc-multilib g++-multilib | ||
sudo apt-get install -q -y opam build-essential libgmp-dev z3 pkg-config zlib1g-dev | ||
.ci/riscv-toolchain-install.sh | ||
echo "$PWD/toolchain/bin" >> $GITHUB_PATH | ||
- name: Build binaries | ||
run: | | ||
make artifact ENABLE_PREBUILT=0 | ||
mkdir -p /tmp/rv32emu-prebuilt | ||
mv build/linux-x86-softfp build/riscv32 /tmp/rv32emu-prebuilt | ||
- name: Build Sail model | ||
run: | | ||
cd /tmp | ||
opam init -y --disable-sandboxing | ||
opam switch create ocaml-base-compiler.4.06.1 | ||
opam install sail -y | ||
eval $(opam config env) | ||
git clone https://github.com/riscv/sail-riscv.git | ||
cd sail-riscv | ||
git checkout 9547a30bf84572c458476591b569a95f5232c1c7 | ||
ARCH=RV32 make -j | ||
mkdir -p /tmp/rv32emu-prebuilt/sail_cSim | ||
mv c_emulator/riscv_sim_RV32 /tmp/rv32emu-prebuilt/sail_cSim | ||
- name: Create tarball | ||
run: | | ||
cd /tmp | ||
tar -zcvf rv32emu-prebuilt.tar.gz rv32emu-prebuilt | ||
- name: Create GitHub Release | ||
env: | ||
GH_TOKEN: ${{ secrets.RV32EMU_PREBUILT_TOKEN }} | ||
run: | | ||
RELEASE_TAG=$(date +'%Y.%m.%d') | ||
cd /tmp | ||
gh release create $RELEASE_TAG \ | ||
--repo sysprog21/rv32emu-prebuilt \ | ||
--title "$RELEASE_TAG""-nightly" | ||
gh release upload $RELEASE_TAG \ | ||
rv32emu-prebuilt.tar.gz \ | ||
--repo sysprog21/rv32emu-prebuilt |
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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,67 @@ | ||
# Prebuilt Binaries | ||
|
||
The prebuilt binaries for [rv32emu](https://github.com/sysprog21/rv32emu) are prepared primarily because the [RISC-V Sail Model](https://github.com/riscv/sail-riscv) executable is required for the [RISC-V Architecture Test](https://github.com/riscv-non-isa/riscv-arch-test), and selected RISC-V ELF files are useful for ISA simulation validation and testing. | ||
Some of these prebuilt binaries are stored in [rv32emu-prebuilt](https://github.com/sysprog21/rv32emu-prebuilt). | ||
During testing or benchmarking, these binaries are automatically downloaded into the `build/linux-x86-softfp/` and `build/riscv32/` directories by default. | ||
The RISC-V binaries are compiled using the [xPack RISC-V GCC toolchain](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack) with the options `-march=rv32im -mabi=ilp32`. | ||
The x86 binaries are compiled by GCC with `-m32 -mno-sse -mno-sse2 -msoft-float` options and use [ieeelib](https://github.com/sysprog21/ieeelib) as the soft-fp library. | ||
|
||
To fetch the prebuilt binaries manually, run: | ||
|
||
```shell | ||
$ make artifact | ||
``` | ||
|
||
Or build the binaries from scratch (the RISC-V cross-compiler is required): | ||
|
||
```shell | ||
$ make artifact ENABLE_PREBUILT=0 [CROSS_COMPILE=<COMPILER_PREFIX>] | ||
``` | ||
|
||
The compiler prefix varies according to the used toolchain, such as `riscv-none-elf-`, `riscv32-unknown-elf-`, etc. | ||
|
||
The prebuilt binaries in `rv32emu-prebuilt` are built from the following repositories and resources: | ||
|
||
- [ansibench](https://github.com/sysprog21/ansibench) | ||
- coremark | ||
- stream | ||
- nbench | ||
- [rv8-bench](https://github.com/sysprog21/rv8-bench) | ||
- aes | ||
- dhrystone | ||
- miniz | ||
- norx | ||
- primes | ||
- qsort | ||
- sha512 | ||
- `captcha` : See [tests/captcha.c](/tests/captcha.c) | ||
- `donut` : See [tests/donut.c](/tests/donut.c) | ||
- `fcalc` : See [tests/fcalc.c](/tests/fcalc.c) | ||
- `hamilton` : See [tests/hamilton.c](/tests/hamilton.c) | ||
- `jit` : See [tests/jit.c](/tests/jit.c) | ||
- `lena`: See [tests/lena.c](/tests/lena.c) | ||
- `line` : See [tests/line.c](/tests/line.c) | ||
- `maj2random` : See [tests/maj2random.c](/tests/maj2random.c) | ||
- `mandelbrot` : See [tests/mandelbrot.c](/tests/mandelbrot.c) | ||
- `nqueens` : See [tests/nqueens.c](/tests/nqueens.c) | ||
- `nyancat` : See [tests/nyancat.c](/tests/nyancat.c) | ||
- `pi` : See [tests/pi.c](/tests/pi.c) | ||
- `puzzle` : See [tests/puzzle.c](/tests/puzzle.c) | ||
- `qrcode` : See [tests/qrcode.c](/tests/qrcode.c) | ||
- `richards` : See [tests/richards.c](/tests/richards.c) | ||
- `rvsim` : See [tests/rvsim.c](/tests/rvsim.c) | ||
- `spirograph` : See [tests/spirograph.c](/tests/spirograph.c) | ||
- `uaes` : See [tests/uaes.c](/tests/uaes.c) | ||
|
||
There are still some prebuilt standalone RISC-V binaries under `build/` directory only for testing purpose: | ||
|
||
- `hello.elf` : See [tests/asm-hello](/tests/asm-hello) | ||
- `cc.elf` : See [tests/cc](/tests/cc) | ||
- `chacha20.elf` : See [tests/chacha20](/tests/chacha20) | ||
- `doom.elf` : See [sysprog21/doom_riscv](https://github.com/sysprog21/doom_riscv) [RV32M] | ||
- `ieee754.elf` : See [tests/ieee754.c](/tests/ieee754.c) [RV32F] | ||
- `jit-bf.elf` : See [ezaki-k/xkon_beta](https://github.com/ezaki-k/xkon_beta) | ||
- `quake.elf` : See [sysprog21/quake-embedded](https://github.com/sysprog21/quake-embedded) [RV32F] | ||
- `readelf.elf` : See [tests/readelf](/tests/readelf) | ||
- `scimark2.elf` : See [tests/scimark2](/tests/scimark2) [RV32MF] | ||
- `smolnes.elf` : See [tests/smolnes](/tests/smolnes.c) [RV32M] |
Oops, something went wrong.