gem5 [DEVELOP-FOR-25.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/statistics.hh"
56#include "base/types.hh"
57#include "cpu/inst_seq.hh"
59#include "cpu/utils.hh"
60#include "enums/SMTQueuePolicy.hh"
61#include "mem/port.hh"
62#include "sim/sim_object.hh"
63
64namespace gem5
65{
66
67struct BaseO3CPUParams;
68
69namespace o3
70{
71
72class CPU;
73class IEW;
74class LSQUnit;
75
76class LSQ
77{
78 public:
79 class LSQRequest;
80
84 class DcachePort : public RequestPort
85 {
86 protected:
87
91
92 public:
94 DcachePort(LSQ *_lsq, CPU *_cpu);
95
97 {
99
100 /* Number of recieved responses */
102
103 /* Number of recieved response bytes */
105
106 /* Average bandwidth of received responses */
108
109 /* Average pkt size per received response */
111
112 /* Average rate of received responses per cycle */
114
115 /* Average retry rate per received response */
117
118 /* Number of retry responses sent */
121
122 protected:
123
127 virtual bool recvTimingResp(PacketPtr pkt);
128 virtual void recvTimingSnoopReq(PacketPtr pkt);
129
130 virtual void
132 {
133 // @todo: Is there a need for potential invalidation here?
134 }
135
137 virtual void recvReqRetry();
138
145 virtual bool isSnooping() const { return true; }
146
148 bool throttleReadResp(PacketPtr pkt);
149 };
150
220 {
221 protected:
222 typedef uint32_t FlagsStorage;
224
226 {
227 IsLoad = 0x00000001,
233 Delayed = 0x00000004,
234 IsSplit = 0x00000008,
236 TranslationStarted = 0x00000010,
239 Sent = 0x00000040,
240 Retry = 0x00000080,
241 Complete = 0x00000100,
246 Discarded = 0x00000400,
248 LSQEntryFreed = 0x00000800,
250 WritebackScheduled = 0x00001000,
251 WritebackDone = 0x00002000,
253 IsAtomic = 0x00004000
254 };
256
266 void setState(const State& newState) { _state = newState; }
267
270
271
272 void markDelayed() override { flags.set(Flag::Delayed); }
273 bool isDelayed() { return flags.isSet(Flag::Delayed); }
274
275 public:
278 uint32_t _taskId;
283 uint64_t* _res;
284 const Addr _addr;
285 const uint32_t _size;
291
292 protected:
293 LSQUnit* lsqUnit() { return &_port; }
294 LSQRequest(LSQUnit* port, const DynInstPtr& inst, bool isLoad);
295 LSQRequest(LSQUnit* port, const DynInstPtr& inst, bool isLoad,
296 const Addr& addr, const uint32_t& size,
297 const Request::Flags& flags_, PacketDataPtr data=nullptr,
298 uint64_t* res=nullptr, AtomicOpFunctorPtr amo_op=nullptr,
299 bool stale_translation=false);
300
301 bool
302 isLoad() const
303 {
304 return flags.isSet(Flag::IsLoad);
305 }
306
307 bool
308 isAtomic() const
309 {
310 return flags.isSet(Flag::IsAtomic);
311 }
312
314 void install();
315
316 bool squashed() const override;
317
318
328 void
329 release(Flag reason)
330 {
331 assert(reason == Flag::LSQEntryFreed || reason == Flag::Discarded);
333 delete this;
334 } else {
335 flags.set(reason);
336 }
337 }
338
345 void addReq(Addr addr, unsigned size,
346 const std::vector<bool>& byte_enable);
347
352 virtual ~LSQRequest();
353
354 public:
358 void
359 setContext(const ContextID& context_id)
360 {
361 req()->setContext(context_id);
362 }
363
364 const DynInstPtr& instruction() { return _inst; }
365
367
368 virtual void markAsStaleTranslation() = 0;
369
373 void
374 setVirt(Addr vaddr, unsigned size, Request::Flags flags_,
375 RequestorID requestor_id, Addr pc)
376 {
377 req()->setVirt(vaddr, size, flags_, requestor_id, pc);
378 }
379
380 ContextID contextId() const;
381
382 void
383 taskId(const uint32_t& v)
384 {
385 _taskId = v;
386 for (auto& r: _reqs)
387 r->taskId(v);
388 }
389
390 uint32_t taskId() const { return _taskId; }
391
392 RequestPtr req(int idx = 0) { return _reqs.at(idx); }
393 const RequestPtr req(int idx = 0) const { return _reqs.at(idx); }
394
395 Addr getVaddr(int idx = 0) const { return req(idx)->getVaddr(); }
396 virtual void initiateTranslation() = 0;
397
398 PacketPtr packet(int idx = 0) { return _packets.at(idx); }
399
400 virtual PacketPtr
402 {
403 assert (_packets.size() == 1);
404 return packet();
405 }
406
407 virtual RequestPtr
409 {
410 assert (_reqs.size() == 1);
411 return req();
412 }
413
417 bool
425
431 bool
433 {
434 return flags.isSet(Flag::LSQEntryFreed) ||
435 flags.isSet(Flag::Discarded);
436 }
437
438 bool
439 isSplit() const
440 {
441 return flags.isSet(Flag::IsSplit);
442 }
443
444 bool
446 {
447 return flags.isSet(Flag::WriteBackToRegister);
448 }
449
450 virtual bool recvTimingResp(PacketPtr pkt) = 0;
451 virtual void sendPacketToCache() = 0;
452 virtual void buildPackets() = 0;
453
459
463 virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask) = 0;
464
466 void
468 {
469 flags.set(Flag::Sent);
470 }
471
475 void
477 {
478 flags.set(Flag::Retry);
479 flags.clear(Flag::Sent);
480 }
481
483 bool
485 {
486 return flags.isSet(Flag::Complete);
487 }
488
489 bool
491 {
492 return _state == State::Translation;
493 }
494
495 bool
497 {
498 return flags.isSet(Flag::TranslationStarted) &&
500 }
501
502 bool
509
510 bool
512 {
513 return flags.isSet(Flag::Sent);
514 }
515
516 bool
518 {
519 return _state == State::PartialFault;
520 }
521
522 bool
524 {
525 return (_state == State::Request ||
526 (isPartialFault() && isLoad()));
527 }
528
529 void
534
538 void
543
547 void
549 {
551 }
552
553 void
555 {
556 assert(_numOutstandingPackets > 0);
559 delete this;
560 }
561
562 void
568
569 void
571 {
573 /* If the lsq resources are already free */
574 if (_numOutstandingPackets == 0 && isReleased()) {
575 delete this;
576 }
577 }
578
579 void
581 {
582 assert(numInTranslationFragments == 0);
584 /* If we are on our own, self-destruct. */
585 if (isReleased()) {
586 delete this;
587 }
588 }
589
590 void
592 {
594 }
595
596 virtual std::string name() const { return "LSQRequest"; }
597 };
598
600 {
601 public:
603 bool isLoad, const Addr& addr, const uint32_t& size,
604 const Request::Flags& flags_, PacketDataPtr data=nullptr,
605 uint64_t* res=nullptr, AtomicOpFunctorPtr amo_op=nullptr) :
606 LSQRequest(port, inst, isLoad, addr, size, flags_, data, res,
607 std::move(amo_op)) {}
608
610 virtual void markAsStaleTranslation();
611 virtual void initiateTranslation();
612 virtual void finish(const Fault &fault, const RequestPtr &req,
614 virtual bool recvTimingResp(PacketPtr pkt);
615 virtual void sendPacketToCache();
616 virtual void buildPackets();
619 virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask);
620 virtual std::string name() const { return "SingleDataRequest"; }
621 };
622
623 // This class extends SingleDataRequest for the purpose
624 // of allowing special requests (eg Hardware transactional memory, TLB
625 // shootdowns) to bypass irrelevant system elements like translation &
626 // squashing.
628 {
629 public:
631 const Request::Flags& flags_);
632 inline virtual ~UnsquashableDirectRequest() {}
633 virtual void initiateTranslation();
634 virtual void markAsStaleTranslation();
635 virtual void finish(const Fault &fault, const RequestPtr &req,
637 virtual std::string
638 name() const
639 {
640 return "UnsquashableDirectRequest";
641 }
642 };
643
645 {
646 protected:
647 uint32_t numFragments;
651
652 public:
654 bool isLoad, const Addr& addr, const uint32_t& size,
655 const Request::Flags & flags_, PacketDataPtr data=nullptr,
656 uint64_t* res=nullptr) :
657 LSQRequest(port, inst, isLoad, addr, size, flags_, data, res,
658 nullptr),
659 numFragments(0),
661 _mainReq(nullptr),
662 _mainPacket(nullptr)
663 {
664 flags.set(Flag::IsSplit);
665 }
667 {
668 if (_mainReq) {
669 _mainReq = nullptr;
670 }
671 if (_mainPacket) {
672 delete _mainPacket;
673 _mainPacket = nullptr;
674 }
675 }
676 virtual void markAsStaleTranslation();
677 virtual void finish(const Fault &fault, const RequestPtr &req,
679 virtual bool recvTimingResp(PacketPtr pkt);
680 virtual void initiateTranslation();
681 virtual void sendPacketToCache();
682 virtual void buildPackets();
683
686 virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask);
687
688 virtual RequestPtr mainReq();
689 virtual PacketPtr mainPacket();
690 virtual std::string name() const { return "SplitDataRequest"; }
691 };
692
694 LSQ(CPU *cpu_ptr, IEW *iew_ptr, const BaseO3CPUParams &params);
695
697 std::string name() const;
698
701
703 void drainSanityCheck() const;
705 bool isDrained() const;
707 void takeOverFrom();
708
710 int entryAmount(ThreadID num_threads);
711
713 void tick();
714
716 void insertLoad(const DynInstPtr &load_inst);
718 void insertStore(const DynInstPtr &store_inst);
719
721 Fault executeLoad(const DynInstPtr &inst);
722
724 Fault executeStore(const DynInstPtr &inst);
725
729 void commitLoads(InstSeqNum &youngest_inst, ThreadID tid);
730
734 void commitStores(InstSeqNum &youngest_inst, ThreadID tid);
735
740 void writebackStores();
743
747 void squash(const InstSeqNum &squashed_num, ThreadID tid);
748
750 bool violation();
751
756 bool violation(ThreadID tid);
757
760
762 int getLoadHead(ThreadID tid);
763
766
768 int getStoreHead(ThreadID tid);
769
772
774 int getCount();
776 int getCount(ThreadID tid);
777
779 int numLoads();
781 int numLoads(ThreadID tid);
782
784 int numStores();
786 int numStores(ThreadID tid);
787
788
789 // hardware transactional memory
790
791 int numHtmStarts(ThreadID tid) const;
792 int numHtmStops(ThreadID tid) const;
794 uint64_t getLatestHtmUid(ThreadID tid) const;
795 void setLastRetiredHtmUid(ThreadID tid, uint64_t htmUid);
796
798 unsigned numFreeLoadEntries();
799
801 unsigned numFreeStoreEntries();
802
805
807 unsigned numFreeLoadEntries(ThreadID tid);
808
810 unsigned numFreeStoreEntries(ThreadID tid);
811
813 bool isFull();
818 bool isFull(ThreadID tid);
819
821 bool isEmpty() const;
823 bool lqEmpty() const;
825 bool sqEmpty() const;
826
828 bool lqFull();
830 bool lqFull(ThreadID tid);
831
833 bool sqFull();
835 bool sqFull(ThreadID tid);
836
841 bool isStalled();
846 bool isStalled(ThreadID tid);
847
849 bool hasStoresToWB();
850
854 bool hasStoresToWB(ThreadID tid);
855
857 int numStoresToWB(ThreadID tid);
858
860 bool willWB();
864 bool willWB(ThreadID tid);
865
867 void dumpInsts() const;
869 void dumpInsts(ThreadID tid) const;
870
874 Fault read(LSQRequest* request, ssize_t load_idx);
875
879 Fault write(LSQRequest* request, uint8_t *data, ssize_t store_idx);
880
885
889 void recvReqRetry();
890
898 bool recvTimingResp(PacketPtr pkt);
899
901
902 Fault pushRequest(const DynInstPtr& inst, bool isLoad, uint8_t *data,
903 unsigned int size, Addr addr, Request::Flags flags,
904 uint64_t *res, AtomicOpFunctorPtr amo_op,
905 const std::vector<bool>& byte_enable);
906
909
912
914 bool cacheBlocked() const;
916 void cacheBlocked(bool v);
918 bool cachePortAvailable(bool is_load) const;
920 void cachePortBusy(bool is_load);
921
923
924 void sendRetryResp();
925
926 protected:
937
942
944 SMTQueuePolicy lsqPolicy;
945
951 static uint32_t
952 maxLSQAllocation(SMTQueuePolicy pol, uint32_t entries,
953 uint32_t numThreads, uint32_t SMTThreshold)
954 {
955 if (pol == SMTQueuePolicy::Dynamic) {
956 return entries;
957 } else if (pol == SMTQueuePolicy::Partitioned) {
958 //@todo:make work if part_amt doesnt divide evenly.
959 return entries / numThreads;
960 } else if (pol == SMTQueuePolicy::Threshold) {
961 //Divide up by threshold amount
962 //@todo: Should threads check the max and the total
963 //amount of the LSQ
964 return SMTThreshold;
965 }
966 return 0;
967 }
968
971
973 unsigned LQEntries;
975 unsigned SQEntries;
976
978 unsigned maxLQEntries;
979
981 unsigned maxSQEntries;
982
985
988
991
994 const unsigned recvRespMaxCachelines;
995 const unsigned recvRespBufferSize;
1002};
1003
1004} // namespace o3
1005} // namespace gem5
1006
1007#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 RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
RequestPort(const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
Request port.
Definition port.cc:125
gem5::Flags< FlagsType > Flags
Definition request.hh:102
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:85
virtual void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition lsq.cc:1489
DcachePort(LSQ *_lsq, CPU *_cpu)
Default constructor.
Definition lsq.cc:67
virtual bool recvTimingResp(PacketPtr pkt)
Timing version of receive.
Definition lsq.cc:1474
gem5::o3::LSQ::DcachePort::DcachePortStats dcachePortStats
virtual void recvReqRetry()
Handles doing a retry of the previous send.
Definition lsq.cc:1500
LSQ * lsq
Pointer to LSQ.
Definition lsq.hh:89
bool throttleReadResp(PacketPtr pkt)
Applies throttling in recvTimingResp for incoming load responses.
Definition lsq.cc:1385
virtual void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition lsq.hh:131
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:145
Memory operation metadata.
Definition lsq.hh:220
virtual bool recvTimingResp(PacketPtr pkt)=0
@ WritebackScheduled
Store written back.
Definition lsq.hh:250
@ IsAtomic
True if this is an atomic request.
Definition lsq.hh:253
@ TranslationSquashed
Ownership tracking flags.
Definition lsq.hh:244
@ LSQEntryFreed
LSQ resources freed.
Definition lsq.hh:248
@ TranslationFinished
True if there are un-replied outbound translations.
Definition lsq.hh:238
@ WriteBackToRegister
True if this request needs to writeBack to register.
Definition lsq.hh:232
@ TranslationStarted
True if any translation has been sent to TLB.
Definition lsq.hh:236
@ Discarded
Request discarded.
Definition lsq.hh:246
std::vector< bool > _byteEnable
Definition lsq.hh:287
LSQRequest(LSQUnit *port, const DynInstPtr &inst, bool isLoad)
Definition lsq.cc:1025
Flags< FlagsStorage > FlagsType
Definition lsq.hh:223
virtual ~LSQRequest()
Destructor.
Definition lsq.cc:1108
virtual void buildPackets()=0
const RequestPtr req(int idx=0) const
Definition lsq.hh:393
bool isLoad() const
Definition lsq.hh:302
void install()
Install the request in the LQ/SQ.
Definition lsq.cc:1064
void release(Flag reason)
Release the LSQRequest.
Definition lsq.hh:329
virtual RequestPtr mainReq()
Definition lsq.hh:408
AtomicOpFunctorPtr _amo_op
Definition lsq.hh:289
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:548
ContextID contextId() const
Definition lsq.cc:1118
void taskId(const uint32_t &v)
Definition lsq.hh:383
PacketPtr packet(int idx=0)
Definition lsq.hh:398
virtual void initiateTranslation()=0
void setContext(const ContextID &context_id)
Convenience getters/setters.
Definition lsq.hh:359
void setState(const State &newState)
Definition lsq.hh:266
bool isTranslationBlocked()
Definition lsq.hh:503
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:1078
void setVirt(Addr vaddr, unsigned size, Request::Flags flags_, RequestorID requestor_id, Addr pc)
Set up virtual request.
Definition lsq.hh:374
uint32_t _numOutstandingPackets
Definition lsq.hh:288
void packetNotSent()
Update the status to reflect that a packet was not sent.
Definition lsq.hh:476
const uint32_t _size
Definition lsq.hh:285
LSQUnit * lsqUnit()
Definition lsq.hh:293
bool isReleased()
Test if the LSQRequest has been released, i.e.
Definition lsq.hh:432
PacketDataPtr _data
Definition lsq.hh:279
bool isAnyOutstandingRequest()
Test if there is any in-flight translation or mem access request.
Definition lsq.hh:418
virtual void sendPacketToCache()=0
void sendFragmentToTranslation(int i)
Definition lsq.cc:1124
const DynInstPtr _inst
Definition lsq.hh:277
bool isSplit() const
Definition lsq.hh:439
void packetSent()
Update the status to reflect that a packet was sent.
Definition lsq.hh:467
const Request::Flags _flags
Definition lsq.hh:286
virtual Cycles handleLocalAccess(gem5::ThreadContext *thread, PacketPtr pkt)=0
Memory mapped IPR accesses.
uint32_t numTranslatedFragments
Definition lsq.hh:268
std::vector< Fault > _fault
Definition lsq.hh:282
uint32_t numInTranslationFragments
Definition lsq.hh:269
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:1075
virtual std::string name() const
Definition lsq.hh:596
void markDelayed() override
Signal that the translation has been delayed due to a hw page table walk.
Definition lsq.hh:272
bool needWBToRegister() const
Definition lsq.hh:445
RequestPtr req(int idx=0)
Definition lsq.hh:392
virtual PacketPtr mainPacket()
Definition lsq.hh:401
std::vector< RequestPtr > _reqs
Definition lsq.hh:281
uint32_t taskId() const
Definition lsq.hh:390
bool hasStaleTranslation() const
Definition lsq.hh:366
std::vector< PacketPtr > _packets
Definition lsq.hh:280
const DynInstPtr & instruction()
Definition lsq.hh:364
bool isTranslationComplete()
Definition lsq.hh:496
virtual void markAsStaleTranslation()=0
void freeLSQEntry()
The LSQ entry is cleared.
Definition lsq.hh:539
bool isAtomic() const
Definition lsq.hh:308
Addr getVaddr(int idx=0) const
Definition lsq.hh:395
virtual std::string name() const
Definition lsq.hh:620
virtual Cycles handleLocalAccess(gem5::ThreadContext *thread, PacketPtr pkt)
Memory mapped IPR accesses.
Definition lsq.cc:1315
virtual void finish(const Fault &fault, const RequestPtr &req, gem5::ThreadContext *tc, BaseMMU::Mode mode)
Definition lsq.cc:844
virtual void initiateTranslation()
Definition lsq.cc:924
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:602
virtual bool recvTimingResp(PacketPtr pkt)
Definition lsq.cc:1162
virtual void buildPackets()
Definition lsq.cc:1199
virtual void markAsStaleTranslation()
Definition lsq.cc:1132
virtual void sendPacketToCache()
Definition lsq.cc:1296
virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask)
Test if the request accesses a particular cache line.
Definition lsq.cc:1342
virtual bool recvTimingResp(PacketPtr pkt)
Definition lsq.cc:1173
virtual bool isCacheBlockHit(Addr blockAddr, Addr cacheBlockMask)
Caches may probe into the load-store queue to enforce memory ordering guarantees.
Definition lsq.cc:1363
virtual void initiateTranslation()
Definition lsq.cc:957
virtual void markAsStaleTranslation()
Definition lsq.cc:1147
virtual void finish(const Fault &fault, const RequestPtr &req, gem5::ThreadContext *tc, BaseMMU::Mode mode)
Definition lsq.cc:876
virtual PacketPtr mainPacket()
Definition lsq.cc:945
virtual Cycles handleLocalAccess(gem5::ThreadContext *thread, PacketPtr pkt)
Memory mapped IPR accesses.
Definition lsq.cc:1322
virtual std::string name() const
Definition lsq.hh:690
virtual void sendPacketToCache()
Definition lsq.cc:1304
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:653
virtual RequestPtr mainReq()
Definition lsq.cc:951
virtual void buildPackets()
Definition lsq.cc:1231
virtual void finish(const Fault &fault, const RequestPtr &req, gem5::ThreadContext *tc, BaseMMU::Mode mode)
Definition lsq.cc:1559
UnsquashableDirectRequest(LSQUnit *port, const DynInstPtr &inst, const Request::Flags &flags_)
Definition lsq.cc:1505
virtual std::string name() const
Definition lsq.hh:638
unsigned SQEntries
Total Size of SQ Entries.
Definition lsq.hh:975
bool isDrained() const
Has the LSQ drained?
Definition lsq.cc:193
EventFunctionWrapper retryRespEvent
Definition lsq.hh:1001
int cacheLoadPorts
The number of cache ports available each cycle (loads only).
Definition lsq.hh:934
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:932
int numHtmStarts(ThreadID tid) const
Definition lsq.cc:381
std::string name() const
Returns the name of the LSQ.
Definition lsq.cc:171
void commitStores(InstSeqNum &youngest_inst, ThreadID tid)
Commits stores up until the given sequence number for a specific thread.
Definition lsq.cc:306
Addr staleTranslationWaitTxnId
The ID if the transaction that made translations stale.
Definition lsq.hh:941
bool recvTimingResp(PacketPtr pkt)
Handles writing back and completing the load or store that has returned from memory.
Definition lsq.cc:446
void checkStaleTranslations()
Checks if queues have any marked operations left, and sends the appropriate Sync Completion message i...
Definition lsq.cc:1567
int getLoadHead(ThreadID tid)
Returns the head index of the load queue for a specific thread.
Definition lsq.cc:351
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:325
bool sqEmpty() const
Returns if all of the SQs are empty.
Definition lsq.cc:627
void completeDataAccess(PacketPtr pkt)
Definition lsq.cc:432
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:756
unsigned numFreeLoadEntries()
Returns the number of free load entries.
Definition lsq.cc:552
ThreadID numThreads
Number of Threads.
Definition lsq.hh:990
IEW * iewStage
The IEW stage pointer.
Definition lsq.hh:911
InstSeqNum getLoadHeadSeqNum(ThreadID tid)
Returns the sequence number of the head of the load queue.
Definition lsq.cc:357
void sendRetryResp()
Definition lsq.cc:440
std::list< ThreadID > * activeThreads
List of Active Threads in System.
Definition lsq.hh:970
DcachePort dcachePort
Data port.
Definition lsq.hh:984
void takeOverFrom()
Takes over execution from another CPU's thread.
Definition lsq.cc:211
DynInstPtr getMemDepViolator(ThreadID tid)
Gets the instruction that caused the memory ordering violation.
Definition lsq.cc:345
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:952
void setActiveThreads(std::list< ThreadID > *at_ptr)
Sets the pointer to the list of active threads.
Definition lsq.cc:177
bool cacheBlocked() const
Is D-cache blocked?
Definition lsq.cc:233
int numLoads()
Returns the total number of loads in the load queue.
Definition lsq.cc:528
void setLastRetiredHtmUid(ThreadID tid, uint64_t htmUid)
Definition lsq.cc:414
void dumpInsts() const
Debugging function to print out all instructions.
Definition lsq.cc:742
int usedLoadPorts
The number of used cache ports in this cycle by loads.
Definition lsq.hh:936
unsigned maxLQEntries
Max LQ Size - Used to Enforce Sharing Policies.
Definition lsq.hh:978
bool isFull()
Returns if the LSQ is full (either LQ or SQ is full).
Definition lsq.cc:588
void insertStore(const DynInstPtr &store_inst)
Inserts a store into the LSQ.
Definition lsq.cc:276
void recvReqRetry()
Retry the previous send that failed.
Definition lsq.cc:421
void commitLoads(InstSeqNum &youngest_inst, ThreadID tid)
Commits loads up until the given sequence number for a specific thread.
Definition lsq.cc:300
RequestPort & getDataPort()
Definition lsq.hh:922
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:1606
Cycles recvRespLastActiveCycle
Definition lsq.hh:1000
void writebackStores(ThreadID tid)
Same as above, but only for one thread.
Addr recvRespLastCachelineAddr
Definition lsq.hh:999
uint64_t getLatestHtmUid(ThreadID tid) const
Definition lsq.cc:405
bool willWB()
Returns if the LSQ will write back to memory this cycle.
Definition lsq.cc:725
int getStoreHead(ThreadID tid)
Returns the head index of the store queue.
Definition lsq.cc:363
unsigned recvRespPendBytes
Definition lsq.hh:997
LSQ(CPU *cpu_ptr, IEW *iew_ptr, const BaseO3CPUParams &params)
Constructs an LSQ with the given parameters.
Definition lsq.cc:110
CPU * cpu
The CPU pointer.
Definition lsq.hh:908
bool _cacheBlocked
D-cache is blocked.
Definition lsq.hh:928
void drainSanityCheck() const
Perform sanity checks after a drain.
Definition lsq.cc:184
std::vector< LSQUnit > thread
The LSQ units for individual threads.
Definition lsq.hh:987
unsigned LQEntries
Total Size of LQ Entries.
Definition lsq.hh:973
int numHtmStops(ThreadID tid) const
Definition lsq.cc:389
void cachePortBusy(bool is_load)
Another store port is in use.
Definition lsq.cc:257
unsigned recvRespBytes
Definition lsq.hh:996
const unsigned recvRespBufferSize
Definition lsq.hh:995
bool cachePortAvailable(bool is_load) const
Is any store port available to use?
Definition lsq.cc:245
InstSeqNum getStoreHeadSeqNum(ThreadID tid)
Returns the sequence number of the head of the store queue.
Definition lsq.cc:369
bool isStalled()
Returns if the LSQ is stalled due to a memory operation that must be replayed.
Definition lsq.cc:682
void writebackStores()
Attempts to write back stores until all cache ports are used or the interface becomes blocked.
Definition lsq.cc:312
bool lqFull()
Returns if any of the LQs are full.
Definition lsq.cc:638
bool waitingForStaleTranslation
If the LSQ is currently waiting for stale translations.
Definition lsq.hh:939
unsigned maxSQEntries
Max SQ Size - Used to Enforce Sharing Policies.
Definition lsq.hh:981
bool lqEmpty() const
Returns if all of the LQs are empty.
Definition lsq.cc:616
int getCount()
Returns the number of instructions in all of the queues.
Definition lsq.cc:516
bool hasStoresToWB()
Returns whether or not there are any stores to write back to memory.
Definition lsq.cc:702
Fault read(LSQRequest *request, ssize_t load_idx)
Executes a read operation, using the load specified at the load index.
Definition lsq.cc:1597
Fault executeStore(const DynInstPtr &inst)
Executes a store.
Definition lsq.cc:292
void tick()
Ticks the LSQ.
Definition lsq.cc:222
void insertLoad(const DynInstPtr &load_inst)
Inserts a load into the LSQ.
Definition lsq.cc:268
bool isEmpty() const
Returns if the LSQ is empty (both LQ and SQ are empty).
Definition lsq.cc:610
int numStores()
Returns the total number of stores in the store queue.
Definition lsq.cc:540
void recvTimingSnoopReq(PacketPtr pkt)
Definition lsq.cc:487
int cacheStorePorts
The number of cache ports available each cycle (stores only).
Definition lsq.hh:930
Fault executeLoad(const DynInstPtr &inst)
Executes a load.
Definition lsq.cc:284
bool violation()
Returns whether or not there was a memory ordering violation.
Definition lsq.cc:331
void resetHtmStartsStops(ThreadID tid)
Definition lsq.cc:398
SMTQueuePolicy lsqPolicy
The LSQ policy for SMT mode.
Definition lsq.hh:944
const bool recvRespThrottling
Enable load receive response throttling in the LSQ.
Definition lsq.hh:993
int numStoresToWB(ThreadID tid)
Returns the number of stores a specific thread has to write back.
Definition lsq.cc:719
unsigned numFreeStoreEntries()
Returns the number of free store entries.
Definition lsq.cc:564
bool sqFull()
Returns if any of the SQs are full.
Definition lsq.cc:660
unsigned recvRespCachelines
Definition lsq.hh:998
const unsigned recvRespMaxCachelines
Definition lsq.hh:994
A formula for statistics that is calculated when printed.
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
STL list class.
Definition stl.hh:51
STL vector class.
Definition stl.hh:37
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition amo.hh:269
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
RefCountingPtr< DynInst > DynInstPtr
Copyright (c) 2024 Arm Limited 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
Packet * PacketPtr
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
Declaration of Statistics objects.
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition packet.hh:469
statistics::Formula recvRespAvgRetryRate
Definition lsq.hh:116
statistics::Formula recvRespAvgSize
Definition lsq.hh:110
statistics::Formula recvRespAvgRate
Definition lsq.hh:113

Generated on Mon May 26 2025 09:19:08 for gem5 by doxygen 1.13.2