*/
Packet(Request *_req, MemCmd _cmd, NodeID _dest)
: flags(VALID_DST), cmd(_cmd), req(_req), data(NULL),
- addr(_req->paddr), size(_req->size), dest(_dest), time(curTick),
- senderState(NULL)
+ dest(_dest), time(curTick), senderState(NULL)
{
- if (req->flags.isSet(Request::VALID_PADDR))
- flags.set(VALID_ADDR|VALID_SIZE);
+ if (req->hasPaddr()) {
+ addr = req->getPaddr();
+ flags.set(VALID_ADDR);
+ }
+ if (req->hasSize()) {
+ size = req->getSize();
+ flags.set(VALID_SIZE);
+ }
}
/**
*/
Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize)
: flags(VALID_DST), cmd(_cmd), req(_req), data(NULL),
- addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), dest(_dest),
- time(curTick), senderState(NULL)
+ dest(_dest), time(curTick), senderState(NULL)
{
- if (req->flags.isSet(Request::VALID_PADDR))
- flags.set(VALID_ADDR|VALID_SIZE);
+ if (req->hasPaddr()) {
+ addr = req->getPaddr() & ~(_blkSize - 1);
+ flags.set(VALID_ADDR);
+ }
+ size = _blkSize;
+ flags.set(VALID_SIZE);
}
/**
void
reinitFromRequest()
{
- assert(req->flags.isSet(Request::VALID_PADDR));
+ assert(req->hasPaddr());
flags = 0;
- addr = req->paddr;
- size = req->size;
- time = req->time;
+ addr = req->getPaddr();
+ size = req->getSize();
+ time = req->getTime();
flags.set(VALID_ADDR|VALID_SIZE);
deleteData();
class Request : public FastAlloc
{
- friend class Packet;
-
public:
typedef uint32_t FlagsType;
typedef ::Flags<FlagsType> Flags;
/** This request is to a memory mapped register. */
static const FlagsType MMAPED_IPR = 0x00800000;
+ /** These flags are *not* cleared when a Request object is reused
+ (assigned a new address). */
+ static const FlagsType STICKY_FLAGS = INST_READ;
+
private:
- static const FlagsType PUBLIC_FLAGS = 0x00FFFFFF;
- static const FlagsType PRIVATE_FLAGS = 0xFF000000;
+ typedef uint8_t PrivateFlagsType;
+ typedef ::Flags<PrivateFlagsType> PrivateFlags;
/** Whether or not the size is valid. */
- static const FlagsType VALID_SIZE = 0x01000000;
+ static const PrivateFlagsType VALID_SIZE = 0x00000001;
/** Whether or not paddr is valid (has been written yet). */
- static const FlagsType VALID_PADDR = 0x02000000;
+ static const PrivateFlagsType VALID_PADDR = 0x00000002;
/** Whether or not the vaddr & asid are valid. */
- static const FlagsType VALID_VADDR = 0x04000000;
+ static const PrivateFlagsType VALID_VADDR = 0x00000004;
/** Whether or not the pc is valid. */
- static const FlagsType VALID_PC = 0x10000000;
+ static const PrivateFlagsType VALID_PC = 0x00000010;
/** Whether or not the context ID is valid. */
- static const FlagsType VALID_CONTEXT_ID = 0x20000000;
- static const FlagsType VALID_THREAD_ID = 0x40000000;
+ static const PrivateFlagsType VALID_CONTEXT_ID = 0x00000020;
+ static const PrivateFlagsType VALID_THREAD_ID = 0x00000040;
/** Whether or not the sc result is valid. */
- static const FlagsType VALID_EXTRA_DATA = 0x80000000;
+ static const PrivateFlagsType VALID_EXTRA_DATA = 0x00000080;
+
+ /** These flags are *not* cleared when a Request object is reused
+ (assigned a new address). */
+ static const PrivateFlagsType STICKY_PRIVATE_FLAGS =
+ VALID_CONTEXT_ID | VALID_THREAD_ID;
private:
/**
/** Flag structure for the request. */
Flags flags;
+ /** Private flags for field validity checking. */
+ PrivateFlags privateFlags;
+
/**
* The time this request was started. Used to calculate
* latencies. This field is set to curTick any time paddr or vaddr
Request(int asid, Addr vaddr, int size, Flags flags, Addr pc,
int cid, int tid)
{
- setThreadContext(cid, tid);
setVirt(asid, vaddr, size, flags, pc);
+ setThreadContext(cid, tid);
}
~Request() {} // for FastAlloc
{
_contextId = context_id;
_threadId = thread_id;
- flags.set(VALID_CONTEXT_ID|VALID_THREAD_ID);
+ privateFlags.set(VALID_CONTEXT_ID|VALID_THREAD_ID);
}
/**
size = _size;
time = curTick;
- flags.set(VALID_PADDR|VALID_SIZE);
- flags.clear(VALID_VADDR|VALID_PC|VALID_EXTRA_DATA|MMAPED_IPR);
- flags.update(_flags, PUBLIC_FLAGS);
+ flags.clear(~STICKY_FLAGS);
+ flags.set(_flags);
+ privateFlags.clear(~STICKY_PRIVATE_FLAGS);
+ privateFlags.set(VALID_PADDR|VALID_SIZE);
}
/**
asid = _asid;
vaddr = _vaddr;
size = _size;
+ flags = _flags;
pc = _pc;
time = curTick;
- flags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
- flags.clear(VALID_PADDR|VALID_EXTRA_DATA|MMAPED_IPR);
- flags.update(_flags, PUBLIC_FLAGS);
+ flags.clear(~STICKY_FLAGS);
+ flags.set(_flags);
+ privateFlags.clear(~STICKY_PRIVATE_FLAGS);
+ privateFlags.set(VALID_VADDR|VALID_SIZE|VALID_PC);
}
/**
void
setPaddr(Addr _paddr)
{
- assert(flags.isSet(VALID_VADDR));
+ assert(privateFlags.isSet(VALID_VADDR));
paddr = _paddr;
- flags.set(VALID_PADDR);
+ privateFlags.set(VALID_PADDR);
}
/**
*/
void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2)
{
- assert(flags.isSet(VALID_VADDR));
- assert(flags.noneSet(VALID_PADDR));
+ assert(privateFlags.isSet(VALID_VADDR));
+ assert(privateFlags.noneSet(VALID_PADDR));
assert(split_addr > vaddr && split_addr < vaddr + size);
req1 = new Request;
*req1 = *this;
/**
* Accessor for paddr.
*/
+ bool
+ hasPaddr()
+ {
+ return privateFlags.isSet(VALID_PADDR);
+ }
+
Addr
getPaddr()
{
- assert(flags.isSet(VALID_PADDR));
+ assert(privateFlags.isSet(VALID_PADDR));
return paddr;
}
/**
* Accessor for size.
*/
+ bool
+ hasSize()
+ {
+ return privateFlags.isSet(VALID_SIZE);
+ }
+
int
getSize()
{
- assert(flags.isSet(VALID_SIZE));
+ assert(privateFlags.isSet(VALID_SIZE));
return size;
}
Tick
getTime()
{
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
+ assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
return time;
}
- void
- setTime(Tick when)
- {
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
- time = when;
- }
-
/** Accessor for flags. */
Flags
getFlags()
{
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
- return flags & PUBLIC_FLAGS;
- }
-
- Flags
- anyFlags(Flags _flags)
- {
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
- assert(_flags.noneSet(~PUBLIC_FLAGS));
- return flags.isSet(_flags);
- }
-
- Flags
- allFlags(Flags _flags)
- {
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
- assert(_flags.noneSet(~PUBLIC_FLAGS));
- return flags.allSet(_flags);
+ assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
+ return flags;
}
- /** Accessor for flags. */
void
setFlags(Flags _flags)
{
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
- assert(_flags.noneSet(~PUBLIC_FLAGS));
+ assert(privateFlags.isSet(VALID_PADDR|VALID_VADDR));
flags.set(_flags);
}
- void
- clearFlags(Flags _flags)
- {
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
- assert(_flags.noneSet(~PUBLIC_FLAGS));
- flags.clear(_flags);
- }
-
- void
- clearFlags()
- {
- assert(flags.isSet(VALID_PADDR|VALID_VADDR));
- flags.clear(PUBLIC_FLAGS);
- }
-
/** Accessor function for vaddr.*/
Addr
getVaddr()
{
- assert(flags.isSet(VALID_VADDR));
+ assert(privateFlags.isSet(VALID_VADDR));
return vaddr;
}
int
getAsid()
{
- assert(flags.isSet(VALID_VADDR));
+ assert(privateFlags.isSet(VALID_VADDR));
return asid;
}
uint8_t
getAsi()
{
- assert(flags.isSet(VALID_VADDR));
+ assert(privateFlags.isSet(VALID_VADDR));
return flags & ASI_BITS;
}
- /** Accessor function for asi.*/
- void
- setAsi(uint8_t a)
- {
- assert(flags.isSet(VALID_VADDR));
- flags.update(a, ASI_BITS);
- }
-
- /** Accessor function for asi.*/
+ /** Accessor function for MMAPED_IPR flag. */
bool
isMmapedIpr()
{
- assert(flags.isSet(VALID_PADDR));
+ assert(privateFlags.isSet(VALID_PADDR));
return flags.isSet(MMAPED_IPR);
}
- /** Accessor function for asi.*/
void
setMmapedIpr(bool r)
{
bool
extraDataValid()
{
- return flags.isSet(VALID_EXTRA_DATA);
+ return privateFlags.isSet(VALID_EXTRA_DATA);
}
/** Accessor function for store conditional return value.*/
uint64_t
getExtraData() const
{
- assert(flags.isSet(VALID_EXTRA_DATA));
+ assert(privateFlags.isSet(VALID_EXTRA_DATA));
return extraData;
}
setExtraData(uint64_t _extraData)
{
extraData = _extraData;
- flags.set(VALID_EXTRA_DATA);
+ privateFlags.set(VALID_EXTRA_DATA);
}
bool
hasContextId() const
{
- return flags.isSet(VALID_CONTEXT_ID);
+ return privateFlags.isSet(VALID_CONTEXT_ID);
}
/** Accessor function for context ID.*/
int
contextId() const
{
- assert(flags.isSet(VALID_CONTEXT_ID));
+ assert(privateFlags.isSet(VALID_CONTEXT_ID));
return _contextId;
}
int
threadId() const
{
- assert(flags.isSet(VALID_THREAD_ID));
+ assert(privateFlags.isSet(VALID_THREAD_ID));
return _threadId;
}
bool
hasPC() const
{
- return flags.isSet(VALID_PC);
+ return privateFlags.isSet(VALID_PC);
}
/** Accessor function for pc.*/
Addr
getPC() const
{
- assert(flags.isSet(VALID_PC));
+ assert(privateFlags.isSet(VALID_PC));
return pc;
}