Deleted Added
sdiff udiff text old ( 13752:135bb759ee9c ) new ( 13938:14f80b6b37c1 )
full compact
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;

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

47#include "mem/cache/replacement_policies/replaceable_entry.hh"
48#include "mem/cache/tags/indexing_policies/base.hh"
49
50SectorTags::SectorTags(const SectorTagsParams *p)
51 : BaseTags(p), allocAssoc(p->assoc),
52 sequentialAccess(p->sequential_access),
53 replacementPolicy(p->replacement_policy),
54 numBlocksPerSector(p->num_blocks_per_sector),
55 numSectors(numBlocks / numBlocksPerSector),
56 sectorShift(floorLog2(blkSize)), sectorMask(numBlocksPerSector - 1)
57{
58 // Check parameters
59 fatal_if(blkSize < 4 || !isPowerOf2(blkSize),
60 "Block size must be at least 4 and a power of 2");
61 fatal_if(!isPowerOf2(numBlocksPerSector),
62 "# of blocks per sector must be non-zero and a power of 2");
63}
64
65void
66SectorTags::tagsInit()
67{
68 // Create blocks and sector blocks
69 blks = std::vector<SectorSubBlk>(numBlocks);
70 secBlks = std::vector<SectorBlk>(numSectors);
71
72 // Initialize all blocks
73 unsigned blk_index = 0; // index into blks array
74 for (unsigned sec_blk_index = 0; sec_blk_index < numSectors;
75 sec_blk_index++)
76 {
77 // Locate next cache sector
78 SectorBlk* sec_blk = &secBlks[sec_blk_index];
79

--- 232 unchanged lines hidden ---