Related to queue

my queue has 12 entries… every entry contains {id.address}. i want to pop back and want to read address only (means first index only) everytime.

i am saving like:
RADDR_Q.push_front({axi_vif.id,axi_vif.address});

i am trying to fetch index-1 value like:
RADDR_Q.pop_back[1];

is it right?
as it’s not showing error but data is also not coming

In reply to Er. Shipra:

what do you mean “pop back and want to read address only (means first index only)”?
“pop back” → remove from tail
“read address (first index only)” → read head item



module automatic test;
  function void run;
    typedef struct {int addr; int data;} item;
    item q[$];
    item tmp, tmp1;
    // init q has 12 entries
    repeat(12) begin
      tmp.addr = $urandom_range(10, 0);
      tmp.data = $urandom_range(200, 100);
      q.push_back(tmp);
    end
    // read the first item's addr from head and won't change q structure
    $display("ans:%0d", q[0].addr);
    // remove an item from tail
    tmp1 = q.pop_back();
    $display("tmp1:%p", tmp1);
  endfunction
  initial run();
endmodule