Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving tool installation to step prior to matrix generation #70

Merged
merged 10 commits into from
May 4, 2023
109 changes: 83 additions & 26 deletions .github/workflows/build-test-verilator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,9 @@ on:
workflow_dispatch:

jobs:
build_matrix:
name: Build Smoke Test matrix
runs-on: ubuntu-22.04
outputs:
test_names: ${{ steps.output-matrix.outputs.test_names }}
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
sudo apt-get update -qy && sudo apt-get install -qy --no-install-recommends \
python3-minimal python3-yaml
- name: Build matrix
id: output-matrix
run: |
echo "test_names=$(python3 .github/scripts/build_tests_matrix.py)" >> $GITHUB_OUTPUT

build_and_test:
name: Verilator Smoke Test
build_tools:
name: Build Tools
runs-on: ubuntu-22.04
needs: build_matrix

strategy:
fail-fast: false
matrix:
test_name: ${{fromJSON(needs.build_matrix.outputs.test_names)}}

env:
CARGO_INCREMENTAL: 0
Expand Down Expand Up @@ -135,14 +113,93 @@ jobs:
path: /opt/riscv
key: riscv-${{ env.RISCV_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}

- name: Setup riscv path
run: |
echo /opt/riscv/bin >> $GITHUB_PATH

build_matrix:
name: Build Smoke Test matrix
runs-on: ubuntu-22.04
needs: build_tools
outputs:
test_names: ${{ steps.output-matrix.outputs.test_names }}
steps:
- uses: actions/checkout@v3
- name: Install deps
run: |
sudo apt-get update -qy && sudo apt-get install -qy --no-install-recommends \
python3-minimal python3-yaml
- name: Build matrix
id: output-matrix
run: |
echo "test_names=$(python3 .github/scripts/build_tests_matrix.py)" >> $GITHUB_OUTPUT

build_and_test:
name: Verilator Smoke Test
runs-on: ubuntu-22.04
needs: build_matrix

strategy:
fail-fast: false
matrix:
test_name: ${{fromJSON(needs.build_matrix.outputs.test_names)}}

env:
# TODO: is there a way to grab these from build_tools?
CARGO_INCREMENTAL: 0
SCCACHE_VERSION: 0.3.3
RISCV_VERSION: v12.1.0
# TODO: To update to 5.006, clean up lint errors
VERILATOR_VERSION: v5.002
PKG_CONFIG_PATH: /opt/verilator/share/pkgconfig
SCCACHE_GHA_CACHE_TO: sccache-verilator-10000
SCCACHE_GHA_CACHE_FROM: sccache-verilator-
# Change this to a new random value if you suspect the cache is corrupted
SCCACHE_C_CUSTOM_CACHE_BUSTER: f3e6951f0c1d

steps:
- uses: actions/checkout@v3
with:
submodules: 'true'

- name: Restore Cargo index
uses: actions/cache/restore@v3
id: cargo_index_restore
with:
path: ~/.cargo/registry/index
key: cargo-index-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}-${{ hashFiles('Cargo.lock') }}

- name: Restore sccache binary
uses: actions/cache/restore@v3
id: sccache_bin_restore
with:
path: ~/.cargo/bin/sccache
key: sccache-bin-${{ env.SCCACHE_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}

- name: Restore verilator dir
uses: actions/cache/restore@v3
id: verilator_restore
with:
path: /opt/verilator
key: verilator-${{ env.VERILATOR_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}

- name: Restore Risc V Toolchain
uses: actions/cache/restore@v3
id: riscv_restore
with:
path: /opt/riscv
key: riscv-${{ env.RISCV_VERSION }}-${{ env.SCCACHE_C_CUSTOM_CACHE_BUSTER }}

- name: Setup verilator path
run: |
echo /opt/verilator/bin >> $GITHUB_PATH

- name: Setup riscv path
run: |
echo /opt/riscv/bin >> $GITHUB_PATH

- name: Run Caliptra Verilator Smoke Test
run: |
# TODO: Add the run_verilator_l0_regression.py script.
# Running a simple test to make sure that there aren't any elaboration issues
CALIPTRA_ROOT=$(pwd)
cd tools/scripts
make verilator CALIPTRA_ROOT=$CALIPTRA_ROOT TESTNAME=${{ matrix.test_name }}
6 changes: 3 additions & 3 deletions src/integration/tb/caliptra_top_tb_services.sv
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ module caliptra_top_tb_services
cycleCnt <= cycleCnt+1;
// Test timeout monitor
if(cycleCnt == MAX_CYCLES && !UVM_TB) begin
$display ("Hit max cycle count (%0d) .. stopping",cycleCnt);
$error("Hit max cycle count (%0d) .. stopping",cycleCnt);
dump_memory_contents(MEMTYPE_LMEM, 32'h8000_0110, 32'h8000_0180);
dump_memory_contents(MEMTYPE_DCCM, `RV_DCCM_SADR, `RV_DCCM_EADR);
dump_memory_contents(MEMTYPE_ICCM, `RV_ICCM_SADR, `RV_ICCM_EADR);
Expand Down Expand Up @@ -528,12 +528,12 @@ module caliptra_top_tb_services
if (UVM_TB) $info("INFO: Detected FW write to manually end the test with FAIL; ignoring since the UVM environment will handle this.");
else begin
cycleCntKillReq <= cycleCnt;
$display("* TESTCASE FAILED");
$error("* TESTCASE FAILED");
$display(" -- Extending simulation for 100 clock cycles to capture ending waveform");
end
end
if (|cycleCntKillReq && (cycleCnt == (cycleCntKillReq + 100))) begin
$display("Dumping memory contents at simulation end due to FAILURE");
$error("Dumping memory contents at simulation end due to FAILURE");
dump_memory_contents(MEMTYPE_LMEM, 32'h0000_0000, 32'h001_FFFF);
dump_memory_contents(MEMTYPE_DCCM, `RV_DCCM_SADR, `RV_DCCM_EADR);
dump_memory_contents(MEMTYPE_ICCM, `RV_ICCM_SADR, `RV_ICCM_EADR);
Expand Down
8 changes: 3 additions & 5 deletions src/soc_ifc/rtl/soc_ifc_top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,9 @@ assign timer2_en = soc_ifc_reg_hwif_out.CPTRA_WDT_TIMER2_EN.timer2_en;
assign timer1_restart = soc_ifc_reg_hwif_out.CPTRA_WDT_TIMER1_CTRL.timer1_restart;
assign timer2_restart = soc_ifc_reg_hwif_out.CPTRA_WDT_TIMER2_CTRL.timer2_restart;

always_comb begin
for (int i = 0; i < WDT_TIMEOUT_PERIOD_NUM_DWORDS; i++) begin
timer1_timeout_period[i] = soc_ifc_reg_hwif_out.CPTRA_WDT_TIMER1_TIMEOUT_PERIOD[i].timer1_timeout_period.value;
timer2_timeout_period[i] = soc_ifc_reg_hwif_out.CPTRA_WDT_TIMER2_TIMEOUT_PERIOD[i].timer2_timeout_period.value;
end
for (genvar i = 0; i < WDT_TIMEOUT_PERIOD_NUM_DWORDS; i++) begin
assign timer1_timeout_period[i] = soc_ifc_reg_hwif_out.CPTRA_WDT_TIMER1_TIMEOUT_PERIOD[i].timer1_timeout_period.value;
assign timer2_timeout_period[i] = soc_ifc_reg_hwif_out.CPTRA_WDT_TIMER2_TIMEOUT_PERIOD[i].timer2_timeout_period.value;
end

//Set WDT status reg
Expand Down