Jump to content

Recommended Posts

Posted

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.

  • 2 months later...
Posted

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...