20#ifndef __SIMPLE_LT_TARGET2_H__
21#define __SIMPLE_LT_TARGET2_H__
24#include "tlm_utils/simple_target_socket.h"
71 std::cout <<
name() <<
": ERROR, extension not present" << std::endl;
75 std::cout <<
name() <<
": OK, extension data = "
76 << tmp_ext->
m_data << std::endl;
83 std::cout <<
name() <<
": Received write request: A = 0x"
84 << std::hex << (
unsigned int)address
85 <<
", D = 0x" <<
data << std::dec
88 *
reinterpret_cast<unsigned int*
>(&
mMem[address]) =
data;
92 std::cout <<
name() <<
": Received read request: A = 0x"
93 << std::hex << (
unsigned int)address << std::dec
96 data = *
reinterpret_cast<unsigned int*
>(&
mMem[address]);
112 if (r.get_address() >= 400)
return 0;
114 unsigned int tmp = (int)r.get_address();
115 unsigned int num_bytes;
116 if (tmp + r.get_data_length() >= 400) {
117 num_bytes = 400 - tmp;
120 num_bytes = r.get_data_length();
123 for (
unsigned int i = 0; i < num_bytes; ++i) {
124 r.get_data_ptr()[i] =
mMem[i + tmp];
128 for (
unsigned int i = 0; i < num_bytes; ++i) {
129 mMem[i + tmp] = r.get_data_ptr()[i];
147 std::cout <<
name() <<
": get_direct_mem_ptr OK, extension data = "
148 <<tmp_ext->
m_data << std::endl;
152 std::cout <<
name() <<
", get_direct_mem_ptr ERROR: "
153 <<
"didn't get pointer to extension"
178 socket->invalidate_direct_mem_ptr(start_address, end_address);
181 unsigned char mMem[400];
sc_core::sc_event m_invalidate_dmi_event
tlm_utils::simple_target_socket< SimpleLTTarget_ext, 32, my_extended_payload_types > target_socket_type
sync_enum_type myNBTransport(transaction_type &trans, phase_type &phase, sc_core::sc_time &t)
unsigned int transport_dbg(transaction_type &r)
SC_HAS_PROCESS(SimpleLTTarget_ext)
sc_core::sc_time m_invalidate_dmi_time
SimpleLTTarget_ext(sc_core::sc_module_name name, sc_core::sc_time invalidate_dmi_time=sc_core::sc_time(25, sc_core::SC_NS))
target_socket_type socket
tlm::tlm_phase phase_type
bool myGetDMIPtr(transaction_type &trans, tlm::tlm_dmi &dmi_data)
void invalidate_dmi_method()
tlm::tlm_sync_enum sync_enum_type
tlm::tlm_generic_payload transaction_type
const char * name() const
void set_write_latency(sc_core::sc_time t)
void set_dmi_ptr(unsigned char *p)
void set_start_address(sc_dt::uint64 addr)
void set_end_address(sc_dt::uint64 addr)
void set_read_latency(sc_core::sc_time t)
unsigned char * get_data_ptr() const
void set_dmi_allowed(bool dmi_allowed)
void set_response_status(const tlm_response_status response_status)
sc_dt::uint64 get_address() const
void get_extension(T *&ext) const
tlm_command get_command() const
void register_nb_transport_fw(MODULE *mod, sync_enum_type(MODULE::*cb)(transaction_type &, phase_type &, sc_core::sc_time &))
void register_get_direct_mem_ptr(MODULE *mod, bool(MODULE::*cb)(transaction_type &, tlm::tlm_dmi &))
void register_transport_dbg(MODULE *mod, unsigned int(MODULE::*cb)(transaction_type &))
const sc_time & sc_time_stamp()