#include "../include/Cache_OneLevel.h"

namespace environment {
namespace cache {
namespace cache_onelevel {

  // return the number of param->associativity if hit
  // return nb_accosiativity if miss
  uint32_t Cache_OneLevel::hit_access_port (uint32_t trdid, Address address)
  {
    uint32_t it_num_port = 0;
    
    // scan all port - test if have a transaction
    for (it_num_port = 0; it_num_port < param->nb_port; it_num_port ++)
      if ( (access_port[it_num_port].valid           == true           ) &&
	   (access_port[it_num_port].trdid           == trdid          ) &&
	   (access_port[it_num_port].address.tag     == address.tag    ) &&
	   (access_port[it_num_port].address.familly == address.familly))
	break;
    
    return it_num_port;
  }

};
};
};
