base_set_assoc.cc (10815:169af9a2779f) | base_set_assoc.cc (10941:a39646f4c407) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2012-2013 ARM Limited | 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 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 38 unchanged lines hidden (view full) --- 49 50#include "base/intmath.hh" 51#include "mem/cache/tags/base_set_assoc.hh" 52#include "sim/core.hh" 53 54using namespace std; 55 56BaseSetAssoc::BaseSetAssoc(const Params *p) | 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 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 38 unchanged lines hidden (view full) --- 49 50#include "base/intmath.hh" 51#include "mem/cache/tags/base_set_assoc.hh" 52#include "sim/core.hh" 53 54using namespace std; 55 56BaseSetAssoc::BaseSetAssoc(const Params *p) |
57 :BaseTags(p), assoc(p->assoc), | 57 :BaseTags(p), assoc(p->assoc), allocAssoc(p->assoc), |
58 numSets(p->size / (p->block_size * p->assoc)), 59 sequentialAccess(p->sequential_access) 60{ 61 // Check parameters 62 if (blkSize < 4 || !isPowerOf2(blkSize)) { 63 fatal("Block size must be at least 4 and a power of 2"); 64 } 65 if (numSets <= 0 || !isPowerOf2(numSets)) { --- 37 unchanged lines hidden (view full) --- 103 // Setting the tag to j is just to prevent long chains in the hash 104 // table; won't matter because the block is invalid 105 blk->tag = j; 106 blk->whenReady = 0; 107 blk->isTouched = false; 108 blk->size = blkSize; 109 sets[i].blks[j]=blk; 110 blk->set = i; | 58 numSets(p->size / (p->block_size * p->assoc)), 59 sequentialAccess(p->sequential_access) 60{ 61 // Check parameters 62 if (blkSize < 4 || !isPowerOf2(blkSize)) { 63 fatal("Block size must be at least 4 and a power of 2"); 64 } 65 if (numSets <= 0 || !isPowerOf2(numSets)) { --- 37 unchanged lines hidden (view full) --- 103 // Setting the tag to j is just to prevent long chains in the hash 104 // table; won't matter because the block is invalid 105 blk->tag = j; 106 blk->whenReady = 0; 107 blk->isTouched = false; 108 blk->size = blkSize; 109 sets[i].blks[j]=blk; 110 blk->set = i; |
111 blk->way = j; |
|
111 } 112 } 113} 114 115BaseSetAssoc::~BaseSetAssoc() 116{ 117 delete [] dataBlks; 118 delete [] blks; --- 4 unchanged lines hidden (view full) --- 123BaseSetAssoc::findBlock(Addr addr, bool is_secure) const 124{ 125 Addr tag = extractTag(addr); 126 unsigned set = extractSet(addr); 127 BlkType *blk = sets[set].findBlk(tag, is_secure); 128 return blk; 129} 130 | 112 } 113 } 114} 115 116BaseSetAssoc::~BaseSetAssoc() 117{ 118 delete [] dataBlks; 119 delete [] blks; --- 4 unchanged lines hidden (view full) --- 124BaseSetAssoc::findBlock(Addr addr, bool is_secure) const 125{ 126 Addr tag = extractTag(addr); 127 unsigned set = extractSet(addr); 128 BlkType *blk = sets[set].findBlk(tag, is_secure); 129 return blk; 130} 131 |
132CacheBlk* 133BaseSetAssoc::findBlockBySetAndWay(int set, int way) const 134{ 135 return sets[set].blks[way]; 136} 137 |
|
131void 132BaseSetAssoc::clearLocks() 133{ 134 for (int i = 0; i < numBlocks; i++){ 135 blks[i].clearLoadLocks(); 136 } 137} 138 --- 61 unchanged lines hidden --- | 138void 139BaseSetAssoc::clearLocks() 140{ 141 for (int i = 0; i < numBlocks; i++){ 142 blks[i].clearLoadLocks(); 143 } 144} 145 --- 61 unchanged lines hidden --- |