Implementation of Queue to mimic mailbox in SV testbench

In reply to dave_59:

Thanks Dave,

I have following questions to above :

  1. When you say unconnected gen2driv queues : you mean that - if in the generator, queue.push_back(transaction) is being implemented – the queue in the environment class will not be filled ?

  2. Is the queue definition correct? i.e. Here i am defining a queue of transaction class objects. So as per your suggestion :

class mymailbox;

transaction gen2driv[$];  //Is this definition correct ?

task push(transaction tr); . //Is this correct way of passing my transaction class objects
gen2driv.push_back(tr);
endtask

task transaction get();
transaction tr1 = gen2driv.pop_front();
return tr1;
endtask

endclass

Looking forward to your reply.