Multi dimensional array

Hi,

I am looking for a data type which is associative in nature for populating expected data for Scoreboarding.

Scenario -
For every request, I can get upto 2 responses.
Upon detecting the valid request in Scoreboard, my expected response array should look something like below -
req_A → exp_Rsp_A_1 , exp_Rsp_A_2
req_B → exp_Rsp_B_1 , exp_Rsp_B_2 …

Whenever I get response, I should be able to delete the expected response array entries and make sure at the end of the simulation, the array size becomes 0.

Where I am stuck?
logic [5:0] exp_resp [req_id] [1:0] → This works for me but this is not helping to track individual responses i.e. I cannot delete exp_resp[req_id][0] and exp_resp[req_id][1] as the second dimension of the array is static.

Any suggestions is very much appreciated.

In reply to naveensv:
Not sure why you have logic[5:0] for exp_resp but if you putting expected response on those
tracker then it must be some kind of class.

Based on my understanding of your problem I can suggest something like below.

resp_type req_tracker[int][$] 

//On every request push expected response in queue with req_id as index. 
function update_tracker_on_request() 
  req_tracker[req_id].push_back(exp_resp_X1)
  req_tracker[req_id].push_back(exp_resp_X2)

//On every response find index with matching expected response and 
//delete that index.  
function update_tracker_on_response()
  result = req_tracker[req_id].find_index with (item == rx_resp)
  //not sure if you have case where both expected response will match.
  //but assuming not. 
  if result.size() != 1 : throw an error  
  else {
    req_tracker[req_id].delete(result[0])
  }
  if req_tracker[req_id].size() == 0 {
    req_tracker.delete(req_id)
  }

//Check req tracker must be empty at end.  
function end_of_test(..)
  if req_tracker.size() != 0 : throw an error.

In reply to Vinay Jain:

Thanks Vinay.
Reason for having logic[5:0] is because the expected responses are basically opcodes which are of 6 bits wide.
I will go with queues.

logic [5:0] exp_resp [req_id] [$];

Using queues will help in verifying the order of responses as well :)

Regards,
Naveen