diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 497447e628..1c95314f31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,10 @@ jobs: - uses: actions/checkout@v6 with: submodules: recursive - + - name: Fix submodule sync + run: | + git submodule sync --recursive + git submodule update --init --recursive - name: Get specific submodule hash id: core-v-submodule-hash run: | @@ -133,9 +136,10 @@ jobs: runs-on: ubuntu-latest env: SPIKE_TANDEM: 1 + RISCV: ${{ github.workspace }}/tools/riscv-toolchain strategy: matrix: - testcase: [ dv-riscv-arch-test, cv32a6_tests ] + testcase: [ dv-riscv-arch-test, cv32a6_tests, wrapper-cv32a65x-act] config: [ cv32a65x ] simulator: [ veri-testharness ] needs: diff --git a/.gitmodules b/.gitmodules index e87394db64..d1e8b0b8c2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -52,3 +52,6 @@ [submodule "corev_apu/fpga/src/gpio"] path = corev_apu/fpga/src/gpio url = https://github.com/pulp-platform/gpio.git +[submodule "external/act4"] + path = external/act4 + url = https://github.com/riscv-non-isa/riscv-arch-test.git diff --git a/external/act4 b/external/act4 new file mode 160000 index 0000000000..aec3ea396f --- /dev/null +++ b/external/act4 @@ -0,0 +1 @@ +Subproject commit aec3ea396f254f37a7d0aba1179a7c7e2068a41a diff --git a/verif/core-v-verif b/verif/core-v-verif index b3149ab0da..60e57248c4 160000 --- a/verif/core-v-verif +++ b/verif/core-v-verif @@ -1 +1 @@ -Subproject commit b3149ab0da3ac8bf2179e24595a4b7a860b668ff +Subproject commit 60e57248c48b0f8f90cf52af20aecc5c16e9d6d8 diff --git a/verif/regress/wrapper-cv32a65x-act.sh b/verif/regress/wrapper-cv32a65x-act.sh new file mode 100755 index 0000000000..6d9f6f4467 --- /dev/null +++ b/verif/regress/wrapper-cv32a65x-act.sh @@ -0,0 +1,62 @@ +#!/bin/bash +# Run ACT 4.0 tests on cv32a65x via Makefile targets + +# where are the tools +if ! [ -n "$RISCV" ]; then + echo "Error: RISCV variable undefined" + exit 1 +fi + +if ! [ -n "$DV_SIMULATORS" ]; then + DV_SIMULATORS=veri-testharness,spike +fi + +# install the required tools +if [[ "$DV_SIMULATORS" == *"veri-testharness"* ]]; then + source ./verif/regress/install-verilator.sh +fi +source ./verif/regress/install-spike.sh + +# setup sim env +source ./verif/sim/setup-env.sh + +if [ ! -d "external/act4" ]; then + echo "ERROR: ACT4 submodule missing" + exit 1 +fi + +echo "$SPIKE_INSTALL_DIR" + +set -e + +# ================== CONFIGURATION ================== +export CVA6_REPO_DIR="$(pwd)" +export ACT4_PKG="$CVA6_REPO_DIR/external/act4" +export TARGET_RTL="cv32a65x" +export CV_SW_PREFIX="riscv64-unknown-elf-" +export max_cycles=2000000 + +echo "Environment Setup Complete" + +# Build the Verilator model +echo "Building Verilator model for ${TARGET_RTL}" +make verilate target="$TARGET_RTL" -j$(nproc) + +cd "${CVA6_REPO_DIR}/verif/sim" + +# Run generation and certification via Makefile +# This triggers the 'gen' then 'certify' targets defined in verif/sim/Makefile +echo "Starting ACT Regression (Generation + RTL Simulation)" +make gen-certify target="$TARGET_RTL" + +#Display Summary +# Path derived from SIM_RESULTS and VERI_LOG_DIR in Makefile +SUMMARY_FILE="${CVA6_REPO_DIR}/verif/sim/simulation_results/certification_summary.txt" + +if [ -f "${SUMMARY_FILE}" ]; then + echo "" + cat "${SUMMARY_FILE}" +else + echo "Error: Summary file not found at ${SUMMARY_FILE}" + exit 1 +fi diff --git a/verif/sim/Makefile b/verif/sim/Makefile index 05efa32b57..ee922dedf1 100644 --- a/verif/sim/Makefile +++ b/verif/sim/Makefile @@ -72,6 +72,81 @@ else spike_params_final := $(spike_params_final) --extension=cvxif endif + +# ============================================================================== +# CVA6 ACT 4.0 Certification Targets (cv32a65x) +# ============================================================================== + +# Updated paths for CVA6 directory structure +certification_PROGRAM_PATH = $(ACT4_PKG)/work/cv32a65x/elfs +certification_PROGRAM_RELPATH = ../../vendor_lib/cva6/external/act4/work/cv32a65x/elfs +VERI_LOG_DIR = $(CVA6_REPO_DIR)/verif/sim/simulation_results + +.PHONY: gen +gen: $(ACT4_PKG) + @command -v uv >/dev/null 2>&1 || { echo "Error: 'uv' not found. Install from https://docs.astral.sh/uv/getting-started/installation/"; exit 1; } + @echo "* Cleaning ACT4.0 directory..." + $(MAKE) -C $(ACT4_PKG) clean + @echo "* Generating ACT4.0 tests for CVA6 (cv32a65x)..." + # Test generation now relies on the YAML config for extensions and parameters + $(MAKE) -C $(ACT4_PKG) \ + CONFIG_FILES=config/cores/cva6/cv32a65x/test_config.yaml EXTENSIONS="" EXCLUDE_EXTENSIONS="InterruptsSm,Sm" \ + --jobs $(shell nproc) + @echo "* Tests generated in: $(certification_PROGRAM_PATH)" + +.PHONY: certify +certify: TEST = certification +certify: + @echo "$(BANNER)" + @echo "* Running ALL compliance ELFs with CVA6 Verilator Model" + @echo "$(BANNER)" + @set -e; \ + mkdir -p "$(VERI_LOG_DIR)"; \ + SUMMARY="$(VERI_LOG_DIR)/certification_summary.txt"; \ + echo "RESULT TEST" > "$$SUMMARY"; \ + echo "------ ----" >> "$$SUMMARY"; \ + ROOT="$(certification_PROGRAM_PATH)"; \ + ELFS="$$(find -L "$$ROOT" \( -type f -o -type l \) -a \( -iname '*.elf' -o -iname '*.elf32' \) 2>/dev/null | sort)"; \ + if [ -z "$$ELFS" ]; then \ + echo "No .elf files found under $$ROOT"; \ + exit 2; \ + fi; \ + PASS=0; FAIL=0; TOTAL=0; \ + for ELF in $$ELFS; do \ + TOTAL=$$((TOTAL+1)); \ + REL="$${ELF#$$ROOT/}"; \ + LOG="$(VERI_LOG_DIR)/$${REL%.*}.log"; \ + mkdir -p "$$(dirname "$$LOG")"; \ + # CVA6 requires the exact tohost address to be passed as a plusarg\ + TOHOST_ADDR=$$(riscv64-unknown-elf-nm -B $$ELF | grep -w tohost | cut -d' ' -f1); \ + set +e; \ + # Using the CVA6 Variane_testharness binary directly \ + $(CVA6_REPO_DIR)/work-ver/Variane_testharness \ + $$ELF \ + +elf_file=$$ELF \ + +tohost_addr=0x$$TOHOST_ADDR \ + +signature=$$ELF.signature_output \ + > "$$LOG" 2>&1; \ + RC=$$?; \ + set -e; \ + # CVA6 testbench signals success with "ALL TESTS PASSED"\ + if [ $$RC -eq 0 ] && grep -q "PASSED" "$$LOG"; then \ + echo "PASS $$REL" | tee -a "$$SUMMARY"; \ + PASS=$$((PASS+1)); \ + else \ + echo "FAIL $$REL" | tee -a "$$SUMMARY"; \ + FAIL=$$((FAIL+1)); \ + fi; \ + done; \ + echo "" | tee -a "$$SUMMARY"; \ + echo "TOTAL=$$TOTAL PASS=$$PASS FAIL=$$FAIL" | tee -a "$$SUMMARY"; \ + echo "Summary saved to: $$SUMMARY"; \ + true + +.PHONY: gen-certify +gen-certify: gen certify + + ############################################## # Waveform configuration ##############################################