47 #ifndef __CPU_MINOR_NEW_LSQ_HH__
48 #define __CPU_MINOR_NEW_LSQ_HH__
211 Addr req1_addr,
unsigned int req1_size,
212 Addr req2_addr,
unsigned int req2_size);
285 {
fatal(
"No packets in a SpecialDataRequest"); }
369 bool isLoad_,
PacketDataPtr data_ = NULL, uint64_t *res_ = NULL) :
370 LSQRequest(port_, inst_, isLoad_, data_, res_),
428 uint64_t *res_ = NULL);
492 unsigned int store_buffer_size,
493 unsigned int store_limit_per_cycle);
511 unsigned int &found_slot);
647 LSQ(std::string name_, std::string dcache_port_name_,
649 unsigned int max_accesses_in_memory_system,
unsigned int line_width,
650 unsigned int requests_queue_size,
unsigned int transfers_queue_size,
651 unsigned int store_buffer_size,
652 unsigned int store_buffer_cycle_store_limit);
MemoryState
State of memory access for head access.
SpecialDataRequest(LSQ &port_, MinorDynInstPtr inst_)
void makeFragmentPackets()
Make the packets to go with the requests so they can be sent to the memory system.
MinorCPU & cpu
The enclosing cpu.
virtual bool sentAllPackets()=0
Have all packets been sent?
void setState(LSQRequestState new_state)
Set state and output trace output.
MinorDynInstPtr inst
Instruction which made this request.
void stepToNextPacket()
Remember that the packet has been sent.
SingleDataRequest is used for requests that don't fragment.
const unsigned int numSlots
Number of slots, this is a bound on the size of slots.
unsigned int numAccessesIssuedToMemory
The number of accesses which have been issued to the memory system but have not been committed/discar...
LSQQueue transfers
Once issued to memory (or, for stores, just had their state changed to StoreToStoreBuffer) LSQRequest...
Top level definition of the Minor in-order CPU model.
PacketDataPtr data
Dynamically allocated and populated data carried for building write packets.
Contains class definitions for data flowing between pipeline stages in the top-level structure portio...
void makeFragmentRequests()
Make all the Requests for this transfer's fragments so that those requests can be sent for address tr...
StoreBuffer(std::string name_, LSQ &lsq_, unsigned int store_buffer_size, unsigned int store_limit_per_cycle)
TranslationEvent(SplitDataRequest &owner_)
LSQQueue requests
requests contains LSQRequests which have been issued to the TLB by calling ExecContext::readMem/write...
friend std::ostream & operator<<(std::ostream &os, MemoryState state)
Print MemoryState values as shown in the enum definition.
void finish(const Fault &fault_, RequestPtr request_, ThreadContext *tc, BaseTLB::Mode mode)
TLB interace.
std::vector< Packet * > fragmentPackets
Packets matching fragmentRequests to issue fragments to memory.
void step()
Try to issue more stores to memory.
TranslationEvent translationEvent
const std::string name() const
Return port name (for DPRINTF).
unsigned int numIssuedFragments
Number of fragments already issued (<= numFragments)
void popResponse(LSQRequestPtr response)
Sanity check and pop the head response.
void issuedMemBarrierInst(MinorDynInstPtr inst)
A memory barrier instruction has been issued, remember its execSeqNum that we can avoid issuing memor...
unsigned int numUnissuedAccesses
Number of occupied slots which have not yet issued a memory access.
void makePacket()
Make a packet to use with the memory transaction.
void finish(const Fault &fault_, RequestPtr request_, ThreadContext *tc, BaseTLB::Mode mode)
TLB response interface.
void pushFailedRequest(MinorDynInstPtr inst)
Push a predicate failed-representing request into the queues just to maintain commit order...
std::deque< LSQRequestPtr > slots
Queue of store requests on their way to memory.
unsigned int numStoresInTransfers
The number of stores in the transfers queue.
Fault fault
Fault generated performing this request.
const unsigned int storeLimitPerCycle
Maximum number of stores that can be issued per cycle.
PacketPtr makePacketForRequest(Request &request, bool isLoad, Packet::SenderState *sender_state, PacketDataPtr data)
Make a suitable packet for the given request.
void stepToNextPacket()
Step on numIssuedFragments.
virtual bool isBarrier()
Is this a request a barrier?
SingleDataRequest(LSQ &port_, MinorDynInstPtr inst_, bool isLoad_, PacketDataPtr data_=NULL, uint64_t *res_=NULL)
void minorTrace() const
Report queue contents for MinorTrace.
Special request types that don't actually issue memory requests.
PacketPtr getHeadPacket()
Get the head packet as counted by numIssuedFragments.
void retireResponse(PacketPtr packet_)
For loads, paste the response data into the main response packet.
bool accessesInFlight() const
Are there any accesses other than normal cached loads in the memory system or having received respons...
void retireResponse(PacketPtr packet_)
Keep the given packet as the response packet LSQRequest::packet.
unsigned int numFragments
Number of fragments this request is split into.
void finish(const Fault &fault_, RequestPtr request_, ThreadContext *tc, BaseTLB::Mode mode)
TLB interace.
MinorCPUPort(const std::string &name_, MinorCPU &cpu_)
void startAddrTranslation()
Send single translation request.
unsigned int numAccessesInMemorySystem
Count of the number of mem.
unsigned int unreservedRemainingSpace() const
Like remainingSpace but does not count reserved spaces.
void reportData(std::ostream &os) const
MinorTrace report interface.
LSQRequestPtr findResponse(MinorDynInstPtr inst)
Returns a response if it's at the head of the transfers queue and it's either complete or can be sent...
void sendNextFragmentToTranslation()
Part of the address translation loop, see startAddTranslation.
BarrierDataRequest(LSQ &port_, MinorDynInstPtr inst_)
Wrapper for a queue type to act as a pipeline stage input queue.
bool isBarrier()
Is this a request a barrier?
ThreadContext is the external interface to all thread state for anything outside of the CPU...
This file contains miscellaneous classes and functions for formatting general trace information and a...
FailedDataRequest(LSQ &port_, MinorDynInstPtr inst_)
bool sentAllPackets()
packetInFlight can become false again, so need to check packetSent
Derived SenderState to carry data access info.
bool canInsert() const
Can a new request be inserted into the queue?
bool isSnooping() const override
Determine if this master port is snooping or not.
Provide a non-protected base class for Minor's Ports as derived classes are created by Fetch1 and Exe...
static AddrRangeCoverage containsAddrRangeOf(Addr req1_addr, unsigned int req1_size, Addr req2_addr, unsigned int req2_size)
Does address range req1 (req1_addr to req1_addr + req1_size - 1) fully cover, partially cover or not ...
std::vector< InstSeqNum > lastMemBarrier
Most recent execSeqNum of a memory barrier instruction or 0 if there are no in-flight barriers...
std::vector< Request * > fragmentRequests
Fragment Requests corresponding to the address ranges of each fragment.
void pushRequest(MinorDynInstPtr inst, bool isLoad, uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res)
Single interface for readMem/writeMem to issue requests into the LSQ.
bool canRequest()
Is their space in the request queue to be able to push a request by issuing an isMemRef instruction...
Request for doing barrier accounting in the store buffer.
void completeMemBarrierInst(MinorDynInstPtr inst, bool committed)
Complete a barrier instruction.
Request request
The underlying request of this LSQRequest.
A similar adaptor but for elements held by pointer ElemType should implement ReportIF.
MemoryState state
Retry state of last issued memory transfer.
bool skippedMemAccess()
Was no memory access attempted for this request?
unsigned int numRetiredFragments
Number of fragments retired back to this request.
PacketPtr getHeadPacket()
Get the head packet as counted by numIssuedFragments.
void startAddrTranslation()
Start a loop of do { sendNextFragmentToTranslation ; translateTiming ; finish } while (numTranslatedF...
PacketPtr getHeadPacket()
Get the head packet as counted by numIssuedFragments.
bool issuedToMemory
This in an access other than a normal cacheable load that's visited the memory system.
virtual void retireResponse(PacketPtr packet_)=0
Retire a response packet into the LSQRequest packet possibly completing this transfer.
bool tryToSend(LSQRequestPtr request)
Try to send (or resend) a memory request's next/only packet to the memory system. ...
bool isLoad
Load/store indication used for building packet.
bool hasPacketsInMemSystem()
Has packet been sent.
virtual void stepToNextPacket()=0
Step to the next packet for the next call to getHeadPacket.
MinorCPU::MinorCPUPort & getDcachePort()
Return the raw-bindable port.
bool canSendToMemorySystem()
Can a request be sent to the memory system.
virtual void startAddrTranslation()=0
Start the address translation process for this request.
bool isDrained() const
Drained if there is absolutely nothing left in the buffer.
FailedDataRequest represents requests from instructions that failed their predicates but need to ride...
LSQRequest * LSQRequestPtr
AddrRangeCoverage canForwardDataToLoad(LSQRequestPtr request, unsigned int &found_slot)
Look for a store which satisfies the given load.
bool packetSent
Has the packet been at least sent to the memory system?
unsigned int numInTranslationFragments
Number of fragments in the address translation mechanism.
Classes for buffer, queue and FIFO behaviour.
bool needsToBeSentToStoreBuffer()
This request, once processed by the requests/transfers queues, will need to go to the store buffer...
void clearMemBarrier(MinorDynInstPtr inst)
Clear a barrier (if it's the last one marked up in lastMemBarrier)
InstSeqNum getLastMemBarrier(ThreadID thread_id) const
Get the execSeqNum of the last issued memory barrier.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
MinorCPU & cpu
My owner(s)
bool sentAllPackets()
Have we stepped past the end of fragmentPackets?
bool canPushIntoStoreBuffer() const
Must check this before trying to insert into the store buffer.
bool isDrained()
Is there nothing left in the LSQ.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
unsigned int numUnissuedStores()
Number of stores in the store buffer which have not been completely issued to the memory system...
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the slave port.
void tryToSendToTransfers(LSQRequestPtr request)
Try and issue a memory access for a translated request at the head of the requests queue...
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a MemObject that sees the packet.
LSQRequest(LSQ &port_, MinorDynInstPtr inst_, bool isLoad_, PacketDataPtr data_=NULL, uint64_t *res_=NULL)
AddrRangeCoverage
Coverage of one address range with another.
void recvReqRetry() override
Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be...
void markDelayed()
BaseTLB::Translation interface.
void step()
Step checks the queues to see if their are issuable transfers which were not otherwise picked up by t...
unsigned int numAccessesInDTLB
Number of requests in the DTLB in the requests queue.
int16_t ThreadID
Thread index/ID type.
void sendStoreToStoreBuffer(LSQRequestPtr request)
A store has been committed, please move it to the store buffer.
LSQRequestPtr retryRequest
The request (from either requests or the store buffer) which is currently waiting have its memory acc...
bool recvTimingResp(PacketPtr pkt)
Memory interface.
uint64_t * res
Res from pushRequest.
DcachePort(std::string name, LSQ &lsq_, MinorCPU &cpu)
Event to step between translations.
void insert(LSQRequestPtr request)
Insert a request at the back of the queue.
void recvTimingSnoopReq(PacketPtr pkt) override
Receive a timing snoop request from the slave port.
bool hasPacketsInMemSystem()
True if this request has any issued packets in the memory system and so can't be interrupted until it...
Addr cacheBlockMask
Address Mask for a cache block (e.g.
bool hasPacketsInMemSystem()
Never sends any requests.
LSQ(std::string name_, std::string dcache_port_name_, MinorCPU &cpu_, Execute &execute_, unsigned int max_accesses_in_memory_system, unsigned int line_width, unsigned int requests_queue_size, unsigned int transfers_queue_size, unsigned int store_buffer_size, unsigned int store_buffer_cycle_store_limit)
virtual PacketPtr getHeadPacket()=0
Get the next packet to issue for this request.
bool packetInFlight
Has my only packet been sent to the memory system but has not yet been responded to.
const unsigned int inMemorySystemLimit
Maximum number of in-flight accesses issued to the memory system.
const unsigned int lineWidth
Memory system access width (and snap) in bytes.
MinorCPU is an in-order CPU model with four fixed pipeline stages:
void recvFunctionalSnoop(PacketPtr pkt) override
Receive a functional snoop request packet from the slave port.
bool isComplete() const
Has this request been completed.
void threadSnoop(LSQRequestPtr request)
Snoop other threads monitors on memory system accesses.
void setSkipped()
Set this request as having been skipped before a memory transfer was attempt.
void stepToNextPacket()
Step on numIssuedFragments.
std::shared_ptr< FaultBase > Fault
void retireResponse(PacketPtr packet_)
Keep the given packet as the response packet LSQRequest::packet.
Queue< LSQRequestPtr, ReportTraitsPtrAdaptor< LSQRequestPtr >, NoBubbleTraits< LSQRequestPtr > > LSQQueue
The LSQ consists of three queues: requests, transfers and the store buffer storeBuffer.
void startAddrTranslation()
Send single translation request.
void deleteRequest(LSQRequestPtr request)
Delete the given request and free the slot it occupied.
void recvTimingSnoopReq(PacketPtr pkt)
void countIssuedStore(LSQRequestPtr request)
Count a store being issued to memory by decrementing numUnissuedAccesses.
bool sentAllPackets()
Has no packets to send.
void moveFromRequestsToTransfers(LSQRequestPtr request)
Move a request between queues.
void forwardStoreData(LSQRequestPtr load, unsigned int slot_number)
Fill the given packet with appropriate date from slot slot_number.
SplitDataRequest(LSQ &port_, MinorDynInstPtr inst_, bool isLoad_, PacketDataPtr data_=NULL, uint64_t *res_=NULL)
virtual bool hasPacketsInMemSystem()=0
True if this request has any issued packets in the memory system and so can't be interrupted until it...
bool needsToTick()
May need to be ticked next cycle as one of the queues contains an actionable transfers or address tra...
unsigned int numTranslatedFragments
Number of fragments that have completed address translation, (numTranslatedFragments + numInTranslati...