gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sc_ext.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, University of Kaiserslautern
3  * Copyright (c) 2016, Dresden University of Technology (TU Dresden)
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
25  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__
35 #define __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__
36 
37 #include <cstdint>
38 #include <memory>
39 #include <optional>
40 
41 #include "base/amo.hh"
42 #include "mem/packet.hh"
44 
45 namespace Gem5SystemC
46 {
47 
49 {
52 };
53 
54 class Gem5Extension: public tlm::tlm_extension<Gem5Extension>
55 {
56  public:
58 
59  tlm_extension_base *clone() const override;
60  void copy_from(const tlm_extension_base &ext) override;
61 
63  const tlm::tlm_generic_payload *payload);
65  const tlm::tlm_generic_payload &payload);
67 
68  private:
70 };
71 
72 class AtomicExtension: public tlm::tlm_extension<AtomicExtension>
73 {
74  public:
76  std::shared_ptr<gem5::AtomicOpFunctor> o, bool r);
77 
78  tlm_extension_base *clone() const override;
79  void copy_from(const tlm_extension_base &ext) override;
80 
82  const tlm::tlm_generic_payload *payload);
84  const tlm::tlm_generic_payload &payload);
85 
86  bool isReturnRequired() const;
88 
89  private:
90  std::shared_ptr<gem5::AtomicOpFunctor> op;
92 };
93 
94 class ControlExtension : public tlm::tlm_extension<ControlExtension>
95 {
96  public:
98 
99  tlm_extension_base *clone() const override;
100  void copy_from(const tlm_extension_base &ext) override;
101 
103  const tlm::tlm_generic_payload *payload);
105  const tlm::tlm_generic_payload &payload);
106 
107  /* Secure and privileged access */
108  bool isPrivileged() const;
109  void setPrivileged(bool p);
110  bool isSecure() const;
111  void setSecure(bool s);
112  bool isInstruction() const;
113  void setInstruction(bool i);
114 
115  /* Quality of Service (AXI4) */
116  uint8_t getQos() const;
117  void setQos(uint8_t q);
118 
119  /* Stream ID and Substream ID */
120  bool hasStreamId() const;
121  std::optional<uint32_t> getStreamId() const;
122  void setStreamId(std::optional<uint32_t> s);
123  bool hasSubstreamId() const;
124  std::optional<uint32_t> getSubstreamId() const;
125  void setSubstreamId(std::optional<uint32_t> s);
126 
127  private:
128  /* Secure and privileged access */
130  bool secure;
132 
133  /* Quality of Service (AXI4) */
134  uint8_t qos;
135 
136  /* Stream ID and Substream ID */
137  std::optional<uint32_t> stream_id;
138  std::optional<uint32_t> substream_id;
139 };
140 
141 } // namespace Gem5SystemC
142 
143 #endif // __SYSTEMC_TLM_BRIDGE_SC_EXT_HH__
gem5::VegaISA::s
Bitfield< 1 > s
Definition: pagetable.hh:64
Gem5SystemC::ControlExtension::clone
tlm_extension_base * clone() const override
Definition: sc_ext.cc:207
gem5::AtomicOpFunctor
Definition: amo.hh:43
amo.hh
Gem5SystemC::ControlExtension::setInstruction
void setInstruction(bool i)
Definition: sc_ext.cc:265
Gem5SystemC::ControlExtension::isInstruction
bool isInstruction() const
Definition: sc_ext.cc:259
Gem5SystemC::ControlExtension::privileged
bool privileged
Definition: sc_ext.hh:129
Gem5SystemC::Gem5Extension::clone
tlm_extension_base * clone() const override
Definition: sc_ext.cc:141
Gem5SystemC::ControlExtension::getStreamId
std::optional< uint32_t > getStreamId() const
Definition: sc_ext.cc:289
Gem5SystemC::ControlExtension
Definition: sc_ext.hh:94
Gem5SystemC::Gem5Extension::Gem5Extension
Gem5Extension(gem5::PacketPtr p)
Definition: sc_ext.cc:115
Gem5SystemC::Gem5Extension::getPacket
gem5::PacketPtr getPacket()
Definition: sc_ext.cc:135
gem5::VegaISA::r
Bitfield< 5 > r
Definition: pagetable.hh:60
Gem5SystemC::ControlExtension::getSubstreamId
std::optional< uint32_t > getSubstreamId() const
Definition: sc_ext.cc:307
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:67
Gem5SystemC::ControlExtension::ControlExtension
ControlExtension()
Definition: sc_ext.cc:199
Gem5SystemC::ControlExtension::setStreamId
void setStreamId(std::optional< uint32_t > s)
Definition: sc_ext.cc:295
Gem5SystemC::AtomicExtension::clone
tlm_extension_base * clone() const override
Definition: sc_ext.cc:160
Gem5SystemC::TlmSenderState::TlmSenderState
TlmSenderState(tlm::tlm_generic_payload &trans)
Definition: sc_ext.hh:51
packet.hh
Gem5SystemC::AtomicExtension::AtomicExtension
AtomicExtension(std::shared_ptr< gem5::AtomicOpFunctor > o, bool r)
Definition: sc_ext.cc:153
gem5::SparcISA::int_reg::o
constexpr RegId o(int index)
Definition: int.hh:147
Gem5SystemC
Definition: sc_ext.cc:44
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
Gem5SystemC::ControlExtension::stream_id
std::optional< uint32_t > stream_id
Definition: sc_ext.hh:137
Gem5SystemC::ControlExtension::substream_id
std::optional< uint32_t > substream_id
Definition: sc_ext.hh:138
Gem5SystemC::ControlExtension::isPrivileged
bool isPrivileged() const
Definition: sc_ext.cc:235
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
Gem5SystemC::ControlExtension::isSecure
bool isSecure() const
Definition: sc_ext.cc:247
Gem5SystemC::TlmSenderState
Definition: sc_ext.hh:48
Gem5SystemC::ControlExtension::setQos
void setQos(uint8_t q)
Definition: sc_ext.cc:277
Gem5SystemC::ControlExtension::getQos
uint8_t getQos() const
Definition: sc_ext.cc:271
Gem5SystemC::ControlExtension::secure
bool secure
Definition: sc_ext.hh:130
gem5::ArmISA::ext
Bitfield< 12 > ext
Definition: misc_types.hh:485
gem5::Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:468
Gem5SystemC::AtomicExtension::getExtension
static AtomicExtension & getExtension(const tlm::tlm_generic_payload *payload)
Definition: sc_ext.cc:179
Gem5SystemC::AtomicExtension::isReturnRequired
bool isReturnRequired() const
Definition: sc_ext.cc:188
Gem5SystemC::ControlExtension::hasSubstreamId
bool hasSubstreamId() const
Definition: sc_ext.cc:301
gem5::ArmISA::q
Bitfield< 27 > q
Definition: misc_types.hh:55
tlm::tlm_generic_payload
Definition: gp.hh:133
tlm::tlm_extension
Definition: gp.hh:83
Gem5SystemC::Gem5Extension::getExtension
static Gem5Extension & getExtension(const tlm::tlm_generic_payload *payload)
Definition: sc_ext.cc:120
Gem5SystemC::ControlExtension::setPrivileged
void setPrivileged(bool p)
Definition: sc_ext.cc:241
Gem5SystemC::AtomicExtension
Definition: sc_ext.hh:72
Gem5SystemC::ControlExtension::copy_from
void copy_from(const tlm_extension_base &ext) override
Definition: sc_ext.cc:213
Gem5SystemC::ControlExtension::instruction
bool instruction
Definition: sc_ext.hh:131
Gem5SystemC::Gem5Extension
Definition: sc_ext.hh:54
Gem5SystemC::AtomicExtension::returnRequired
bool returnRequired
Definition: sc_ext.hh:91
Gem5SystemC::ControlExtension::hasStreamId
bool hasStreamId() const
Definition: sc_ext.cc:283
Gem5SystemC::AtomicExtension::getAtomicOpFunctor
gem5::AtomicOpFunctor * getAtomicOpFunctor() const
Definition: sc_ext.cc:194
Gem5SystemC::ControlExtension::setSubstreamId
void setSubstreamId(std::optional< uint32_t > s)
Definition: sc_ext.cc:313
Gem5SystemC::ControlExtension::qos
uint8_t qos
Definition: sc_ext.hh:134
Gem5SystemC::AtomicExtension::op
std::shared_ptr< gem5::AtomicOpFunctor > op
Definition: sc_ext.hh:90
Gem5SystemC::AtomicExtension::copy_from
void copy_from(const tlm_extension_base &ext) override
Definition: sc_ext.cc:166
Gem5SystemC::Gem5Extension::copy_from
void copy_from(const tlm_extension_base &ext) override
Definition: sc_ext.cc:147
Gem5SystemC::ControlExtension::getExtension
static ControlExtension & getExtension(const tlm::tlm_generic_payload *payload)
Definition: sc_ext.cc:226
Gem5SystemC::TlmSenderState::trans
tlm::tlm_generic_payload & trans
Definition: sc_ext.hh:50
Gem5SystemC::ControlExtension::setSecure
void setSecure(bool s)
Definition: sc_ext.cc:253
gp.hh
Gem5SystemC::Gem5Extension::packet
gem5::PacketPtr packet
Definition: sc_ext.hh:69

Generated on Sun Jul 30 2023 01:57:03 for gem5 by doxygen 1.8.17