summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2014-02-20 17:27:45 -0600
committerNilay Vaish <nilay@cs.wisc.edu>2014-02-20 17:27:45 -0600
commit896654746adeebc264150692a9dda4e3fa48a6a3 (patch)
treeea24710d84c4d3e9610dea2e37c15aea9001f951
parent0ce8c2591941fa7899ad7fff445391ec089e974c (diff)
downloadgem5-896654746adeebc264150692a9dda4e3fa48a6a3.tar.xz
ruby: controller: slight code refactoring
-rw-r--r--src/mem/ruby/network/Topology.cc3
-rw-r--r--src/mem/ruby/slicc_interface/AbstractController.hh6
-rw-r--r--src/mem/slicc/symbols/StateMachine.py6
3 files changed, 6 insertions, 9 deletions
diff --git a/src/mem/ruby/network/Topology.cc b/src/mem/ruby/network/Topology.cc
index cb13d1530..0b81e1850 100644
--- a/src/mem/ruby/network/Topology.cc
+++ b/src/mem/ruby/network/Topology.cc
@@ -89,8 +89,7 @@ Topology::Topology(uint32_t num_routers, vector<BasicExtLink *> ext_links,
// Store the ExtLink pointers for later
m_ext_link_vector.push_back(ext_link);
- int machine_base_idx = MachineType_base_number(
- string_to_MachineType(abs_cntrl->getName()));
+ int machine_base_idx = MachineType_base_number(abs_cntrl->getType());
int ext_idx1 = machine_base_idx + abs_cntrl->getVersion();
int ext_idx2 = ext_idx1 + m_nodes;
int int_idx = router->params()->router_id + 2*m_nodes;
diff --git a/src/mem/ruby/slicc_interface/AbstractController.hh b/src/mem/ruby/slicc_interface/AbstractController.hh
index ac577ed09..e3584fa8b 100644
--- a/src/mem/ruby/slicc_interface/AbstractController.hh
+++ b/src/mem/ruby/slicc_interface/AbstractController.hh
@@ -56,11 +56,12 @@ class AbstractController : public ClockedObject, public Consumer
void init();
const Params *params() const { return (const Params *)_params; }
- const NodeID getVersion() const { return m_version; }
+ const NodeID getVersion() const { return m_machineID.getNum(); }
+ const MachineType getType() const { return m_machineID.getType(); }
+
void initNetworkPtr(Network* net_ptr) { m_net_ptr = net_ptr; }
// return instance name
- const std::string getName() const { return m_name; }
void blockOnQueue(Address, MessageBuffer*);
void unblock(Address);
@@ -129,7 +130,6 @@ class AbstractController : public ClockedObject, public Consumer
void wakeUpAllBuffers();
protected:
- std::string m_name;
NodeID m_version;
MachineID m_machineID;
NodeID m_clusterID;
diff --git a/src/mem/slicc/symbols/StateMachine.py b/src/mem/slicc/symbols/StateMachine.py
index 679d15f97..b2f225af8 100644
--- a/src/mem/slicc/symbols/StateMachine.py
+++ b/src/mem/slicc/symbols/StateMachine.py
@@ -458,7 +458,8 @@ stringstream ${ident}_transitionComment;
$c_ident::$c_ident(const Params *p)
: AbstractController(p)
{
- m_name = "${ident}";
+ m_machineID.type = MachineType_${ident};
+ m_machineID.num = m_version;
''')
num_in_ports = len(self.in_ports)
code(' m_in_ports = $num_in_ports;')
@@ -545,9 +546,6 @@ $c_ident::init()
MachineType machine_type = string_to_MachineType("${{var.machine.ident}}");
int base M5_VAR_USED = MachineType_base_number(machine_type);
- m_machineID.type = MachineType_${ident};
- m_machineID.num = m_version;
-
// initialize objects
''')