20#ifndef __EXPLICIT_LT_TARGET_H__
21#define __EXPLICIT_LT_TARGET_H__
24#include "tlm_utils/simple_target_socket.h"
56 assert(address < 400);
60 std::cout <<
name() <<
": Received write request: A = 0x"
61 << std::hex << (
unsigned int)address <<
", D = 0x" <<
data
65 *
reinterpret_cast<unsigned int*
>(&
mMem[address]) =
data;
75 *
reinterpret_cast<unsigned int*
>(&
mMem[address]);
78 std::cout <<
name() <<
": Received read request: A = 0x"
79 << std::hex << (
unsigned int)address
83 data = *
reinterpret_cast<unsigned int*
>(&
mMem[address]);
94 if (r.get_address() >= 400)
return 0;
96 unsigned int tmp = (int)r.get_address();
97 unsigned int num_bytes;
98 if (tmp + r.get_data_length() >= 400) {
99 num_bytes = 400 - tmp;
102 num_bytes = r.get_data_length();
104 if (!r.is_read() && !r.is_write()) {
108 for (
unsigned int i = 0; i < num_bytes; ++i) {
109 r.get_data_ptr()[i] =
mMem[i + tmp];
113 for (
unsigned int i = 0; i < num_bytes; ++i) {
114 mMem[i + tmp] = r.get_data_ptr()[i];
tlm::tlm_generic_payload transaction_type
ExplicitLTTarget(sc_core::sc_module_name name)
tlm_utils::simple_target_socket< ExplicitLTTarget > target_socket_type
target_socket_type socket
unsigned int transport_dbg(transaction_type &r)
tlm::tlm_sync_enum sync_enum_type
tlm::tlm_phase phase_type
void myBTransport(transaction_type &trans, sc_core::sc_time &t)
SC_HAS_PROCESS(ExplicitLTTarget)
const char * name() const
unsigned char * get_data_ptr() const
void set_response_status(const tlm_response_status response_status)
sc_dt::uint64 get_address() const
tlm_command get_command() const
void register_b_transport(MODULE *mod, void(MODULE::*cb)(transaction_type &, sc_core::sc_time &))
void register_transport_dbg(MODULE *mod, unsigned int(MODULE::*cb)(transaction_type &))
const sc_time SC_ZERO_TIME
const sc_time & sc_time_stamp()