systemc: define control extension

There are some flags in gem5 Packet class to specifying the control
signals, like priv bit, secure bit, etc. For now we don't have the
corresponding way to bridge the information in gem5 and SystemC. The
control extension would be responsible for control signals.

Change-Id: I35ba8610210e0750917a78fa0adb321991968f6a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/59649
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Reviewed-by: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
Yu-hsin Wang
2022-05-13 11:53:42 +08:00
parent 9e821b3233
commit d4456b3ee0
2 changed files with 117 additions and 0 deletions

View File

@@ -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<const ControlExtension &>(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

View File

@@ -34,6 +34,7 @@
#ifndef __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__
#define __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__
#include <cstdint>
#include <memory>
#include "base/amo.hh"
@@ -83,6 +84,41 @@ class AtomicExtension: public tlm::tlm_extension<AtomicExtension>
bool _needReturn;
};
class ControlExtension : public tlm::tlm_extension<ControlExtension>
{
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__