20 #ifndef __SYSTEMC_EXT_TLM_CORE_2_GENERIC_PAYLOAD_GP_HH__
21 #define __SYSTEMC_EXT_TLM_CORE_2_GENERIC_PAYLOAD_GP_HH__
25 #include "../../../utils/sc_report_handler.hh"
31 class tlm_generic_payload;
33 class tlm_mm_interface
36 virtual void free(tlm_generic_payload *) = 0;
48 class tlm_extension_base
52 virtual void free() {
delete this; }
72 const static unsigned int ID;
107 #define TLM_BYTE_DISABLED 0x0
108 #define TLM_BYTE_ENABLED 0xff
133 if (--m_ref_count == 0)
137 int get_ref_count()
const {
return m_ref_count; }
139 void set_mm(tlm_mm_interface *
mm) { m_mm =
mm; }
140 bool has_mm()
const {
return m_mm != 0; }
160 bool use_byte_enable_on_read=
true);
167 void free_all_extensions();
180 tlm_command get_command()
const {
return m_command; }
181 void set_command(
const tlm_command command) { m_command = command; }
185 void set_address(
const sc_dt::uint64 address) { m_address = address; }
188 unsigned char *get_data_ptr()
const {
return m_data; }
189 void set_data_ptr(
unsigned char *
data) { m_data =
data; }
192 unsigned int get_data_length()
const {
return m_length; }
196 bool is_response_ok()
const {
return (m_response_status > 0); }
197 bool is_response_error()
const {
return (m_response_status <= 0); }
199 get_response_status()
const
201 return m_response_status;
206 m_response_status = response_status;
208 std::string get_response_string()
const;
211 unsigned int get_streaming_width()
const {
return m_streaming_width; }
213 set_streaming_width(
const unsigned int streaming_width)
215 m_streaming_width = streaming_width;
219 unsigned char *get_byte_enable_ptr()
const {
return m_byte_enable; }
221 set_byte_enable_ptr(
unsigned char *byte_enable)
223 m_byte_enable = byte_enable;
226 get_byte_enable_length()
const
228 return m_byte_enable_length;
231 set_byte_enable_length(
const unsigned int byte_enable_length)
233 m_byte_enable_length = byte_enable_length;
239 set_dmi_allowed(
bool dmi_allowed)
244 is_dmi_allowed()
const
251 void set_gp_option(
const tlm_gp_option gp_opt) { m_gp_option = gp_opt; }
291 unsigned char *m_data;
292 unsigned int m_length;
295 unsigned char *m_byte_enable;
296 unsigned int m_byte_enable_length;
297 unsigned int m_streaming_width;
338 template <
typename T>
340 set_extension(T *
ext)
342 return static_cast<T *
>(set_extension(
T::ID,
ext));
351 template <
typename T>
353 set_auto_extension(T *
ext)
355 return static_cast<T *
>(set_auto_extension(
T::ID,
ext));
363 template <
typename T>
364 void get_extension(T *&
ext)
const {
ext = get_extension<T>(); }
365 template <
typename T>
367 get_extension()
const
369 return static_cast<T*
>(get_extension(
T::ID));
378 template <
typename T>
379 void clear_extension(
const T *
ext) { clear_extension<T>(); }
385 template <
typename T>
386 void clear_extension() { clear_extension(
T::ID); }
391 template <
typename T>
392 void release_extension(T *
ext)
394 release_extension<T>();
400 template <
typename T>
401 void release_extension()
408 void clear_extension(
unsigned int index);
410 void release_extension(
unsigned int index);
418 void resize_extensions();
423 unsigned int m_ref_count;