pulp-platform / snitch_cluster

An energy-efficient RISC-V floating-point compute cluster.
https://pulp-platform.github.io/snitch_cluster/
Apache License 2.0
52 stars 55 forks source link

ipc: Handle failing RTL simulations #97

Closed colluca closed 9 months ago

colluca commented 9 months ago

Bug diagnosis

If the SnitchSim instance is waiting on a read() from the pipe to the simulation, and the RTL simulation terminates prematurely (e.g. due to a fatal assertion failure), the SnitchSim instance would block on the read() and any verification script based on it would not terminate.

Fix

When the simulation subprocess is spawned, a separate thread is created to monitor it. If the simulation terminates prematurely, the monitor will notice and send a SIGINT signal to interrupt the read(). The signal is handled by the main thread which will stop the simulation monitor, communicate the cause of the failure and gracefully terminate the verification script.