Mailbox and Queues in UVM within components

I have implemented an analysis port between monitor and sequencer in order for me to access the requests through a queue in the sequencer itself. in order to implement pipelined responses to the master. when monitor detects a requests it writes it to the MAILBOX within the SEQUENCER using write method implemented in the sequencer. seems good until now. however when i try to get next item it always pops the item that was lastly pushed into the mailbox as if it was a stack which is the complete opposite of what i wanna do! It seems that the queue/mailbox gets filled with the same item at the same time scope of write method is revisited! Simulator informed me of blocking/nonblocking issue when I changed the implementation from queue to mailbox. but I wasn’t able to detect or know what is going wrong. Here is my code: normal - EDA Playground

If you wanna check my implementation, just visit those three files SSequence.sv, SSequencer.sv, SMonitor.sv. other files are not a problem.
**

Through the command line log below, you can notice through the messages I implemented through various stages of the code. that what is poped is what was previously pushed! it doens’t build up a queue! I thought every time the scope of write method is revisted it acts as if it was automatic.or a stack!**

In reply to haithamx15:

You might have 2 problems.
First, you do not store a copy of your seq_item, i.e. if you are generating a new one the old one will be overwitten.
Secondly, I do not understand why you are using a mailboy or a queue. You do not need a storage elemenr there. A seq_item will be generated in 8 time, i,e, it is immediately available when you need one.

In reply to chr_sue:

In reply to haithamx15:
You might have 2 problems.
First, you do not store a copy of your seq_item, i.e. if you are generating a new one the old one will be overwitten.
Secondly, I do not understand why you are using a mailboy or a queue. You do not need a storage elemenr there. A seq_item will be generated in 8 time, i,e, it is immediately available when you need one.

I should take responses from master and generate the responses with delay to enable pipelining i should store the requests that are being sent by master while waiting for item done from driver then i pop the request that followed the response or requests that have already been pushed into queuem im still beginner in uvm. i dont know if this is the appropriate way of doing this.

In reply to chr_sue:

In reply to haithamx15:
You might have 2 problems.
First, you do not store a copy of your seq_item, i.e. if you are generating a new one the old one will be overwitten.
Secondly, I do not understand why you are using a mailboy or a queue. You do not need a storage elemenr there. A seq_item will be generated in 8 time, i,e, it is immediately available when you need one.

The problem is that I inserted a delay between sequence, item_done will not be sent to the slave sequence until the delay has passed, during this time i must be taking requests from master but because of the delay and item done not being available at the same clock cycle, i used a queue and recorded the requests in the slave monitor and passed them to slave sequence through the sequencer.

In reply to haithamx15:

If you need this delay I’d not insert this prior to item_done. You could insert your delay also before starting the processing of the next item.

In reply to chr_sue:

In reply to haithamx15:
If you need this delay I’d not insert this prior to item_done. You could insert your delay also before starting the processing of the next item.

But, how will I able to generate the response sequence of requests recieved if I don’t store them anywhere, wait_for_item_done is blocking, even if I provide item done from driver without the delay, where will the requested value be stored. it will try to send_request(req) before driver is officially done driving signals. it will send requests prematurely.

In reply to chr_sue:

In reply to haithamx15:
If you need this delay I’d not insert this prior to item_done. You could insert your delay also before starting the processing of the next item.

This is what I’m trying to do.

As long SCmdAccept is high i should be able to generate the response sequences and provide them to driver. two concurrent processes.

I was able to fix it with one line of code.
I performed deep copy to every new packet I push into the queue.
thanks for chr_sue for giving me a hint of where the problem is. all objects in the queue were pointing at same location.