base_set_assoc.cc (12679:6c416cb3ca06) | base_set_assoc.cc (12684:44ebd2bc020f) |
---|---|
1/* 2 * Copyright (c) 2012-2014 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 36 unchanged lines hidden (view full) --- 45 * Definitions of a base set associative tag store. 46 */ 47 48#include "mem/cache/tags/base_set_assoc.hh" 49 50#include <string> 51 52#include "base/intmath.hh" | 1/* 2 * Copyright (c) 2012-2014 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 36 unchanged lines hidden (view full) --- 45 * Definitions of a base set associative tag store. 46 */ 47 48#include "mem/cache/tags/base_set_assoc.hh" 49 50#include <string> 51 52#include "base/intmath.hh" |
53#include "sim/core.hh" | |
54 55BaseSetAssoc::BaseSetAssoc(const Params *p) 56 :BaseTags(p), assoc(p->assoc), allocAssoc(p->assoc), 57 blks(p->size / p->block_size), 58 numSets(p->size / (p->block_size * p->assoc)), 59 sequentialAccess(p->sequential_access), 60 sets(p->size / (p->block_size * p->assoc)), 61 replacementPolicy(p->replacement_policy) --- 25 unchanged lines hidden (view full) --- 87 BlkType*& blk = sets[i].blks[j]; 88 89 // Locate next cache block 90 blk = &blks[blkIndex]; 91 92 // Associate a data chunk to the block 93 blk->data = &dataBlks[blkSize*blkIndex]; 94 | 53 54BaseSetAssoc::BaseSetAssoc(const Params *p) 55 :BaseTags(p), assoc(p->assoc), allocAssoc(p->assoc), 56 blks(p->size / p->block_size), 57 numSets(p->size / (p->block_size * p->assoc)), 58 sequentialAccess(p->sequential_access), 59 sets(p->size / (p->block_size * p->assoc)), 60 replacementPolicy(p->replacement_policy) --- 25 unchanged lines hidden (view full) --- 86 BlkType*& blk = sets[i].blks[j]; 87 88 // Locate next cache block 89 blk = &blks[blkIndex]; 90 91 // Associate a data chunk to the block 92 blk->data = &dataBlks[blkSize*blkIndex]; 93 |
94 // Associate a replacement data entry to the block 95 blk->replacementData = replacementPolicy->instantiateEntry(); 96 |
|
95 // Setting the tag to j is just to prevent long chains in the 96 // hash table; won't matter because the block is invalid 97 blk->tag = j; 98 99 // Set its set and way 100 blk->set = i; 101 blk->way = j; 102 103 // Update block index 104 ++blkIndex; 105 } 106 } 107} 108 | 97 // Setting the tag to j is just to prevent long chains in the 98 // hash table; won't matter because the block is invalid 99 blk->tag = j; 100 101 // Set its set and way 102 blk->set = i; 103 blk->way = j; 104 105 // Update block index 106 ++blkIndex; 107 } 108 } 109} 110 |
111void 112BaseSetAssoc::invalidate(CacheBlk *blk) 113{ 114 BaseTags::invalidate(blk); 115 116 // Invalidate replacement data 117 replacementPolicy->invalidate(blk->replacementData); 118} 119 |
|
109CacheBlk* 110BaseSetAssoc::findBlock(Addr addr, bool is_secure) const 111{ 112 Addr tag = extractTag(addr); 113 unsigned set = extractSet(addr); 114 BlkType *blk = sets[set].findBlk(tag, is_secure); 115 return blk; 116} --- 70 unchanged lines hidden --- | 120CacheBlk* 121BaseSetAssoc::findBlock(Addr addr, bool is_secure) const 122{ 123 Addr tag = extractTag(addr); 124 unsigned set = extractSet(addr); 125 BlkType *blk = sets[set].findBlk(tag, is_secure); 126 return blk; 127} --- 70 unchanged lines hidden --- |