cpu,mem,dev: Use Addr for cacheLineSize

Change-Id: I2f056571dbf35081d58afda09726c600141d5a05
Signed-off-by: Hoa Nguyen <hn@hnpl.org>
This commit is contained in:
Hoa Nguyen
2023-09-20 14:16:46 -07:00
parent ac5280fedc
commit 1fc89bc8ae
11 changed files with 18 additions and 18 deletions

View File

@@ -257,8 +257,8 @@ BaseCPU::mwait(ThreadID tid, PacketPtr pkt)
AddressMonitor &monitor = addressMonitor[tid];
if (!monitor.gotWakeup) {
int block_size = cacheLineSize();
uint64_t mask = ~((uint64_t)(block_size - 1));
Addr block_size = cacheLineSize();
Addr mask = ~(block_size - 1);
assert(pkt->req->hasPaddr());
monitor.pAddr = pkt->getAddr() & mask;
@@ -282,8 +282,8 @@ BaseCPU::mwaitAtomic(ThreadID tid, ThreadContext *tc, BaseMMU *mmu)
RequestPtr req = std::make_shared<Request>();
Addr addr = monitor.vAddr;
int block_size = cacheLineSize();
uint64_t mask = ~((uint64_t)(block_size - 1));
Addr block_size = cacheLineSize();
Addr mask = ~(block_size - 1);
int size = block_size;
//The address of the next line if it crosses a cache line boundary.

View File

@@ -143,7 +143,7 @@ class BaseCPU : public ClockedObject
bool _switchedOut;
/** Cache the cache line size that we get from the system */
const uint64_t _cacheLineSize;
const Addr _cacheLineSize;
/** Global CPU statistics that are merged into the Root object. */
struct GlobalStats : public statistics::Group
@@ -394,7 +394,7 @@ class BaseCPU : public ClockedObject
/**
* Get the cache line size of the system.
*/
inline uint64_t cacheLineSize() const { return _cacheLineSize; }
inline Addr cacheLineSize() const { return _cacheLineSize; }
/**
* Serialize this object to the given output stream.

View File

@@ -213,13 +213,13 @@ class Fetch1 : public Named
/** Line snap size in bytes. All fetches clip to make their ends not
* extend beyond this limit. Setting this to the machine L1 cache line
* length will result in fetches never crossing line boundaries. */
unsigned int lineSnap;
Addr lineSnap;
/** Maximum fetch width in bytes. Setting this (and lineSnap) to the
* machine L1 cache line length will result in fetches of whole cache
* lines. Setting this to sizeof(MachInst) will result it fetches of
* single instructions (except near the end of lineSnap lines) */
unsigned int maxLineWidth;
Addr maxLineWidth;
/** Maximum number of fetches allowed in flight (in queues or memory) */
unsigned int fetchLimit;

View File

@@ -548,7 +548,7 @@ class LSQ : public Named
const unsigned int inMemorySystemLimit;
/** Memory system access width (and snap) in bytes */
const unsigned int lineWidth;
const Addr lineWidth;
public:
/** The LSQ consists of three queues: requests, transfers and the

View File

@@ -470,7 +470,7 @@ class Fetch
ThreadID retryTid;
/** Cache block size. */
unsigned int cacheBlkSize;
Addr cacheBlkSize;
/** The size of the fetch buffer in bytes. The fetch buffer
* itself may be smaller than a cache line.

View File

@@ -142,7 +142,7 @@ class MemTest : public ClockedObject
// store the expected value for the addresses we have touched
std::unordered_map<Addr, uint8_t> referenceData;
const unsigned blockSize;
const Addr blockSize;
const Addr blockAddrMask;

View File

@@ -585,7 +585,7 @@ TraceCPU::ElasticDataGen::executeMemReq(GraphNode* node_ptr)
// stat counting this is useful to keep a check on how frequently this
// happens. If required the code could be revised to mimick splitting such
// a request into two.
unsigned blk_size = owner.cacheLineSize;
Addr blk_size = owner.cacheLineSize;
Addr blk_offset = (node_ptr->physAddr & (Addr)(blk_size - 1));
if (!(blk_offset + node_ptr->size <= blk_size)) {
node_ptr->size = blk_size - blk_offset;

View File

@@ -286,7 +286,7 @@ class TraceCPU : public ClockedObject
};
/** Cache the cache line size that we get from the system */
const unsigned int cacheLineSize;
const Addr cacheLineSize;
/** Port to connect to L1 instruction cache. */
IcachePort icachePort;

View File

@@ -187,7 +187,7 @@ class DmaPort : public RequestPort, public Drainable
/** Default substreamId */
const uint32_t defaultSSid;
const int cacheLineSize;
const Addr cacheLineSize;
protected:
@@ -257,7 +257,7 @@ class DmaDevice : public PioDevice
void init() override;
unsigned int cacheBlockSize() const { return sys->cacheLineSize(); }
Addr cacheBlockSize() const { return sys->cacheLineSize(); }
Port &getPort(const std::string &if_name,
PortID idx=InvalidPortID) override;
@@ -526,7 +526,7 @@ class DmaReadFifo : public Drainable, public Serializable
DmaPort &port;
const int cacheLineSize;
const Addr cacheLineSize;
private:
class DmaDoneEvent : public Event

View File

@@ -267,7 +267,7 @@ class SimpleCache : public ClockedObject
const Cycles latency;
/// The block size for the cache
const unsigned blockSize;
const Addr blockSize;
/// Number of blocks in the cache (size of cache / block size)
const unsigned capacity;

View File

@@ -302,7 +302,7 @@ class SnoopFilter : public SimObject
/** Track the mapping from port ids to the local mask ids. */
std::vector<PortID> localResponsePortIds;
/** Cache line size. */
const unsigned linesize;
const Addr linesize;
/** Latency for doing a lookup in the filter */
const Cycles lookupLatency;
/** Max capacity in terms of cache blocks tracked, for sanity checking */