42#ifndef __ARCH_GENERIC_TYPES_HH__
43#define __ARCH_GENERIC_TYPES_HH__
71 template<
class Target>
75 return static_cast<Target &
>(*this);
78 template<
class Target>
82 return static_cast<const Target &
>(*this);
94 virtual void output(std::ostream &
os)
const = 0;
155static inline std::ostream &
178set(PCStateBase *&dest,
const PCStateBase *src)
180 if (GEM5_LIKELY(dest)) {
181 if (GEM5_LIKELY(src)) {
189 if (GEM5_LIKELY(src)) {
199set(std::unique_ptr<PCStateBase> &dest,
const PCStateBase *src)
201 PCStateBase *dest_ptr = dest.get();
203 if (dest.get() != dest_ptr)
204 dest.reset(dest_ptr);
208set(PCStateBase *&dest,
const std::unique_ptr<PCStateBase> &src)
210 const PCStateBase *src_ptr = src.get();
215set(std::unique_ptr<PCStateBase> &dest,
216 const std::unique_ptr<PCStateBase> &src)
218 PCStateBase *dest_ptr = dest.get();
219 const PCStateBase *src_ptr = src.get();
220 set(dest_ptr, src_ptr);
221 if (dest.get() != dest_ptr)
222 dest.reset(dest_ptr);
226set(PCStateBase *&dest,
const PCStateBase &src)
228 if (GEM5_LIKELY(dest)) {
238set(std::unique_ptr<PCStateBase> &dest,
const PCStateBase &src)
240 PCStateBase *dest_ptr = dest.get();
242 if (dest.get() != dest_ptr)
243 dest.reset(dest_ptr);
247set(PCStateBase &dest,
const PCStateBase &src)
309 _nupc = pcstate._nupc;
353template <
int InstW
idth>
381 this->
npc(val + InstWidth);
387 return this->
npc() != this->
pc() + InstWidth;
395 this->
_npc += InstWidth;
400template <
int InstW
idth>
436 return this->
npc() != this->
pc() + InstWidth ||
437 this->
nupc() != this->
upc() + 1;
459template <
int InstW
idth>
508 return !(this->
nnpc() == this->
npc() + InstWidth &&
509 (this->
npc() == this->
pc() + InstWidth ||
510 this->
npc() == this->
pc() + 2 * InstWidth));
519 this->_nnpc += InstWidth;
545template <
int InstW
idth>
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
bool branching() const override
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void set(Addr val) override
DelaySlotPCState & operator=(const DelaySlotPCState &other)=default
DelaySlotPCState(Addr val)
DelaySlotPCState(const DelaySlotPCState &other)
void output(std::ostream &os) const override
void serialize(CheckpointOut &cp) const override
Serialize an object.
bool equals(const PCStateBase &other) const override
SimplePCState< InstWidth > Base
PCStateBase * clone() const override
void update(const PCStateBase &other) override
DelaySlotUPCState & operator=(const DelaySlotUPCState &other)=default
void output(std::ostream &os) const override
DelaySlotPCState< InstWidth > Base
DelaySlotUPCState(Addr val)
void set(Addr val) override
bool branching() const override
PCStateBase * clone() const override
DelaySlotUPCState(const DelaySlotUPCState &other)
void set(Addr val) override
void output(std::ostream &os) const override
void unserialize(CheckpointIn &cp) override
Unserialize an object.
PCStateWithNext & operator=(const PCStateWithNext &other)=default
bool equals(const PCStateBase &other) const override
void serialize(CheckpointOut &cp) const override
Serialize an object.
PCStateWithNext(const PCStateWithNext &other)
void update(const PCStateBase &other) override
bool branching() const override
SimplePCState & operator=(const SimplePCState &other)=default
SimplePCState(const SimplePCState &other)
void set(Addr val) override
Force this PC to reflect a particular value, resetting all its other fields around it.
PCStateBase * clone() const override
UPCState & operator=(const UPCState &other)=default
void set(Addr val) override
Force this PC to reflect a particular value, resetting all its other fields around it.
void output(std::ostream &os) const override
PCStateBase * clone() const override
SimplePCState< InstWidth > Base
UPCState(const UPCState &other)
bool branching() const override
virtual bool equals(const PCStateBase &other) const
void unserialize(CheckpointIn &cp) override
Unserialize an object.
virtual void set(Addr val)
virtual bool branching() const =0
MicroPC microPC() const
Returns the current micropc.
Addr instAddr() const
Returns the memory address of the instruction this PC points to.
void update(const PCStateBase *ptr)
PCStateBase & operator=(const PCStateBase &other)=default
const Target & as() const
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual void output(std::ostream &os) const =0
virtual void update(const PCStateBase &other)
virtual ~PCStateBase()=default
virtual PCStateBase * clone() const =0
PCStateBase(const PCStateBase &other)
Basic support for object serialization.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
static bool operator==(const PCStateBase &a, const PCStateBase &b)
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static std::ostream & operator<<(std::ostream &os, const DummyMatRegContainer &d)
static bool operator!=(const PCStateBase &a, const PCStateBase &b)
void ccprintf(cp::Print &print)
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)