17 #ifndef TLM_GP_DATA_H_
18 #define TLM_GP_DATA_H_
36 explicit tlm_gp_data(tlm::tlm_generic_payload
const& o)
37 : address(o.get_address())
38 , command(o.get_command())
39 , data(o.get_data_ptr())
40 , data_length(o.get_data_length())
41 , response_status(o.get_response_status())
42 , dmi_allowed(o.is_dmi_allowed())
43 , byte_enable(o.get_byte_enable_ptr())
44 , byte_enable_length(o.get_byte_enable_length())
45 , streaming_width(o.get_streaming_width())
46 , gp_option(o.get_gp_option())
47 , uid(
reinterpret_cast<uintptr_t
>(&o)) {}
66 gp_option = tlm::TLM_MIN_PAYLOAD;
75 other.set_command(command);
76 other.set_address(address);
77 other.set_data_length(data_length);
78 other.set_byte_enable_length(byte_enable_length);
79 other.set_streaming_width(streaming_width);
80 other.set_gp_option(gp_option);
81 other.set_dmi_allowed(dmi_allowed);
82 other.set_response_status(response_status);
83 if(transfer_ownership) {
84 other.set_byte_enable_ptr(byte_enable);
85 other.set_data_ptr(data);
86 byte_enable =
nullptr;
91 std::string get_response_string()
const {
92 switch(response_status) {
93 case tlm::TLM_OK_RESPONSE:
94 return "TLM_OK_RESPONSE";
95 case tlm::TLM_INCOMPLETE_RESPONSE:
96 return "TLM_INCOMPLETE_RESPONSE";
97 case tlm::TLM_GENERIC_ERROR_RESPONSE:
98 return "TLM_GENERIC_ERROR_RESPONSE";
99 case tlm::TLM_ADDRESS_ERROR_RESPONSE:
100 return "TLM_ADDRESS_ERROR_RESPONSE";
101 case tlm::TLM_COMMAND_ERROR_RESPONSE:
102 return "TLM_COMMAND_ERROR_RESPONSE";
103 case tlm::TLM_BURST_ERROR_RESPONSE:
104 return "TLM_BURST_ERROR_RESPONSE";
105 case tlm::TLM_BYTE_ENABLE_ERROR_RESPONSE:
106 return "TLM_BYTE_ENABLE_ERROR_RESPONSE";
108 return "TLM_UNKNOWN_RESPONSE";
111 uint64_t get_data_value() {
114 for(
size_t i = 0; i < data_length; i++)
115 buf += (*(data + i)) << i * 8;
119 sc_dt::uint64 address{0};
120 tlm::tlm_command command{tlm::TLM_IGNORE_COMMAND};
121 unsigned char* data{
nullptr};
122 unsigned int data_length{0};
123 tlm::tlm_response_status response_status{tlm::TLM_INCOMPLETE_RESPONSE};
124 bool dmi_allowed{
false};
125 unsigned char* byte_enable{
nullptr};
126 unsigned int byte_enable_length{0};
127 unsigned int streaming_width{0};
128 tlm::tlm_gp_option gp_option{tlm::TLM_MIN_PAYLOAD};
137 : dmi_ptr(dmi_data.get_dmi_ptr())
138 , dmi_start_address(dmi_data.get_start_address())
139 , dmi_end_address(dmi_data.get_end_address())
140 , dmi_access(dmi_data.get_granted_access())
141 , dmi_read_latency(dmi_data.get_read_latency().value())
142 , dmi_write_latency(dmi_data.get_write_latency().value()) {}
148 unsigned char* dmi_ptr{
nullptr};
149 sc_dt::uint64 dmi_start_address{0};
150 sc_dt::uint64 dmi_end_address{0};
151 tlm::tlm_dmi::dmi_access_e dmi_access{tlm::tlm_dmi::DMI_ACCESS_NONE};
152 sc_dt::uint64 dmi_read_latency{0};
153 sc_dt::uint64 dmi_write_latency{0};
156 enum tlm_phase_enum {
157 UNINITIALIZED_PHASE = 0,
void update_generic_payload(tlm::tlm_generic_payload &other, bool transfer_ownership=false)