changeset 594d96c093d0 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=594d96c093d0
description:
        misc: add a MasterId to the ExternalPort

        The Request constructor requires a MasterID. However, an external
        transactor has no chance of getting a MasterID as it does not have a
        pointer to the System. This patch adds a MasterID to ExternalMaster to
        allow external modules to easily genrerate new Requests.

        Signed-off-by: Jason Lowe-Power <[email protected]>

diffstat:

 src/mem/ExternalMaster.py  |  4 ++++
 src/mem/external_master.cc |  5 ++++-
 src/mem/external_master.hh |  3 +++
 3 files changed, 11 insertions(+), 1 deletions(-)

diffs (69 lines):

diff -r 2191b87e3b47 -r 594d96c093d0 src/mem/ExternalMaster.py
--- a/src/mem/ExternalMaster.py Thu Feb 09 19:11:29 2017 -0500
+++ b/src/mem/ExternalMaster.py Thu Feb 09 19:14:58 2017 -0500
@@ -35,8 +35,10 @@
 #
 # Authors: Andrew Bardsley
 #          Curtis Dunham
+#          Christian Menard
 
 from m5.params import *
+from m5.proxy import *
 from MemObject import MemObject
 
 class ExternalMaster(MemObject):
@@ -50,3 +52,5 @@
     port_data = Param.String('stub', 'A string to pass to the port'
         ' handler (in a format specific to the handler) to describe how'
         ' the port should be bound/bindable/discoverable')
+
+    system = Param.System(Parent.any, 'System this external port belongs to')
diff -r 2191b87e3b47 -r 594d96c093d0 src/mem/external_master.cc
--- a/src/mem/external_master.cc        Thu Feb 09 19:11:29 2017 -0500
+++ b/src/mem/external_master.cc        Thu Feb 09 19:14:58 2017 -0500
@@ -36,6 +36,7 @@
  *
  * Authors: Andrew Bardsley
  *          Curtis Dunham
+ *          Christian Menard
  */
 
 #include "mem/external_master.hh"
@@ -45,6 +46,7 @@
 
 #include "base/trace.hh"
 #include "debug/ExternalPort.hh"
+#include "sim/system.hh"
 
 std::map<std::string, ExternalMaster::Handler *>
     ExternalMaster::portHandlers;
@@ -54,7 +56,8 @@
     externalPort(NULL),
     portName(params->name + ".port"),
     portType(params->port_type),
-    portData(params->port_data)
+    portData(params->port_data),
+    masterId(params->system->getMasterId(params->name))
 {}
 
 BaseMasterPort &
diff -r 2191b87e3b47 -r 594d96c093d0 src/mem/external_master.hh
--- a/src/mem/external_master.hh        Thu Feb 09 19:11:29 2017 -0500
+++ b/src/mem/external_master.hh        Thu Feb 09 19:14:58 2017 -0500
@@ -36,6 +36,7 @@
  *
  * Authors: Andrew Bardsley
  *          Curtis Dunham
+ *          Christian Menard
  */
 
 /**
@@ -129,6 +130,8 @@
         Handler *handler);
 
     void init();
+
+    const MasterID masterId;
 };
 
 
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to