|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + paths: |
| 7 | + - '**.hpp' |
| 8 | + - '**.cpp' |
| 9 | + - '**.h' |
| 10 | + - '**.c' |
| 11 | + - '**.S' |
| 12 | + - '**CMakeLists.txt' |
| 13 | + - '.github/workflows/**' |
| 14 | + - 'conanfile.py' |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - '**.hpp' |
| 18 | + - '**.cpp' |
| 19 | + - '**.h' |
| 20 | + - '**.c' |
| 21 | + - '**.S' |
| 22 | + - '**CMakeLists.txt' |
| 23 | + - '.github/workflows/**' |
| 24 | + - 'conanfile.py' |
| 25 | + |
| 26 | +jobs: |
| 27 | + cpp-compliance: |
| 28 | + name: C++ Std Compliance (C++${{ matrix.cpp_std }}) |
| 29 | + runs-on: ubuntu-24.04 |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + cpp_std: [17, 20] |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Update submodules |
| 37 | + run: git submodule update --init --recursive |
| 38 | + |
| 39 | + - name: Cache Conan |
| 40 | + uses: actions/cache@v4 |
| 41 | + with: |
| 42 | + path: ~/.conan2 |
| 43 | + key: conan-${{ runner.os }}-unit-cpp${{ matrix.cpp_std }}-${{ hashFiles('conanfile.py') }} |
| 44 | + |
| 45 | + - name: Install dependencies |
| 46 | + run: | |
| 47 | + sudo apt-get install -y g++ python3-pip cmake llvm-19-dev |
| 48 | + pip3 install conan |
| 49 | + cmake --version |
| 50 | +
|
| 51 | + - name: Configure |
| 52 | + run: cmake --preset Release -B build -DCMAKE_CXX_STANDARD=${{ matrix.cpp_std }} -DWITH_LLVM=ON -DWITH_SYSTEM_LLVM=ON |
| 53 | + |
| 54 | + - name: Build |
| 55 | + run: cmake --build build -j |
| 56 | + |
| 57 | + - name: Smoke test |
| 58 | + run: ./build/riscv-sim -h |
| 59 | + |
| 60 | + # NOTE: .so filename is tied to VERSION in top-level CMakeLists.txt - update both together |
| 61 | + - name: Upload binary |
| 62 | + if: matrix.cpp_std == 20 |
| 63 | + uses: actions/upload-artifact@v4 |
| 64 | + with: |
| 65 | + name: riscv-sim |
| 66 | + path: | |
| 67 | + build/riscv-sim |
| 68 | + build/libdbt-rise-riscv.so.2.1.0 |
| 69 | +
|
| 70 | + pmp-tests: |
| 71 | + name: PMP Functional Tests |
| 72 | + runs-on: ubuntu-24.04 |
| 73 | + needs: cpp-compliance |
| 74 | + steps: |
| 75 | + - uses: actions/checkout@v4 |
| 76 | + |
| 77 | + - name: Install RISC-V toolchain |
| 78 | + run: sudo apt-get install -y gcc-riscv64-unknown-elf |
| 79 | + |
| 80 | + - name: Download riscv-sim binary |
| 81 | + uses: actions/download-artifact@v4 |
| 82 | + with: |
| 83 | + name: riscv-sim |
| 84 | + |
| 85 | + - name: Make binary executable |
| 86 | + run: chmod +x riscv-sim |
| 87 | + |
| 88 | + - name: Build PMP CSR test firmware |
| 89 | + run: | |
| 90 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 91 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 92 | + -o pmp_csr_test \ |
| 93 | + contrib/fw/pmp-csr-test/pmp_csr_test.S |
| 94 | +
|
| 95 | + - name: rv64gc_m CSR test - interp (no PMP, expect exit 2) |
| 96 | + run: | |
| 97 | + LD_LIBRARY_PATH=. ./riscv-sim -f pmp_csr_test --isa rv64gc_m --backend interp || rc=$? |
| 98 | + [ "${rc:-0}" -eq 2 ] |
| 99 | +
|
| 100 | + - name: rv64gc_mp CSR test - interp (with PMP) |
| 101 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_csr_test --isa rv64gc_mp --backend interp |
| 102 | + |
| 103 | + - name: Build PMP enforcement test firmware |
| 104 | + run: | |
| 105 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 106 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 107 | + -o pmp_enforce_test \ |
| 108 | + contrib/fw/pmp-enforce-test/pmp_enforce_test.S |
| 109 | +
|
| 110 | + - name: rv64gc_mp enforcement test - interp |
| 111 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_enforce_test --isa rv64gc_mp --backend interp |
| 112 | + |
| 113 | + - name: Build PMP shift test firmware |
| 114 | + run: | |
| 115 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 116 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 117 | + -o pmp_shift_test \ |
| 118 | + contrib/fw/pmp-shift-test/pmp_shift_test.S |
| 119 | +
|
| 120 | + - name: rv64gc_mp shift test - interp |
| 121 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_shift_test --isa rv64gc_mp --backend interp |
| 122 | + |
| 123 | + - name: Build PMP upper-cfg test firmware |
| 124 | + run: | |
| 125 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 126 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 127 | + -o pmp_upper_cfg_test \ |
| 128 | + contrib/fw/pmp-upper-cfg-test/pmp_upper_cfg_test.S |
| 129 | +
|
| 130 | + - name: rv64gc_mp upper-cfg test - interp |
| 131 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_upper_cfg_test --isa rv64gc_mp --backend interp |
| 132 | + |
| 133 | + - name: Build PMP cfg2 test firmware |
| 134 | + run: | |
| 135 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 136 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 137 | + -o pmp_cfg2_test \ |
| 138 | + contrib/fw/pmp-cfg2-test/pmp_cfg2_test.S |
| 139 | +
|
| 140 | + - name: rv64gc_mp cfg2 test - interp |
| 141 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_cfg2_test --isa rv64gc_mp --backend interp |
| 142 | + |
| 143 | + - name: Build PMP TOR test firmware |
| 144 | + run: | |
| 145 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 146 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 147 | + -o pmp_tor_test \ |
| 148 | + contrib/fw/pmp-tor-test/pmp_tor_test.S |
| 149 | +
|
| 150 | + - name: rv64gc_mp TOR test - interp |
| 151 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_tor_test --isa rv64gc_mp --backend interp |
| 152 | + |
| 153 | + - name: Build PMP 64-entry pmpaddr test firmware |
| 154 | + run: | |
| 155 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 156 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 157 | + -o pmp_64entry_addr_test \ |
| 158 | + contrib/fw/pmp-64entry-addr-test/pmp_64entry_addr_test.S |
| 159 | +
|
| 160 | + - name: rv64gc_mp 64-entry pmpaddr test - interp |
| 161 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_64entry_addr_test --isa rv64gc_mp --backend interp |
| 162 | + |
| 163 | + - name: Build PMP 64-entry pmpcfg test firmware |
| 164 | + run: | |
| 165 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 166 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 167 | + -o pmp_64entry_cfg_test \ |
| 168 | + contrib/fw/pmp-64entry-cfg-test/pmp_64entry_cfg_test.S |
| 169 | +
|
| 170 | + - name: rv64gc_mp 64-entry pmpcfg test - interp |
| 171 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_64entry_cfg_test --isa rv64gc_mp --backend interp |
| 172 | + |
| 173 | + - name: Build PMP 8-entry guard test firmware (VP/S5 model) |
| 174 | + run: | |
| 175 | + riscv64-unknown-elf-gcc -nostdlib -march=rv64gc -mabi=lp64 \ |
| 176 | + -Wl,-Ttext=0x10000,--no-dynamic-linker \ |
| 177 | + -o pmp_8entry_guard_test \ |
| 178 | + contrib/fw/pmp-8entry-guard-test/pmp_8entry_guard_test.S |
| 179 | +
|
| 180 | + - name: rv64gc_mp_8 8-entry enforcement test - interp (VP/S5 model) |
| 181 | + run: LD_LIBRARY_PATH=. ./riscv-sim -f pmp_8entry_guard_test --isa rv64gc_mp_8 --backend interp |
0 commit comments