gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
45namespace Gem5SystemC
46{
47
53
54class 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
72class 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
94class 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__
tlm_extension_base * clone() const override
Definition sc_ext.cc:160
void copy_from(const tlm_extension_base &ext) override
Definition sc_ext.cc:166
static AtomicExtension & getExtension(const tlm::tlm_generic_payload *payload)
Definition sc_ext.cc:179
AtomicExtension(std::shared_ptr< gem5::AtomicOpFunctor > o, bool r)
Definition sc_ext.cc:153
std::shared_ptr< gem5::AtomicOpFunctor > op
Definition sc_ext.hh:90
bool isReturnRequired() const
Definition sc_ext.cc:188
gem5::AtomicOpFunctor * getAtomicOpFunctor() const
Definition sc_ext.cc:194
static ControlExtension & getExtension(const tlm::tlm_generic_payload *payload)
Definition sc_ext.cc:226
tlm_extension_base * clone() const override
Definition sc_ext.cc:207
std::optional< uint32_t > getSubstreamId() const
Definition sc_ext.cc:307
void setSubstreamId(std::optional< uint32_t > s)
Definition sc_ext.cc:313
std::optional< uint32_t > substream_id
Definition sc_ext.hh:138
void setStreamId(std::optional< uint32_t > s)
Definition sc_ext.cc:295
std::optional< uint32_t > stream_id
Definition sc_ext.hh:137
void copy_from(const tlm_extension_base &ext) override
Definition sc_ext.cc:213
std::optional< uint32_t > getStreamId() const
Definition sc_ext.cc:289
static Gem5Extension & getExtension(const tlm::tlm_generic_payload *payload)
Definition sc_ext.cc:120
Gem5Extension(gem5::PacketPtr p)
Definition sc_ext.cc:115
tlm_extension_base * clone() const override
Definition sc_ext.cc:141
gem5::PacketPtr getPacket()
Definition sc_ext.cc:135
gem5::PacketPtr packet
Definition sc_ext.hh:69
void copy_from(const tlm_extension_base &ext) override
Definition sc_ext.cc:147
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Declaration of the Packet class.
tlm::tlm_generic_payload & trans
Definition sc_ext.hh:50
TlmSenderState(tlm::tlm_generic_payload &trans)
Definition sc_ext.hh:51
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition packet.hh:469

Generated on Tue Jun 18 2024 16:24:07 for gem5 by doxygen 1.11.0