52 #ifndef __MEM_REQUEST_HH__ 53 #define __MEM_REQUEST_HH__ 93 typedef ::Flags<FlagsType>
Flags;
103 ARCH_BITS = 0x000000FF,
105 INST_FETCH = 0x00000100,
107 PHYSICAL = 0x00000200,
115 UNCACHEABLE = 0x00000400,
125 STRICT_ORDER = 0x00000800,
127 MMAPPED_IPR = 0x00002000,
129 PRIVILEGED = 0x00008000,
135 CACHE_BLOCK_ZERO = 0x00010000,
138 NO_ACCESS = 0x00080000,
146 LOCKED_RMW = 0x00100000,
150 MEM_SWAP = 0x00400000,
151 MEM_SWAP_COND = 0x00800000,
154 PREFETCH = 0x01000000,
156 PF_EXCLUSIVE = 0x02000000,
158 EVICT_NEXT = 0x04000000,
160 ACQUIRE = 0x00020000,
162 RELEASE = 0x00040000,
165 ATOMIC_RETURN_OP = 0x40000000,
167 ATOMIC_NO_RETURN_OP = 0x80000000,
178 PT_WALK = 0x20000000,
181 INVALIDATE = 0x0000000100000000,
183 CLEAN = 0x0000000200000000,
186 DST_POU = 0x0000001000000000,
189 DST_POC = 0x0000002000000000,
192 DST_BITS = 0x0000003000000000,
198 STICKY_FLAGS = INST_FETCH
200 static const FlagsType STORE_NO_DATA = CACHE_BLOCK_ZERO |
219 invldMasterId = std::numeric_limits<MasterID>::max()
226 enum : MemSpaceConfigFlagsType {
228 SCOPE_VALID = 0x00000001,
230 WAVEFRONT_SCOPE = 0x00000002,
232 WORKGROUP_SCOPE = 0x00000004,
234 DEVICE_SCOPE = 0x00000008,
236 SYSTEM_SCOPE = 0x00000010,
239 GLOBAL_SEGMENT = 0x00000020,
241 GROUP_SEGMENT = 0x00000040,
243 PRIVATE_SEGMENT = 0x00000080,
245 KERNARG_SEGMENT = 0x00000100,
247 READONLY_SEGMENT = 0x00000200,
249 SPILL_SEGMENT = 0x00000400,
251 ARG_SEGMENT = 0x00000800,
258 enum : PrivateFlagsType {
260 VALID_SIZE = 0x00000001,
262 VALID_PADDR = 0x00000002,
264 VALID_VADDR = 0x00000004,
266 VALID_INST_SEQ_NUM = 0x00000008,
268 VALID_PC = 0x00000010,
270 VALID_CONTEXT_ID = 0x00000020,
272 VALID_EXTRA_DATA = 0x00000080,
274 VALID_STREAM_ID = 0x00000100,
275 VALID_SUBSTREAM_ID = 0x00000200,
280 STICKY_PRIVATE_FLAGS = VALID_CONTEXT_ID
296 _flags.clear(~STICKY_FLAGS);
298 privateFlags.clear(~STICKY_PRIVATE_FLAGS);
299 privateFlags.set(VALID_PADDR|VALID_SIZE);
397 : _paddr(0), _size(0), _masterId(invldMasterId), _time(0),
399 _extraData(0), _contextId(0), _pc(0),
400 _reqInstSeqNum(0), atomicOpFunctor(nullptr), translateDelta(0),
401 accessDelta(0), depth(0)
406 : _paddr(0), _size(0), _masterId(invldMasterId), _time(0),
408 _extraData(0), _contextId(0), _pc(0),
409 _reqInstSeqNum(seq_num), atomicOpFunctor(nullptr), translateDelta(0),
410 accessDelta(0), depth(0)
412 setPhys(paddr, size, flags, mid,
curTick());
414 privateFlags.
set(VALID_INST_SEQ_NUM);
423 : _paddr(0), _size(0), _masterId(invldMasterId), _time(0),
425 _extraData(0), _contextId(0), _pc(0),
426 _reqInstSeqNum(0), atomicOpFunctor(nullptr), translateDelta(0),
427 accessDelta(0), depth(0)
429 setPhys(paddr, size, flags, mid,
curTick());
433 : _paddr(0), _size(0), _masterId(invldMasterId), _time(0),
435 _extraData(0), _contextId(0), _pc(0),
436 _reqInstSeqNum(0), atomicOpFunctor(nullptr), translateDelta(0),
437 accessDelta(0), depth(0)
439 setPhys(paddr, size, flags, mid, time);
444 : _paddr(0), _size(0), _masterId(invldMasterId), _time(0),
446 _extraData(0), _contextId(0), _pc(pc),
447 _reqInstSeqNum(0), atomicOpFunctor(nullptr), translateDelta(0),
448 accessDelta(0), depth(0)
450 setPhys(paddr, size, flags, mid, time);
451 privateFlags.
set(VALID_PC);
456 : _paddr(0), _size(0), _masterId(invldMasterId), _time(0),
458 _extraData(0), _contextId(0), _pc(0),
459 _reqInstSeqNum(0), atomicOpFunctor(nullptr), translateDelta(0),
460 accessDelta(0), depth(0)
462 setVirt(asid, vaddr, size, flags, mid, pc);
470 setVirt(asid, vaddr, size, flags, mid, pc, std::move(atomic_op));
475 : _paddr(other._paddr), _size(other._size),
476 _byteEnable(other._byteEnable),
477 _masterId(other._masterId),
478 _flags(other._flags),
479 _memSpaceConfigFlags(other._memSpaceConfigFlags),
480 privateFlags(other.privateFlags),
482 _taskId(other._taskId), _asid(other._asid), _vaddr(other._vaddr),
483 _extraData(other._extraData), _contextId(other._contextId),
484 _pc(other._pc), _reqInstSeqNum(other._reqInstSeqNum),
485 translateDelta(other.translateDelta),
486 accessDelta(other.accessDelta), depth(other.depth)
501 _contextId = context_id;
502 privateFlags.
set(VALID_CONTEXT_ID);
509 privateFlags.
set(VALID_STREAM_ID);
515 assert(privateFlags.
isSet(VALID_STREAM_ID));
517 privateFlags.
set(VALID_SUBSTREAM_ID);
535 _flags.
clear(~STICKY_FLAGS);
537 privateFlags.
clear(~STICKY_PRIVATE_FLAGS);
538 privateFlags.
set(VALID_VADDR|VALID_SIZE|VALID_PC);
542 atomicOpFunctor = std::move(amo_op);
556 privateFlags.
set(VALID_PADDR);
568 assert(privateFlags.
isSet(VALID_VADDR));
569 assert(privateFlags.
noneSet(VALID_PADDR));
570 assert(split_addr > _vaddr && split_addr < _vaddr + _size);
571 req1 = std::make_shared<Request>(*this);
572 req2 = std::make_shared<Request>(*this);
573 req1->_size = split_addr - _vaddr;
574 req2->_vaddr = split_addr;
575 req2->_size = _size - req1->_size;
576 if (!_byteEnable.empty()) {
579 _byteEnable.begin() + req1->_size);
581 _byteEnable.begin() + req1->_size,
592 return privateFlags.
isSet(VALID_PADDR);
598 assert(privateFlags.
isSet(VALID_PADDR));
625 return privateFlags.
isSet(VALID_SIZE);
631 assert(privateFlags.
isSet(VALID_SIZE));
644 assert(be.empty() || be.size() == _size);
659 false) != _byteEnable.end();
666 assert(privateFlags.
isSet(VALID_PADDR|VALID_VADDR));
676 return (
bool)atomicOpFunctor;
682 assert(atomicOpFunctor);
683 return atomicOpFunctor.get();
690 assert(privateFlags.
isSet(VALID_PADDR|VALID_VADDR));
701 assert(privateFlags.
isSet(VALID_PADDR|VALID_VADDR));
708 assert(privateFlags.
isSet(VALID_PADDR | VALID_VADDR));
709 _memSpaceConfigFlags.
set(extraFlags);
716 return privateFlags.
isSet(VALID_VADDR);
722 assert(privateFlags.
isSet(VALID_VADDR));
748 assert(privateFlags.
isSet(VALID_VADDR));
763 assert(privateFlags.
isSet(VALID_PADDR|VALID_VADDR));
764 return _flags & ARCH_BITS;
771 return privateFlags.
isSet(VALID_EXTRA_DATA);
778 assert(privateFlags.
isSet(VALID_EXTRA_DATA));
786 _extraData = extraData;
787 privateFlags.
set(VALID_EXTRA_DATA);
793 return privateFlags.
isSet(VALID_CONTEXT_ID);
800 assert(privateFlags.
isSet(VALID_CONTEXT_ID));
807 assert(privateFlags.
isSet(VALID_STREAM_ID));
814 return privateFlags.
isSet(VALID_SUBSTREAM_ID);
820 assert(privateFlags.
isSet(VALID_SUBSTREAM_ID));
827 privateFlags.
set(VALID_PC);
834 return privateFlags.
isSet(VALID_PC);
841 assert(privateFlags.
isSet(VALID_PC));
872 return privateFlags.
isSet(VALID_INST_SEQ_NUM);
878 assert(privateFlags.
isSet(VALID_INST_SEQ_NUM));
879 return _reqInstSeqNum;
885 privateFlags.
set(VALID_INST_SEQ_NUM);
886 _reqInstSeqNum = seq_num;
895 _flags.
isSet(PF_EXCLUSIVE)); }
900 bool isSwap()
const {
return _flags.
isSet(MEM_SWAP|MEM_SWAP_COND); }
914 return _flags.
isSet(ATOMIC_RETURN_OP) ||
915 _flags.
isSet(ATOMIC_NO_RETURN_OP);
927 Flags
getDest()
const {
return _flags & DST_BITS; }
941 return _memSpaceConfigFlags.
isSet(WAVEFRONT_SCOPE);
948 return _memSpaceConfigFlags.
isSet(WORKGROUP_SCOPE);
955 return _memSpaceConfigFlags.
isSet(DEVICE_SCOPE);
962 return _memSpaceConfigFlags.
isSet(SYSTEM_SCOPE);
968 return _memSpaceConfigFlags.
isSet(GLOBAL_SEGMENT) ||
969 (!isGroupSegment() && !isPrivateSegment() &&
970 !isKernargSegment() && !isReadonlySegment() &&
971 !isSpillSegment() && !isArgSegment());
977 return _memSpaceConfigFlags.
isSet(GROUP_SEGMENT);
983 return _memSpaceConfigFlags.
isSet(PRIVATE_SEGMENT);
989 return _memSpaceConfigFlags.
isSet(KERNARG_SEGMENT);
995 return _memSpaceConfigFlags.
isSet(READONLY_SEGMENT);
1001 return _memSpaceConfigFlags.
isSet(SPILL_SEGMENT);
1007 return _memSpaceConfigFlags.
isSet(ARG_SEGMENT);
1028 #endif // __MEM_REQUEST_HH__
bool isPrefetchEx() const
std::vector< bool > _byteEnable
Byte-enable mask for writes.
ContextID _contextId
The context ID (for statistics, locks, and wakeups).
bool isGroupSegment() const
bool isDeviceScope() const
Tick time() const
Accessor for time.
::Flags< PrivateFlagsType > PrivateFlags
void setStreamId(uint32_t sid)
void setMemSpaceConfigFlags(MemSpaceConfigFlags extraFlags)
void setSubStreamId(uint32_t ssid)
PrivateFlags privateFlags
Private flags for field validity checking.
int depth
Level of the cache hierachy where this request was responded to (e.g.
bool isUncacheable() const
Accessor functions for flags.
Tick _time
The time this request was started.
uint64_t getExtraData() const
Accessor function for store conditional return value.
Flags _flags
Flag structure for the request.
uint64_t _extraData
Extra data for the request, such as the return value of store conditional or the compare value for a ...
unsigned _size
The size of the request.
bool isKernargSegment() const
void setExtraData(uint64_t extraData)
Accessor function for store conditional return value.
::Flags< FlagsType > Flags
bool hasAtomicOpFunctor()
Accessor for atomic-op functor.
InstSeqNum _reqInstSeqNum
Sequence number of the instruction that creates the request.
std::shared_ptr< Request > RequestPtr
Request(uint64_t asid, Addr vaddr, unsigned size, Flags flags, MasterID mid, Addr pc, ContextID cid)
Request(uint64_t asid, Addr vaddr, unsigned size, Flags flags, MasterID mid, Addr pc, ContextID cid, AtomicOpFunctorPtr atomic_op)
bool hasPaddr() const
Accessor for paddr.
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
MasterID _masterId
The requestor ID which is unique in the system for all ports that are capable of issuing a transactio...
void setContext(ContextID context_id)
Set up Context numbers.
MasterID masterId() const
Accesssor for the requestor id.
uint32_t _streamId
The stream ID uniquely identifies a device behind the SMMU/IOMMU Each transaction arriving at the SMM...
uint16_t PrivateFlagsType
bool isScoped() const
Accessor functions for the memory space configuration flags and used by GPU ISAs such as the Heteroge...
Addr _paddr
The physical address of the request.
void setVirt(uint64_t asid, Addr vaddr, unsigned size, Flags flags, MasterID mid, Addr pc, AtomicOpFunctorPtr amo_op=nullptr)
Set up a virtual (e.g., CPU) request in a previously allocated Request object.
void setAccessLatency()
Set/Get the time taken to complete this request's access, not including the time to successfully tran...
uint32_t _taskId
The task id associated with this request.
uint32_t _substreamId
The substream ID identifies an "execution context" within a device behind an SMMU/IOMMU.
bool isCacheClean() const
Accessor functions to determine whether this request is part of a cache maintenance operation...
bool isSystemScope() const
bool hasVaddr() const
Accessor function for vaddr.
Request(Addr paddr, unsigned size, Flags flags, MasterID mid, Tick time, Addr pc)
::Flags< MemSpaceConfigFlagsType > MemSpaceConfigFlags
Tick getAccessLatency() const
bool isGlobalSegment() const
Tick curTick()
The current simulated tick.
AtomicOpFunctor * getAtomicOpFunctor()
Addr _vaddr
The virtual address of the request.
Request(Addr paddr, unsigned size, Flags flags, MasterID mid)
Constructor for physical (e.g.
ContextID contextId() const
Accessor function for context ID.
void incAccessDepth() const
Increment/Get the depth at which this request is responded to.
Tick accessDelta
Access latency to complete this memory transaction not including translation time.
Request()
Minimal constructor.
uint64_t Tick
Tick count type.
Request(const Request &other)
bool isCacheInvalidate() const
bool isMasked() const
Returns true if the memory request is masked, which means there is at least one byteEnable element wh...
bool isAtomicNoReturn() const
int getAccessDepth() const
void splitOnVaddr(Addr split_addr, RequestPtr &req1, RequestPtr &req2)
Generate two requests as if this request had been split into two pieces.
bool isWorkgroupScope() const
bool isSpillSegment() const
uint32_t streamId() const
void setPhys(Addr paddr, unsigned size, Flags flags, MasterID mid, Tick time)
Set up a physical (e.g.
void setReqInstSeqNum(const InstSeqNum seq_num)
const std::vector< bool > & getByteEnable() const
bool extraDataValid() const
Accessor function to check if sc result is valid.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool isStrictlyOrdered() const
uint64_t _asid
The address space ID.
bool hasContextId() const
Special TaskIds that are used for per-context-switch stats dumps and Cache Occupancy.
void setByteEnable(const std::vector< bool > &be)
Flags getFlags()
Accessor for flags.
bool isReadonlySegment() const
AtomicOpFunctorPtr atomicOpFunctor
A pointer to an atomic operation.
uint32_t substreamId() const
Tick translateDelta
Time for the TLB/table walker to successfully translate this request.
Request(Addr paddr, unsigned size, Flags flags, MasterID mid, Tick time)
Addr _pc
program counter of initiating access; for tracing/debugging
bool isMmappedIpr() const
bool isWavefrontScope() const
bool isCacheMaintenance() const
void setAsid(uint64_t asid)
Accessor function for asid.
bool isArgSegment() const
ArchFlagsType getArchFlags() const
Accessor function for architecture-specific flags.
bool hasInstSeqNum() const
Accessor for the sequence number of instruction that creates the request.
Addr getPC() const
Accessor function for pc.
bool isPrivateSegment() const
bool isAtomicReturn() const
InstSeqNum getReqInstSeqNum() const
void setPaddr(Addr paddr)
Set just the physical address.
void setFlags(Flags flags)
Note that unlike other accessors, this function sets specific flags (ORs them in); it does not assign...
Tick getTranslateLatency() const
MemSpaceConfigFlags _memSpaceConfigFlags
Memory space configuraiton flag structure for the request.
uint64_t getAsid() const
Accessor function for asid.
bool hasSubstreamId() const
int ContextID
Globally unique thread context ID.
Request(Addr paddr, unsigned size, Flags flags, MasterID mid, InstSeqNum seq_num, ContextID cid)
bool hasSize() const
Accessor for size.
uint32_t MemSpaceConfigFlagsType
void setTranslateLatency()
Set/Get the time taken for this request to be successfully translated.
bool isToPOU() const
Accessor functions for the destination of a memory request.