Skip to content

Commit

Permalink
ci: Added support for gvsoc
Browse files Browse the repository at this point in the history
  • Loading branch information
Germain Haugou committed Oct 11, 2024
1 parent 1b9da15 commit 3b4b15d
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 25 deletions.
44 changes: 22 additions & 22 deletions target/snitch_cluster/sw/run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,55 @@

runs:
- elf: tests/build/alias.elf
simulators: [vsim, vcs, verilator] # banshee does not model alias regions
simulators: [vsim, vcs, verilator, gvsoc] # banshee does not model alias regions
- elf: tests/build/atomics.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x4
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x4
- elf: tests/build/barrier.elf
- elf: tests/build/data_mover.elf
- elf: tests/build/dma_empty_transfer.elf
- elf: tests/build/dma_simple.elf
- elf: tests/build/event_unit.elf
- elf: tests/build/fence_i.elf
- elf: tests/build/fp8_comparison_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with segfault
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with segfault
- elf: tests/build/fp8_comparison_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with segfault
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with segfault
- elf: tests/build/fp8_computation_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with JIT issue
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with JIT issue
- elf: tests/build/fp8_computation_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x6
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x6
- elf: tests/build/fp8alt_comparison_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with segfault
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with segfault
- elf: tests/build/fp8alt_comparison_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x10
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x10
- elf: tests/build/fp8alt_computation_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with JIT issue
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with JIT issue
- elf: tests/build/fp8alt_computation_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x12
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x12
- elf: tests/build/fp16_comparison_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x10
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x10
- elf: tests/build/fp16_comparison_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x10
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x10
- elf: tests/build/fp16_computation_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with JIT issue
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with JIT issue
- elf: tests/build/fp16_computation_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x6
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x6
- elf: tests/build/fp16alt_comparison_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x10
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x10
- elf: tests/build/fp16alt_comparison_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x10
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x10
- elf: tests/build/fp16alt_computation_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with JIT issue
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with JIT issue
- elf: tests/build/fp16alt_computation_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x16
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x16
- elf: tests/build/fp32_comparison_scalar.elf
- elf: tests/build/fp32_comparison_vector.elf
- elf: tests/build/fp32_computation_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x2
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x2
- elf: tests/build/fp32_computation_vector.elf
simulators: [vsim, vcs, verilator] # banshee fails with exit code 0x2
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with exit code 0x2
- elf: tests/build/fp32_conversions_scalar.elf
simulators: [vsim, vcs, verilator] # banshee fails with illegal instruction
simulators: [vsim, vcs, verilator, gvsoc] # banshee fails with illegal instruction
# - elf: tests/build/fp64_conversions_scalar.elf
# simulators: [vsim, vcs, verilator]
- elf: tests/build/interrupt_local.elf
Expand All @@ -73,7 +73,7 @@ runs:
retcode: 56
- elf: tests/build/caq.elf
- elf: tests/build/caq_frep.elf
simulators: [vsim, vcs, verilator] # banshee does not model FREP timing
simulators: [vsim, vcs, verilator, gvsoc] # banshee does not model FREP timing
- elf: apps/blas/axpy/build/axpy.elf
cmd: [../../../sw/blas/axpy/scripts/verify.py, "${sim_bin}", "${elf}"]
- elf: apps/blas/gemm/build/gemm.elf
Expand Down
5 changes: 3 additions & 2 deletions target/snitch_cluster/util/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@

sys.path.append(str(Path(__file__).parent / '../../../util/sim'))
import sim_utils # noqa: E402
from Simulator import QuestaSimulator, VCSSimulator, VerilatorSimulator, \
from Simulator import QuestaSimulator, VCSSimulator, VerilatorSimulator, GvsocSimulator, \
BansheeSimulator # noqa: E402


SIMULATORS = {
'vsim': QuestaSimulator(Path(__file__).parent.resolve() / '../bin/snitch_cluster.vsim'),
'vcs': VCSSimulator(Path(__file__).parent.resolve() / '../bin/snitch_cluster.vcs'),
'verilator': VerilatorSimulator(Path(__file__).parent.resolve() / '../bin/snitch_cluster.vlt'),
'banshee': BansheeSimulator(Path(__file__).parent.resolve() / '../src/banshee.yaml')
'banshee': BansheeSimulator(Path(__file__).parent.resolve() / '../src/banshee.yaml'),
'gvsoc': GvsocSimulator(Path(__file__).parent.resolve())
}


Expand Down
21 changes: 21 additions & 0 deletions util/sim/Simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,27 @@ def get_cpu_time(self):
return hours*3600 + minutes*60 + seconds


class GvsocSimulation(Simulation):
"""A functional simulation running on GVSOC."""

def __init__(self, sim_bin=None, cmd=None, **kwargs):
super().__init__(**kwargs)

self.cmd = ['gvsoc', '--target', os.environ.get('GVSOC_TARGET'), '--binary',
str(self.elf), 'run']

def successful(self):
"""Return whether the simulation was successful."""
# On GVSOC, OpenOCD semi-hosting is used which can just report 0 or 1
actual_retcode = self.get_retcode()
if actual_retcode is not None:
if self.expected_retcode != 0:
return int(actual_retcode) != 0
else:
return int(actual_retcode) == 0
else:
return False

class VCSSimulation(QuestaVCSSimulation):
"""An RTL simulation running on VCS."""

Expand Down
19 changes: 18 additions & 1 deletion util/sim/Simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Luca Colagrande <colluca@iis.ee.ethz.ch>

from Simulation import QuestaSimulation, VCSSimulation, VerilatorSimulation, BansheeSimulation
from Simulation import QuestaSimulation, VCSSimulation, VerilatorSimulation, BansheeSimulation, GvsocSimulation


class Simulator(object):
Expand Down Expand Up @@ -96,6 +96,23 @@ def get_simulation(self, test):
cmd=cmd
)

class GvsocSimulator(RTLSimulator):
"""Gvsoc simulator
An [RTL simulator][Simulator.RTLSimulator], identified by the name
`vsim`, tailored to the creation of
[Gvsoc simulations][Simulation.GvsocSimulation].
"""

def __init__(self, binary):
"""Constructor for the GvsocSimulator class.
Arguments:
binary: The Gvsoc simulation binary.
"""
super().__init__(binary, name='gvsoc', simulation_cls=GvsocSimulation)



class VCSSimulator(RTLSimulator):
"""VCS simulator
Expand Down

0 comments on commit 3b4b15d

Please sign in to comment.