diff options
author | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2018-05-10 14:37:27 +0100 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2018-09-07 13:16:20 +0000 |
commit | 53cdcdee663c614d134174edea57b98a15385679 (patch) | |
tree | 0be8fe01736511047b22bb4732d3f61b72612c71 /src/sim/system.hh | |
parent | 8fee83d1ff0abf23226138c36a995dfe3ce70516 (diff) | |
download | gem5-53cdcdee663c614d134174edea57b98a15385679.tar.xz |
sim: Add System method for MasterID lookup
A new method (lookupMasterId) has been added to the System. A client
should use it when querying the System for the MasterID of a particular
master. It changes from getMasterId since it is
not registering a new MasterID if the master is not found in the
master's list.
Change-Id: I701158d22e235085bba9ab91154fbb702cae1467
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/11969
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/sim/system.hh')
-rw-r--r-- | src/sim/system.hh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/sim/system.hh b/src/sim/system.hh index 0d26ffa0d..878c81252 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -325,6 +325,12 @@ class System : public MemObject ThermalModel * thermalModel; + protected: + /** + * Strips off the system name from a master name + */ + std::string stripSystemName(const std::string& master_name) const; + public: /** @@ -370,19 +376,32 @@ class System : public MemObject * @param masterName full name of the master * @return the master's ID. */ - MasterID getGlobalMasterId(std::string master_name); + MasterID getGlobalMasterId(const std::string& master_name); /** * Get the name of an object for a given request id. */ std::string getMasterName(MasterID master_id); + /** + * Looks up the MasterID for a given SimObject + * returns an invalid MasterID (invldMasterId) if not found. + */ + MasterID lookupMasterId(const SimObject* obj) const; + + /** + * Looks up the MasterID for a given object name string + * returns an invalid MasterID (invldMasterId) if not found. + */ + MasterID lookupMasterId(const std::string& name) const; + /** Get the number of masters registered in the system */ MasterID maxMasters() { return masters.size(); } protected: /** helper function for getMasterId */ - MasterID _getMasterId(const SimObject* master, std::string master_name); + MasterID _getMasterId(const SimObject* master, + const std::string& master_name); /** * Helper function for constructing the full (sub)master name |