45#ifndef __CPU_MINOR_FETCH1_HH__
46#define __CPU_MINOR_FETCH1_HH__
185 request = std::make_shared<Request>();
250 pc(other.
pc->clone()),
261 std::unique_ptr<PCStateBase>
pc;
386 Fetch1(
const std::string &name_,
388 const BaseMinorCPUParams ¶ms,
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.
Forward data betwen Execute and Fetch1 carrying change-of-address/stream information.
InstId id
Identity of the line that this request will generate.
bool isComplete() const
Is this a complete read line or fault.
bool isDiscardable() const
Is this line out of date with the current stream/prediction sequence and can it be discarded without ...
void markDelayed()
BaseMMU::Translation interface.
void reportData(std::ostream &os) const
Report interface.
Fetch1 & fetch
Owning fetch unit.
void finish(const Fault &fault_, const RequestPtr &request_, ThreadContext *tc, BaseMMU::Mode mode)
Interface for ITLB responses.
Addr pc
PC to fixup with line address.
void makePacket()
Make a packet to use with the memory transaction.
Fault fault
Fill in a fault if one happens during fetch, check this by picking apart the response packet.
RequestPtr request
The underlying request that this fetch represents.
FetchRequest(Fetch1 &fetch_, InstId id_, Addr pc_)
FetchRequestState
Progress of this request through address translation and memory.
PacketPtr packet
FetchRequests carry packets while they're in the requests and transfers responses queues.
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
IcachePort(std::string name, Fetch1 &fetch_, MinorCPU &cpu)
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
A stage responsible for fetching "lines" from memory and passing them to Fetch2.
FetchState
Cycle-by-cycle state.
unsigned int numFetchesInITLB
Number of requests inside the ITLB rather than in the queues.
Fetch1(const std::string &name_, MinorCPU &cpu_, const BaseMinorCPUParams ¶ms, Latch< BranchData >::Output inp_, Latch< ForwardLineData >::Input out_, Latch< BranchData >::Output prediction_, std::vector< InputBuffer< ForwardLineData > > &next_stage_input_buffer)
virtual void recvReqRetry()
void changeStream(const BranchData &branch)
Start fetching from a new address.
void minorTraceResponseLine(const std::string &name, FetchRequestPtr response) const
Print the appropriate MinorLine line for a fetch response.
MinorCPU::MinorCPUPort & getIcachePort()
Returns the IcachePort owned by this Fetch1.
unsigned int numFetchesInMemorySystem
Count of the number fetches which have left the transfers queue and are in the 'wild' in the memory s...
Latch< BranchData >::Output inp
Input port carrying branch requests from Execute.
ThreadID getScheduledThread()
Use the current threading policy to determine the next thread to fetch from.
void tryToSendToTransfers(FetchRequestPtr request)
Try and issue a fetch for a translated request at the head of the requests queue.
void popAndDiscard(FetchQueue &queue)
Pop a request from the given queue and correctly deallocate and discard it.
std::vector< Fetch1ThreadInfo > fetchInfo
IcacheState icacheState
Retry state of icache_port.
virtual bool recvTimingResp(PacketPtr pkt)
Memory interface.
IcachePort icachePort
IcachePort to pass to the CPU.
Addr lineSnap
Line snap size in bytes.
std::vector< InputBuffer< ForwardLineData > > & nextStageReserve
Interface to reserve space in the next stage.
Addr maxLineWidth
Maximum fetch width in bytes.
void wakeupFetch(ThreadID tid)
Initiate fetch1 fetching.
friend std::ostream & operator<<(std::ostream &os, Fetch1::FetchState state)
bool tryToSend(FetchRequestPtr request)
Try to send (or resend) a memory request's next/only packet to the memory system.
void handleTLBResponse(FetchRequestPtr response)
Handle pushing a TLB response onto the right queue.
bool isDrained()
Is this stage drained? For Fetch1, draining is initiated by Execute signalling a branch with the reas...
Latch< BranchData >::Output prediction
Input port carrying branch predictions from Fetch2.
void evaluate()
Pass on input/buffer data to the output if you can.
unsigned int fetchLimit
Maximum number of fetches allowed in flight (in queues or memory)
void processResponse(FetchRequestPtr response, ForwardLineData &line)
Convert a response to a ForwardLineData.
unsigned int numInFlightFetches()
Returns the total number of queue occupancy, in-ITLB and in-memory system fetches.
MinorCPU & cpu
Construction-assigned data members.
Queue< FetchRequestPtr, ReportTraitsPtrAdaptor< FetchRequestPtr >, NoBubbleTraits< FetchRequestPtr > > FetchQueue
FetchQueue transfers
Queue of in-memory system requests and responses.
void stepQueues()
Step requests along between requests and transfers queues.
void updateExpectedSeqNums(const BranchData &branch)
Update streamSeqNum and predictionSeqNum from the given branch (and assume these have changed and dis...
FetchRequest * FetchRequestPtr
InstSeqNum lineSeqNum
Sequence number for line fetch used for ordering lines to flush.
void fetchLine(ThreadID tid)
Insert a line fetch into the requests.
Latch< ForwardLineData >::Input out
Output port carrying read lines to Fetch2.
FetchQueue requests
Queue of address translated requests from Fetch1.
void moveFromRequestsToTransfers(FetchRequestPtr request)
Move a request between queues.
IcacheState
State of memory access for head instruction fetch.
Line fetch data in the forward direction.
Id for lines and instructions.
static const InstSeqNum firstStreamSeqNum
First sequence numbers to use in initialisation of the pipeline and to be expected on the first line/...
static const InstSeqNum firstPredictionSeqNum
... 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.
A similar adaptor but for elements held by pointer ElemType should implement ReportIF.
Top level definition of the Minor in-order CPU model.
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.
constexpr decltype(nullptr) NoFault
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....
Stage cycle-by-cycle state.
std::unique_ptr< PCStateBase > pc
Fetch PC value.
Fetch1ThreadInfo(const Fetch1ThreadInfo &other)
InstSeqNum streamSeqNum
Stream sequence number.
InstSeqNum predictionSeqNum
Prediction sequence number.
bool blocked
Blocked indication for report.
bool wakeupGuard
Signal to guard against sleeping first cycle of wakeup.
Addr fetchAddr
The address we're currently fetching lines from.