30 template <
typename Enum>
struct enable_for_enum {
static const bool value =
false; };
36 template <
typename E>
inline E
into(
typename std::underlying_type<E>::type t);
42 template <typename E, typename ULT = typename std::underlying_type<E>::type,
43 typename X =
typename std::enable_if<std::is_enum<E>::value && !std::is_convertible<E, ULT>::value,
bool>::type>
45 return static_cast<typename std::underlying_type<E>::type
>(t);
52 template <
typename E>
const char*
to_char(E t);
59 template <typename E, typename std::enable_if<enable_for_enum<E>::value,
bool>::type>
60 inline std::ostream& operator<<(std::ostream& os, E e) {
65 std::ostream& operator<<(std::ostream& os, tlm::tlm_generic_payload
const& t);
67 enum class lock_e : uint8_t { NORMAL = 0x0, EXLUSIVE = 0x1, LOCKED = 0x2 };
69 enum class resp_e : uint8_t { OKAY = 0x0, EXOKAY = 0x1, SLVERR = 0x2, DECERR = 0x3 };
71 enum class trans_e : uint8_t { IDLE = 0x0, BUSY = 0x1, NONSEQ = 0x2, SEQ = 0x3 };
73 enum class burst_e : uint8_t { SINGLE = 0x0, INCR = 0x1, WRAP4 = 0x2, INCR4 = 0x3, WRAP8 = 0x4, INCR8 = 0x5, WRAP16 = 0x6, INCR16 = 0x7 };
77 bool is_instruction()
const;
78 void set_instruction(
bool =
true);
80 bool is_privileged()
const;
81 void set_privileged(
bool =
true);
83 void set_bufferable(
bool =
true);
84 bool is_bufferable()
const;
86 void set_cacheable(
bool =
true);
87 bool is_cacheable()
const;
89 bool is_locked()
const;
90 void set_locked(
bool =
true);
93 void set_seq(
bool =
true);
95 uint8_t get_protection()
const;
96 void set_protection(uint8_t);
98 burst_e get_burst()
const;
99 void set_burst(burst_e);
101 resp_e get_resp()
const;
102 void set_resp(resp_e);
111 tlm::tlm_extension_base*
clone()
const override;
116 void copy_from(tlm::tlm_extension_base
const& ext)
override;
119 enum { INSTR = 1, PRIV = 2, BUFFERABLE = 4, CACHABLE = 8 };
121 lock_e lock{lock_e::NORMAL};
122 resp_e resp{resp_e::OKAY};
123 burst_e burst{burst_e::SINGLE};
130 inline bool ahb_extension::is_instruction()
const {
return prot & INSTR; }
132 inline void ahb_extension::set_instruction(
bool instr) {
139 inline bool ahb_extension::is_privileged()
const {
return prot & PRIV; }
141 inline void ahb_extension::set_privileged(
bool priv) {
148 inline bool ahb_extension::is_bufferable()
const {
return prot & BUFFERABLE; }
150 inline void ahb_extension::set_bufferable(
bool bufferable) {
157 inline bool ahb_extension::is_cacheable()
const {
return prot & CACHABLE; }
159 inline void ahb_extension::set_cacheable(
bool cacheable) {
166 inline uint8_t ahb_extension::get_protection()
const {
return prot; }
168 inline void ahb_extension::set_protection(uint8_t protection) { prot = protection; }
170 inline bool ahb_extension::is_locked()
const {
return lock == lock_e::LOCKED; }
172 inline void ahb_extension::set_locked(
bool locked) { lock = locked ? lock_e::LOCKED : lock_e::NORMAL; }
174 inline burst_e ahb_extension::get_burst()
const {
return burst; }
176 inline void ahb_extension::set_burst(burst_e b) { burst = b; }
178 inline bool ahb_extension::is_seq()
const {
return seq; }
180 inline void ahb_extension::set_seq(
bool s) { seq = s; }
184 inline resp_e ahb_extension::get_resp()
const {
return resp; }
186 inline void ahb_extension::set_resp(resp_e r) { resp = r; }
189 auto const* ahb_ext =
dynamic_cast<const ahb_extension*
>(&ext);
TLM2.0 components modeling AHB.
constexpr ULT to_int(E t)
const char * to_char(E t)
E into(typename std::underlying_type< E >::type t)
void copy_from(tlm::tlm_extension_base const &ext) override
deep copy all values from ext
tlm::tlm_extension_base * clone() const override
the clone function to create deep copies of