// read, like the EV5). The EV6 approach is cleaner and seems to
// work with EV5 PAL code, but not the other way around.
if (!tc->misspeculating() &&
- reqFlags.none(Request::VPTE|Request::NO_FAULT)) {
+ reqFlags.noneSet(Request::VPTE|Request::NO_FAULT)) {
// set VA register with faulting address
tc->setMiscRegNoEffect(IPR_VA, vaddr);
return *this;
}
- bool any() const { return _flags; }
- bool any(Type flags) const { return (_flags & flags); }
- bool all() const { return !(~_flags); }
- bool all(Type flags) const { return (_flags & flags) == flags; }
- bool none() const { return _flags == 0; }
- bool none(Type flags) const { return (_flags & flags) == 0; }
+ bool isSet() const { return _flags; }
+ bool isSet(Type flags) const { return (_flags & flags); }
+ bool allSet() const { return !(~_flags); }
+ bool allSet(Type flags) const { return (_flags & flags) == flags; }
+ bool noneSet() const { return _flags == 0; }
+ bool noneSet(Type flags) const { return (_flags & flags) == 0; }
void clear() { _flags = 0; }
void clear(Type flags) { _flags &= ~flags; }
void set(Type flags) { _flags |= flags; }
// Snoop flags
void assertMemInhibit() { flags.set(MEM_INHIBIT); }
- bool memInhibitAsserted() { return flags.any(MEM_INHIBIT); }
+ bool memInhibitAsserted() { return flags.isSet(MEM_INHIBIT); }
void assertShared() { flags.set(SHARED); }
- bool sharedAsserted() { return flags.any(SHARED); }
+ bool sharedAsserted() { return flags.isSet(SHARED); }
// Special control flags
void setExpressSnoop() { flags.set(EXPRESS_SNOOP); }
- bool isExpressSnoop() { return flags.any(EXPRESS_SNOOP); }
+ bool isExpressSnoop() { return flags.isSet(EXPRESS_SNOOP); }
void setSupplyExclusive() { flags.set(SUPPLY_EXCLUSIVE); }
- bool isSupplyExclusive() { return flags.any(SUPPLY_EXCLUSIVE); }
+ bool isSupplyExclusive() { return flags.isSet(SUPPLY_EXCLUSIVE); }
// Network error conditions... encapsulate them as methods since
// their encoding keeps changing (from result field to command
void copyError(Packet *pkt) { assert(pkt->isError()); cmd = pkt->cmd; }
/// Accessor function to get the source index of the packet.
- NodeID getSrc() const { assert(flags.any(VALID_SRC)); return src; }
+ NodeID getSrc() const { assert(flags.isSet(VALID_SRC)); return src; }
/// Accessor function to set the source index of the packet.
void setSrc(NodeID _src) { src = _src; flags.set(VALID_SRC); }
/// Reset source field, e.g. to retransmit packet on different bus.
void clearSrc() { flags.clear(VALID_SRC); }
/// Accessor function for the destination index of the packet.
- NodeID getDest() const { assert(flags.any(VALID_DST)); return dest; }
+ NodeID getDest() const { assert(flags.isSet(VALID_DST)); return dest; }
/// Accessor function to set the destination index of the packet.
void setDest(NodeID _dest) { dest = _dest; flags.set(VALID_DST); }
- Addr getAddr() const { assert(flags.all(VALID_ADDR)); return addr; }
- int getSize() const { assert(flags.all(VALID_SIZE)); return size; }
+ Addr getAddr() const { assert(flags.isSet(VALID_ADDR)); return addr; }
+ int getSize() const { assert(flags.isSet(VALID_SIZE)); return size; }
Addr getOffset(int blkSize) const { return getAddr() & (Addr)(blkSize - 1); }
/**
addr(_req->paddr), size(_req->size), dest(_dest), time(curTick),
senderState(NULL)
{
- if (req->flags.any(Request::VALID_PADDR))
+ if (req->flags.isSet(Request::VALID_PADDR))
flags.set(VALID_ADDR|VALID_SIZE);
}
addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), dest(_dest),
time(curTick), senderState(NULL)
{
- if (req->flags.any(Request::VALID_PADDR))
+ if (req->flags.isSet(Request::VALID_PADDR))
flags.set(VALID_ADDR|VALID_SIZE);
}
*/
Packet(Packet *pkt, bool clearFlags = false)
: cmd(pkt->cmd), req(pkt->req),
- data(pkt->flags.any(STATIC_DATA) ? pkt->data : NULL),
+ data(pkt->flags.isSet(STATIC_DATA) ? pkt->data : NULL),
addr(pkt->addr), size(pkt->size), src(pkt->src), dest(pkt->dest),
time(curTick), senderState(pkt->senderState)
{
void
reinitFromRequest()
{
- assert(req->flags.any(Request::VALID_PADDR));
+ assert(req->flags.isSet(Request::VALID_PADDR));
flags = 0;
addr = req->paddr;
size = req->size;
cmd = cmd.responseCommand();
dest = src;
- flags.set(VALID_DST, flags.any(VALID_SRC));
+ flags.set(VALID_DST, flags.isSet(VALID_SRC));
flags.clear(VALID_SRC);
}
void
dataStatic(T *p)
{
- assert(flags.none(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
+ assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
data = (PacketDataPtr)p;
flags.set(STATIC_DATA);
}
void
dataDynamicArray(T *p)
{
- assert(flags.none(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
+ assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
data = (PacketDataPtr)p;
flags.set(DYNAMIC_DATA|ARRAY_DATA);
}
void
dataDynamic(T *p)
{
- assert(flags.none(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
+ assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA));
data = (PacketDataPtr)p;
flags.set(DYNAMIC_DATA);
}
T*
getPtr()
{
- assert(flags.any(STATIC_DATA|DYNAMIC_DATA));
+ assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA));
return (T*)data;
}
void
deleteData()
{
- if (flags.any(ARRAY_DATA))
+ if (flags.isSet(ARRAY_DATA))
delete [] data;
- else if (flags.any(DYNAMIC_DATA))
+ else if (flags.isSet(DYNAMIC_DATA))
delete data;
flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA);
allocate()
{
if (data) {
- assert(flags.any(STATIC_DATA|DYNAMIC_DATA));
+ assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA));
return;
}
- assert(flags.none(STATIC_DATA|DYNAMIC_DATA));
+ assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA));
flags.set(DYNAMIC_DATA|ARRAY_DATA);
data = new uint8_t[getSize()];
}
inline T
Packet::get()
{
- assert(flags.any(STATIC_DATA|DYNAMIC_DATA));
+ assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA));
assert(sizeof(T) <= size);
return TheISA::gtoh(*(T*)data);
}
inline void
Packet::set(T v)
{
- assert(flags.any(STATIC_DATA|DYNAMIC_DATA));
+ assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA));
assert(sizeof(T) <= size);
*(T*)data = TheISA::htog(v);
}
void
setPaddr(Addr _paddr)
{
- assert(flags.any(VALID_VADDR));
+ assert(flags.isSet(VALID_VADDR));
paddr = _paddr;
flags.set(VALID_PADDR);
}
*/
void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2)
{
- assert(flags.any(VALID_VADDR));
- assert(flags.none(VALID_PADDR));
+ assert(flags.isSet(VALID_VADDR));
+ assert(flags.noneSet(VALID_PADDR));
assert(split_addr > vaddr && split_addr < vaddr + size);
req1 = new Request;
*req1 = *this;
Addr
getPaddr()
{
- assert(flags.any(VALID_PADDR));
+ assert(flags.isSet(VALID_PADDR));
return paddr;
}
int
getSize()
{
- assert(flags.any(VALID_SIZE));
+ assert(flags.isSet(VALID_SIZE));
return size;
}
Tick
getTime()
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
return time;
}
void
setTime(Tick when)
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
time = when;
}
- void resetTime() { setTime(curTick); }
-
/** Accessor for flags. */
Flags
getFlags()
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
return flags & PUBLIC_FLAGS;
}
Flags
anyFlags(Flags _flags)
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
- assert(_flags.none(~PUBLIC_FLAGS));
- return flags.any(_flags);
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
+ assert(_flags.noneSet(~PUBLIC_FLAGS));
+ return flags.isSet(_flags);
}
Flags
allFlags(Flags _flags)
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
- assert(_flags.none(~PUBLIC_FLAGS));
- return flags.all(_flags);
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
+ assert(_flags.noneSet(~PUBLIC_FLAGS));
+ return flags.allSet(_flags);
}
/** Accessor for flags. */
void
setFlags(Flags _flags)
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
- assert(_flags.none(~PUBLIC_FLAGS));
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
+ assert(_flags.noneSet(~PUBLIC_FLAGS));
flags.set(_flags);
}
void
clearFlags(Flags _flags)
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
- assert(_flags.none(~PUBLIC_FLAGS));
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
+ assert(_flags.noneSet(~PUBLIC_FLAGS));
flags.clear(_flags);
}
void
clearFlags()
{
- assert(flags.any(VALID_PADDR|VALID_VADDR));
+ assert(flags.isSet(VALID_PADDR|VALID_VADDR));
flags.clear(PUBLIC_FLAGS);
}
Addr
getVaddr()
{
- assert(flags.any(VALID_VADDR));
+ assert(flags.isSet(VALID_VADDR));
return vaddr;
}
int
getAsid()
{
- assert(flags.any(VALID_VADDR));
+ assert(flags.isSet(VALID_VADDR));
return asid;
}
uint8_t
getAsi()
{
- assert(flags.any(VALID_VADDR));
+ assert(flags.isSet(VALID_VADDR));
return flags & ASI_BITS;
}
void
setAsi(uint8_t a)
{
- assert(flags.any(VALID_VADDR));
+ assert(flags.isSet(VALID_VADDR));
flags.update(a, ASI_BITS);
}
bool
isMmapedIpr()
{
- assert(flags.any(VALID_PADDR));
- return flags.any(MMAPED_IPR);
+ assert(flags.isSet(VALID_PADDR));
+ return flags.isSet(MMAPED_IPR);
}
/** Accessor function for asi.*/
bool
extraDataValid()
{
- return flags.any(VALID_EXTRA_DATA);
+ return flags.isSet(VALID_EXTRA_DATA);
}
/** Accessor function for store conditional return value.*/
uint64_t
getExtraData() const
{
- assert(flags.any(VALID_EXTRA_DATA));
+ assert(flags.isSet(VALID_EXTRA_DATA));
return extraData;
}
int
contextId() const
{
- assert(flags.any(VALID_CONTEXT_ID));
+ assert(flags.isSet(VALID_CONTEXT_ID));
return _contextId;
}
int
threadId() const
{
- assert(flags.any(VALID_THREAD_ID));
+ assert(flags.isSet(VALID_THREAD_ID));
return _threadId;
}
Addr
getPC() const
{
- assert(flags.any(VALID_PC));
+ assert(flags.isSet(VALID_PC));
return pc;
}
/** Accessor Function to Check Cacheability. */
- bool isUncacheable() const { return flags.any(UNCACHEABLE); }
- bool isInstRead() const { return flags.any(INST_READ); }
- bool isLocked() const { return flags.any(LOCKED); }
- bool isSwap() const { return flags.any(MEM_SWAP|MEM_SWAP_COND); }
- bool isCondSwap() const { return flags.any(MEM_SWAP_COND); }
+ bool isUncacheable() const { return flags.isSet(UNCACHEABLE); }
+ bool isInstRead() const { return flags.isSet(INST_READ); }
+ bool isLocked() const { return flags.isSet(LOCKED); }
+ bool isSwap() const { return flags.isSet(MEM_SWAP|MEM_SWAP_COND); }
+ bool isCondSwap() const { return flags.isSet(MEM_SWAP_COND); }
bool
isMisaligned() const
{
- if (flags.any(NO_ALIGN_FAULT))
+ if (flags.isSet(NO_ALIGN_FAULT))
return false;
if ((vaddr & 0x1))
return true;
- if (flags.any(NO_HALF_WORD_ALIGN_FAULT))
+ if (flags.isSet(NO_HALF_WORD_ALIGN_FAULT))
return false;
if ((vaddr & 0x2))