Shivani Parekh has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/33538 )
Change subject: sim: Update master/slave and masterId --system.cc
......................................................................
sim: Update master/slave and masterId --system.cc
system.cc
Change-Id: I25468cbd4bb201d4c74791610d0a0e07562da707
---
M src/sim/system.cc
M src/sim/system.hh
2 files changed, 67 insertions(+), 64 deletions(-)
diff --git a/src/sim/system.cc b/src/sim/system.cc
index ac4ebed..a711ce7 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -246,7 +246,7 @@
_cacheLineSize == 64 || _cacheLineSize == 128))
warn_once("Cache line size is neither 16, 32, 64 nor 128
bytes.\n");
- // Get the generic system master IDs
+ // Get the generic system unique IDs
MasterID tmp_id M5_VAR_USED;
tmp_id = getMasterId(this, "writebacks");
assert(tmp_id == Request::wbUniqueId);
@@ -420,28 +420,28 @@
}
void
-System::addDeviceMemory(MasterID masterId, AbstractMemory *deviceMemory)
+System::addDeviceMemory(MasterID unique_id, AbstractMemory *deviceMemory)
{
- if (!deviceMemMap.count(masterId)) {
- deviceMemMap.insert(std::make_pair(masterId, deviceMemory));
+ if (!deviceMemMap.count(unique_id)) {
+ deviceMemMap.insert(std::make_pair(unique_id, deviceMemory));
}
}
bool
System::isDeviceMemAddr(PacketPtr pkt) const
{
- const MasterID& mid = pkt->masterId();
+ const MasterID& id = pkt->masterId();
- return (deviceMemMap.count(mid) &&
- deviceMemMap.at(mid)->getAddrRange().contains(pkt->getAddr()));
+ return (deviceMemMap.count(id) &&
+ deviceMemMap.at(id)->getAddrRange().contains(pkt->getAddr()));
}
AbstractMemory *
-System::getDeviceMemory(MasterID mid) const
+System::getDeviceMemory(MasterID id) const
{
- panic_if(!deviceMemMap.count(mid),
- "No device memory found for MasterID %d\n", mid);
- return deviceMemMap.at(mid);
+ panic_if(!deviceMemMap.count(id),
+ "No device memory found for MasterID %d\n", id);
+ return deviceMemMap.at(id);
}
void
@@ -544,12 +544,12 @@
}
std::string
-System::stripSystemName(const std::string& master_name) const
+System::stripSystemName(const std::string& requestor_name) const
{
- if (startswith(master_name, name())) {
- return master_name.substr(name().size());
+ if (startswith(requestor_name, name())) {
+ return requestor_name.substr(name().size());
} else {
- return master_name;
+ return requestor_name;
}
}
@@ -559,7 +559,7 @@
MasterID id = Request::invldUniqueId;
// number of occurrences of the SimObject pointer
- // in the master list.
+ // in the requestor list.
auto obj_number = 0;
for (int i = 0; i < requestors.size(); i++) {
@@ -571,15 +571,15 @@
fatal_if(obj_number > 1,
"Cannot lookup MasterID by SimObject pointer: "
- "More than one master is sharing the same SimObject\n");
+ "More than one requestor is sharing the same SimObject\n");
return id;
}
MasterID
-System::lookupMasterId(const std::string& master_name) const
+System::lookupMasterId(const std::string& requestor_name) const
{
- std::string name = stripSystemName(master_name);
+ std::string name = stripSystemName(requestor_name);
for (int i = 0; i < requestors.size(); i++) {
if (requestors[i].req_name == name) {
@@ -591,22 +591,23 @@
}
MasterID
-System::getGlobalMasterId(const std::string& _name)
+System::getGlobalMasterId(const std::string& requestor_name)
{
- return _getMasterId(nullptr, _name);
+ return _getMasterId(nullptr, requestor_name);
}
MasterID
System::getMasterId(const SimObject* requestor, std::string subrequestor)
{
- auto name = leafMasterName(requestor, subrequestor);
- return _getMasterId(requestor, name);
+ auto requestor_name = leafMasterName(requestor, subrequestor);
+ return _getMasterId(requestor, requestor_name);
}
MasterID
-System::_getMasterId(const SimObject* requestor, const std::string& _name)
+System::_getMasterId(const SimObject* requestor,
+ const std::string& requestor_name)
{
- std::string name = stripSystemName(_name);
+ std::string name = stripSystemName(requestor_name);
// CPUs in switch_cpus ask for ids again after switching
for (int i = 0; i < requestors.size(); i++) {
@@ -620,27 +621,28 @@
// they will be too small
if (Stats::enabled()) {
- fatal("Can't request a masterId after regStats(). "
+ fatal("Can't request a uniqueId after regStats(). "
"You must do so in init().\n");
}
// Generate a new MasterID incrementally
- MasterID _id = requestors.size();
+ MasterID unique_id = requestors.size();
// Append the new Master metadata to the group of system Masters.
- requestors.emplace_back(requestor, name, _id);
+ requestors.emplace_back(requestor, name, unique_id);
return requestors.back()._id;
}
std::string
-System::leafMasterName(const SimObject* requestor, const std::string&
subrequestor)
+System::leafMasterName(const SimObject* requestor,
+ const std::string& subrequestor)
{
if (subrequestor.empty()) {
return requestor->name();
} else {
- // Get the full master name by appending the submaster name to
- // the root SimObject master name
+ // Get the full requestor name by appending the subrequestor name
to
+ // the root SimObject requestor name
return requestor->name() + "." + subrequestor;
}
}
@@ -649,7 +651,7 @@
System::getMasterName(MasterID unique_id)
{
if (unique_id >= requestors.size())
- fatal("Invalid id passed to getMasterName()\n");
+ fatal("Invalid unique_id passed to getMasterName()\n");
const auto& requestor_info = requestors[unique_id];
return requestor_info.req_name;
diff --git a/src/sim/system.hh b/src/sim/system.hh
index 52530f5..c1400b6 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -76,7 +76,7 @@
/**
* Private class for the system port which is only used as a
- * master for debug access and for non-structural entities that do
+ * requestor for debug access and for non-structural entities that do
* not have a port of their own.
*/
class SystemPort : public RequestPort
@@ -358,10 +358,10 @@
/**
* Add a physical memory range for a device. The ranges added here will
- * be considered a non-PIO memory address if the masterId of the packet
+ * be considered a non-PIO memory address if the uniqueId of the packet
* and range match something in the device memory map.
*/
- void addDeviceMemory(MasterID masterID, AbstractMemory *deviceMemory);
+ void addDeviceMemory(MasterID uniqueID, AbstractMemory *deviceMemory);
/**
* Similar to isMemAddr but for devices. Checks if a physical address
@@ -373,7 +373,7 @@
/**
* Return a pointer to the device memory.
*/
- AbstractMemory *getDeviceMemory(MasterID masterID) const;
+ AbstractMemory *getDeviceMemory(MasterID _id) const;
/**
* Get the architecture.
@@ -423,8 +423,8 @@
uint32_t numWorkIds;
/** This array is a per-system list of all devices capable of issuing a
- * memory system request and an associated string for each master id.
- * It's used to uniquely id any master in the system by name for things
+ * memory system request and an associated string for each unique id.
+ * It's used to uniquely id any requestor in the system by name for
things
* like cache statistics.
*/
std::vector<MasterInfo> requestors;
@@ -433,31 +433,32 @@
protected:
/**
- * Strips off the system name from a master name
+ * Strips off the system name from a requestor name
*/
- std::string stripSystemName(const std::string& master_name) const;
+ std::string stripSystemName(const std::string& requestor_name) const;
public:
/**
* Request an id used to create a request object in the system. All
objects
* that intend to issues requests into the memory system must request
an id
- * in the init() phase of startup. All master ids must be fixed by the
+ * in the init() phase of startup. All requestor ids must be fixed by
the
* regStats() phase that immediately precedes it. This allows objects
in
* the memory system to understand how many requestors may exist and
- * appropriately name the bins of their per-master stats before the
stats
- * are finalized.
+ * appropriately name the bins of their per-requestor stats before the
+ * stats are finalized.
*
* Registers a MasterID:
* This method takes two parameters, one of which is optional.
- * The first one is the master object, and it is compulsory; in case
+ * The first one is the requestor object, and it is compulsory; in case
* a object has multiple (sub)requestors, a second parameter must be
- * provided and it contains the name of the submaster. The method will
- * create a master's name by concatenating the SimObject name with the
- * eventual submaster string, separated by a dot.
+ * provided and it contains the name of the subrequestor. The method
will
+ * create a requestor's name by concatenating the SimObject name with
the
+ * eventual subrequestor string, separated by a dot.
*
* As an example:
- * For a cpu having two requestors: a data master and an instruction
master,
+ * For a cpu having two requestors: a data requestor and an
+ * instruction requestor,
* the method must be called twice:
*
* instMasterId = getMasterId(cpu, "inst");
@@ -467,27 +468,27 @@
* - "cpu.inst"
* - "cpu.data"
*
- * @param master SimObject related to the master
- * @param submaster String containing the submaster's name
- * @return the master's ID.
+ * @param requestor SimObject related to the requestor
+ * @param subrequestor String containing the subrequestor's name
+ * @return the requestor's ID.
*/
- MasterID getMasterId(const SimObject* master,
- std::string submaster = std::string());
+ MasterID getMasterId(const SimObject* requestor,
+ std::string subrequestor = std::string());
/**
* Registers a GLOBAL MasterID, which is a MasterID not related
* to any particular SimObject; since no SimObject is passed,
- * the master gets registered by providing the full master name.
+ * the requestor gets registered by providing the full requestor name.
*
- * @param masterName full name of the master
- * @return the master's ID.
+ * @param requestorName full name of the requestor
+ * @return the requestor's ID.
*/
- MasterID getGlobalMasterId(const std::string& master_name);
+ MasterID getGlobalMasterId(const std::string& requestor_name);
/**
* Get the name of an object for a given request id.
*/
- std::string getMasterName(MasterID master_id);
+ std::string getMasterName(MasterID unique_id);
/**
* Looks up the MasterID for a given SimObject
@@ -506,15 +507,15 @@
protected:
/** helper function for getMasterId */
- MasterID _getMasterId(const SimObject* master,
- const std::string& master_name);
+ MasterID _getMasterId(const SimObject* requestor,
+ const std::string& requestor_name);
/**
- * Helper function for constructing the full (sub)master name
- * by providing the root master and the relative submaster name.
+ * Helper function for constructing the full (sub)requestor name
+ * by providing the root requestor and the relative subrequestor name.
*/
- std::string leafMasterName(const SimObject* master,
- const std::string& submaster);
+ std::string leafMasterName(const SimObject* requestor,
+ const std::string& subrequestor);
public:
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33538
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I25468cbd4bb201d4c74791610d0a0e07562da707
Gerrit-Change-Number: 33538
Gerrit-PatchSet: 1
Gerrit-Owner: Shivani Parekh <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s