diff --git a/.github/workflows/impl.yml b/.github/workflows/impl.yml index 9eaf1f2..a5922cd 100644 --- a/.github/workflows/impl.yml +++ b/.github/workflows/impl.yml @@ -5,14 +5,16 @@ on: [push, pull_request] jobs: impl_ice40: name: iCE40 Reference Implementation - runs-on: prunner + runs-on: ubuntu-latest steps: - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-02/oss-cad-suite-linux-x64-20240202.tgz" >> $GITHUB_ENV - - name: Checkout repository uses: actions/checkout@v3 + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 + with: + version: '2024-02-02' + - uses: actions/setup-python@v5 with: python-version: '3.10' @@ -26,11 +28,6 @@ jobs: fusesoc library add fazyrv . fusesoc library add fsoc . - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad - with: - from_url: ${{ env.oss_url }} - - name: Run implementation run: | make report.soc.all TARGET_ARCH=ice40 @@ -38,14 +35,16 @@ jobs: impl_ecp5: name: ECP5 Reference Implementation - runs-on: prunner + runs-on: ubuntu-latest steps: - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-02/oss-cad-suite-linux-x64-20240202.tgz" >> $GITHUB_ENV - - name: Checkout repository uses: actions/checkout@v3 + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 + with: + version: '2024-02-02' + - uses: actions/setup-python@v5 with: python-version: '3.10' @@ -59,11 +58,6 @@ jobs: fusesoc library add fazyrv . fusesoc library add fsoc . - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad - with: - from_url: ${{ env.oss_url }} - - name: Run implementation run: | make report.soc.all TARGET_ARCH=ecp5 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6413e4a..af8c069 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -3,19 +3,9 @@ name: Lint FazyRV on: [push, pull_request] jobs: - lint_slang: - name: Lint using slang - runs-on: prunner - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Linting with slang - run: make SLANG=/tools/slang/build/bin/slang lint.slang - lint_svlint: name: Lint using svlint - runs-on: prunner + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 @@ -24,4 +14,4 @@ jobs: run: sudo snap install svlint - name: Linting with svlint - run: make lint.svlint + run: make lint.svlint >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/setup-oss-cad/action.yml b/.github/workflows/setup-oss-cad/action.yml index ecd3327..ff009fe 100644 --- a/.github/workflows/setup-oss-cad/action.yml +++ b/.github/workflows/setup-oss-cad/action.yml @@ -11,13 +11,13 @@ runs: - id: cache-oss-cad uses: actions/cache@v3 with: - path: oss-cad-suite + path: .oss-cad-suite key: oss-cad-suite-${{ runner.os }}-${{ inputs.from_url }} - shell: bash if: steps.cache-oss-cad.outputs.cache-hit != 'true' run: | - wget -q -O - ${{ inputs.from_url }} | tar -zx + wget -q -O - ${{ inputs.from_url }} | tar -zx --transform "s/oss-cad-suite/.oss-cad-suite" - shell: bash run: echo "$(pwd)/oss-cad-suite/bin" >> $GITHUB_PATH \ No newline at end of file diff --git a/.github/workflows/setup-riscv-toolchain/action.yml b/.github/workflows/setup-riscv-toolchain/action.yml new file mode 100644 index 0000000..bbba76d --- /dev/null +++ b/.github/workflows/setup-riscv-toolchain/action.yml @@ -0,0 +1,24 @@ +name: Build RISC-V riscv-gnu-toolchain + +runs: + using: composite + steps: + - id: cache-riscv-gnu-toolchain + uses: actions/cache@v3 + with: + path: .riscv-gnu-toolchain + key: riscv-gnu-toolchain-${{ runner.os }} + + - shell: bash + if: steps.cache-riscv-gnu-toolchain.outputs.cache-hit != 'true' + run: | + mkdir -p .riscv-gnu-toolchain + cd .riscv-gnu-toolchain + wget -q -O - https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2023.09.27/riscv32-elf-ubuntu-22.04-gcc-nightly-2023.09.27-nightly.tar.gz | tar -zx --transform "s/riscv/riscv32/" + cd .. + + - shell: bash + run: | + echo "$(pwd)/.riscv-gnu-toolchain/riscv32/bin" >> $GITHUB_PATH + + diff --git a/.github/workflows/setup-sail/action.yml b/.github/workflows/setup-sail/action.yml new file mode 100644 index 0000000..1efaef4 --- /dev/null +++ b/.github/workflows/setup-sail/action.yml @@ -0,0 +1,31 @@ +name: Build sail-riscv + +runs: + using: composite + steps: + - id: cache-sail-riscv + uses: actions/cache@v3 + with: + path: .sail + key: sail-riscv-${{ runner.os }} + + - shell: bash + if: steps.cache-sail-riscv.outputs.cache-hit != 'true' + run: | + mkdir -p .sail + git clone --recursive https://github.com/rems-project/sail-riscv.git + cd sail-riscv + git checkout tags/0.5 + sudo apt install -y opam build-essential libgmp-dev z3 pkg-config zlib1g-dev + opam init + opam switch create 4.06.1 + eval $(opam config env) + opam install -y sail + make + ARCH=RV32 make + cp -r c_emulator/* ../.sail/ + cd .. + + - shell: bash + run: echo ".sail" >> $GITHUB_PATH + diff --git a/.github/workflows/track_area.yml b/.github/workflows/track_area.yml index 28b03ef..d0ea3c8 100644 --- a/.github/workflows/track_area.yml +++ b/.github/workflows/track_area.yml @@ -1,20 +1,24 @@ name: Track area demand in readme -on: [push, pull_request] +on: + push: + branches: + - dev + pull_request: jobs: evaluate: name: Run synthesis and upload plot - runs-on: prunner + runs-on: ubuntu-latest steps: - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/$(date -d "yesterday" "+%Y-%m-%d")/oss-cad-suite-linux-x64-$(date -d "yesterday" "+%Y%m%d").tgz" >> $GITHUB_ENV - - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 + - uses: actions/setup-python@v5 with: python-version: '3.10' @@ -31,11 +35,6 @@ jobs: - name: Actions checkout uses: actions/checkout@v3 - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad - with: - from_url: ${{ env.oss_url }} - - name: Run implementation run: make track.sizes.synth COMMIT=$(git rev-parse --short "$GITHUB_SHA") diff --git a/.github/workflows/verif.yml b/.github/workflows/verif.yml index 8a24f48..25afe39 100644 --- a/.github/workflows/verif.yml +++ b/.github/workflows/verif.yml @@ -5,26 +5,26 @@ on: [push, pull_request] jobs: rvtests: name: Run rvtests - runs-on: prunner + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-26/oss-cad-suite-linux-x64-20240226.tgz" >> $GITHUB_ENV - - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 with: - from_url: ${{ env.oss_url }} + version: '2024-02-02' + + - name: gcc + uses: ./.github/workflows/setup-riscv-toolchain - name: RISC-V Tests - run: make report.riscvtests.all TOOLCHAIN_PREFIX=/tools/riscv/rv32i/bin/riscv32-unknown-elf- + run: make report.riscvtests.all TOOLCHAIN_PREFIX=riscv32-unknown-elf- riscof: name: Run RISCOF tests - runs-on: prunner + runs-on: ubuntu-latest needs: rvtests steps: - name: Checkout repository @@ -45,36 +45,36 @@ jobs: fusesoc library add fazyrv . fusesoc library add fsoc . - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-26/oss-cad-suite-linux-x64-20240226.tgz" >> $GITHUB_ENV - - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 with: - from_url: ${{ env.oss_url }} + version: '2024-02-02' + + - name: gcc + uses: ./.github/workflows/setup-riscv-toolchain + + - name: sail + uses: ./.github/workflows/setup-sail - name: RISCOF run: | make riscof.prepare - make riscof.all PATH="/tools/riscv/rv32i/bin/:/tools/sail-riscv/c_emulator/:$PATH" + make riscof.all cov_insn: name: Cover insn checks - runs-on: prunner + runs-on: ubuntu-latest needs: rvtests steps: - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-26/oss-cad-suite-linux-x64-20240226.tgz" >> $GITHUB_ENV - - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 with: - from_url: ${{ env.oss_url }} + version: '2024-02-02' - name: cov.8 run: make fv.rvformal.cov.insn.8 @@ -84,21 +84,18 @@ jobs: cov_reg: name: Cover reg checks - runs-on: prunner + runs-on: ubuntu-latest needs: rvtests steps: - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-26/oss-cad-suite-linux-x64-20240226.tgz" >> $GITHUB_ENV - - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 with: - from_url: ${{ env.oss_url }} + version: '2024-02-02' - name: cov.8 run: make fv.rvformal.cov.reg.8 @@ -108,21 +105,18 @@ jobs: bmc_insn: name: BMC insn checks - runs-on: prunner + runs-on: ubuntu-latest needs: rvtests steps: - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-26/oss-cad-suite-linux-x64-20240226.tgz" >> $GITHUB_ENV - - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 with: - from_url: ${{ env.oss_url }} + version: '2024-02-02' - name: bmc.8 run: make fv.rvformal.bmc.insn.8 @@ -132,21 +126,18 @@ jobs: bmc_reg: name: BMC reg checks - runs-on: prunner + runs-on: ubuntu-latest needs: rvtests steps: - - name: OSS-CAD-Suite version - run: echo "oss_url=https://github.com/YosysHQ/oss-cad-suite-build/releases/download/2024-02-26/oss-cad-suite-linux-x64-20240226.tgz" >> $GITHUB_ENV - - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive - - name: OSS CAD Suite - uses: ./.github/workflows/setup-oss-cad + - name: oss-cad-suite + uses: YosysHQ/setup-oss-cad-suite@v3 with: - from_url: ${{ env.oss_url }} + version: '2024-02-02' - name: bmc.8 run: make fv.rvformal.bmc.reg.8 diff --git a/Makefile b/Makefile index 8bdf3b7..f46b80a 100644 --- a/Makefile +++ b/Makefile @@ -174,6 +174,11 @@ riscof.run.%: $(SRC_DESIGN) $(SRC_SYNTH) # workaround using the tmp.txt file riscof.all: $(addprefix riscof.run., $(RVTESTS_PARAMS)) + @if [ -z $$(find $(SUMMARY_DIR_RISCOF) -name "*.log") ]; then \ + echo "Error: No *.log files found"; \ + exit 1; \ + fi + @for log_file in $(wildcard $(SUMMARY_DIR_RISCOF)/*.log); do \ if [ $$(cat "$$log_file") != "0" ]; then \ echo "Error: $$log_file RICOF failed"; \ diff --git a/dv/fazyrv/riscof_fazyrv.py b/dv/fazyrv/riscof_fazyrv.py index 198d389..efd222d 100644 --- a/dv/fazyrv/riscof_fazyrv.py +++ b/dv/fazyrv/riscof_fazyrv.py @@ -239,7 +239,7 @@ def runTests(self, testList): # for debug purposes if you would like stop the DUT plugin after compilation, you can # comment out the lines below and raise a SystemExit - objcopy_run = f'riscv64-unknown-elf-objcopy -O binary {elf} {fname}.bin' + objcopy_run = f'riscv32-unknown-elf-objcopy -O binary {elf} {fname}.bin' utils.shellCommand(objcopy_run).run(cwd=test_dir) self.makehex(f"{test_dir}/{fname}.bin", f"{test_dir}/{fname}.hex") diff --git a/sim/Makefile b/sim/Makefile index 7b698a5..d2bc5e0 100644 --- a/sim/Makefile +++ b/sim/Makefile @@ -36,7 +36,7 @@ firmware/firmware.bin: firmware/firmware.elf chmod -x $@ firmware/firmware.elf: $(FIRMWARE_OBJS) $(TEST_OBJS) firmware/sections.lds - $(TOOLCHAIN_PREFIX)gcc -Os -mabi=ilp32 -march=rv32im -ffreestanding -nostdlib -o $@ \ + $(TOOLCHAIN_PREFIX)gcc -Os -mabi=ilp32 -march=rv32i -ffreestanding -nostdlib -o $@ \ -Wl,--build-id=none,-Bstatic,-T,firmware/sections.lds,-Map,firmware/firmware.map,--strip-debug \ $(FIRMWARE_OBJS) $(TEST_OBJS) -lgcc chmod -x $@