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

namespace environnement {
namespace cache {
namespace cache_onelevel {

  Address Cache_OneLevel::translate_address (uint32_t address)
  {
    Address  address_translated;
    uint32_t shift;
    
    address_translated.offset  = (address & ((uint32_t)-1 >> (32-(size_address.offset          ))));
    address                   -= address_translated.offset;
    shift                      = size_address.offset;
    address_translated.familly = (address & ((uint32_t)-1 >> (32-(size_address.familly + shift))))>>shift;
    address                   -= address_translated.familly;
    shift                     += size_address.familly;
    address_translated.tag     = (address & ((uint32_t)-1 >> (32-(size_address.tag     + shift))))>>shift;
    
    return address_translated;
  }

};
};
};
