45 #include "arch/locked_mem.hh" 46 #include "arch/mmapped_ipr.hh" 53 #include "debug/Activity.hh" 54 #include "debug/MinorMem.hh" 70 issuedToMemory(false),
71 isTranslationDelayed(false),
74 request = std::make_shared<Request>();
86 inst->translationFault =
inst->staticInst->initiateAcc(&context,
nullptr);
89 "Translation fault suppressed for inst:%s\n", *
inst);
91 assert(
inst->translationFault == fault);
99 DPRINTFS(MinorMem, (&
port),
"Complete disabled mem access for inst:%s\n",
108 inst->staticInst->completeAcc(
nullptr, &context,
inst->traceData);
122 Addr req1_addr,
unsigned int req1_size,
123 Addr req2_addr,
unsigned int req2_size)
127 Addr req2_end_addr = req2_addr + req2_size;
128 Addr req1_end_addr = req1_addr + req1_size;
132 if (req1_addr >= req2_end_addr || req1_end_addr <= req2_addr)
134 else if (req1_addr <= req2_addr && req1_end_addr >= req2_end_addr)
147 other_request->
request->getPaddr(), other_request->
request->getSize());
160 return inst->isInst() &&
inst->staticInst->isMemBarrier();
172 DPRINTFS(MinorMem, (&
port),
"Setting state from %d to %d for request:" 188 os << (
isLoad ?
'R' :
'W') <<
';';
189 inst->reportData(os);
198 os <<
"PartialAddrRangeCoverage";
201 os <<
"FullAddrRangeCoverage";
204 os <<
"NoAddrRangeCoverage";
207 os <<
"AddrRangeCoverage-" <<
static_cast<int>(coverage);
221 os <<
"InTranslation";
230 os <<
"RequestIssuing";
233 os <<
"StoreToStoreBuffer";
236 os <<
"StoreInStoreBuffer";
239 os <<
"StoreBufferIssuing";
242 os <<
"RequestNeedsRetry";
245 os <<
"StoreBufferNeedsRetry";
251 os <<
"LSQRequestState-" <<
static_cast<int>(
state);
260 bool is_last_barrier =
263 DPRINTF(MinorMem,
"Moving %s barrier out of store buffer inst: %s\n",
264 (is_last_barrier ?
"last" :
"a"), *inst);
276 DPRINTFS(MinorMem, (&
port),
"Received translation response for" 278 fault_ !=
NoFault ? fault_->name() :
"");
281 inst->translationFault = fault_;
306 const auto &byte_enable =
request->getByteEnable();
307 if (byte_enable.size() == 0 ||
313 DPRINTFS(MinorMem, (&
port),
"Submitting DTLB request\n");
330 packetInFlight =
false;
341 numTranslatedFragments;
343 numInTranslationFragments--;
344 numTranslatedFragments++;
346 DPRINTFS(MinorMem, (&
port),
"Received translation response for fragment" 347 " %d of request: %s delayed:%d %s\n", expected_fragment_index,
349 fault_ !=
NoFault ? fault_->name() :
"");
351 assert(request_ == fragmentRequests[expected_fragment_index]);
359 inst->translationFault = fault_;
361 DPRINTFS(MinorMem, (&
port),
"Faulting translation for fragment:" 362 " %d of request: %s\n",
363 expected_fragment_index, *
inst);
367 if (expected_fragment_index == 0) {
376 numTranslatedFragments--;
377 makeFragmentPackets();
382 }
else if (numTranslatedFragments == numFragments) {
383 makeFragmentPackets();
388 assert(!translationEvent.scheduled());
395 LSQRequest(port_, inst_, isLoad_, data_, res_),
423 unsigned int whole_size =
request->getSize();
426 unsigned int fragment_size;
443 unsigned int first_fragment_offset =
445 unsigned int last_fragment_size =
447 unsigned int first_fragment_size =
448 line_width - first_fragment_offset;
450 unsigned int middle_fragments_total_size =
451 whole_size - (first_fragment_size + last_fragment_size);
455 unsigned int middle_fragment_count =
456 middle_fragments_total_size / line_width;
459 (last_fragment_size == 0 ? 0 : 1);
461 DPRINTFS(MinorMem, (&
port),
"Dividing transfer into %d fragmentRequests." 462 " First fragment size: %d Last fragment size: %d\n",
464 (last_fragment_size == 0 ? line_width : last_fragment_size));
466 assert(((middle_fragment_count * line_width) +
467 first_fragment_size + last_fragment_size) == whole_size);
469 fragment_addr = base_addr;
470 fragment_size = first_fragment_size;
473 Addr end_addr = base_addr + whole_size;
475 auto& byte_enable =
request->getByteEnable();
476 unsigned int num_disabled_fragments = 0;
478 for (
unsigned int fragment_index = 0; fragment_index <
numFragments;
483 if (fragment_addr == base_addr) {
485 fragment_size = first_fragment_size;
487 if ((fragment_addr + line_width) > end_addr) {
489 fragment_size = end_addr - fragment_addr;
490 is_last_fragment =
true;
493 fragment_size = line_width;
498 bool disabled_fragment =
false;
500 fragment->setContext(
request->contextId());
501 if (byte_enable.empty()) {
502 fragment->setVirt(0 ,
503 fragment_addr, fragment_size,
request->getFlags(),
508 auto it_start = byte_enable.begin() +
509 (fragment_addr - base_addr);
510 auto it_end = byte_enable.begin() +
511 (fragment_addr - base_addr) + fragment_size;
513 fragment->setVirt(0 ,
514 fragment_addr, fragment_size,
request->getFlags(),
519 disabled_fragment =
true;
523 if (!disabled_fragment) {
524 DPRINTFS(MinorMem, (&
port),
"Generating fragment addr: 0x%x" 525 " size: %d (whole request addr: 0x%x size: %d) %s\n",
526 fragment_addr, fragment_size, base_addr, whole_size,
527 (is_last_fragment ?
"last fragment" :
""));
531 num_disabled_fragments++;
534 fragment_addr += fragment_size;
536 assert(numFragments >= num_disabled_fragments);
537 numFragments -= num_disabled_fragments;
548 for (
unsigned int fragment_index = 0;
554 DPRINTFS(MinorMem, (&
port),
"Making packet %d for request: %s" 556 fragment_index, *
inst,
557 (fragment->hasPaddr() ?
"has paddr" :
"no paddr"),
558 (fragment->hasPaddr() ? fragment->getPaddr() : 0));
560 Addr fragment_addr = fragment->getVaddr();
561 unsigned int fragment_size = fragment->getSize();
563 uint8_t *request_data = NULL;
568 request_data =
new uint8_t[fragment_size];
569 std::memcpy(request_data,
data + (fragment_addr - base_addr),
573 assert(fragment->hasPaddr());
580 request->setFlags(fragment->getFlags());
637 DPRINTFS(MinorMem, (&
port),
"Retiring fragment addr: 0x%x size: %d" 638 " offset: 0x%x (retired fragment num: %d)\n",
639 response->
req->getVaddr(), response->
req->getSize(),
640 request->getVaddr() - response->
req->getVaddr(),
648 DPRINTFS(MinorMem, (&
port),
"Skipping this fragment\n");
649 }
else if (response->
isError()) {
651 DPRINTFS(MinorMem, (&
port),
"Fragment has an error, skipping\n");
668 response->
req->getSize());
674 DPRINTFS(MinorMem, (&
port),
"Completed skipped burst\n");
686 DPRINTFS(MinorMem, (&
port),
"Retired packet isRead: %d isWrite: %d" 687 " needsResponse: %d packetSize: %s requestSize: %s responseSize:" 716 DPRINTFS(MinorMem, (&
port),
"Submitting DTLB request for fragment: %d\n",
731 return slots.size() < numSlots;
737 auto found = std::find(slots.begin(), slots.end(),
request);
739 if (found != slots.end()) {
740 DPRINTF(MinorMem,
"Deleting request: %s %s %s from StoreBuffer\n",
741 request, *found, *(request->
inst));
752 warn(
"%s: store buffer insertion without space to insert from" 753 " inst: %s\n",
name(), *(request->
inst));
756 DPRINTF(MinorMem,
"Pushing store: %s into store buffer\n", request);
758 numUnissuedAccesses++;
763 slots.push_back(request);
772 unsigned int &found_slot)
774 unsigned int slot_index = slots.size() - 1;
775 auto i = slots.rbegin();
787 slot->
inst->id.threadId == request->
inst->id.threadId &&
788 !slot->
packet->
req->isCacheMaintenance()) {
792 DPRINTF(MinorMem,
"Forwarding: slot: %d result: %s thisAddr:" 793 " 0x%x thisSize: %d slotAddr: 0x%x slotSize: %d\n",
794 slot_index, coverage,
798 found_slot = slot_index;
813 unsigned int slot_number)
815 assert(slot_number < slots.size());
826 Addr addr_offset = load_addr - store_addr;
828 unsigned int load_size = load->
request->getSize();
830 DPRINTF(MinorMem,
"Forwarding %d bytes for addr: 0x%x from store buffer" 831 " slot: %d addr: 0x%x addressOffset: 0x%x\n",
832 load_size, load_addr, slot_number,
833 store_addr, addr_offset);
836 void *store_packet_data = store->
packet->
getPtr<uint8_t>() + addr_offset;
838 std::memcpy(load_packet_data, store_packet_data, load_size);
847 numUnissuedAccesses--;
853 DPRINTF(MinorMem,
"StoreBuffer step numUnissuedAccesses: %d\n",
854 numUnissuedAccesses);
858 while (!slots.empty() &&
859 slots.front()->isComplete() && slots.front()->isBarrier())
863 DPRINTF(MinorMem,
"Clearing barrier for inst: %s\n",
866 numUnissuedAccesses--;
867 lsq.clearMemBarrier(barrier->
inst);
873 auto i = slots.begin();
875 unsigned int issue_count = 0;
885 issue_count < storeLimitPerCycle &&
886 lsq.canSendToMemorySystem() &&
891 DPRINTF(MinorMem,
"Considering request: %s, sentAllPackets: %d" 902 DPRINTF(MinorMem,
"Trying to send request: %s to memory" 903 " system\n", *(request->
inst));
905 if (lsq.tryToSend(request)) {
906 countIssuedStore(request);
926 if (!inst->inStoreBuffer) {
940 unsigned int size = slots.size();
942 std::ostringstream
os;
954 while (i < numSlots) {
962 MINORTRACE(
"addr=%s num_unissued_stores=%d\n", os.str(),
963 numUnissuedAccesses);
970 DPRINTF(MinorMem,
"Request needs retry, not issuing to" 971 " memory until retry arrives\n");
976 DPRINTF(MinorMem,
"Request still in translation, not issuing to" 987 DPRINTF(MinorMem,
"Request not at front of requests queue, can't" 988 " issue to memory\n");
993 DPRINTF(MinorMem,
"No space to insert request into transfers" 999 DPRINTF(MinorMem,
"Passing a %s transfer on to transfers" 1000 " queue\n", (request->
isComplete() ?
"completed" :
"failed"));
1011 DPRINTF(MinorMem,
"Request's inst. is from the wrong stream," 1012 " waiting for responses before aborting request\n");
1014 DPRINTF(MinorMem,
"Request's inst. is from the wrong stream," 1015 " aborting request\n");
1024 if (request->
inst->staticInst->isPrefetch()) {
1025 DPRINTF(MinorMem,
"Not signalling fault for faulting prefetch\n");
1027 DPRINTF(MinorMem,
"Moving faulting request into the transfers" 1035 bool is_load = request->
isLoad;
1036 bool is_llsc = request->
request->isLLSC();
1037 bool is_swap = request->
request->isSwap();
1038 bool is_atomic = request->
request->isAtomic();
1039 bool bufferable = !(request->
request->isStrictlyOrdered() ||
1040 is_llsc || is_swap || is_atomic);
1044 DPRINTF(MinorMem,
"Load request with stores still in transfers" 1045 " queue, stalling\n");
1050 if (bufferable && !request->
request->isMmappedIpr()) {
1053 DPRINTF(MinorMem,
"Moving store into transfers queue\n");
1063 DPRINTF(MinorMem,
"Memory access not the head inst., can't be" 1064 " sure it can be performed, not issuing\n");
1068 unsigned int forwarding_slot = 0;
1080 DPRINTF(MinorMem,
"Memory access can receive forwarded data" 1081 " from the store buffer, but need to wait for store buffer" 1091 bool do_access =
true;
1096 unsigned int forwarding_slot = 0;
1101 switch (forwarding_result) {
1112 DPRINTF(MinorMem,
"Load partly satisfied by store buffer" 1113 " data. Must wait for the store to complete\n");
1117 DPRINTF(MinorMem,
"No forwardable data from store buffer\n");
1124 DPRINTF(MinorMem,
"Can't send request to memory system yet\n");
1141 DPRINTF(MinorMem,
"Not perfoming a memory " 1142 "access for store conditional\n");
1151 DPRINTF(MinorMem,
"Can't send request to memory system yet\n");
1177 DPRINTF(MinorMem,
"Can't send request: %s yet, no space in memory\n",
1182 DPRINTF(MinorMem,
"Trying to send request: %s addr: 0x%x\n",
1183 *(request->
inst), packet->
req->getVaddr());
1189 if (request->
request->isMmappedIpr()) {
1192 request->
request->contextId()));
1195 DPRINTF(MinorMem,
"IPR read inst: %s\n", *(request->
inst));
1198 DPRINTF(MinorMem,
"IPR write inst: %s\n", *(request->
inst));
1206 DPRINTF(MinorMem,
"IPR access has another packet: %s\n",
1215 DPRINTF(MinorMem,
"Sent data memory request\n");
1223 switch (request->
state) {
1237 panic(
"Unrecognized LSQ request state %d.", request->
state);
1243 "Sending data memory request - needs retry\n");
1249 switch (request->
state) {
1259 panic(
"Unrecognized LSQ request state %d.", request->
state);
1300 DPRINTF(MinorMem,
"Received response packet inst: %s" 1301 " addr: 0x%x cmd: %s\n",
1308 DPRINTF(MinorMem,
"Received error response packet: %s\n",
1312 switch (request->
state) {
1318 DPRINTF(MinorMem,
"Has outstanding packets?: %d %d\n",
1333 DPRINTF(MinorMem,
"Completed transfer for barrier: %s" 1334 " leaving the request as it is also a barrier\n",
1340 panic(
"Shouldn't be allowed to receive a response from another state");
1357 DPRINTF(MinorMem,
"Received retry request\n");
1401 LSQ::LSQ(std::string name_, std::string dcache_port_name_,
1403 unsigned int in_memory_system_limit,
unsigned int line_width,
1404 unsigned int requests_queue_size,
unsigned int transfers_queue_size,
1405 unsigned int store_buffer_size,
1406 unsigned int store_buffer_cycle_store_limit) :
1414 lineWidth((line_width == 0 ?
cpu.cacheLineSize() : line_width)),
1415 requests(name_ +
".requests",
"addr", requests_queue_size),
1416 transfers(name_ +
".transfers",
"addr", transfers_queue_size),
1418 *this, store_buffer_size, store_buffer_cycle_store_limit),
1426 if (in_memory_system_limit < 1) {
1427 fatal(
"%s: executeMaxAccessesInMemory must be >= 1 (%d)\n", name_,
1428 in_memory_system_limit);
1431 if (store_buffer_cycle_store_limit < 1) {
1432 fatal(
"%s: executeLSQMaxStoreBufferStoresPerCycle must be" 1433 " >= 1 (%d)\n", name_, store_buffer_cycle_store_limit);
1436 if (requests_queue_size < 1) {
1437 fatal(
"%s: executeLSQRequestsQueueSize must be" 1438 " >= 1 (%d)\n", name_, requests_queue_size);
1441 if (transfers_queue_size < 1) {
1442 fatal(
"%s: executeLSQTransfersQueueSize must be" 1443 " >= 1 (%d)\n", name_, transfers_queue_size);
1446 if (store_buffer_size < 1) {
1447 fatal(
"%s: executeLSQStoreBufferSize must be" 1448 " >= 1 (%d)\n", name_, store_buffer_size);
1494 if (request->
inst->id == inst->id) {
1497 bool to_store_buffer = request->
state ==
1500 if ((complete && !(request->
isBarrier() && !can_store)) ||
1501 (to_store_buffer && can_store))
1509 DPRINTF(MinorMem,
"Found matching memory response for inst: %s\n",
1512 DPRINTF(MinorMem,
"No matching memory response for inst: %s\n",
1533 DPRINTF(MinorMem,
"Deleting %s request: %s\n",
1534 (response->
isLoad ?
"load" :
"store"),
1546 DPRINTF(MinorMem,
"Sending store: %s to store buffer\n",
1549 request->
inst->inStoreBuffer =
true;
1571 ret = have_translated_requests ||
1576 DPRINTF(Activity,
"Need to tick\n");
1587 assert(inst->translationFault ==
NoFault || inst->inLSQ);
1590 return inst->translationFault;
1595 if (needs_burst && inst->staticInst->isAtomic()) {
1603 panic(
"Do not expect cross-cache-line atomic memory request\n");
1610 uint8_t *request_data = NULL;
1612 DPRINTF(MinorMem,
"Pushing request (%s) addr: 0x%x size: %d flags:" 1613 " 0x%x%s lineWidth : 0x%x\n",
1614 (isLoad ?
"load" :
"store/atomic"), addr, size, flags,
1615 (needs_burst ?
" (needs burst)" :
""),
lineWidth);
1620 request_data =
new uint8_t[size];
1621 if (inst->staticInst->isAtomic() ||
1624 std::memset(request_data, 0, size);
1626 std::memcpy(request_data, data, size);
1632 *
this, inst, isLoad, request_data, res);
1635 *
this, inst, isLoad, request_data, res);
1638 if (inst->traceData)
1639 inst->traceData->setMem(addr, size, flags);
1641 int cid =
cpu.
threads[inst->id.threadId]->getTC()->contextId();
1642 request->
request->setContext(cid);
1646 inst->pc.instAddr(), std::move(amo_op));
1647 request->
request->setByteEnable(byte_enable);
1653 return inst->translationFault;
1666 MINORTRACE(
"state=%s in_tlb_mem=%d/%d stores_in_transfers=%d" 1667 " lastMemBarrier=%d\n",
1676 unsigned int store_buffer_size,
1677 unsigned int store_limit_per_cycle) :
1678 Named(name_), lsq(lsq_),
1679 numSlots(store_buffer_size),
1680 storeLimitPerCycle(store_limit_per_cycle),
1682 numUnissuedAccesses(0)
1698 }
else if (!request->isCacheMaintenance()) {
1710 assert(inst->isInst() && inst->staticInst->isMemBarrier());
1722 assert(inst->translationFault ==
NoFault);
1740 os <<
"MemoryRunning";
1743 os <<
"MemoryNeedsRetry";
1746 os <<
"MemoryState-" <<
static_cast<int>(
state);
1782 if (tid != req_tid) {
MemoryState
State of memory access for head access.
#define panic(...)
This implements a cprintf based panic() function.
Addr addrBlockOffset(Addr addr, Addr block_size)
Calculates the offset of a given address wrt aligned fixed-size blocks.
virtual bool sentAllPackets()=0
Have all packets been sent?
MinorDynInstPtr inst
Instruction which made this request.
SingleDataRequest is used for requests that don't fragment.
unsigned int numAccessesIssuedToMemory
The number of accesses which have been issued to the memory system but have not been committed/discar...
decltype(nullptr) constexpr NoFault
AddressMonitor * getCpuAddrMonitor(ThreadID tid)
void pop()
Pop the head item.
LSQQueue transfers
Once issued to memory (or, for stores, just had their state changed to StoreToStoreBuffer) LSQRequest...
T * findNextSenderState() const
Go through the sender state stack and return the first instance that is of type T (as determined by a...
bool transferNeedsBurst(Addr addr, unsigned int size, unsigned int block_size)
Returns true if the given memory access (address, size) needs to be fragmented across aligned fixed-s...
#define fatal(...)
This implements a cprintf based fatal() function.
PacketDataPtr data
Dynamically allocated and populated data carried for building write packets.
void setState(LSQRequestState new_state)
Set state and output trace output.
StoreBuffer(std::string name_, LSQ &lsq_, unsigned int store_buffer_size, unsigned int store_limit_per_cycle)
void finish(const Fault &fault_, const RequestPtr &request_, ThreadContext *tc, BaseTLB::Mode mode)
TLB interace.
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.
bool isTranslationDelayed
Address translation is delayed due to table walk.
SplitDataRequest(LSQ &port_, MinorDynInstPtr inst_, bool isLoad_, PacketDataPtr data_=NULL, uint64_t *res_=NULL)
std::vector< Packet * > fragmentPackets
Packets matching fragmentRequests to issue fragments to memory.
void step()
Try to issue more stores to memory.
ThreadID numThreads
Number of threads we're actually simulating (<= SMT_MAX_THREADS).
virtual BaseTLB * getDTBPtr()=0
void minorTrace() const
Report queue contents for MinorTrace.
virtual bool isBarrier()
Is this a request a barrier?
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...
bool empty() const
Is the queue empty?
bool instIsHeadInst(MinorDynInstPtr inst)
Returns true if the given instruction is at the head of the inFlightInsts instruction queue...
const std::string & toString() const
Return the string to a cmd given by idx.
void pushFailedRequest(MinorDynInstPtr inst)
Push a predicate failed-representing request into the queues just to maintain commit order...
std::shared_ptr< Request > RequestPtr
All the fun of executing instructions from Decode and sending branch/new instruction stream info...
std::vector< RequestPtr > fragmentRequests
Fragment Requests corresponding to the address ranges of each fragment.
void wakeupOnEvent(unsigned int stage_id)
Interface for stages to signal that they have become active after a callback or eventq event where th...
unsigned int numStoresInTransfers
The number of stores in the transfers queue.
unsigned int unreservedRemainingSpace() const
Like remainingSpace but does not count reserved spaces.
static PacketPtr createWrite(const RequestPtr &req)
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Cycles handleIprRead(ThreadContext *, Packet *)
void retireResponse(PacketPtr packet_)
For loads, paste the response data into the main response packet.
void setMemAccPredicate(bool val) override
void startAddrTranslation()
Start a loop of do { sendNextFragmentToTranslation ; translateTiming ; finish } while (numTranslatedF...
TheISA::PCState pcState() const override
bool needsToBeSentToStoreBuffer()
This request, once processed by the requests/transfers queues, will need to go to the store buffer...
The SimpleThread object provides a combination of the ThreadState object and the ThreadContext interf...
bool handleLockedWrite(XC *xc, const RequestPtr &req, Addr cacheBlockMask)
unsigned int numFragments
Number of fragments this request is split into.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the slave port by calling its corresponding receive function...
Minor contains all the definitions within the MinorCPU apart from the CPU class itself.
bool canInsert() const
Can a new request be inserted into the queue?
void handleLockedRead(XC *xc, const RequestPtr &req)
unsigned int numAccessesInMemorySystem
Count of the number of mem.
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 isInvalidate() const
ThreadContext is the external interface to all thread state for anything outside of the CPU...
T * getPtr()
get a pointer to the data ptr.
ExecContext bears the exec_context interface for Minor.
struct ip6_opt_fragment fragment
bool isComplete() const
Has this request been completed.
ExecContext bears the exec_context interface for Minor.
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 ...
Derived SenderState to carry data access info.
RequestPtr req
A pointer to the original request.
std::vector< InstSeqNum > lastMemBarrier
Most recent execSeqNum of a memory barrier instruction or 0 if there are no in-flight barriers...
Request for doing barrier accounting in the store buffer.
void completeMemBarrierInst(MinorDynInstPtr inst, bool committed)
Complete a barrier instruction.
LSQRequest(LSQ &port_, MinorDynInstPtr inst_, bool isLoad_, PacketDataPtr data_=NULL, uint64_t *res_=NULL)
Tick curTick()
The current simulated tick.
bool needsResponse() const
MemoryState state
Retry state of last issued memory transfer.
unsigned int numRetiredFragments
Number of fragments retired back to this request.
ElemType & front()
Head value.
MasterID dataMasterId() const
Reads this CPU's unique data requestor ID.
PacketPtr getHeadPacket()
Get the head packet as counted by numIssuedFragments.
PacketPtr makePacketForRequest(const RequestPtr &request, bool isLoad, Packet::SenderState *sender_state, PacketDataPtr data)
Make a suitable packet for the given request.
bool issuedToMemory
This in an access other than a normal cacheable load that's visited the memory system.
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.
virtual void retireResponse(PacketPtr packet_)=0
Retire a response packet into the LSQRequest packet possibly completing this transfer.
void makePacket()
Make a packet to use with the memory transaction.
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 doMonitor(PacketPtr pkt)
virtual void translateTiming(const RequestPtr &req, ThreadContext *tc, Translation *translation, Mode mode)=0
virtual void stepToNextPacket()=0
Step to the next packet for the next call to getHeadPacket.
bool canSendToMemorySystem()
Can a request be sent to the memory system.
void makeFragmentPackets()
Make the packets to go with the requests so they can be sent to the memory system.
virtual void startAddrTranslation()=0
Start the address translation process for this request.
static const FlagsType STORE_NO_DATA
FailedDataRequest represents requests from instructions that failed their predicates but need to ride...
AddrRangeCoverage canForwardDataToLoad(LSQRequestPtr request, unsigned int &found_slot)
Look for a store which satisfies the given load.
unsigned int numInTranslationFragments
Number of fragments in the address translation mechanism.
void reportData(std::ostream &os) const
MinorTrace report interface.
void clearMemBarrier(MinorDynInstPtr inst)
Clear a barrier (if it's the last one marked up in lastMemBarrier)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
MinorCPU & cpu
My owner(s)
static PacketPtr createRead(const RequestPtr &req)
Constructor-like methods that return Packets based on Request objects.
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...
const std::string & name() const
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 SimObject that sees the packet.
AddrRangeCoverage
Coverage of one address range with another.
void step()
Step checks the queues to see if their are issuable transfers which were not otherwise picked up by t...
A load/store queue that allows outstanding reads and writes.
unsigned int numAccessesInDTLB
Number of requests in the DTLB in the requests queue.
void makeFragmentRequests()
Make all the Requests for this transfer's fragments so that those requests can be sent for address tr...
int16_t ThreadID
Thread index/ID type.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
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.
void startAddrTranslation()
Send single translation request.
void insert(LSQRequestPtr request)
Insert a request at the back of the queue.
bool instIsRightStream(MinorDynInstPtr inst)
Does the given instruction have the right stream sequence number to be committed? ...
GenericISA::SimplePCState< MachInst > PCState
MemCmd cmd
The command field of the packet.
void sendNextFragmentToTranslation()
Part of the address translation loop, see startAddTranslation.
bool hasPacketsInMemSystem()
True if this request has any issued packets in the memory system and so can't be interrupted until it...
Top level definition of the Minor in-order CPU model.
Addr cacheBlockMask
Address Mask for a cache block (e.g.
void wakeup(ThreadID tid) override
void stepToNextPacket()
Step on numIssuedFragments.
ThreadID contextToThread(ContextID cid)
Convert ContextID to threadID.
virtual ThreadContext * getContext(int tn)
Given a thread num get tho thread context for it.
std::vector< Minor::MinorThread * > threads
These are thread state-representing objects for this CPU.
bool isDrained() const
Drained if there is absolutely nothing left in the buffer.
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)
void push(ElemType &data)
Push an element into the buffer if it isn't a bubble.
#define MINORTRACE(...)
DPRINTFN for MinorTrace reporting.
void retireResponse(PacketPtr packet_)
Keep the given packet as the response packet LSQRequest::packet.
bool isAnyActiveElement(const std::vector< bool >::const_iterator &it_start, const std::vector< bool >::const_iterator &it_end)
Test if there is any active element in an enablement range.
void tryToSuppressFault()
Instructions may want to suppress translation faults (e.g.
void schedule(Event &event, Tick when)
The constructed pipeline.
const T * getConstPtr() const
virtual PacketPtr getHeadPacket()=0
Get the next packet to issue for this request.
void completeDisabledMemAccess()
void dataDynamic(T *p)
Set the data pointer to a value that should have delete [] called on it.
void handleLockedSnoop(XC *xc, PacketPtr pkt, Addr cacheBlockMask)
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
void copyError(Packet *pkt)
const unsigned int inMemorySystemLimit
Maximum number of in-flight accesses issued to the memory system.
Cycles handleIprWrite(ThreadContext *, Packet *)
const unsigned int lineWidth
Memory system access width (and snap) in bytes.
MinorCPU is an in-order CPU model with four fixed pipeline stages:
static const int NumArgumentRegs M5_VAR_USED
RequestPtr request
The underlying request of this LSQRequest.
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.
std::shared_ptr< FaultBase > Fault
void finish(const Fault &fault_, const RequestPtr &request_, ThreadContext *tc, BaseTLB::Mode mode)
TLB response interface.
void allocate()
Allocate memory for the packet.
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.
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.
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...