Skip to content

Commit

Permalink
try to use singularity for verilator
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanlippuner committed Nov 4, 2023
1 parent ff683b9 commit 0f9bad7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.simg
11 changes: 11 additions & 0 deletions .github/verilator_singularity
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

IMAGE='verilator/verilator:v5.018'
FILE=$(dirname $0)/verilator.simg

if [ ! -f $FILE ]; then
singularity pull $FILE docker://$IMAGE
fi

export LC_ALL="C"
singularity run $FILE $@
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ jobs:
name: Generation
runs-on: ubuntu-22.04
steps:
- uses: eWaterCycle/setup-singularity@v7
with:
singularity-version: 3.8.7

- name: Checkout sources
uses: actions/checkout@v4

- name: Install Tools
run: sudo apt-get install ghdl verilator
run: sudo apt-get install ghdl

- name: Setup Python venv
run: |
Expand All @@ -22,6 +26,7 @@ jobs:
- name: Test Generation
run: |
export VERILATOR=$(pwd)/.github/verilator_singularity
cd proto
python3 tests.py
Expand Down
7 changes: 6 additions & 1 deletion proto/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,13 @@ def test_hdl_ref():
if res.returncode != 0:
error('VHDL elaboration failed for {}'.format(f))


if 'VERILATOR' in os.environ:
verilator_cmd = os.environ['VERILATOR']
else:
verilator_cmd = 'verilator'
sv_pkgs = [srcdir + 'tb/dpssram.sv', srcdir + 'tb/wishbone_pkg.sv']
res = subprocess.run(['verilator', '--lint-only', '--top-module', top_entity] + sv_pkgs + [sv_file])
res = subprocess.run([verilator_cmd, '--lint-only', '--top-module', top_entity] + sv_pkgs + [sv_file])
if res.returncode != 0:
error('SV elaboration failed for {}'.format(f))

Expand Down

0 comments on commit 0f9bad7

Please sign in to comment.