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.