In reply to cgales:
In reply to verif_learner:
Sending an individual transaction should not take ‘forever’, so why would you fork two ‘forever’ threads? I would recommend having a discrete send_transaction() task that follows a linear process from start to finish without needing any forks.
Perhaps if you can describe what you are trying to accomplish in greater detail, we can provide an easier solution.
The driver code is implemented as a state machine. One thread deals with the states of the state machine and the other one takes care of output logic.
The issue with straight linear process is that the interface can back pressure randomly and for random intervals. So, imagine checking the status of back pressure after every clock cycle after driving every word of data.
Also, in my experience, state machine is highly readable and hence easy to maintain and easier to extend later to add additional function.