Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move run_vltr check to pre-run-check and share result to all Verilato…
Browse files Browse the repository at this point in the history
…r-based workflows
calebofearth committed Jan 22, 2025
1 parent a04dcdd commit d1f8acd
Showing 4 changed files with 111 additions and 56 deletions.
70 changes: 14 additions & 56 deletions .github/workflows/build-test-verilator.yml
Original file line number Diff line number Diff line change
@@ -6,6 +6,12 @@ on:
push:
branches: ["main", "dev-goog", "dev-msft"]
workflow_call:
inputs:
run_vltr:
description: "Control parameter indicating if Verilator tests should be run or skipped"
required: true
type: string
default: 'true'
workflow_dispatch:

env:
@@ -20,52 +26,10 @@ env:
SCCACHE_C_CUSTOM_CACHE_BUSTER: f3e6951f0c1e

jobs:
# Verilator is always run outside of the Pull Request context.
# For Pull Requests, conditionally run based on evaluation of
# modified file set
evaluate_if_run:
name: Evaluate if Verilator Will Run
runs-on: ubuntu-22.04
outputs:
run_vltr: ${{ steps.do_decide.outputs.run }}
env:
DO_EVAL: ${{ github.event_name == 'pull_request' }}

steps:
- uses: actions/checkout@v3
if: ${{ env.DO_EVAL == 'true' }}
with:
submodules: 'true'

# If any non-documentation files have been modified as part of a
# Pull Request, run the Verilator checks
# Otherwise, skip Verilator
- name: Do Git Diff
id: do_git_diff
if: ${{ env.DO_EVAL == 'true' }}
run: |
if [[ -n "$(git diff --name-only --merge-base ${{ github.event.pull_request.base_ref }} | grep -v '\\.md\\|\\.png\\|\\.github\\/workflows')" ]]; then
echo "src_mods=true" >> "${GITHUB_OUTPUT}"
else
echo "src_mods=false" >> "${GITHUB_OUTPUT}"
fi
- name: Decide
id: do_decide
run: |
if [[ "${{ env.DO_EVAL }}" == "false" ]]; then
echo "run=true" >> "${GITHUB_OUTPUT}"
elif [[ "${{ steps.do_git_diff.outputs.src_mods }}" == "true" ]]; then
echo "run=true" >> "${GITHUB_OUTPUT}"
else
echo "run=false" >> "${GITHUB_OUTPUT}"
fi
build_tools:
name: Build Tools
runs-on: ubuntu-22.04
needs: evaluate_if_run
if: ${{ needs.evaluate_if_run.outputs.run_vltr == 'true' }}
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}

steps:
- uses: actions/checkout@v3
@@ -160,10 +124,8 @@ jobs:
build_matrix:
name: Build Smoke Test matrix
runs-on: ubuntu-22.04
needs:
- build_tools
- evaluate_if_run
if: ${{ needs.evaluate_if_run.outputs.run_vltr == 'true' }}
needs: build_tools
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
outputs:
test_names: ${{ steps.output-matrix.outputs.test_names }}
env:
@@ -182,10 +144,8 @@ jobs:
build_and_test:
name: Verilator
runs-on: ubuntu-22.04
needs:
- build_matrix
- evaluate_if_run
if: ${{ needs.evaluate_if_run.outputs.run_vltr == 'true' }}
needs: build_matrix
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}

strategy:
fail-fast: false
@@ -248,16 +208,14 @@ jobs:
verify_test_results:
name: Verify Verilator Test Results
runs-on: ubuntu-22.04
needs:
- build_and_test
- evaluate_if_run
needs: build_and_test
# Force to run even if the build_and_test job is skipped for any reason
if: ${{ !cancelled() }}
steps:
- name: Print Verilator Aggregated Result
run: |
echo "Run Verilator check has a result of [${{ needs.evaluate_if_run.outputs.run_vltr }}]"
if [[ "${{ needs.evaluate_if_run.outputs.run_vltr }}" != "true" ]]; then
echo "Run Verilator check has a result of [${{ on.workflow_call.inputs.run_vltr }}]"
if [[ "${{ on.workflow_call.inputs.run_vltr }}" == "false" ]]; then
exit 0
fi
echo "build_and_test has a result of [${{ needs.build_and_test.result }}]"
43 changes: 43 additions & 0 deletions .github/workflows/interactive-debugging.yml
Original file line number Diff line number Diff line change
@@ -6,12 +6,19 @@ on:
push:
branches: ["main", "dev-goog", "dev-msft", "dev-public"]
workflow_call:
inputs:
run_vltr:
description: "Control parameter indicating if Verilator tests should be run or skipped"
required: true
type: string
default: 'true'
workflow_dispatch:

jobs:
build_verilator:
name:
runs-on: ubuntu-22.04
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}

env:
CARGO_INCREMENTAL: 0
@@ -90,6 +97,7 @@ jobs:
build_openocd:
name:
runs-on: ubuntu-22.04
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}

env:
CARGO_INCREMENTAL: 0
@@ -182,47 +190,55 @@ jobs:
steps:

- name: Install Risc V Toolchain
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
# Building from source takes around 6.65 GB of disk and download size
wget -O toolchain.tar.gz https://github.com/chipsalliance/caliptra-tools/releases/download/gcc-v12.1.0/riscv64-unknown-elf.gcc-12.1.0.tar.gz
tar -xzf toolchain.tar.gz -C /opt/
- name: Install dependencies
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
# For some reason GDB requires libpython3.8.so
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update -qy && sudo apt install -qy --no-install-recommends \
libpython3.8
- name: Download Verilator binaries
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
uses: actions/download-artifact@v4
with:
name: verilator
path: /opt

- name: Download OpenOCD binaries
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
uses: actions/download-artifact@v4
with:
name: openocd
path: /opt

- name: Unpack binaries
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
pushd /opt
tar -zxvf verilator.tar.gz
tar -zxvf openocd.tar.gz
popd
- name: Setup path
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
echo /opt/riscv/bin:/opt/verilator/bin:/opt/openocd/bin >> $GITHUB_PATH
- name: Clone repository
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
uses: actions/checkout@v3
with:
submodules: 'true'

- name: Build Verilated simulation
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
@@ -232,6 +248,7 @@ jobs:
make -C run -f ${CALIPTRA_ROOT}/tools/scripts/Makefile program.hex TESTNAME=infinite_loop
- name: Test core register access
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
@@ -240,6 +257,7 @@ jobs:
/bin/bash -c 'cd ${CALIPTRA_ROOT}/src/integration/test_suites/infinite_loop && ./dump_and_compare.sh'
- name: Test memory access
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
@@ -248,13 +266,21 @@ jobs:
/bin/bash -c 'cd ${CALIPTRA_ROOT}/src/integration/test_suites/infinite_loop && ./mem_access.sh'
- name: Test peripheral access
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
cd run
${CALIPTRA_ROOT}/.github/scripts/gdb_test.sh \
/bin/bash -c 'cd ${CALIPTRA_ROOT}/src/integration/test_suites/infinite_loop && ./peripheral_access.sh'
- name: Generate result
run: |
if [[ "${{ on.workflow_call.inputs.run_vltr }}" == 'true' ]]; then
echo "Reporting a passing status after skipping [${{ github.job }}] due to run_vltr: [${{ on.workflow_call.inputs.run_vltr }}]"
exit 0
fi
openocd_tests:
name: Run OpenOCD debugging tests
runs-on: ubuntu-22.04
@@ -268,40 +294,47 @@ jobs:
steps:

- name: Install Risc V Toolchain
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
# Building from source takes around 6.65 GB of disk and download size
wget -O toolchain.tar.gz https://github.com/chipsalliance/caliptra-tools/releases/download/gcc-v12.1.0/riscv64-unknown-elf.gcc-12.1.0.tar.gz
tar -xzf toolchain.tar.gz -C /opt/
- name: Download Verilator binaries
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
uses: actions/download-artifact@v4
with:
name: verilator
path: /opt

- name: Download OpenOCD binaries
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
uses: actions/download-artifact@v4
with:
name: openocd
path: /opt

- name: Unpack binaries
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
pushd /opt
tar -zxvf verilator.tar.gz
tar -zxvf openocd.tar.gz
popd
- name: Setup path
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
echo /opt/riscv/bin:/opt/verilator/bin:/opt/openocd/bin >> $GITHUB_PATH
- name: Clone repository
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
uses: actions/checkout@v3
with:
submodules: 'true'

- name: Build Verilated simulation
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
@@ -311,6 +344,7 @@ jobs:
make -C run -f ${CALIPTRA_ROOT}/tools/scripts/Makefile program.hex TESTNAME=infinite_loop
- name: Test peripheral access with core in reset
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
@@ -320,6 +354,7 @@ jobs:
-f ${CALIPTRA_ROOT}/src/integration/test_suites/infinite_loop/peripheral_access.tcl
- name: Build Verilated simulation
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
@@ -329,10 +364,18 @@ jobs:
make -C run -f ${CALIPTRA_ROOT}/tools/scripts/Makefile program.hex TESTNAME=infinite_loop
- name: Test JTAG access with clock gating
if: ${{ on.workflow_call.inputs.run_vltr == 'true' }}
run: |
export CALIPTRA_ROOT=$(pwd)
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
cd run
${CALIPTRA_ROOT}/.github/scripts/openocd_test.sh \
-f board/caliptra-verilator.cfg \
-f ${CALIPTRA_ROOT}/src/integration/test_suites/infinite_loop/jtag_cg.tcl
- name: Generate result
run: |
if [[ "${{ on.workflow_call.inputs.run_vltr }}" == 'true' ]]; then
echo "Reporting a passing status after skipping [${{ github.job }}] due to run_vltr: [${{ on.workflow_call.inputs.run_vltr }}]"
exit 0
fi
48 changes: 48 additions & 0 deletions .github/workflows/pre-run-check.yml
Original file line number Diff line number Diff line change
@@ -16,6 +16,12 @@ on:
type: string
default: 'main'
workflow_call:
outputs:
run_vltr:
description: "Control parameter indicating if Verilator tests should be run or skipped"
required: true
type: string
value: ${{ jobs.evaluate_if_run.outputs.run_vltr }}

env:
MSFT_ACTORS: ( "Nitsirks" "calebofearth" "mojtaba-bisheh" "anjpar" "upadhyayulakiran" "nileshbpat" "ekarabu" )
@@ -218,3 +224,45 @@ jobs:
export CALIPTRA_ROOT=$GITHUB_WORKSPACE
export ADAMSBRIDGE_ROOT=$CALIPTRA_ROOT/submodules/adams-bridge
$GITHUB_WORKSPACE/.github/scripts/pr_rdl_check.sh "origin/$TARGET_BR"
# Verilator is always run outside of the Pull Request context.
# For Pull Requests, conditionally run based on evaluation of
# modified file set
evaluate_if_run:
name: Evaluate if Verilator Will Run
runs-on: ubuntu-22.04
outputs:
run_vltr: ${{ steps.do_decide.outputs.run }}
env:
DO_EVAL: ${{ github.event_name == 'pull_request' }}

steps:
- uses: actions/checkout@v4
if: ${{ env.DO_EVAL == 'true' }}
with:
submodules: 'true'

# If only documentation files have been modified as part of a
# Pull Request, skip the Verilator checks
# Otherwise, run Verilator
- name: Do Git Diff
id: do_git_diff
if: ${{ env.DO_EVAL == 'true' }}
run: |
if [[ -n "$(git diff --name-only --merge-base ${{ github.event.pull_request.base_ref }} | grep -v '\\.md\\|\\.png\\|\\.github\\/workflows')" ]]; then
echo "src_mods=true" >> "${GITHUB_OUTPUT}"
else
echo "src_mods=false" >> "${GITHUB_OUTPUT}"
fi
- name: Decide
id: do_decide
run: |
if [[ "${{ env.DO_EVAL }}" == "false" ]]; then
echo "run=true" >> "${GITHUB_OUTPUT}"
elif [[ "${{ steps.do_git_diff.outputs.src_mods }}" == "true" ]]; then
echo "run=true" >> "${GITHUB_OUTPUT}"
else
echo "run=false" >> "${GITHUB_OUTPUT}"
fi
6 changes: 6 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -14,8 +14,14 @@ jobs:
uses: ./.github/workflows/pre-run-check.yml
verilator:
uses: ./.github/workflows/build-test-verilator.yml
needs: pre_run
with:
run_vltr: ${{ needs.pre_run.outputs.run_vltr }}
interactive_dbg:
uses: ./.github/workflows/interactive-debugging.yml
needs: pre_run
with:
run_vltr: ${{ needs.pre_run.outputs.run_vltr }}
doc_gen:
uses: ./.github/workflows/doc-gen.yml
permissions:

0 comments on commit d1f8acd

Please sign in to comment.