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