From 03f740664bc8db8890359c9c5ad02df9db478bae Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 9 Feb 2017 19:15:41 -0500 Subject: misc: Clean up and complete the gem5<->SystemC-TLM bridge [5/10] Changeset 11798:3a490c57058d --------------------------- misc: Clean up and complete the gem5<->SystemC-TLM bridge [5/10] The current TLM bridge only provides a Slave Port that allows the gem5 world to send request to the SystemC world. This patch series refractors and cleans up the existing code, and adds a Master Port that allows the SystemC world to send requests to the gem5 world. This patch: * Introduce transactor modules that represent the gem5 ports in the * SystemC world. * Update the SimControl module and let it keep track of the gem5 ports. Reviewed at http://reviews.gem5.org/r/3775/ Signed-off-by: Jason Lowe-Power --- util/tlm/sc_master_port.hh | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'util/tlm/sc_master_port.hh') diff --git a/util/tlm/sc_master_port.hh b/util/tlm/sc_master_port.hh index f2ac1580e..5fae9b6b4 100644 --- a/util/tlm/sc_master_port.hh +++ b/util/tlm/sc_master_port.hh @@ -36,17 +36,20 @@ #define __SC_MASTER_PORT_HH__ #include -#include +#include #include #include -#include #include +#include namespace Gem5SystemC { +// forward declaration +class Gem5MasterTransactor; + /** * This is a gem5 master port that translates TLM transactions to gem5 packets. * @@ -84,11 +87,11 @@ class SCMasterPort : public ExternalMaster::Port bool responseInProgress; - // Keep a reference to the gem5 SystemC module - Module& module; + Gem5MasterTransactor* transactor; - public: - tlm_utils::simple_target_socket tSocket; + System* system; + + Gem5SimControl& simControl; protected: // payload event call back @@ -112,9 +115,9 @@ class SCMasterPort : public ExternalMaster::Port SCMasterPort(const std::string& name_, const std::string& systemc_name, ExternalMaster& owner_, - Module& module); + Gem5SimControl& simControl); - static void registerPortHandler(Module& module); + void bindToTransactor(Gem5MasterTransactor* transactor); friend PayloadEvent; @@ -132,6 +135,19 @@ class SCMasterPort : public ExternalMaster::Port void checkTransaction(tlm::tlm_generic_payload& trans); }; +class SCMasterPortHandler : public ExternalMaster::Handler +{ + private: + Gem5SimControl& control; + + public: + SCMasterPortHandler(Gem5SimControl& control) : control(control) {} + + ExternalMaster::Port *getExternalPort(const std::string &name, + ExternalMaster &owner, + const std::string &port_data); +}; + } #endif -- cgit v1.2.3