Dear sir,
i have my data stored in queue as id_queue while sending data to DUT. It is described as follows
bit[15:0] id_queue[$]
id_queue= {16’h0001, 16’h0002, 16’h0003, 16’h0004… , 16’hCFFF}
While receiving response from the DUT same id/different id comes in any order. I want to match my response id with the originally sent id(if exists) and delete the same. For that to happen i have tried to match my response id with sent id_queue. But i could not do that.
Can anyone please help me with the same?
In reply to shine2828:
There is no need to store the ID in a seperate queue. Sending a response back to the sequencer requires that you are copying the id_info from the req to the rsp. If your transactions are generated pipelined or out-of-order the rsp will not be received after the req was processed.
In reply to shine2828:
I would use an associative array instead of a queue. Then you can use the built-in exists() and delete() methods.
1 Like
In reply to shine2828:
Dear sir,
i have my data stored in queue as id_queue while sending data to DUT. It is described as follows
bit[15:0] id_queue[$]
id_queue= {16’h0001, 16’h0002, 16’h0003, 16’h0004… , 16’hCFFF}
While receiving response from the DUT same id/different id comes in any order. I want to match my response id with the originally sent id(if exists) and delete the same. For that to happen i have tried to match my response id with sent id_queue. But i could not do that.
Can anyone please help me with the same?
Your logic of matching response ID with sent ID should also work logically.
What is the issue that you are getting?
Thanks,
Suyog
In reply to shine2828:
As dave has suggected associative array is better choice over queue in this scenario, however the queue can be used , it would require more coding to cater the need.
// sample code to do with queue
bit[15:0] id_queue[$];
bit[15:0] exp_id;
bit[15:0] r_queue[$];
int qi[$];
id_queue= {16'h0001, 16'h0002, 16'h0003, 16'h0004,.. 16'hCFFF};
r_queue = id_queue.find (x) with (x == exp_id); if entry exist then it will returnb the element
$display("%p",r_queue);
qi = r_queue.find_index with(item == exp_id); // get the index for deleation of entry
if(r_queue.size) r_queue.delete(qi.pop_front()); // delate the entry that match
else $display("error message"); // if your are using UVM then use uvm_error to print the error message