gem5 v24.1.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tlm_chi.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Arm Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#include <ARM/TLM/arm_chi.h>
39
41#include "sim/init.hh"
42
43namespace py = pybind11;
44
45using namespace ARM::CHI;
46
47namespace gem5 {
48
49namespace {
50
53template <typename T>
54struct PayloadDeleter
55{
56 void
57 operator()(T * p) const
58 {
59 p->unref();
60 }
61};
62
63void
64tlm_chi_pybind(pybind11::module_ &m_internal)
65{
66 auto tlm_chi = m_internal.def_submodule("tlm_chi");
67 py::class_<Payload, std::unique_ptr<Payload, PayloadDeleter<Payload>>>(
68 tlm_chi, "TlmPayload")
69 .def(py::init(&Payload::new_payload))
70 .def_readwrite("address", &Payload::address)
71 .def_property("size",
72 [] (const Payload &p) { return p.size; },
73 [] (Payload &p, SizeEnum val) { p.size = val; })
74 .def_readwrite("lpid", &Payload::lpid)
75 .def_property("ns",
76 [] (const Payload &p) { return p.ns; },
77 [] (Payload &p, bool val) { p.ns = val; })
78 ;
79
80 py::class_<Phase>(tlm_chi, "TlmPhase")
81 .def(py::init<>())
82 .def_readwrite("txn_id", &Phase::txn_id)
83 .def_readwrite("src_id", &Phase::src_id)
84 .def_readwrite("tgt_id", &Phase::tgt_id)
85 .def_readwrite("opcode", &Phase::raw_opcode)
86 .def_property("channel",
87 [] (const Phase &p) { return p.channel; },
88 [] (Phase &p, Channel val) { p.channel = val; })
89 .def_property("sub_channel",
90 [] (const Phase &p) { return p.sub_channel; },
91 [] (Phase &p, uint8_t val) { p.sub_channel = val; })
92 .def_property("lcrd",
93 [] (const Phase &p) { return p.lcrd; },
94 [] (Phase &p, bool val) { p.lcrd = val; })
95 .def_property("exp_comp_ack",
96 [] (const Phase &p) { return p.exp_comp_ack; },
97 [] (Phase &p, bool val) { p.exp_comp_ack = val; })
98 .def_property("snp_attr",
99 [] (const Phase &p) { return p.snp_attr; },
100 [] (Phase &p, bool val) { p.snp_attr = val; })
101 .def_property("allow_retry",
102 [] (const Phase &p) { return p.allow_retry; },
103 [] (Phase &p, bool val) { p.allow_retry = val; })
104 .def_property("do_dwt",
105 [] (const Phase &p) { return p.do_dwt; },
106 [] (Phase &p, bool val) { p.do_dwt = val; })
107 .def_property("data_id",
108 [] (const Phase &p) { return p.data_id; },
109 [] (Phase &p, uint8_t val) { p.data_id = val; })
110 .def_property("c_busy",
111 [] (const Phase &p) { return p.c_busy; },
112 [] (Phase &p, uint8_t val) { p.c_busy = val; })
113 .def_property("pcrd_type",
114 [] (const Phase &p) { return p.pcrd_type; },
115 [] (Phase &p, uint8_t val) { p.pcrd_type = val; })
116 .def_property("qos",
117 [] (const Phase &p) { return p.qos; },
118 [] (Phase &p, uint8_t val) { p.qos = val; })
119 .def_property("resp",
120 [] (const Phase &p) { return p.resp; },
121 [] (Phase &p, Resp val) { p.resp = val; })
122 .def_property("fwd_state",
123 [] (const Phase &p) { return p.fwd_state; },
124 [] (Phase &p, Resp val) { p.fwd_state = val; })
125 .def_property("order",
126 [] (const Phase &p) { return p.order; },
127 [] (Phase &p, Order val) { p.order = val; })
128 .def_property("resp_err",
129 [] (const Phase &p) { return p.resp_err; },
130 [] (Phase &p, RespErr val) { p.resp_err = val; })
131 .def_property("tag_op",
132 [] (const Phase &p) { return p.tag_op; },
133 [] (Phase &p, TagOp val) { p.tag_op = val; })
134 ;
135
136 py::enum_<Resp>(tlm_chi, "Resp")
137 .value("RESP_I", RESP_I)
138 .value("RESP_SC", RESP_SC)
139 .value("RESP_UC", RESP_UC)
140 .value("RESP_UD", RESP_UD)
141 .value("RESP_SD", RESP_SD)
142 .value("RESP_I_PD", RESP_I_PD)
143 .value("RESP_SC_PD", RESP_SC_PD)
144 .value("RESP_UC_PD", RESP_UC_PD)
145 .value("RESP_UD_PD", RESP_UD_PD)
146 .value("RESP_SD_PD", RESP_SD_PD)
147 ;
148
149 py::enum_<RespErr>(tlm_chi, "RespErr")
150 .value("RESP_ERR_OK", RESP_ERR_OK)
151 .value("RESP_ERR_EXOK", RESP_ERR_EXOK)
152 .value("RESP_ERR_DERR", RESP_ERR_DERR)
153 .value("RESP_ERR_NDERR", RESP_ERR_NDERR)
154 ;
155
156 py::enum_<Order>(tlm_chi, "Order")
157 .value("ORDER_NO_ORDER", ORDER_NO_ORDER)
158 .value("ORDER_REQUEST_ACCEPTED", ORDER_REQUEST_ACCEPTED)
159 .value("ORDER_REQUEST_ORDER", ORDER_REQUEST_ORDER)
160 .value("ORDER_ENDPOINT_ORDER", ORDER_ENDPOINT_ORDER)
161 ;
162
163 py::enum_<TagOp>(tlm_chi, "TagOp")
164 .value("TAG_OP_INVALID", TAG_OP_INVALID)
165 .value("TAG_OP_TRANSFER", TAG_OP_TRANSFER)
166 .value("TAG_OP_UPDATE", TAG_OP_UPDATE)
167 .value("TAG_OP_MATCH", TAG_OP_MATCH)
168 .value("TAG_OP_FETCH", TAG_OP_FETCH)
169 ;
170
171 py::enum_<SizeEnum>(tlm_chi, "Size")
172 .value("SIZE_1", SIZE_1)
173 .value("SIZE_2", SIZE_2)
174 .value("SIZE_4", SIZE_4)
175 .value("SIZE_8", SIZE_8)
176 .value("SIZE_16", SIZE_16)
177 .value("SIZE_32", SIZE_32)
178 .value("SIZE_64", SIZE_64)
179 ;
180
181 py::enum_<Channel>(tlm_chi, "Channel")
182 .value("REQ", CHANNEL_REQ)
183 .value("DAT", CHANNEL_DAT)
184 .value("RSP", CHANNEL_RSP)
185 .value("SNP", CHANNEL_SNP)
186 ;
187
188 py::enum_<ReqOpcodeEnum>(tlm_chi, "ReqOpcode")
189 .value("READ_SHARED", REQ_OPCODE_READ_SHARED)
190 .value("READ_CLEAN", REQ_OPCODE_READ_CLEAN)
191 .value("READ_ONCE", REQ_OPCODE_READ_ONCE)
192 .value("READ_NO_SNP", REQ_OPCODE_READ_NO_SNP)
193 .value("PCRD_RETURN", REQ_OPCODE_PCRD_RETURN)
194 .value("READ_UNIQUE", REQ_OPCODE_READ_UNIQUE)
195 .value("CLEAN_SHARED", REQ_OPCODE_CLEAN_SHARED)
196 .value("CLEAN_INVALID", REQ_OPCODE_CLEAN_INVALID)
197 .value("MAKE_INVALID", REQ_OPCODE_MAKE_INVALID)
198 .value("CLEAN_UNIQUE", REQ_OPCODE_CLEAN_UNIQUE)
199 .value("MAKE_UNIQUE", REQ_OPCODE_MAKE_UNIQUE)
200 .value("EVICT", REQ_OPCODE_EVICT)
201 .value("EO_BARRIER", REQ_OPCODE_EO_BARRIER)
202 .value("EC_BARRIER", REQ_OPCODE_EC_BARRIER)
203 .value("READ_NO_SNP_SEP", REQ_OPCODE_READ_NO_SNP_SEP)
204 .value("CLEAN_SHARED_PERSIST_SEP", REQ_OPCODE_CLEAN_SHARED_PERSIST_SEP)
205 .value("DVM_OP", REQ_OPCODE_DVM_OP)
206 .value("WRITE_EVICT_FULL", REQ_OPCODE_WRITE_EVICT_FULL)
207 .value("WRITE_CLEAN_PTL", REQ_OPCODE_WRITE_CLEAN_PTL)
208 .value("WRITE_CLEAN_FULL", REQ_OPCODE_WRITE_CLEAN_FULL)
209 .value("WRITE_UNIQUE_PTL", REQ_OPCODE_WRITE_UNIQUE_PTL)
210 .value("WRITE_UNIQUE_FULL", REQ_OPCODE_WRITE_UNIQUE_FULL)
211 .value("WRITE_BACK_PTL", REQ_OPCODE_WRITE_BACK_PTL)
212 .value("WRITE_BACK_FULL", REQ_OPCODE_WRITE_BACK_FULL)
213 .value("WRITE_NO_SNP_PTL", REQ_OPCODE_WRITE_NO_SNP_PTL)
214 .value("WRITE_NO_SNP_FULL", REQ_OPCODE_WRITE_NO_SNP_FULL)
215 .value("WRITE_UNIQUE_FULL_STASH", REQ_OPCODE_WRITE_UNIQUE_FULL_STASH)
216 .value("WRITE_UNIQUE_PTL_STASH", REQ_OPCODE_WRITE_UNIQUE_PTL_STASH)
217 .value("STASH_ONCE_SHARED", REQ_OPCODE_STASH_ONCE_SHARED)
218 .value("STASH_ONCE_UNIQUE", REQ_OPCODE_STASH_ONCE_UNIQUE)
219 ;
220
221 py::enum_<RspOpcodeEnum>(tlm_chi, "RspOpcode")
222 .value("RSP_LCRD_RETURN", RSP_OPCODE_RSP_LCRD_RETURN)
223 .value("SNP_RESP", RSP_OPCODE_SNP_RESP)
224 .value("COMP_ACK", RSP_OPCODE_COMP_ACK)
225 .value("RETRY_ACK", RSP_OPCODE_RETRY_ACK)
226 .value("COMP", RSP_OPCODE_COMP)
227 .value("COMP_DBID_RESP", RSP_OPCODE_COMP_DBID_RESP)
228 .value("DBID_RESP", RSP_OPCODE_DBID_RESP)
229 .value("PCRD_GRANT", RSP_OPCODE_PCRD_GRANT)
230 .value("READ_RECEIPT", RSP_OPCODE_READ_RECEIPT)
231 .value("SNP_RESP_FWDED", RSP_OPCODE_SNP_RESP_FWDED)
232 .value("TAG_MATCH", RSP_OPCODE_TAG_MATCH)
233 .value("RESP_SEP_DATA", RSP_OPCODE_RESP_SEP_DATA)
234 .value("PERSIST", RSP_OPCODE_PERSIST)
235 .value("COMP_PERSIST", RSP_OPCODE_COMP_PERSIST)
236 .value("DBID_RESP_ORD", RSP_OPCODE_DBID_RESP_ORD)
237 .value("STASH_DONE", RSP_OPCODE_STASH_DONE)
238 .value("COMP_STASH_DONE", RSP_OPCODE_COMP_STASH_DONE)
239 .value("COMP_CMO", RSP_OPCODE_COMP_CMO)
240 ;
241
242 py::enum_<DatOpcodeEnum>(tlm_chi, "DatOpcode")
243 .value("DAT_LCRD_RETURN", DAT_OPCODE_DAT_LCRD_RETURN)
244 .value("SNP_RESP_DATA", DAT_OPCODE_SNP_RESP_DATA)
245 .value("COPY_BACK_WR_DATA", DAT_OPCODE_COPY_BACK_WR_DATA)
246 .value("NON_COPY_BACK_WR_DATA", DAT_OPCODE_NON_COPY_BACK_WR_DATA)
247 .value("COMP_DATA", DAT_OPCODE_COMP_DATA)
248 .value("SNP_RESP_DATA_PTL", DAT_OPCODE_SNP_RESP_DATA_PTL)
249 .value("SNP_RESP_DATA_FWDED", DAT_OPCODE_SNP_RESP_DATA_FWDED)
250 .value("WRITE_DATA_CANCEL", DAT_OPCODE_WRITE_DATA_CANCEL)
251 .value("DATA_SEP_RESP", DAT_OPCODE_DATA_SEP_RESP)
252 .value("NCB_WR_DATA_COMP_ACK", DAT_OPCODE_NCB_WR_DATA_COMP_ACK)
253 ;
254
255 py::enum_<SnpOpcodeEnum>(tlm_chi, "SnpOpcode")
256 .value("SNP_LCRD_RETURN", SNP_OPCODE_SNP_LCRD_RETURN)
257 .value("SNP_SHARED", SNP_OPCODE_SNP_SHARED)
258 .value("SNP_CLEAN", SNP_OPCODE_SNP_CLEAN)
259 .value("SNP_ONCE", SNP_OPCODE_SNP_ONCE)
260 .value("SNP_NOT_SHARED_DIRTY", SNP_OPCODE_SNP_NOT_SHARED_DIRTY)
261 .value("SNP_UNIQUE_STASH", SNP_OPCODE_SNP_UNIQUE_STASH)
262 .value("SNP_MAKE_INVALID_STASH", SNP_OPCODE_SNP_MAKE_INVALID_STASH)
263 .value("SNP_UNIQUE", SNP_OPCODE_SNP_UNIQUE)
264 .value("SNP_CLEAN_SHARED", SNP_OPCODE_SNP_CLEAN_SHARED)
265 .value("SNP_CLEAN_INVALID", SNP_OPCODE_SNP_CLEAN_INVALID)
266 .value("SNP_MAKE_INVALID", SNP_OPCODE_SNP_MAKE_INVALID)
267 .value("SNP_STASH_UNIQUE", SNP_OPCODE_SNP_STASH_UNIQUE)
268 .value("SNP_STASH_SHARED", SNP_OPCODE_SNP_STASH_SHARED)
269 .value("SNP_DVM_OP", SNP_OPCODE_SNP_DVM_OP)
270 .value("SNP_QUERY", SNP_OPCODE_SNP_QUERY)
271 .value("SNP_SHARED_FWD", SNP_OPCODE_SNP_SHARED_FWD)
272 .value("SNP_CLEAN_FWD", SNP_OPCODE_SNP_CLEAN_FWD)
273 .value("SNP_ONCE_FWD", SNP_OPCODE_SNP_ONCE_FWD)
274 .value("SNP_NOT_SHARED_DIRTY_FWD", SNP_OPCODE_SNP_NOT_SHARED_DIRTY_FWD)
275 .value("SNP_PREFER_UNIQUE", SNP_OPCODE_SNP_PREFER_UNIQUE)
276 .value("SNP_PREFER_UNIQUE_FWD", SNP_OPCODE_SNP_PREFER_UNIQUE_FWD)
277 .value("SNP_UNIQUE_FWD", SNP_OPCODE_SNP_UNIQUE_FWD)
278 ;
279}
280
281EmbeddedPyBind embed_("tlm_chi", &tlm_chi_pybind);
282
283} // namespace
284} // namespace gem5
Bitfield< 0 > p
Bitfield< 63 > val
Definition misc.hh:804
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36

Generated on Mon Jan 13 2025 04:28:40 for gem5 by doxygen 1.9.8