StefanoEsposito Posted October 23, 2019 Report Posted October 23, 2019 Hello all, we are trying to use the grab/ungrab mechanism in a TB and are experiencing some issue. The problem is that if more than one sequence require a lock/grab on an already locked sequencer, they will be all granted at the same time when the sequencer is released by the grabbing sequence. Doe anybody have some hints for a solution/workaround? It should be possible to replicate the issue by having three unrelated sequences all grabbing the sequencer in parallel. The first will grab and execute as expected, the other two will be granted as soon as the first one un-grabs the sequence. Thanks, Stefano. Quote
Lawrence Said Posted January 3, 2020 Report Posted January 3, 2020 In our testbench we use a semaphore around grab/ungrab calls. So all our grab/ungrab calls look like some_pkg::sem[sqcr].get() sqcr.grab(seq) // do whatever you need sqcr.ungrab(seq) some_pkg::sem[sqcr].put() The semaphore is static and is per sqcr (an associative array). It's ugly, but it was necessary to prevent this and also other issues like deadlock. You have to be careful though, if the thread getting the semaphore is killed you could also shoot yourself in the foot and cause a deadlock since the semaphore is never returned. In that case you need to get even more sophisticated and have some daemon that monitors active owners of the semaphore and detects when those threads are killed, but that's getting a little too involved Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.