Skip to content

Revert "fixme: force un-hit ICache" #448

Revert "fixme: force un-hit ICache"

Revert "fixme: force un-hit ICache" #448

name: Self-hosted Difftest
on:
push:
branches:
- master
- feat-*
- fix-*
- perf-*
workflow_dispatch:
jobs:
setup-toolchains:
name: Setup toolchains
runs-on: self-hosted
steps:
- name: Remove toolchains stub
run: |
rm -rf ./toolchains
- name: Restore toolchains cache
uses: woshiluo/local-cache@v3
id: cache-toolchains-restore
with:
path: toolchains
base: /var/cache/github_runners/local-cache
key: ${{ runner.os }}-toolchains
- name: Setup directory structure
if: steps.cache-toolchains-restore.outputs.cache-hit != 'true'
run: |
mkdir -p toolchains
chgrp github_runners toolchains
chmod g+s toolchains
cd toolchains
mkdir -p nemu picolibc newlib
- name: Download and setup GCC toolchain
if: steps.cache-toolchains-restore.outputs.cache-hit != 'true'
run: |
cd toolchains
wget https://gitee.com/loongson-edu/la32r-toolchains/releases/download/v0.0.3/loongson-gnu-toolchain-8.3-x86_64-loongarch32r-linux-gnusf-v2.0.tar.xz
tar -xf loongson-gnu-toolchain-8.3-x86_64-loongarch32r-linux-gnusf-v2.0.tar.xz
chmod -R +x loongson-gnu-toolchain-8.3-x86_64-loongarch32r-linux-gnusf-v2.0/bin/
rm loongson-gnu-toolchain-8.3-x86_64-loongarch32r-linux-gnusf-v2.0.tar.xz
- name: Download NEMU
if: steps.cache-toolchains-restore.outputs.cache-hit != 'true'
run: |
cd toolchains/nemu
wget https://gitee.com/wwt_panache/la32r-nemu/releases/download/v1.0.5-x86/la32r-nemu-interpreter-so
chmod +x la32r-nemu-interpreter-so
- name: Download and setup picolibc
if: steps.cache-toolchains-restore.outputs.cache-hit != 'true'
run: |
cd toolchains
wget https://gitee.com/ffshff/la32r-picolibc/releases/download/V1.0/picolibc.tar.gz
tar -xzf picolibc.tar.gz -C picolibc
rm picolibc.tar.gz
- name: Download and setup newlib
if: steps.cache-toolchains-restore.outputs.cache-hit != 'true'
run: |
cd toolchains
wget https://gitee.com/ffshff/newlib-la32r/releases/download/V1.0/newlib.tar.gz
tar -xzf newlib.tar.gz -C newlib
rm newlib.tar.gz
- name: Download and setup QEMU
if: steps.cache-toolchains-restore.outputs.cache-hit != 'true'
run: |
cd toolchains
wget https://gitee.com/loongson-edu/la32r-QEMU/releases/download/v0.0.2/la32r-QEMU-x86_64-ubuntu-22.04.tar
tar -xf la32r-QEMU-x86_64-ubuntu-22.04.tar
chmod -R +x la32r-QEMU-x86_64-ubuntu-22.04/
rm la32r-QEMU-x86_64-ubuntu-22.04.tar
generate-verilog:
runs-on: self-hosted
if: ${{ !(contains(github.event.head_commit.message, format('X-Actions-Control{0} no-verilog', ':')) || contains(github.event.head_commit.message, format('X-Actions-Control{0}no-verilog', ':'))) }}
strategy:
fail-fast: false
matrix:
build-mode: [full]
name: 'Generate Verilog: ${{ matrix.build-mode }}'
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- name: Verify dependencies installation
run: |
firtool --version
which espresso
- name: Clobber Chisel
if: ${{ contains(github.event.head_commit.message, format('X-Actions-Control{0} clobber-chisel', ':')) || contains(github.event.head_commit.message, format('X-Actions-Control{0}clobber-chisel', ':')) }}
run: |
cd dependencies/chisel
./mill clean
- name: Setup Chisel
run: |
cd dependencies/chisel
./mill unipublish.publishLocal
- name: Patch CoreTop config
run: |
export UNTITL3D_BUILD_MODE=${{ matrix.build-mode }}
export UNTITL3D_BUILD_PATCH_CORETOP_CONFIG=config/CoreTop.json
./scripts/switch_build_mode.sh
export UNTITL3D_SYNTHESIS=off
export UNTITL3D_SYNTHESIS_PATCH_CORETOP_CONFIG=./config/CoreTop.json
./scripts/switch_synthesis.sh
sed -i -E 's/"tlbEntryNum":[[:space:]]*[[:digit:]]+/"tlbEntryNum": 32/gI' ./config/CoreTop.json
sed -i -E 's/"tlbEntries":[[:space:]]*[[:digit:]]+/"tlbEntries": 32/gI' ./config/CoreTop.json
- name: Clean previous runs
run: |
./mill clean
make clean
make clean DESIGN=backend
- name: Generate RTL
run: |
make -j verilog
- name: Upload built RTL
uses: actions/upload-artifact@v4
with:
name: verilog-output-${{ matrix.build-mode }}
path: ./IP/myCPU/rtl/CoreTop
retention-days: 2
difftest:
runs-on: self-hosted
needs: [setup-toolchains, generate-verilog]
if: ${{ contains(github.event.head_commit.message, format('X-Actions-Control{0} difftest', ':')) || contains(github.event.head_commit.message, format('X-Actions-Control{0}difftest', ':')) }}
strategy:
fail-fast: false
matrix:
build-mode: [full]
test-name: [func/func_lab19, my_coremark, fireye/my_A0]
name: 'Difftest ${{ matrix.test-name }}: ${{ matrix.build-mode }}'
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- name: Remove toolchains stub
run: |
rm -rf ./toolchains
- name: Restore toolchains cache
uses: woshiluo/local-cache@v3
with:
base: /var/cache/github_runners/local-cache
path: toolchains
key: ${{ runner.os }}-toolchains
- name: Fetch built RTL
uses: actions/download-artifact@v4
with:
name: verilog-output-${{ matrix.build-mode }}
path: ./IP/myCPU/rtl/CoreTop
- name: Setup environment variables
run: |
echo "CHIPLAB_HOME=$(pwd)" >> $GITHUB_ENV
- name: Setup PATH
run: |
echo "${CHIPLAB_HOME}/toolchains/loongson-gnu-toolchain-8.3-x86_64-loongarch32r-linux-gnusf-v2.0/bin/" >> $GITHUB_PATH
echo "${CHIPLAB_HOME}/toolchains/la32r-QEMU-x86_64-ubuntu-22.04/" >> $GITHUB_PATH
- name: Build DPI library
run: |
CC=clang CXX=clang++ make -j dpi-lib DESIGN=backend
- name: Build test and driver
run: |
cd ./sims/verilator/run_prog
./configure.sh --run ${{ matrix.test-name }} --output-pc-info
# https://unix.stackexchange.com/questions/14270/get-exit-status-of-process-thats-piped-to-another
set -o pipefail
CC=clang CXX=clang++ make -j 2> >(tee build_stderr_output.log >&2) | tee build_stdout_output.log
- name: Test
run: |
cd ./sims/verilator/run_prog
make run TIME_LIMIT=10000000 1> run_output.log 2> sim.md
- name: Tail report
if: ${{ success() || failure() }}
run: |
tail -n 128 ./sims/verilator/run_prog/run_output.log
- name: Generate report name
id: generate-report-name
if: ${{ failure() }}
run: |
echo "report_name=$(echo 'difftest-report-${{ matrix.test-name }}-${{ matrix.build-mode }}' | sed 's/\//-/g')" | tee $GITHUB_OUTPUT
- name: Upload report
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ${{ steps.generate-report-name.outputs.report_name }}
path: |
./sims/verilator/run_prog/sim.md
./sims/verilator/run_prog/*_output.log
./sims/verilator/run_prog/log/
retention-days: 1