diff --git a/src/systemc/tlm_bridge/sc_ext.cc b/src/systemc/tlm_bridge/sc_ext.cc index ba4078ae00..20efe6acc2 100644 --- a/src/systemc/tlm_bridge/sc_ext.cc +++ b/src/systemc/tlm_bridge/sc_ext.cc @@ -125,4 +125,85 @@ AtomicExtension::getAtomicOpFunctor() const return _op.get(); } +ControlExtension::ControlExtension() + : privileged(false), secure(false), instruction(false), qos(0) +{ +} + +tlm::tlm_extension_base * +ControlExtension::clone() const +{ + return new ControlExtension(*this); +} + +void +ControlExtension::copy_from(const tlm::tlm_extension_base &ext) +{ + const ControlExtension &from = static_cast(ext); + *this = from; +} + +ControlExtension & +ControlExtension::getExtension(const tlm::tlm_generic_payload &payload) +{ + return ControlExtension::getExtension(&payload); +} + +ControlExtension & +ControlExtension::getExtension(const tlm::tlm_generic_payload *payload) +{ + ControlExtension *result = nullptr; + payload->get_extension(result); + sc_assert(result); + return *result; +} + +bool +ControlExtension::isPrivileged() const +{ + return privileged; +} + +void +ControlExtension::setPrivileged(bool p) +{ + privileged = p; +} + +bool +ControlExtension::isSecure() const +{ + return secure; +} + +void +ControlExtension::setSecure(bool s) +{ + secure = s; +} + +bool +ControlExtension::isInstruction() const +{ + return instruction; +} + +void +ControlExtension::setInstruction(bool i) +{ + instruction = i; +} + +uint8_t +ControlExtension::getQos() const +{ + return qos; +} + +void +ControlExtension::setQos(uint8_t q) +{ + qos = q; +} + } // namespace Gem5SystemC diff --git a/src/systemc/tlm_bridge/sc_ext.hh b/src/systemc/tlm_bridge/sc_ext.hh index 25e6a1cc04..156c8d90ae 100644 --- a/src/systemc/tlm_bridge/sc_ext.hh +++ b/src/systemc/tlm_bridge/sc_ext.hh @@ -34,6 +34,7 @@ #ifndef __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__ #define __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__ +#include #include #include "base/amo.hh" @@ -83,6 +84,41 @@ class AtomicExtension: public tlm::tlm_extension bool _needReturn; }; +class ControlExtension : public tlm::tlm_extension +{ + public: + ControlExtension(); + + tlm_extension_base *clone() const override; + void copy_from(const tlm_extension_base &ext) override; + + static ControlExtension &getExtension( + const tlm::tlm_generic_payload *payload); + static ControlExtension &getExtension( + const tlm::tlm_generic_payload &payload); + + /* Secure and privileged access */ + bool isPrivileged() const; + void setPrivileged(bool p); + bool isSecure() const; + void setSecure(bool s); + bool isInstruction() const; + void setInstruction(bool i); + + /* Quality of Service (AXI4) */ + uint8_t getQos() const; + void setQos(uint8_t q); + + private: + /* Secure and privileged access */ + bool privileged; + bool secure; + bool instruction; + + /* Quality of Service (AXI4) */ + uint8_t qos; +}; + } // namespace Gem5SystemC #endif // __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__