public iTLB() { entries = new ulong[BANKS][]; entries[0] = new ulong[ENTRIES]; entries[1] = new ulong[ENTRIES]; entries[2] = new ulong[ENTRIES]; entries[3] = new ulong[ENTRIES]; LRU = new LRU_Manager(ENTRIES, BANKS); }
public Cache(Constants.CACHE_TYPE CacheType) { if (CacheType.Equals(Constants.CACHE_TYPE.iL1Cache)) { SETS = 128; BANKS = 4; BLOCK_SIZE = 64;//bytes TAG_WIDTH = 23; SET_IDX_WIDTH = 7; RecordStat = StatisticsGatherer.RecordiL1CacheAccesses; } else if(CacheType.Equals(Constants.CACHE_TYPE.dL1Cache)) { SETS = 64; BANKS = 8; BLOCK_SIZE = 64;//bytes TAG_WIDTH = 24; SET_IDX_WIDTH = 6; RecordStat = StatisticsGatherer.RecorddL1CacheAccesses; } else if (CacheType.Equals(Constants.CACHE_TYPE.L2Cache)) { SETS = 512; BANKS = 8; BLOCK_SIZE = 64;//bytes TAG_WIDTH = 21; SET_IDX_WIDTH = 9; RecordStat = StatisticsGatherer.RecordL2CacheAccessess; } else { throw new Exception("Passed-in Value is not valid Cache_Type Enumeration. This should not be possible"); } //entries = new byte[BANKS][][]; meta = new uint[BANKS][]; for (int i = 0; i < BANKS; i++) { meta[i] = new uint[SETS]; for (int j = 0; j < SETS; j++) { meta[i][j] = 0; } } LRU = new LRU_Manager(SETS, BANKS); }