How do I test for a transaction available in a sequence_item_port of a driver

In all of my previous simulations I had always added idle cycles to a bus in between transactions. This is with my CPU interface. This was always the same number, so I have a idle member in my seq_item class. However now I need to be able vary this. So I am going to set the idle parameter to 0 and delay the next transaction in the sequence class. My driver class has been modified to leave the “pins” in an active state if the idle member of the transaction is 0. If it is greater than 0, then it puts the bus in an idle state. The driver uses the sequence_item_port.get() method to get the next transaction but with now the next transaction is not guaranteed to be available. How do I check to see if a transaction is available so that if one is not, I can put the bus in an idle state for 1 clock cycle and check again? Below is the section of the driver using the get method

forever
    begin
        seq_item_port.get(req);

In reply to bbushart:

The get modthod is blocking until a sequence item req is available. You do not to have to check for this explicitly.

In reply to chr_sue:

What I want to do is replace the get method with a non-blocking method so that if there isn’t a transaction available I can put the bus in an idle state.

In reply to bbushart:

Then you should use the try_get. Note this is a function which returns 0 if there is no transaction. But I believe this is not a good idea. You should have transactions with the state idle.