cocotb: Looping with First cause segmentation fault (modelsim)

Hello,

I am writing a test-bench to parse an asynchronous signal. Among the various checks, I need to get whether the monitored signal shows a rising edge, a falling edge or simply never arrive (timeout) transition. To achieve this I used the cocotb.triggers.First method.

When I yield this method in a for loop I always get a segmentation error after the first few iterations.

I attached a simple counter test to reproduce the issue. I think it is related to the way the scheduler cleans up the not-yet-fired triggers in the First method list (I do not understand a lot of the code behind its implementation).

dummy_counter.zip

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 20 (20 by maintainers)

Most upvoted comments

Should I ever manage to miraculously debug code in python, would it be worth to add the procedure to the Troubleshooting section of the CoCoTb guide?

Ok will make a pull request to update the guide.

Btw I managed to connect to a debugger in remote (I report the receipt for your convenience):

  1. Install remote_pdb python package
  2. In the file to be debugged define a remote breakpoint:
from remote_pdb import RemotePdb
RemotePdb('127.0.0.1', 4444).set_trace()
  1. open the simulator with GUI=1
  2. open a terminal and connect through telnet:
telnet.exe 127.0.0.1 4444

At this point you should see a pdb instance being opened.