gem5 v24.0.0.0
Loading...
Searching...
No Matches
phase.hh
Go to the documentation of this file.
1/*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 implied. See the License for the specific language governing
16 permissions and limitations under the License.
17
18 *****************************************************************************/
19
20#ifndef __SYSTEMC_EXT_TLM_CORE_2_GENERIC_PAYLOAD_PHASE_HH__
21#define __SYSTEMC_EXT_TLM_CORE_2_GENERIC_PAYLOAD_PHASE_HH__
22
23#include <iostream>
24#include <typeinfo>
25#include <vector>
26
27#define SC_CONCAT_HELPER_(a, b) SC_CONCAT_HELPER_DEFERRED_(a, b)
28#define SC_CONCAT_HELPER_DEFERRED_(a, b) SC_CONCAT_HELPER_MORE_DEFERRED_(a, b)
29#define SC_CONCAT_HELPER_MORE_DEFERRED_(a, b) a ## b
30
31#define SC_STRINGIFY_HELPER_(a) SC_STRINGIFY_HELPER_DEFERRED_(a)
32#define SC_STRINGIFY_HELPER_DEFERRED_(a) SC_STRINGIFY_HELPER_MORE_DEFERRED_(a)
33#define SC_STRINGIFY_HELPER_MORE_DEFERRED_(a) #a
34
35namespace tlm
36{
37
46
48{
49 public:
50 tlm_phase();
51 tlm_phase(unsigned int id);
52
53 tlm_phase(tlm_phase_enum standard);
55
56 operator unsigned int() const { return m_id; }
57 const char *get_name() const;
58
59 protected:
60 // Register extended phase.
61 tlm_phase(const std::type_info &type, const char *name);
62
63 private:
64 unsigned int m_id;
65};
66
68
69inline tlm_phase::tlm_phase(tlm_phase_enum standard) : m_id(standard) {}
70
71inline tlm_phase &
73{
74 m_id = standard;
75 return *this;
76}
77
78inline std::ostream &
79operator << (std::ostream &s, const tlm_phase &p)
80{
81 s << p.get_name();
82 return s;
83}
84
85#define TLM_DECLARE_EXTENDED_PHASE(name_arg) \
86static class SC_CONCAT_HELPER_(tlm_phase_, name_arg) : \
87 public ::tlm::tlm_phase \
88{ \
89 typedef SC_CONCAT_HELPER_(tlm_phase_, name_arg) this_type; \
90 public: \
91 SC_CONCAT_HELPER_(tlm_phase_, name_arg)() : \
92 /* register extended phase */ \
93 ::tlm::tlm_phase(typeid(*this), SC_STRINGIFY_HELPER_(name_arg)) \
94 {} \
95 \
96 static const this_type &get_phase() \
97 /* needed only for IEEE 1666-2011 */ \
98 { \
99 static this_type this_; \
100 return this_; \
101 } \
102} const name_arg
103
104// for backwards-compatibility
105#define DECLARE_EXTENDED_PHASE(NameArg) TLM_DECLARE_EXTENDED_PHASE(NameArg)
106
107} // namespace tlm
108
109#endif /* __SYSTEMC_EXT_TLM_CORE_2_GENERIC_PAYLOAD_PHASE_HH__ */
const char * get_name() const
Definition phase.cc:106
unsigned int m_id
Definition phase.hh:64
tlm_phase & operator=(tlm_phase_enum standard)
Definition phase.hh:72
tlm_phase_enum
Definition phase.hh:39
@ BEGIN_RESP
Definition phase.hh:43
@ END_RESP
Definition phase.hh:44
@ BEGIN_REQ
Definition phase.hh:41
@ END_REQ
Definition phase.hh:42
@ UNINITIALIZED_PHASE
Definition phase.hh:40
std::ostream & operator<<(std::ostream &s, const tlm_phase &p)
Definition phase.hh:79
const std::string & name()
Definition trace.cc:48

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