rohd-cosim icon indicating copy to clipboard operation
rohd-cosim copied to clipboard

Resolve race condition in RohdConnector during interactive debug and SV timeout

Open mkorbel1 opened this issue 2 years ago • 0 comments

There is a block of code in rohd_connector.py which is designed to detect whether there was a timeout waiting for the SystemVerilog simulator to complete a tick:

            if not ready_to_read and self.mid_tick:
                # not necessarily an error, since maybe SV simulator called $finish
                print('Timeout waiting for tick to complete in Simulator!', flush=True)
                self.shutdown()
                break

This code is only necessary because sometimes simulators appear to not properly indicate to cocotb that the simulation has ended, so a graceful shutdown cannot be achieved (https://github.com/cocotb/cocotb/issues/3121).

The race condition appears if ROHD is being interactively debugged and fails to send the entirety of a tick's information (i.e. not ready_to_read) even though a tick is ongoing (i.e. self.mid_tick).

For most users, unless actively debugging ROHD Cosim itself, this will not be often hit.

mkorbel1 avatar Feb 08 '23 16:02 mkorbel1