sector_tags.cc (13419:aaadcfae091a) sector_tags.cc (13445:070fc4d948c0)
1/*
2 * Copyright (c) 2018 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 157 unchanged lines hidden (view full) ---

166 return blk;
167}
168
169void
170SectorTags::insertBlock(const Addr addr, const bool is_secure,
171 const int src_master_ID, const uint32_t task_ID,
172 CacheBlk *blk)
173{
1/*
2 * Copyright (c) 2018 Inria
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 157 unchanged lines hidden (view full) ---

166 return blk;
167}
168
169void
170SectorTags::insertBlock(const Addr addr, const bool is_secure,
171 const int src_master_ID, const uint32_t task_ID,
172 CacheBlk *blk)
173{
174 // Do common block insertion functionality
175 BaseTags::insertBlock(addr, is_secure, src_master_ID, task_ID, blk);
176
177 // Get block's sector
178 SectorSubBlk* sub_blk = static_cast<SectorSubBlk*>(blk);
179 const SectorBlk* sector_blk = sub_blk->getSectorBlock();
180
181 // When a block is inserted, the tag is only a newly used tag if the
182 // sector was not previously present in the cache.
174 // Get block's sector
175 SectorSubBlk* sub_blk = static_cast<SectorSubBlk*>(blk);
176 const SectorBlk* sector_blk = sub_blk->getSectorBlock();
177
178 // When a block is inserted, the tag is only a newly used tag if the
179 // sector was not previously present in the cache.
183 // This assumes BaseTags::insertBlock does not set the valid bit.
184 if (sector_blk->isValid()) {
185 // An existing entry's replacement data is just updated
186 replacementPolicy->touch(sector_blk->replacementData);
187 } else {
188 // Increment tag counter
189 tagsInUse++;
190
191 // A new entry resets the replacement data
192 replacementPolicy->reset(sector_blk->replacementData);
193 }
180 if (sector_blk->isValid()) {
181 // An existing entry's replacement data is just updated
182 replacementPolicy->touch(sector_blk->replacementData);
183 } else {
184 // Increment tag counter
185 tagsInUse++;
186
187 // A new entry resets the replacement data
188 replacementPolicy->reset(sector_blk->replacementData);
189 }
190
191 // Do common block insertion functionality
192 BaseTags::insertBlock(addr, is_secure, src_master_ID, task_ID, blk);
194}
195
196CacheBlk*
197SectorTags::findBlock(Addr addr, bool is_secure) const
198{
199 // Extract sector tag
200 const Addr tag = extractTag(addr);
201

--- 110 unchanged lines hidden ---
193}
194
195CacheBlk*
196SectorTags::findBlock(Addr addr, bool is_secure) const
197{
198 // Extract sector tag
199 const Addr tag = extractTag(addr);
200

--- 110 unchanged lines hidden ---