KONRAD Frederic
Builds for 2 pipelines passed

add the debug transport.

Debug transport is needed for some model which want to load the initial code in
it. So this just adds it.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
... ... @@ -106,6 +106,29 @@ public:
m_ro = read_only;
}
unsigned int dbg_transport(tlm::tlm_generic_payload& payload,
uint32_t offset)
{
tlm::tlm_command command = payload.get_command();
unsigned char *dataPtr = payload.get_data_ptr();
unsigned int length = payload.get_data_length();
switch (command)
{
case tlm::TLM_READ_COMMAND:
memcpy(dataPtr, &(((uint8_t *)m_ptr)[offset]), length);
break;
case tlm::TLM_WRITE_COMMAND:
memcpy(&(((uint8_t *)m_ptr)[offset]), dataPtr, length);
break;
default:
break;
}
payload.set_response_status(tlm::TLM_OK_RESPONSE);
return length;
}
void b_transact(gs::gp::GenericSlavePort<32>::accessHandle t,
uint32_t offset)
{
... ...
... ... @@ -33,15 +33,33 @@ public:
{
wrap_1.register_b_transport(&DualPortMemory::b_transact_0, this);
this->targetPort0.bind_b_if(wrap_1);
this->targetPort0.register_transport_dbg(this,
&DualPortMemory::dbg_transact_0);
this->targetPort0.register_get_direct_mem_ptr(this,
&DualPortMemory::get_direct_mem_ptr);
wrap_2.register_b_transport(&DualPortMemory::b_transact_1, this);
this->targetPort1.bind_b_if(wrap_2);
this->targetPort1.register_transport_dbg(this,
&DualPortMemory::dbg_transact_1);
this->targetPort1.register_get_direct_mem_ptr(this,
&DualPortMemory::get_direct_mem_ptr);
}
unsigned int dbg_transact_0(unsigned int index,
tlm::tlm_generic_payload& payload)
{
uint64_t offset = payload.get_address() - targetPort0.base_addr;
return BaseMemory::dbg_transport(payload, offset);
}
unsigned int dbg_transact_1(unsigned int index,
tlm::tlm_generic_payload& payload)
{
uint64_t offset = payload.get_address() - targetPort1.base_addr;
return BaseMemory::dbg_transport(payload, offset);
}
void b_transact_0(gs::gp::GenericSlaveAccessHandle ah)
{
uint32_t offset;
... ... @@ -56,6 +74,13 @@ public:
uint32_t offset;
accessHandle1 t = _getSlaveAccessHandle(ah);
#if 0
temp_counting++;
if (temp_counting > 100)
SC_REPORT_ERROR("STOPPED", "TO SEE THE TRACE.");
std::cout << "pAsip mem access: " << t->getMAddr() << std::endl;
#endif
offset = t->getMAddr() - targetPort1.base_addr;
BaseMemory::b_transact(t, offset);
}
... ... @@ -74,6 +99,7 @@ public:
gs::gp::GenericSlavePort<BUSWIDTH_1> targetPort1;
private:
size_t temp_counting; /* HACK */
gs::gs_param<uint32_t> m_size;
gs::gs_param<bool> m_ro; /*!< read only? */
gs::tlm_b_if_wrapper<DualPortMemory,
... ...
... ... @@ -79,6 +79,7 @@ class Memory:
this->target_port.bind_b_if(*this);
this->target_port.register_get_direct_mem_ptr(this,
&Memory::get_direct_mem_ptr);
this->target_port.register_transport_dbg(this, &Memory::dbg_transact);
}
~Memory()
... ... @@ -98,6 +99,13 @@ class Memory:
BaseMemory::b_transact(t, offset);
}
unsigned int dbg_transact(unsigned int index,
tlm::tlm_generic_payload& payload)
{
uint64_t offset = payload.get_address() - target_port.base_addr;
return BaseMemory::dbg_transport(payload, offset);
}
/*
* Socket for memory access.
*/
... ...