systemc: Enable DMI in the non-blocking/timing mode bridge.

Change-Id: Ia618081e2dbf8b49f62480ac5dc29f87100cd4f1
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65754
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2022-10-04 05:36:22 -07:00
committed by Gabe Black
parent 985d9c641f
commit 00a893ad4e

View File

@@ -207,6 +207,29 @@ void
TlmToGem5Bridge<BITWIDTH>::sendBeginResp(tlm::tlm_generic_payload &trans,
sc_core::sc_time &delay)
{
MemBackdoor::Flags flags;
switch (trans.get_command()) {
case tlm::TLM_READ_COMMAND:
flags = MemBackdoor::Readable;
break;
case tlm::TLM_WRITE_COMMAND:
flags = MemBackdoor::Writeable;
break;
default:
panic("TlmToGem5Bridge: "
"received transaction with unsupported command");
}
Addr start_addr = trans.get_address();
Addr length = trans.get_data_length();
MemBackdoorReq req({start_addr, start_addr + length}, flags);
MemBackdoorPtr backdoor = nullptr;
bmp.sendMemBackdoorReq(req, backdoor);
if (backdoor)
trans.set_dmi_allowed(true);
tlm::tlm_phase phase = tlm::BEGIN_RESP;
auto status = socket->nb_transport_bw(trans, phase, delay);
@@ -574,12 +597,12 @@ TlmToGem5Bridge<BITWIDTH>::before_end_of_elaboration()
DPRINTF(TlmBridge, "register blocking interface");
socket.register_b_transport(
this, &TlmToGem5Bridge<BITWIDTH>::b_transport);
socket.register_get_direct_mem_ptr(
this, &TlmToGem5Bridge<BITWIDTH>::get_direct_mem_ptr);
} else {
panic("gem5 operates neither in Timing nor in Atomic mode");
}
socket.register_get_direct_mem_ptr(
this, &TlmToGem5Bridge<BITWIDTH>::get_direct_mem_ptr);
socket.register_transport_dbg(
this, &TlmToGem5Bridge<BITWIDTH>::transport_dbg);