gem5 v24.0.0.0
Loading...
Searching...
No Matches
lsq.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2012, 2014, 2018-2019, 2021 ARM Limited
3 * Copyright (c) 2013 Advanced Micro Devices, Inc.
4 * All rights reserved
5 *
6 * The license below extends only to copyright in the software and shall
7 * not be construed as granting a license to any other intellectual
8 * property including but not limited to intellectual property relating
9 * to a hardware implementation of the functionality of the software
10 * licensed hereunder. You may use the software subject to the license
11 * terms below provided that you ensure that this notice is replicated
12 * unmodified and in its entirety in all distributions of the software,
13 * modified or unmodified, in source code or in binary form.
14 *
15 * Copyright (c) 2004-2006 The Regents of The University of Michigan
16 * All rights reserved.
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are
20 * met: redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer;
22 * redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution;
25 * neither the name of the copyright holders nor the names of its
26 * contributors may be used to endorse or promote products derived from
27 * this software without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 */
41
42#ifndef __CPU_O3_LSQ_HH__
43#define __CPU_O3_LSQ_HH__
44
45#include <cassert>
46#include <cstdint>
47#include <list>
48#include <map>
49#include <queue>
50#include <vector>
51
52#include "arch/generic/mmu.hh"
53#include "arch/generic/tlb.hh"
54#include "base/flags.hh"
55#include "base/types.hh"
56#include "cpu/inst_seq.hh"
58#include "cpu/utils.hh"
59#include "enums/SMTQueuePolicy.hh"
60#include "mem/port.hh"
61#include "sim/sim_object.hh"
62
63namespace gem5
64{
65
66struct BaseO3CPUParams;
67
68namespace o3
69{
70
71class CPU;
72class IEW;
73class LSQUnit;
74
75class LSQ
76{
77 public:
78 class LSQRequest;
79
83 class DcachePort : public RequestPort
84 {
85 protected:
86
90
91 public:
93 DcachePort(LSQ *_lsq, CPU *_cpu);
94
95 protected:
96
100 virtual bool recvTimingResp(PacketPtr pkt);
101 virtual void recvTimingSnoopReq(PacketPtr pkt);
102
103 virtual void
105 {
106 // @todo: Is there a need for potential invalidation here?
107 }
108
110 virtual void recvReqRetry();
111
118 virtual bool isSnooping() const { return true; }
119 };
120
190 {
191 protected:
192 typedef uint32_t FlagsStorage;
194
196 {
197 IsLoad = 0x00000001,
203 Delayed = 0x00000004,
204 IsSplit = 0x00000008,
206 TranslationStarted = 0x00000010,
209 Sent = 0x00000040,
210 Retry = 0x00000080,
211 Complete = 0x00000100,
216 Discarded = 0x00000400,
218 LSQEntryFreed = 0x00000800,
220 WritebackScheduled = 0x00001000,
221 WritebackDone = 0x00002000,
223 IsAtomic = 0x00004000
224 };
226
227 enum class State
228 {
229 NotIssued,
231 Request,
232 Fault,
234 };
236 void setState(const State& newState) { _state = newState; }
237
240
241
242 void markDelayed() override { flags.set(Flag::Delayed); }
243 bool isDelayed() { return flags.isSet(Flag::Delayed); }
244
245 public:
248 uint32_t _taskId;
253 uint64_t* _res;
254 const Addr _addr;
255 const uint32_t _size;
261
262 protected:
263 LSQUnit* lsqUnit() { return &_port; }
264 LSQRequest(LSQUnit* port, const DynInstPtr& inst, bool isLoad);
265 LSQRequest(LSQUnit* port, const DynInstPtr& inst, bool isLoad,
266 const Addr& addr, const uint32_t& size,
267 const Request::Flags& flags_, PacketDataPtr data=nullptr,
268 uint64_t* res=nullptr, AtomicOpFunctorPtr amo_op=nullptr,
269 bool stale_translation=false);
270
271 bool
272 isLoad() const
273 {
274 return flags.isSet(Flag::IsLoad);
275 }
276
277 bool
278 isAtomic() const
279 {
280 return flags.isSet(Flag::IsAtomic);
281 }
282
284 void install();
285
286 bool squashed() const override;
287
288
298 void
299 release(Flag reason)
300 {
301 assert(reason == Flag::LSQEntryFreed || reason == Flag::Discarded);
303 delete this;
304 } else {
305 flags.set(reason);
306 }
307 }
308
315 void addReq(Addr addr, unsigned size,
316 const std::vector<bool>& byte_enable);
317
322 virtual ~LSQRequest();
323
324 public:
328 void
329 setContext(const ContextID& context_id)
330 {
331 req()->setContext(context_id);
332 }
333
334 const DynInstPtr& instruction() { return _inst; }
335
337
338 virtual void markAsStaleTranslation() = 0;
339
343 void
344 setVirt(Addr vaddr, unsigned size, Request::Flags flags_,
345 RequestorID requestor_id, Addr pc)
346 {
347 req()->setVirt(vaddr, size, flags_, requestor_id, pc);
348 }
349
350 ContextID contextId() const;
351
352 void
353 taskId(const uint32_t& v)
354 {
355 _taskId = v;
356 for (auto& r: _reqs)
357 r->taskId(v);
358 }
359
360 uint32_t taskId() const { return _taskId; }
361
362 RequestPtr req(int idx = 0) { return _reqs.at(idx); }
363 const RequestPtr req(int idx = 0) const { return _reqs.at(idx); }
364
365 Addr getVaddr(int idx = 0) const { return req(idx)->getVaddr(); }
366 virtual void initiateTranslation() = 0;
367
368 PacketPtr packet(int idx = 0) { return _packets.at(idx); }
369
370 virtual PacketPtr
372 {
373 assert (_packets.size() == 1);
374 return packet();
375 }
376
377 virtual RequestPtr
379 {
380 assert (_reqs.size() == 1);
381 return req();
382 }
383
387 bool
395
401 bool
407
408 bool
409 isSplit() const
410 {
411 return flags.isSet(Flag::IsSplit);
412 }
413
414 bool
416 {
418 }
420 virtual bool recvTimingResp(PacketPtr pkt) = 0;
421 virtual void sendPacketToCache() = 0;
422 virtual void buildPackets() = 0;
423
429
433 virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask) = 0;
434
436 void
438 {
440 }
445 void
451
453 bool
455 {
456 return flags.isSet(Flag::Complete);
457 }
458
459 bool
461 {
462 return _state == State::Translation;
463 }
464
465 bool
471
472 bool
479
480 bool
482 {
483 return flags.isSet(Flag::Sent);
484 }
485
486 bool
488 {
489 return _state == State::PartialFault;
490 }
491
492 bool
494 {
495 return (_state == State::Request ||
496 (isPartialFault() && isLoad()));
497 }
498
499 void
504
508 void
513
517 void
519 {
521 }
522
523 void
525 {
526 assert(_numOutstandingPackets > 0);
529 delete this;
530 }
531
532 void
538
539 void
541 {
543 /* If the lsq resources are already free */
544 if (_numOutstandingPackets == 0 && isReleased()) {
545 delete this;
546 }
547 }
548
549 void
551 {
552 assert(numInTranslationFragments == 0);
554 /* If we are on our own, self-destruct. */
555 if (isReleased()) {
556 delete this;
557 }
558 }
559
560 void
562 {
564 }
565
566 virtual std::string name() const { return "LSQRequest"; }
567 };
568
570 {
571 public:
573 bool isLoad, const Addr& addr, const uint32_t& size,
574 const Request::Flags& flags_, PacketDataPtr data=nullptr,
575 uint64_t* res=nullptr, AtomicOpFunctorPtr amo_op=nullptr) :
576 LSQRequest(port, inst, isLoad, addr, size, flags_, data, res,
577 std::move(amo_op)) {}
578
580 virtual void markAsStaleTranslation();
581 virtual void initiateTranslation();
582 virtual void finish(const Fault &fault, const RequestPtr &req,
584 virtual bool recvTimingResp(PacketPtr pkt);
585 virtual void sendPacketToCache();
586 virtual void buildPackets();
589 virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask);
590 virtual std::string name() const { return "SingleDataRequest"; }
591 };
592
593 // This class extends SingleDataRequest for the purpose
594 // of allowing special requests (eg Hardware transactional memory, TLB
595 // shootdowns) to bypass irrelevant system elements like translation &
596 // squashing.
598 {
599 public:
601 const Request::Flags& flags_);
602 inline virtual ~UnsquashableDirectRequest() {}
603 virtual void initiateTranslation();
604 virtual void markAsStaleTranslation();
605 virtual void finish(const Fault &fault, const RequestPtr &req,
607 virtual std::string
608 name() const
609 {
610 return "UnsquashableDirectRequest";
611 }
612 };
613
615 {
616 protected:
617 uint32_t numFragments;
621
622 public:
624 bool isLoad, const Addr& addr, const uint32_t& size,
625 const Request::Flags & flags_, PacketDataPtr data=nullptr,
626 uint64_t* res=nullptr) :
627 LSQRequest(port, inst, isLoad, addr, size, flags_, data, res,
628 nullptr),
629 numFragments(0),
631 _mainReq(nullptr),
632 _mainPacket(nullptr)
633 {
635 }
637 {
638 if (_mainReq) {
639 _mainReq = nullptr;
640 }
641 if (_mainPacket) {
642 delete _mainPacket;
643 _mainPacket = nullptr;
644 }
645 }
646 virtual void markAsStaleTranslation();
647 virtual void finish(const Fault &fault, const RequestPtr &req,
649 virtual bool recvTimingResp(PacketPtr pkt);
650 virtual void initiateTranslation();
651 virtual void sendPacketToCache();
652 virtual void buildPackets();
653
656 virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask);
657
658 virtual RequestPtr mainReq();
659 virtual PacketPtr mainPacket();
660 virtual std::string name() const { return "SplitDataRequest"; }
661 };
662
664 LSQ(CPU *cpu_ptr, IEW *iew_ptr, const BaseO3CPUParams &params);
665
667 std::string name() const;
668
671
673 void drainSanityCheck() const;
675 bool isDrained() const;
677 void takeOverFrom();
678
680 int entryAmount(ThreadID num_threads);
681
683 void tick();
684
686 void insertLoad(const DynInstPtr &load_inst);
688 void insertStore(const DynInstPtr &store_inst);
689
691 Fault executeLoad(const DynInstPtr &inst);
692
694 Fault executeStore(const DynInstPtr &inst);
695
699 void commitLoads(InstSeqNum &youngest_inst, ThreadID tid);
700
704 void commitStores(InstSeqNum &youngest_inst, ThreadID tid);
705
710 void writebackStores();
713
717 void squash(const InstSeqNum &squashed_num, ThreadID tid);
718
720 bool violation();
721
726 bool violation(ThreadID tid);
727
730
732 int getLoadHead(ThreadID tid);
733
736
738 int getStoreHead(ThreadID tid);
739
742
744 int getCount();
746 int getCount(ThreadID tid);
747
749 int numLoads();
751 int numLoads(ThreadID tid);
752
754 int numStores();
756 int numStores(ThreadID tid);
757
758
759 // hardware transactional memory
760
761 int numHtmStarts(ThreadID tid) const;
762 int numHtmStops(ThreadID tid) const;
764 uint64_t getLatestHtmUid(ThreadID tid) const;
765 void setLastRetiredHtmUid(ThreadID tid, uint64_t htmUid);
766
768 unsigned numFreeLoadEntries();
769
771 unsigned numFreeStoreEntries();
772
775
777 unsigned numFreeLoadEntries(ThreadID tid);
778
780 unsigned numFreeStoreEntries(ThreadID tid);
781
783 bool isFull();
788 bool isFull(ThreadID tid);
789
791 bool isEmpty() const;
793 bool lqEmpty() const;
795 bool sqEmpty() const;
796
798 bool lqFull();
800 bool lqFull(ThreadID tid);
801
803 bool sqFull();
805 bool sqFull(ThreadID tid);
806
811 bool isStalled();
816 bool isStalled(ThreadID tid);
817
819 bool hasStoresToWB();
820
824 bool hasStoresToWB(ThreadID tid);
825
827 int numStoresToWB(ThreadID tid);
828
830 bool willWB();
834 bool willWB(ThreadID tid);
835
837 void dumpInsts() const;
839 void dumpInsts(ThreadID tid) const;
840
844 Fault read(LSQRequest* request, ssize_t load_idx);
845
849 Fault write(LSQRequest* request, uint8_t *data, ssize_t store_idx);
850
855
859 void recvReqRetry();
860
868 bool recvTimingResp(PacketPtr pkt);
869
871
872 Fault pushRequest(const DynInstPtr& inst, bool isLoad, uint8_t *data,
873 unsigned int size, Addr addr, Request::Flags flags,
874 uint64_t *res, AtomicOpFunctorPtr amo_op,
875 const std::vector<bool>& byte_enable);
876
879
882
884 bool cacheBlocked() const;
886 void cacheBlocked(bool v);
888 bool cachePortAvailable(bool is_load) const;
890 void cachePortBusy(bool is_load);
891
893
894 protected:
905
910
912 SMTQueuePolicy lsqPolicy;
913
919 static uint32_t
920 maxLSQAllocation(SMTQueuePolicy pol, uint32_t entries,
921 uint32_t numThreads, uint32_t SMTThreshold)
922 {
923 if (pol == SMTQueuePolicy::Dynamic) {
924 return entries;
925 } else if (pol == SMTQueuePolicy::Partitioned) {
926 //@todo:make work if part_amt doesnt divide evenly.
927 return entries / numThreads;
928 } else if (pol == SMTQueuePolicy::Threshold) {
929 //Divide up by threshold amount
930 //@todo: Should threads check the max and the total
931 //amount of the LSQ
932 return SMTThreshold;
933 }
934 return 0;
935 }
936
939
941 unsigned LQEntries;
943 unsigned SQEntries;
944
946 unsigned maxLQEntries;
947
949 unsigned maxSQEntries;
950
953
956
959};
960
961} // namespace o3
962} // namespace gem5
963
964#endif // __CPU_O3_LSQ_HH__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
const char data[]
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
Wrapper that groups a few flag bits under the same undelying container.
Definition flags.hh:45
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
ThreadContext is the external interface to all thread state for anything outside of the CPU.
O3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time buff...
Definition cpu.hh:94
IEW handles both single threaded and SMT IEW (issue/execute/writeback).
Definition iew.hh:88
Class that implements the actual LQ and SQ for each specific thread.
Definition lsq_unit.hh:89
DcachePort class for the load/store queue.
Definition lsq.hh:84
virtual void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition lsq.cc:1418
DcachePort(LSQ *_lsq, CPU *_cpu)
Default constructor.
Definition lsq.cc:67
virtual bool recvTimingResp(PacketPtr pkt)
Timing version of receive.
Definition lsq.cc:1412
virtual void recvReqRetry()
Handles doing a retry of the previous send.
Definition lsq.cc:1429
LSQ * lsq
Pointer to LSQ.
Definition lsq.hh:88
virtual void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition lsq.hh:104
virtual bool isSnooping() const
As this CPU requires snooping to maintain the load store queue change the behaviour from the base CPU...
Definition lsq.hh:118
Memory operation metadata.
Definition lsq.hh:190
virtual bool recvTimingResp(PacketPtr pkt)=0
@ WritebackScheduled
Store written back.
Definition lsq.hh:220
@ IsAtomic
True if this is an atomic request.
Definition lsq.hh:223
@ TranslationSquashed
Ownership tracking flags.
Definition lsq.hh:214
@ LSQEntryFreed
LSQ resources freed.
Definition lsq.hh:218
@ TranslationFinished
True if there are un-replied outbound translations.
Definition lsq.hh:208
@ WriteBackToRegister
True if this request needs to writeBack to register.
Definition lsq.hh:202
@ TranslationStarted
True if any translation has been sent to TLB.
Definition lsq.hh:206
@ Discarded
Request discarded.
Definition lsq.hh:216
std::vector< bool > _byteEnable
Definition lsq.hh:257
LSQRequest(LSQUnit *port, const DynInstPtr &inst, bool isLoad)
Definition lsq.cc:1052
Flags< FlagsStorage > FlagsType
Definition lsq.hh:193
virtual ~LSQRequest()
Destructor.
Definition lsq.cc:1135
virtual void buildPackets()=0
const RequestPtr req(int idx=0) const
Definition lsq.hh:363
bool isLoad() const
Definition lsq.hh:272
void install()
Install the request in the LQ/SQ.
Definition lsq.cc:1091
void release(Flag reason)
Release the LSQRequest.
Definition lsq.hh:299
virtual RequestPtr mainReq()
Definition lsq.hh:378
AtomicOpFunctorPtr _amo_op
Definition lsq.hh:259
virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask)=0
Test if the request accesses a particular cache line.
void discard()
The request is discarded (e.g.
Definition lsq.hh:518
ContextID contextId() const
Definition lsq.cc:1145
void taskId(const uint32_t &v)
Definition lsq.hh:353
PacketPtr packet(int idx=0)
Definition lsq.hh:368
virtual void initiateTranslation()=0
void setContext(const ContextID &context_id)
Convenience getters/setters.
Definition lsq.hh:329
void setState(const State &newState)
Definition lsq.hh:236
bool isTranslationBlocked()
Definition lsq.hh:473
void addReq(Addr addr, unsigned size, const std::vector< bool > &byte_enable)
Helper function used to add a (sub)request, given its address addr, size size and byte-enable mask by...
Definition lsq.cc:1105
void setVirt(Addr vaddr, unsigned size, Request::Flags flags_, RequestorID requestor_id, Addr pc)
Set up virtual request.
Definition lsq.hh:344
uint32_t _numOutstandingPackets
Definition lsq.hh:258
void packetNotSent()
Update the status to reflect that a packet was not sent.
Definition lsq.hh:446
const uint32_t _size
Definition lsq.hh:255
LSQUnit * lsqUnit()
Definition lsq.hh:263
bool isReleased()
Test if the LSQRequest has been released, i.e.
Definition lsq.hh:402
PacketDataPtr _data
Definition lsq.hh:249
bool isAnyOutstandingRequest()
Test if there is any in-flight translation or mem access request.
Definition lsq.hh:388
virtual void sendPacketToCache()=0
void sendFragmentToTranslation(int i)
Definition lsq.cc:1151
const DynInstPtr _inst
Definition lsq.hh:247
bool isSplit() const
Definition lsq.hh:409
void packetSent()
Update the status to reflect that a packet was sent.
Definition lsq.hh:437
const Request::Flags _flags
Definition lsq.hh:256
virtual Cycles handleLocalAccess(gem5::ThreadContext *thread, PacketPtr pkt)=0
Memory mapped IPR accesses.
uint32_t numTranslatedFragments
Definition lsq.hh:238
std::vector< Fault > _fault
Definition lsq.hh:252
uint32_t numInTranslationFragments
Definition lsq.hh:239
bool squashed() const override
This function is used by the page table walker to determine if it should translate the a pending requ...
Definition lsq.cc:1102
virtual std::string name() const
Definition lsq.hh:566
void markDelayed() override
Signal that the translation has been delayed due to a hw page table walk.
Definition lsq.hh:242
bool needWBToRegister() const
Definition lsq.hh:415
RequestPtr req(int idx=0)
Definition lsq.hh:362
virtual PacketPtr mainPacket()
Definition lsq.hh:371
std::vector< RequestPtr > _reqs
Definition lsq.hh:251
uint32_t taskId() const
Definition lsq.hh:360
bool hasStaleTranslation() const
Definition lsq.hh:336
std::vector< PacketPtr > _packets
Definition lsq.hh:250
const DynInstPtr & instruction()
Definition lsq.hh:334
bool isTranslationComplete()
Definition lsq.hh:466
virtual void markAsStaleTranslation()=0
void freeLSQEntry()
The LSQ entry is cleared.
Definition lsq.hh:509
bool isAtomic() const
Definition lsq.hh:278
Addr getVaddr(int idx=0) const
Definition lsq.hh:365
virtual std::string name() const
Definition lsq.hh:590
virtual Cycles handleLocalAccess(gem5::ThreadContext *thread, PacketPtr pkt)
Memory mapped IPR accesses.
Definition lsq.cc:1342
virtual void finish(const Fault &fault, const RequestPtr &req, gem5::ThreadContext *tc, BaseMMU::Mode mode)
Definition lsq.cc:871
virtual void initiateTranslation()
Definition lsq.cc:951
SingleDataRequest(LSQUnit *port, const DynInstPtr &inst, bool isLoad, const Addr &addr, const uint32_t &size, const Request::Flags &flags_, PacketDataPtr data=nullptr, uint64_t *res=nullptr, AtomicOpFunctorPtr amo_op=nullptr)
Definition lsq.hh:572
virtual bool recvTimingResp(PacketPtr pkt)
Definition lsq.cc:1189
virtual void buildPackets()
Definition lsq.cc:1226
virtual void markAsStaleTranslation()
Definition lsq.cc:1159
virtual void sendPacketToCache()
Definition lsq.cc:1323
virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask)
Test if the request accesses a particular cache line.
Definition lsq.cc:1369
virtual bool recvTimingResp(PacketPtr pkt)
Definition lsq.cc:1200
virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask)
Caches may probe into the load-store queue to enforce memory ordering guarantees.
Definition lsq.cc:1390
virtual void initiateTranslation()
Definition lsq.cc:984
virtual void markAsStaleTranslation()
Definition lsq.cc:1174
virtual void finish(const Fault &fault, const RequestPtr &req, gem5::ThreadContext *tc, BaseMMU::Mode mode)
Definition lsq.cc:903
virtual PacketPtr mainPacket()
Definition lsq.cc:972
virtual Cycles handleLocalAccess(gem5::ThreadContext *thread, PacketPtr pkt)
Memory mapped IPR accesses.
Definition lsq.cc:1349
virtual std::string name() const
Definition lsq.hh:660
virtual void sendPacketToCache()
Definition lsq.cc:1331
SplitDataRequest(LSQUnit *port, const DynInstPtr &inst, bool isLoad, const Addr &addr, const uint32_t &size, const Request::Flags &flags_, PacketDataPtr data=nullptr, uint64_t *res=nullptr)
Definition lsq.hh:623
virtual RequestPtr mainReq()
Definition lsq.cc:978
virtual void buildPackets()
Definition lsq.cc:1258
virtual void finish(const Fault &fault, const RequestPtr &req, gem5::ThreadContext *tc, BaseMMU::Mode mode)
Definition lsq.cc:1488
UnsquashableDirectRequest(LSQUnit *port, const DynInstPtr &inst, const Request::Flags &flags_)
Definition lsq.cc:1434
virtual std::string name() const
Definition lsq.hh:608
unsigned SQEntries
Total Size of SQ Entries.
Definition lsq.hh:943
bool isDrained() const
Has the LSQ drained?
Definition lsq.cc:146
int cacheLoadPorts
The number of cache ports available each cycle (loads only).
Definition lsq.hh:902
unsigned numFreeEntries(ThreadID tid)
Returns the number of free entries for a specific thread.
int usedStorePorts
The number of used cache ports in this cycle by stores.
Definition lsq.hh:900
int numHtmStarts(ThreadID tid) const
Definition lsq.cc:344
std::string name() const
Returns the name of the LSQ.
Definition lsq.cc:124
void commitStores(InstSeqNum &youngest_inst, ThreadID tid)
Commits stores up until the given sequence number for a specific thread.
Definition lsq.cc:259
Addr staleTranslationWaitTxnId
The ID if the transaction that made translations stale.
Definition lsq.hh:909
bool recvTimingResp(PacketPtr pkt)
Handles writing back and completing the load or store that has returned from memory.
Definition lsq.cc:403
void checkStaleTranslations()
Checks if queues have any marked operations left, and sends the appropriate Sync Completion message i...
Definition lsq.cc:1496
int getLoadHead(ThreadID tid)
Returns the head index of the load queue for a specific thread.
Definition lsq.cc:314
int entryAmount(ThreadID num_threads)
Number of entries needed for the given amount of threads.
void squash(const InstSeqNum &squashed_num, ThreadID tid)
Squash instructions from a thread until the specified sequence number.
Definition lsq.cc:283
bool sqEmpty() const
Returns if all of the SQs are empty.
Definition lsq.cc:619
void completeDataAccess(PacketPtr pkt)
Definition lsq.cc:395
Fault pushRequest(const DynInstPtr &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)
Definition lsq.cc:783
unsigned numFreeLoadEntries()
Returns the number of free load entries.
Definition lsq.cc:524
ThreadID numThreads
Number of Threads.
Definition lsq.hh:958
IEW * iewStage
The IEW stage pointer.
Definition lsq.hh:881
InstSeqNum getLoadHeadSeqNum(ThreadID tid)
Returns the sequence number of the head of the load queue.
Definition lsq.cc:320
std::list< ThreadID > * activeThreads
List of Active Threads in System.
Definition lsq.hh:938
DcachePort dcachePort
Data port.
Definition lsq.hh:952
void takeOverFrom()
Takes over execution from another CPU's thread.
Definition lsq.cc:164
DynInstPtr getMemDepViolator(ThreadID tid)
Gets the instruction that caused the memory ordering violation.
Definition lsq.cc:308
static uint32_t maxLSQAllocation(SMTQueuePolicy pol, uint32_t entries, uint32_t numThreads, uint32_t SMTThreshold)
Auxiliary function to calculate per-thread max LSQ allocation limit.
Definition lsq.hh:920
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets the pointer to the list of active threads.
Definition lsq.cc:130
bool cacheBlocked() const
Is D-cache blocked?
Definition lsq.cc:186
int numLoads()
Returns the total number of loads in the load queue.
Definition lsq.cc:490
void setLastRetiredHtmUid(ThreadID tid, uint64_t htmUid)
Definition lsq.cc:377
void dumpInsts() const
Debugging function to print out all instructions.
Definition lsq.cc:764
int usedLoadPorts
The number of used cache ports in this cycle by loads.
Definition lsq.hh:904
unsigned maxLQEntries
Max LQ Size - Used to Enforce Sharing Policies.
Definition lsq.hh:946
bool isFull()
Returns if the LSQ is full (either LQ or SQ is full).
Definition lsq.cc:570
void insertStore(const DynInstPtr &store_inst)
Inserts a store into the LSQ.
Definition lsq.cc:229
void recvReqRetry()
Retry the previous send that failed.
Definition lsq.cc:384
void commitLoads(InstSeqNum &youngest_inst, ThreadID tid)
Commits loads up until the given sequence number for a specific thread.
Definition lsq.cc:253
RequestPort & getDataPort()
Definition lsq.hh:892
Fault write(LSQRequest *request, uint8_t *data, ssize_t store_idx)
Executes a store operation, using the store specified at the store index.
Definition lsq.cc:1535
void writebackStores(ThreadID tid)
Same as above, but only for one thread.
uint64_t getLatestHtmUid(ThreadID tid) const
Definition lsq.cc:368
bool willWB()
Returns if the LSQ will write back to memory this cycle.
Definition lsq.cc:742
int getStoreHead(ThreadID tid)
Returns the head index of the store queue.
Definition lsq.cc:326
LSQ(CPU *cpu_ptr, IEW *iew_ptr, const BaseO3CPUParams &params)
Constructs an LSQ with the given parameters.
Definition lsq.cc:71
CPU * cpu
The CPU pointer.
Definition lsq.hh:878
bool _cacheBlocked
D-cache is blocked.
Definition lsq.hh:896
void drainSanityCheck() const
Perform sanity checks after a drain.
Definition lsq.cc:137
std::vector< LSQUnit > thread
The LSQ units for individual threads.
Definition lsq.hh:955
unsigned LQEntries
Total Size of LQ Entries.
Definition lsq.hh:941
int numHtmStops(ThreadID tid) const
Definition lsq.cc:352
void cachePortBusy(bool is_load)
Another store port is in use.
Definition lsq.cc:210
bool cachePortAvailable(bool is_load) const
Is any store port available to use?
Definition lsq.cc:198
InstSeqNum getStoreHeadSeqNum(ThreadID tid)
Returns the sequence number of the head of the store queue.
Definition lsq.cc:332
bool isStalled()
Returns if the LSQ is stalled due to a memory operation that must be replayed.
Definition lsq.cc:689
void writebackStores()
Attempts to write back stores until all cache ports are used or the interface becomes blocked.
Definition lsq.cc:265
bool lqFull()
Returns if any of the LQs are full.
Definition lsq.cc:635
bool waitingForStaleTranslation
If the LSQ is currently waiting for stale translations.
Definition lsq.hh:907
unsigned maxSQEntries
Max SQ Size - Used to Enforce Sharing Policies.
Definition lsq.hh:949
bool lqEmpty() const
Returns if all of the LQs are empty.
Definition lsq.cc:603
int getCount()
Returns the number of instructions in all of the queues.
Definition lsq.cc:473
bool hasStoresToWB()
Returns whether or not there are any stores to write back to memory.
Definition lsq.cc:714
Fault read(LSQRequest *request, ssize_t load_idx)
Executes a read operation, using the load specified at the load index.
Definition lsq.cc:1526
Fault executeStore(const DynInstPtr &inst)
Executes a store.
Definition lsq.cc:245
void tick()
Ticks the LSQ.
Definition lsq.cc:175
void insertLoad(const DynInstPtr &load_inst)
Inserts a load into the LSQ.
Definition lsq.cc:221
bool isEmpty() const
Returns if the LSQ is empty (both LQ and SQ are empty).
Definition lsq.cc:597
int numStores()
Returns the total number of stores in the store queue.
Definition lsq.cc:507
void recvTimingSnoopReq(PacketPtr pkt)
Definition lsq.cc:444
int cacheStorePorts
The number of cache ports available each cycle (stores only).
Definition lsq.hh:898
Fault executeLoad(const DynInstPtr &inst)
Executes a load.
Definition lsq.cc:237
bool violation()
Returns whether or not there was a memory ordering violation.
Definition lsq.cc:289
void resetHtmStartsStops(ThreadID tid)
Definition lsq.cc:361
SMTQueuePolicy lsqPolicy
The LSQ policy for SMT mode.
Definition lsq.hh:912
int numStoresToWB(ThreadID tid)
Returns the number of stores a specific thread has to write back.
Definition lsq.cc:736
unsigned numFreeStoreEntries()
Returns the number of free store entries.
Definition lsq.cc:541
bool sqFull()
Returns if any of the SQs are full.
Definition lsq.cc:662
STL list class.
Definition stl.hh:51
STL vector class.
Definition stl.hh:37
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition amo.hh:269
void set(Type mask)
Set all flag's bits matching the given mask.
Definition flags.hh:116
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
Definition flags.hh:83
void clear()
Clear all flag's bits.
Definition flags.hh:102
uint8_t flags
Definition helpers.cc:87
Port Object Declaration.
Bitfield< 28 > v
Definition misc_types.hh:54
Bitfield< 4, 0 > mode
Definition misc_types.hh:74
Bitfield< 7 > i
Definition misc_types.hh:67
Bitfield< 4 > pc
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
int16_t ThreadID
Thread index/ID type.
Definition types.hh:235
std::shared_ptr< Request > RequestPtr
Definition request.hh:94
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
uint8_t * PacketDataPtr
Definition packet.hh:72
uint16_t RequestorID
Definition request.hh:95
int ContextID
Globally unique thread context ID.
Definition types.hh:239
uint64_t InstSeqNum
Definition inst_seq.hh:40
Overload hash function for BasicBlockRange type.
Definition binary32.hh:81
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition packet.hh:469

Generated on Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0