scc 2025.09
SystemC components library
types.h
1/*
2 * Copyright 2020 -2022 Arteris IP
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.axi_util.cpp
15 */
16
17#pragma once
18
19#include <array>
20#include <axi/axi_tlm.h>
21#include <functional>
22#include <tlm/scc/tlm_gp_shared.h>
23
24namespace axi {
25namespace fsm {
26
27// fsm event enumerators
28enum protocol_time_point_e {
29 RequestPhaseBeg = 0, // only for triggering the request phase
30 WValidE,
31 WReadyE,
32 BegPartReqE,
33 EndPartReqE,
34 BegReqE,
35 EndReqE,
36 ResponsePhaseBeg,
37 BegPartRespE,
38 EndPartRespE,
39 BegRespE,
40 EndRespE,
41 Ack,
42 CB_CNT
43};
44
45inline const char* evt2str(unsigned evt) {
46 static const char* lut[] = {
47 "RequestPhaseBeg", "WValidE", "WReadyE", "BegPartReqE", "EndPartReqE", "BegReqE", "EndReqE",
48 "ResponsePhaseBeg", "BegPartRespE", "EndPartRespE", "BegRespE", "EndRespE", "Ack"};
49 return lut[evt];
50}
52using protocol_cb = std::array<std::function<void(void)>, CB_CNT>;
54struct AxiProtocolFsm;
58struct fsm_handle {
62 tlm::scc::tlm_gp_shared_ptr trans{nullptr};
64 size_t beat_count = 0;
66 bool is_snoop = false;
68 sc_core::sc_event finish;
70 tlm::scc::tlm_gp_shared_ptr gp{};
71 union {
72 uint64_t i64;
73 struct {
74 uint32_t i0;
75 uint32_t i1;
76 } i32;
77 void* p;
78 } aux;
79 sc_core::sc_time start;
80 unsigned state{0};
84 void reset() {
85 trans = nullptr;
86 beat_count = 0;
87 is_snoop = false;
88 gp=nullptr;
89 aux.i64 = 0;
90 start = sc_core::SC_ZERO_TIME;
91 state = 0;
92 }
93
94 fsm_handle();
95
97};
98
99} // namespace fsm
100} // namespace axi
TLM2.0 components modeling AHB.
tlm::scc::tlm_gp_shared_ptr trans
pointer to the associated AXITLM payload
Definition types.h:62
sc_core::sc_event finish
event indicating the end of the transaction
Definition types.h:68
size_t beat_count
beat count of this transaction
Definition types.h:64
AxiProtocolFsm *const fsm
pointer to the FSM
Definition types.h:60
bool is_snoop
indicator if this is a snoop access
Definition types.h:66
tlm::scc::tlm_gp_shared_ptr gp
additional data being used in the various adapters,
Definition types.h:70