diff options
author | Christian Menard <Christian.Menard@tu-dresden.de> | 2017-02-09 19:15:41 -0500 |
---|---|---|
committer | Christian Menard <Christian.Menard@tu-dresden.de> | 2017-02-09 19:15:41 -0500 |
commit | 03f740664bc8db8890359c9c5ad02df9db478bae (patch) | |
tree | 27de717f997634ca22d04200a51b54305244929b /util/tlm/sc_master_port.hh | |
parent | ccd9210e1a1bdce828a13a4ffdf84548ffe61592 (diff) | |
download | gem5-03f740664bc8db8890359c9c5ad02df9db478bae.tar.xz |
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 <jason@lowepower.com>
Diffstat (limited to 'util/tlm/sc_master_port.hh')
-rw-r--r-- | util/tlm/sc_master_port.hh | 32 |
1 files changed, 24 insertions, 8 deletions
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 <tlm_utils/peq_with_cb_and_phase.h> -#include <tlm_utils/simple_target_socket.h> +#include <systemc> #include <tlm> #include <mem/external_master.hh> -#include <sc_module.hh> #include <sc_peq.hh> +#include <sim_control.hh> 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<SCMasterPort> 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<SCMasterPort>; @@ -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 |