20#ifndef __SIMPLEBUSAT_H__
21#define __SIMPLEBUSAT_H__
26#include "tlm_utils/simple_target_socket.h"
27#include "tlm_utils/simple_initiator_socket.h"
29#include "tlm_utils/peq_with_get.h"
31template <
int NR_OF_INITIATORS,
int NR_OF_TARGETS>
52 for (
unsigned int i = 0; i < NR_OF_INITIATORS; ++i) {
57 for (
unsigned int i = 0; i < NR_OF_TARGETS; ++i) {
74 return (
unsigned int)address >> 28;
107 assert(portId < NR_OF_TARGETS);
114 it->second.to = decodeSocket;
121 switch ((*decodeSocket)->nb_transport_fw(*trans, phase, t)) {
143 if (it->second.from) {
146 (*it->second.from)->nb_transport_bw(*trans, phase, t);
185 switch ((*initiatorSocket)->nb_transport_bw(*trans, phase, t)) {
206 sync_enum_type r = (*it->second.to)->nb_transport_fw(*trans, phase, t);
237 std::cout <<
"ERROR: '" <<
name()
238 <<
"': Illegal phase received from initiator." << std::endl;
239 assert(
false); exit(1);
251 std::cout <<
"ERROR: '" <<
name()
252 <<
"': Illegal phase received from target." << std::endl;
253 assert(
false); exit(1);
267 assert(portId < NR_OF_TARGETS);
271 return (*decodeSocket)->transport_dbg(trans);
279 if (low > addressMask) {
284 low += addressOffset;
285 if (high > addressMask) {
286 high = addressOffset + addressMask;
289 high += addressOffset;
301 unsigned int portId =
decode(address);
302 assert(portId < NR_OF_TARGETS);
309 (*decodeSocket)->get_direct_mem_ptr(trans, dmi_data);
337 if ((portId >= 0) && !
limitRange(portId, start_range, end_range)) {
342 for (
unsigned int i = 0; i < NR_OF_INITIATORS; ++i) {
343 (
target_socket[i])->invalidate_direct_mem_ptr(start_range, end_range);
void invalidateDMIPointers(int portId, sc_dt::uint64 start_range, sc_dt::uint64 end_range)
tlm_utils::peq_with_get< transaction_type > mResponsePEQ
sc_dt::uint64 getAddressMask(unsigned int portId)
unsigned int decode(const sc_dt::uint64 &address)
std::map< transaction_type *, ConnectionInfo > PendingTransactions
tlm::tlm_sync_enum sync_enum_type
bool getDMIPointer(int initiator_id, transaction_type &trans, tlm::tlm_dmi &dmi_data)
target_socket_type target_socket[NR_OF_INITIATORS]
unsigned int transportDebug(int initiator_id, transaction_type &trans)
tlm_utils::peq_with_get< transaction_type > mRequestPEQ
sc_core::sc_event mBeginResponseEvent
unsigned int getPortId(const sc_dt::uint64 &address)
sync_enum_type initiatorNBTransport(int initiator_id, transaction_type &trans, phase_type &phase, sc_core::sc_time &t)
tlm_utils::simple_initiator_socket_tagged< SimpleBusAT > initiator_socket_type
sc_core::sc_event mBeginRequestEvent
sync_enum_type targetNBTransport(int portId, transaction_type &trans, phase_type &phase, sc_core::sc_time &t)
tlm::tlm_phase phase_type
PendingTransactions mPendingTransactions
PendingTransactions::iterator PendingTransactionsIterator
tlm::tlm_generic_payload transaction_type
tlm_utils::simple_target_socket_tagged< SimpleBusAT > target_socket_type
sc_dt::uint64 getAddressOffset(unsigned int portId)
SC_HAS_PROCESS(SimpleBusAT)
PendingTransactions::const_iterator PendingTransactionsConstIterator
sc_core::sc_event mEndResponseEvent
bool limitRange(unsigned int portId, sc_dt::uint64 &low, sc_dt::uint64 &high)
initiator_socket_type initiator_socket[NR_OF_TARGETS]
sc_core::sc_event mEndRequestEvent
void addPendingTransaction(transaction_type &trans, initiator_socket_type *to, int initiatorId)
SimpleBusAT(sc_core::sc_module_name name)
const char * name() const
sc_dt::uint64 get_start_address() const
sc_dt::uint64 get_end_address() const
void set_start_address(sc_dt::uint64 addr)
void set_end_address(sc_dt::uint64 addr)
void set_address(const sc_dt::uint64 address)
sc_dt::uint64 get_address() const
transaction_type * get_next_transaction()
sc_core::sc_event & get_event()
void notify(transaction_type &trans, const sc_core::sc_time &t)
void register_nb_transport_bw(MODULE *mod, sync_enum_type(MODULE::*cb)(int, transaction_type &, phase_type &, sc_core::sc_time &), int id)
void register_invalidate_direct_mem_ptr(MODULE *mod, void(MODULE::*cb)(int, sc_dt::uint64, sc_dt::uint64), int id)
void register_nb_transport_fw(MODULE *mod, sync_enum_type(MODULE::*cb)(int id, transaction_type &, phase_type &, sc_core::sc_time &), int id)
void register_transport_dbg(MODULE *mod, unsigned int(MODULE::*cb)(int id, transaction_type &), int id)
void register_get_direct_mem_ptr(MODULE *mod, bool(MODULE::*cb)(int id, transaction_type &, tlm::tlm_dmi &), int id)
const sc_time SC_ZERO_TIME
initiator_socket_type * to
target_socket_type * from