fixed bug related DMI access when memory offset != 0
This commit is contained in:
parent
1d7c8bbdac
commit
d63d95f634
|
@ -483,7 +483,6 @@ void CPU::CPU_thread(void) {
|
||||||
/* if memory_offset at Memory module is set, this won't work */
|
/* if memory_offset at Memory module is set, this won't work */
|
||||||
memcpy(&INSTR, dmi_ptr + register_bank->getPC(), 4);
|
memcpy(&INSTR, dmi_ptr + register_bank->getPC(), 4);
|
||||||
} else {
|
} else {
|
||||||
cout << "No DMI access" << endl;
|
|
||||||
trans->set_address(register_bank->getPC());
|
trans->set_address(register_bank->getPC());
|
||||||
instr_bus->b_transport(*trans, delay);
|
instr_bus->b_transport(*trans, delay);
|
||||||
|
|
||||||
|
@ -491,10 +490,13 @@ void CPU::CPU_thread(void) {
|
||||||
SC_REPORT_ERROR("CPU base", "Read memory");
|
SC_REPORT_ERROR("CPU base", "Read memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trans->is_dmi_allowed()) {
|
||||||
dmi_ptr_valid = instr_bus->get_direct_mem_ptr(*trans, dmi_data);
|
dmi_ptr_valid = instr_bus->get_direct_mem_ptr(*trans, dmi_data);
|
||||||
if (dmi_ptr_valid) {
|
if (dmi_ptr_valid) {
|
||||||
|
std::cout << "Get DMI_PTR " << std::endl;
|
||||||
dmi_ptr = dmi_data.get_dmi_ptr();
|
dmi_ptr = dmi_data.get_dmi_ptr();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
perf->codeMemoryRead();
|
perf->codeMemoryRead();
|
||||||
|
|
|
@ -49,7 +49,6 @@ void Memory::b_transport( tlm::tlm_generic_payload& trans, sc_time& delay )
|
||||||
unsigned char* byt = trans.get_byte_enable_ptr();
|
unsigned char* byt = trans.get_byte_enable_ptr();
|
||||||
unsigned int wid = trans.get_streaming_width();
|
unsigned int wid = trans.get_streaming_width();
|
||||||
|
|
||||||
|
|
||||||
adr = adr - memory_offset;
|
adr = adr - memory_offset;
|
||||||
// Obliged to check address range and check for unsupported features,
|
// Obliged to check address range and check for unsupported features,
|
||||||
// i.e. byte enables, streaming, and bursts
|
// i.e. byte enables, streaming, and bursts
|
||||||
|
@ -101,6 +100,10 @@ void Memory::b_transport( tlm::tlm_generic_payload& trans, sc_time& delay )
|
||||||
bool Memory::get_direct_mem_ptr(tlm::tlm_generic_payload& trans,
|
bool Memory::get_direct_mem_ptr(tlm::tlm_generic_payload& trans,
|
||||||
tlm::tlm_dmi& dmi_data)
|
tlm::tlm_dmi& dmi_data)
|
||||||
{
|
{
|
||||||
|
if (memory_offset != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Permit read and write access
|
// Permit read and write access
|
||||||
dmi_data.allow_read_write();
|
dmi_data.allow_read_write();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue