|
| 1 | +name: Evening Regression |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # 12:00 UTC == 20:00 UTC+8 |
| 6 | + - cron: '00 12 * * *' |
| 7 | + |
| 8 | + # Delete after the PR test is passed. |
| 9 | + pull_request: |
| 10 | + types: [opened, synchronize, reopened, ready_for_review] |
| 11 | + |
| 12 | +jobs: |
| 13 | + test-fpga-nutshell: |
| 14 | + if: ${{ github.event_name == 'pull_request' }} |
| 15 | + timeout-minutes: 1440 |
| 16 | + runs-on: self-hosted |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Prepare NutShell |
| 22 | + run: | |
| 23 | + cd $GITHUB_WORKSPACE/.. |
| 24 | + rm -rf NutShell && rm -rf env-scripts |
| 25 | + proxychains git clone -b dev-difftest --single-branch --depth 1 https://github.com/OSCPU/NutShell.git |
| 26 | + cd NutShell && make init && rm -rf difftest && cp -r $GITHUB_WORKSPACE . |
| 27 | + echo "NOOP_HOME=$(pwd)" >> $GITHUB_ENV |
| 28 | + echo "DUT_HOME=$(pwd)/build" >> $GITHUB_ENV |
| 29 | + echo "DIFFTEST_LOG=/nfs/home/ci-runner/ci-runner-difftest/pr_log" >> "$GITHUB_ENV" |
| 30 | + echo "/nfs/home/tools/Xilinx/Vivado/2020.2/bin" >> "$GITHUB_PATH" |
| 31 | +
|
| 32 | + - name: Prepare FPGA scripts |
| 33 | + run: | |
| 34 | + cd $GITHUB_WORKSPACE/.. |
| 35 | + proxychains git clone -b dev_difftest --single-branch --depth 1 https://github.com/OpenXiangShan/env-scripts.git |
| 36 | + cd env-scripts |
| 37 | + echo "ENV_SCRIPTS_HOME=$(pwd)" >> $GITHUB_ENV |
| 38 | +
|
| 39 | + - name: Build NutShell |
| 40 | + run: | |
| 41 | + cd $NOOP_HOME |
| 42 | + make verilog BOARD=fpgadiff MILL_ARGS="--difftest-config ESBIF" -j2 |
| 43 | + cp -i ./difftest/src/test/vsrc/fpga/fpga_clock_gate.v ./build/rtl/ |
| 44 | +
|
| 45 | + - name: Create FPGA project |
| 46 | + run: | |
| 47 | + source /nfs/home/tools/Xilinx/Vivado/2020.2/settings64.sh |
| 48 | + cd $GITHUB_WORKSPACE/../env-scripts/fpga_diff |
| 49 | + make update_core_flist CORE_DIR=$DUT_HOME |
| 50 | + make vivado CPU=nutshell |
| 51 | +
|
| 52 | + - name: Build FPGA synth |
| 53 | + run: | |
| 54 | + source /nfs/home/tools/Xilinx/Vivado/2020.2/settings64.sh |
| 55 | + cd $ENV_SCRIPTS_HOME/fpga_diff |
| 56 | + make synth PRJ=./fpga_nutshell/fpga_nutshell.xpr |
| 57 | + bash ./tools/generate_reports.sh nutshell |
| 58 | +
|
| 59 | + - name: Extract Vivado Hierarchical utilization |
| 60 | + run: | |
| 61 | + set -euo pipefail |
| 62 | + IN_PATH=$ENV_SCRIPTS_HOME/fpga_diff |
| 63 | + MD_PATH="$RUNNER_TEMP/vivado_hier_filtered.md" |
| 64 | + python3 $NOOP_HOME/difftest/scripts/fpga/ci.py --input "$IN_PATH" --cpu nutshell \ |
| 65 | + --filter-instance-root U_CPU_TOP --filter-modules HostEndpoint,GatewayEndpoint,nutcore \ |
| 66 | + --csv-md-output "$MD_PATH" |
| 67 | + echo "VIVADO_HIER_MD=$MD_PATH" >> "$GITHUB_ENV" |
| 68 | +
|
| 69 | +
|
| 70 | + - name: Comment utilization to PR |
| 71 | + if: ${{ github.event_name == 'pull_request' }} |
| 72 | + uses: actions/github-script@v7 |
| 73 | + env: |
| 74 | + VIVADO_HIER_MD: ${{ env.VIVADO_HIER_MD }} |
| 75 | + with: |
| 76 | + script: | |
| 77 | + const fs = require('fs'); |
| 78 | + let body; |
| 79 | + try { |
| 80 | + body = fs.readFileSync(process.env.VIVADO_HIER_MD, 'utf8'); |
| 81 | + if (!body.trim()) throw new Error('empty'); |
| 82 | + } catch (e) { |
| 83 | + body = 'Vivado Hierarchical utilization: section missing or extract failed. Please check the job logs for runme.log output.'; |
| 84 | + } |
| 85 | + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body }); |
| 86 | +
|
| 87 | + test-fpga-xiangshan-miniconfig: |
| 88 | + if: ${{ github.event_name == 'schedule' }} |
| 89 | + timeout-minutes: 1440 |
| 90 | + runs-on: self-hosted |
| 91 | + |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v4 |
| 94 | + |
| 95 | + - name: Prepare XiangShan |
| 96 | + run: | |
| 97 | + cd $GITHUB_WORKSPACE/.. |
| 98 | + rm -rf XiangShan && rm -rf env-scripts |
| 99 | + proxychains git clone --depth 1 https://github.com/OpenXiangShan/XiangShan.git |
| 100 | + cd XiangShan && make init && rm -rf difftest && cp -r $GITHUB_WORKSPACE . |
| 101 | + echo "NOOP_HOME=$(pwd)" >> $GITHUB_ENV |
| 102 | + echo "DIFF_HOME=$NOOP_HOME/difftest/nightly_log" >> $GITHUB_ENV |
| 103 | + echo "DUT_HOME=$(pwd)/build" >> $GITHUB_ENV |
| 104 | + echo "DIFFTEST_LOG=/nfs/home/ci-runner/ci-runner-difftest/evening_log" >> "$GITHUB_ENV" |
| 105 | +
|
| 106 | + - name: Prepare FPGA scripts |
| 107 | + run: | |
| 108 | + cd $GITHUB_WORKSPACE/.. |
| 109 | + proxychains git clone --depth 1 https://github.com/OpenXiangShan/env-scripts.git |
| 110 | + cd env-scripts |
| 111 | + echo "ENV_SCRIPTS_HOME=$(pwd)" >> $GITHUB_ENV |
| 112 | +
|
| 113 | + - name: Build Xiangshan |
| 114 | + run: | |
| 115 | + cd $NOOP_HOME |
| 116 | + make verilog FPGA_DIFF=1 CONFIG=FpgaDiffDefaultConfig PLDM_ARGS="--difftest-config ESBIFDU --difftest-exclude Vec" PLDM=1 WITH_CHISELDB=0 WITH_CONSTANTIN=0 |
| 117 | + cp -r $DIFF_HOME/src/test/vsrc/fpga $DUT_HOME |
| 118 | +
|
| 119 | + - name: Create FPGA project |
| 120 | + run: | |
| 121 | + PATH=$PATH:/nfs/home/tools/Xilinx/Vivado/2020.2/bin |
| 122 | + source /nfs/home/tools/Xilinx/Vivado/2020.2/settings64.sh |
| 123 | + cd $GITHUB_WORKSPACE/../env-scripts/fpga_diff |
| 124 | + make update_core_flist CORE_DIR=$DUT_HOME |
| 125 | + make vivado CPU=xiangshan |
| 126 | +
|
| 127 | + - name: Build FPGA synth |
| 128 | + run: | |
| 129 | + cd $GITHUB_WORKSPACE/../env-scripts/fpga_diff |
| 130 | + make synth PRJ=fpga_xiangshan/fpga_xiangshan.xpr |
| 131 | + bash ./tools/generate_reports.sh xiangshan |
| 132 | +
|
| 133 | + - name: Print Vivado Hierarchical utilization to logs |
| 134 | + run: | |
| 135 | + set -euo pipefail |
| 136 | + IN_PATH=$ENV_SCRIPTS_HOME/fpga_diff |
| 137 | + echo "===== Vivado Hierarchical utilization =====" |
| 138 | + MD_PATH="$RUNNER_TEMP/vivado_hier_filtered_xs.md" |
| 139 | + python3 "$GITHUB_WORKSPACE/scripts/fpga/ci.py" --input "$IN_PATH" --cpu xiangshan \ |
| 140 | + --filter-instance-root U_CPU_TOP --filter-modules HostEndpoint,GatewayEndpoint,XSTop \ |
| 141 | + --csv-md-output "$MD_PATH" --format text |
| 142 | + cat "$MD_PATH"" >> "$GITHUB_STEP_SUMMARY" |
| 143 | +
|
| 144 | + - name: Publish artifacts |
| 145 | + uses: actions/upload-artifact@v4 |
| 146 | + with: |
| 147 | + name: xiangshan-vivado-hier-${{ github.run_id }} |
| 148 | + path: ${{ runner.temp }}/xiangshan_artifacts |
0 commit comments