aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lt_bus.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/lt_bus.cc b/src/lt_bus.cc
index 42495c0..069e01f 100644
--- a/src/lt_bus.cc
+++ b/src/lt_bus.cc
@@ -15,9 +15,12 @@ struct target : public sc_core::sc_module {
private:
void b_transport(tlm::tlm_generic_payload& tx, sc_core::sc_time& t) {
- LOGM("transport 0x%llx w: %d r: %d", tx.get_address(), tx.is_write(),
- tx.is_read());
+ CLOGM(YELLOW, "transport 0x%llx w: %d r: %d", tx.get_address(),
+ tx.is_write(), tx.is_read());
tx.set_response_status(tlm::TLM_OK_RESPONSE);
+
+ CLOGM(YELLOW, "invalidate 0x00 - 0x10");
+ p_sock->invalidate_direct_mem_ptr(0, 0x10);
}
};
@@ -27,13 +30,19 @@ struct initiator : public sc_core::sc_module {
SC_HAS_PROCESS(initiator);
explicit initiator(sc_core::sc_module_name nm) : sc_module(std::move(nm)) {
+ p_sock.register_invalidate_direct_mem_ptr(this, &initiator::invalidate_dmi);
+
SC_THREAD(run);
}
tlm_utils::simple_initiator_socket<initiator> p_sock{"sock"};
private:
- void send_tx(tlm::tlm_command cmd, std::uint64_t addr) {
+ void invalidate_dmi(sc_dt::uint64 start, sc_dt::uint64 end) {
+ CLOGM(CYAN, "INV 0x%08llx-0x%08llx", start, end);
+ }
+
+ void send_tx(tlm::tlm_command cmd, u64 addr) {
unsigned char data[4];
tlm::tlm_generic_payload tx;
tx.set_command(cmd);
@@ -45,11 +54,15 @@ struct initiator : public sc_core::sc_module {
tx.set_response_status(tlm::TLM_INCOMPLETE_RESPONSE);
tx.set_dmi_allowed(false);
+ CLOGM(CYAN, "ACCESS @0x%lx", addr);
+
sc_core::sc_time t;
p_sock->b_transport(tx, t);
- LOGM("ACCESS @%lx ok: %d (%s)", addr, tx.is_response_ok(),
- tx.get_response_string().c_str());
+ CLOGM(CYAN, "ACCESS ok: %d (%s)", tx.is_response_ok(),
+ tx.get_response_string().c_str());
+
+ LOG("------------------------------------------------------------");
}
void run() {
@@ -73,12 +86,14 @@ extern "C" int sc_main(int, char*[]) {
initiator init1{"init1"};
- bus.attach_target(target2.p_sock, 0x4000, 0x4fff);
bus.attach_target(target1.p_sock, 0x0000, 0x3fff);
+ bus.attach_target(target2.p_sock, 0x4000, 0x4fff);
bus.attach_target(target3.p_sock, 0x8000, 0x80ff);
bus.attach_initiator(init1.p_sock);
+ bus.dump();
+
sc_core::sc_start();
return 0;