ruby: network: shorten variable names
This commit is contained in:
parent
47d113696d
commit
e7bd70e079
8 changed files with 120 additions and 120 deletions
|
@ -62,7 +62,7 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p)
|
|||
for (vector<BasicRouter*>::const_iterator i = p->routers.begin();
|
||||
i != p->routers.end(); ++i) {
|
||||
Router_d* router = safe_cast<Router_d*>(*i);
|
||||
m_router_ptr_vector.push_back(router);
|
||||
m_routers.push_back(router);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,8 +72,8 @@ GarnetNetwork_d::init()
|
|||
BaseGarnetNetwork::init();
|
||||
|
||||
// initialize the router's network pointers
|
||||
for (vector<Router_d*>::const_iterator i = m_router_ptr_vector.begin();
|
||||
i != m_router_ptr_vector.end(); ++i) {
|
||||
for (vector<Router_d*>::const_iterator i = m_routers.begin();
|
||||
i != m_routers.end(); ++i) {
|
||||
Router_d* router = safe_cast<Router_d*>(*i);
|
||||
router->init_net_ptr(this);
|
||||
}
|
||||
|
@ -86,21 +86,21 @@ GarnetNetwork_d::init()
|
|||
NetworkInterface_d *ni = new NetworkInterface_d(i, m_virtual_networks,
|
||||
this);
|
||||
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
|
||||
m_ni_ptr_vector.push_back(ni);
|
||||
m_nis.push_back(ni);
|
||||
}
|
||||
m_topology_ptr->createLinks(this);
|
||||
|
||||
// initialize the link's network pointers
|
||||
for (vector<NetworkLink_d*>::const_iterator i = m_link_ptr_vector.begin();
|
||||
i != m_link_ptr_vector.end(); ++i) {
|
||||
for (vector<NetworkLink_d*>::const_iterator i = m_links.begin();
|
||||
i != m_links.end(); ++i) {
|
||||
NetworkLink_d* net_link = safe_cast<NetworkLink_d*>(*i);
|
||||
net_link->init_net_ptr(this);
|
||||
}
|
||||
|
||||
// FaultModel: declare each router to the fault model
|
||||
if(isFaultModelEnabled()){
|
||||
for (vector<Router_d*>::const_iterator i= m_router_ptr_vector.begin();
|
||||
i != m_router_ptr_vector.end(); ++i) {
|
||||
for (vector<Router_d*>::const_iterator i= m_routers.begin();
|
||||
i != m_routers.end(); ++i) {
|
||||
Router_d* router = safe_cast<Router_d*>(*i);
|
||||
int router_id M5_VAR_USED =
|
||||
fault_model->declare_router(router->get_num_inports(),
|
||||
|
@ -121,10 +121,10 @@ GarnetNetwork_d::~GarnetNetwork_d()
|
|||
deletePointers(m_toNetQueues[i]);
|
||||
deletePointers(m_fromNetQueues[i]);
|
||||
}
|
||||
deletePointers(m_router_ptr_vector);
|
||||
deletePointers(m_ni_ptr_vector);
|
||||
deletePointers(m_link_ptr_vector);
|
||||
deletePointers(m_creditlink_ptr_vector);
|
||||
deletePointers(m_routers);
|
||||
deletePointers(m_nis);
|
||||
deletePointers(m_links);
|
||||
deletePointers(m_creditlinks);
|
||||
delete m_topology_ptr;
|
||||
}
|
||||
|
||||
|
@ -157,11 +157,11 @@ GarnetNetwork_d::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
|
|||
NetworkLink_d* net_link = garnet_link->m_network_links[direction];
|
||||
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
|
||||
|
||||
m_link_ptr_vector.push_back(net_link);
|
||||
m_creditlink_ptr_vector.push_back(credit_link);
|
||||
m_links.push_back(net_link);
|
||||
m_creditlinks.push_back(credit_link);
|
||||
|
||||
m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
|
||||
m_ni_ptr_vector[src]->addOutPort(net_link, credit_link);
|
||||
m_routers[dest]->addInPort(net_link, credit_link);
|
||||
m_nis[src]->addOutPort(net_link, credit_link);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -176,19 +176,19 @@ GarnetNetwork_d::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
|
|||
const NetDest& routing_table_entry)
|
||||
{
|
||||
assert(dest < m_nodes);
|
||||
assert(src < m_router_ptr_vector.size());
|
||||
assert(m_router_ptr_vector[src] != NULL);
|
||||
assert(src < m_routers.size());
|
||||
assert(m_routers[src] != NULL);
|
||||
|
||||
GarnetExtLink_d* garnet_link = safe_cast<GarnetExtLink_d*>(link);
|
||||
NetworkLink_d* net_link = garnet_link->m_network_links[direction];
|
||||
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
|
||||
|
||||
m_link_ptr_vector.push_back(net_link);
|
||||
m_creditlink_ptr_vector.push_back(credit_link);
|
||||
m_links.push_back(net_link);
|
||||
m_creditlinks.push_back(credit_link);
|
||||
|
||||
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
|
||||
m_routers[src]->addOutPort(net_link, routing_table_entry,
|
||||
link->m_weight, credit_link);
|
||||
m_ni_ptr_vector[dest]->addInPort(net_link, credit_link);
|
||||
m_nis[dest]->addInPort(net_link, credit_link);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -204,11 +204,11 @@ GarnetNetwork_d::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
|
|||
NetworkLink_d* net_link = garnet_link->m_network_links[direction];
|
||||
CreditLink_d* credit_link = garnet_link->m_credit_links[direction];
|
||||
|
||||
m_link_ptr_vector.push_back(net_link);
|
||||
m_creditlink_ptr_vector.push_back(credit_link);
|
||||
m_links.push_back(net_link);
|
||||
m_creditlinks.push_back(credit_link);
|
||||
|
||||
m_router_ptr_vector[dest]->addInPort(net_link, credit_link);
|
||||
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
|
||||
m_routers[dest]->addInPort(net_link, credit_link);
|
||||
m_routers[src]->addOutPort(net_link, routing_table_entry,
|
||||
link->m_weight, credit_link);
|
||||
}
|
||||
|
||||
|
@ -243,19 +243,19 @@ GarnetNetwork_d::printLinkStats(ostream& out) const
|
|||
}
|
||||
|
||||
out << endl;
|
||||
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
|
||||
for (int i = 0; i < m_links.size(); i++) {
|
||||
average_link_utilization +=
|
||||
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
|
||||
(double(m_links[i]->getLinkUtilization())) /
|
||||
(double(curCycle() - g_ruby_start));
|
||||
|
||||
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
|
||||
vector<int> vc_load = m_links[i]->getVcLoad();
|
||||
for (int j = 0; j < vc_load.size(); j++) {
|
||||
assert(vc_load.size() == m_vcs_per_vnet*m_virtual_networks);
|
||||
average_vc_load[j] += vc_load[j];
|
||||
}
|
||||
}
|
||||
average_link_utilization =
|
||||
average_link_utilization/m_link_ptr_vector.size();
|
||||
average_link_utilization/m_links.size();
|
||||
out << "Average Link Utilization :: " << average_link_utilization
|
||||
<< " flits/cycle" << endl;
|
||||
out << "-------------" << endl;
|
||||
|
@ -286,17 +286,17 @@ GarnetNetwork_d::printPowerStats(ostream& out) const
|
|||
double m_static_router_power = 0.0;
|
||||
double m_clk_power = 0.0;
|
||||
|
||||
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
|
||||
m_total_link_power += m_link_ptr_vector[i]->calculate_power();
|
||||
m_dynamic_link_power += m_link_ptr_vector[i]->get_dynamic_power();
|
||||
m_static_link_power += m_link_ptr_vector[i]->get_static_power();
|
||||
for (int i = 0; i < m_links.size(); i++) {
|
||||
m_total_link_power += m_links[i]->calculate_power();
|
||||
m_dynamic_link_power += m_links[i]->get_dynamic_power();
|
||||
m_static_link_power += m_links[i]->get_static_power();
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_router_ptr_vector.size(); i++) {
|
||||
m_total_router_power += m_router_ptr_vector[i]->calculate_power();
|
||||
m_dynamic_router_power += m_router_ptr_vector[i]->get_dynamic_power();
|
||||
m_static_router_power += m_router_ptr_vector[i]->get_static_power();
|
||||
m_clk_power += m_router_ptr_vector[i]->get_clk_power();
|
||||
for (int i = 0; i < m_routers.size(); i++) {
|
||||
m_total_router_power += m_routers[i]->calculate_power();
|
||||
m_dynamic_router_power += m_routers[i]->get_dynamic_power();
|
||||
m_static_router_power += m_routers[i]->get_static_power();
|
||||
m_clk_power += m_routers[i]->get_clk_power();
|
||||
}
|
||||
out << "Link Dynamic Power = " << m_dynamic_link_power << " W" << endl;
|
||||
out << "Link Static Power = " << m_static_link_power << " W" << endl;
|
||||
|
@ -326,16 +326,16 @@ GarnetNetwork_d::functionalWrite(Packet *pkt)
|
|||
{
|
||||
uint32_t num_functional_writes = 0;
|
||||
|
||||
for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) {
|
||||
num_functional_writes += m_router_ptr_vector[i]->functionalWrite(pkt);
|
||||
for (unsigned int i = 0; i < m_routers.size(); i++) {
|
||||
num_functional_writes += m_routers[i]->functionalWrite(pkt);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) {
|
||||
num_functional_writes += m_ni_ptr_vector[i]->functionalWrite(pkt);
|
||||
for (unsigned int i = 0; i < m_nis.size(); ++i) {
|
||||
num_functional_writes += m_nis[i]->functionalWrite(pkt);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) {
|
||||
num_functional_writes += m_link_ptr_vector[i]->functionalWrite(pkt);
|
||||
for (unsigned int i = 0; i < m_links.size(); ++i) {
|
||||
num_functional_writes += m_links[i]->functionalWrite(pkt);
|
||||
}
|
||||
|
||||
return num_functional_writes;
|
||||
|
|
|
@ -100,10 +100,10 @@ class GarnetNetwork_d : public BaseGarnetNetwork
|
|||
|
||||
std::vector<VNET_type > m_vnet_type;
|
||||
|
||||
std::vector<Router_d *> m_router_ptr_vector; // All Routers in Network
|
||||
std::vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
|
||||
std::vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in net
|
||||
std::vector<NetworkInterface_d *> m_ni_ptr_vector; // All NI's in Network
|
||||
std::vector<Router_d *> m_routers; // All Routers in Network
|
||||
std::vector<NetworkLink_d *> m_links; // All links in the network
|
||||
std::vector<CreditLink_d *> m_creditlinks; // All links in net
|
||||
std::vector<NetworkInterface_d *> m_nis; // All NI's in Network
|
||||
|
||||
int m_buffers_per_data_vc;
|
||||
int m_buffers_per_ctrl_vc;
|
||||
|
|
|
@ -56,7 +56,7 @@ GarnetNetwork::GarnetNetwork(const Params *p)
|
|||
for (vector<BasicRouter*>::const_iterator i = p->routers.begin();
|
||||
i != p->routers.end(); ++i) {
|
||||
Router* router = safe_cast<Router*>(*i);
|
||||
m_router_ptr_vector.push_back(router);
|
||||
m_routers.push_back(router);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ GarnetNetwork::init()
|
|||
assert (m_topology_ptr!=NULL);
|
||||
|
||||
// initialize the router's network pointers
|
||||
for (vector<Router*>::const_iterator i = m_router_ptr_vector.begin();
|
||||
i != m_router_ptr_vector.end(); ++i) {
|
||||
for (vector<Router*>::const_iterator i = m_routers.begin();
|
||||
i != m_routers.end(); ++i) {
|
||||
Router* router = safe_cast<Router*>(*i);
|
||||
router->init_net_ptr(this);
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ GarnetNetwork::init()
|
|||
NetworkInterface *ni = new NetworkInterface(i, m_virtual_networks,
|
||||
this);
|
||||
ni->addNode(m_toNetQueues[i], m_fromNetQueues[i]);
|
||||
m_ni_ptr_vector.push_back(ni);
|
||||
m_nis.push_back(ni);
|
||||
}
|
||||
|
||||
m_topology_ptr->createLinks(this);
|
||||
|
@ -91,9 +91,9 @@ GarnetNetwork::~GarnetNetwork()
|
|||
deletePointers(m_toNetQueues[i]);
|
||||
deletePointers(m_fromNetQueues[i]);
|
||||
}
|
||||
deletePointers(m_router_ptr_vector);
|
||||
deletePointers(m_ni_ptr_vector);
|
||||
deletePointers(m_link_ptr_vector);
|
||||
deletePointers(m_routers);
|
||||
deletePointers(m_nis);
|
||||
deletePointers(m_links);
|
||||
delete m_topology_ptr;
|
||||
}
|
||||
|
||||
|
@ -119,9 +119,9 @@ GarnetNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
|
|||
NetworkLink *net_link = garnet_link->m_network_links[direction];
|
||||
|
||||
net_link->init_net_ptr(this);
|
||||
m_link_ptr_vector.push_back(net_link);
|
||||
m_router_ptr_vector[dest]->addInPort(net_link);
|
||||
m_ni_ptr_vector[src]->addOutPort(net_link);
|
||||
m_links.push_back(net_link);
|
||||
m_routers[dest]->addInPort(net_link);
|
||||
m_nis[src]->addOutPort(net_link);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -130,17 +130,17 @@ GarnetNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
|
|||
const NetDest& routing_table_entry)
|
||||
{
|
||||
assert(dest < m_nodes);
|
||||
assert(src < m_router_ptr_vector.size());
|
||||
assert(m_router_ptr_vector[src] != NULL);
|
||||
assert(src < m_routers.size());
|
||||
assert(m_routers[src] != NULL);
|
||||
|
||||
GarnetExtLink* garnet_link = safe_cast<GarnetExtLink*>(link);
|
||||
NetworkLink *net_link = garnet_link->m_network_links[direction];
|
||||
|
||||
net_link->init_net_ptr(this);
|
||||
m_link_ptr_vector.push_back(net_link);
|
||||
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
|
||||
m_links.push_back(net_link);
|
||||
m_routers[src]->addOutPort(net_link, routing_table_entry,
|
||||
link->m_weight);
|
||||
m_ni_ptr_vector[dest]->addInPort(net_link);
|
||||
m_nis[dest]->addInPort(net_link);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -152,9 +152,9 @@ GarnetNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
|
|||
NetworkLink *net_link = garnet_link->m_network_links[direction];
|
||||
|
||||
net_link->init_net_ptr(this);
|
||||
m_link_ptr_vector.push_back(net_link);
|
||||
m_router_ptr_vector[dest]->addInPort(net_link);
|
||||
m_router_ptr_vector[src]->addOutPort(net_link, routing_table_entry,
|
||||
m_links.push_back(net_link);
|
||||
m_routers[dest]->addInPort(net_link);
|
||||
m_routers[src]->addOutPort(net_link, routing_table_entry,
|
||||
link->m_weight);
|
||||
|
||||
}
|
||||
|
@ -179,20 +179,20 @@ GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered,
|
|||
bool
|
||||
GarnetNetwork::functionalRead(Packet *pkt)
|
||||
{
|
||||
for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) {
|
||||
if (m_router_ptr_vector[i]->functionalRead(pkt)) {
|
||||
for (unsigned int i = 0; i < m_routers.size(); i++) {
|
||||
if (m_routers[i]->functionalRead(pkt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) {
|
||||
if (m_ni_ptr_vector[i]->functionalRead(pkt)) {
|
||||
for (unsigned int i = 0; i < m_nis.size(); ++i) {
|
||||
if (m_nis[i]->functionalRead(pkt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) {
|
||||
if (m_link_ptr_vector[i]->functionalRead(pkt)) {
|
||||
for (unsigned int i = 0; i < m_links.size(); ++i) {
|
||||
if (m_links[i]->functionalRead(pkt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -205,16 +205,16 @@ GarnetNetwork::functionalWrite(Packet *pkt)
|
|||
{
|
||||
uint32_t num_functional_writes = 0;
|
||||
|
||||
for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) {
|
||||
num_functional_writes += m_router_ptr_vector[i]->functionalWrite(pkt);
|
||||
for (unsigned int i = 0; i < m_routers.size(); i++) {
|
||||
num_functional_writes += m_routers[i]->functionalWrite(pkt);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) {
|
||||
num_functional_writes += m_ni_ptr_vector[i]->functionalWrite(pkt);
|
||||
for (unsigned int i = 0; i < m_nis.size(); ++i) {
|
||||
num_functional_writes += m_nis[i]->functionalWrite(pkt);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) {
|
||||
num_functional_writes += m_link_ptr_vector[i]->functionalWrite(pkt);
|
||||
for (unsigned int i = 0; i < m_links.size(); ++i) {
|
||||
num_functional_writes += m_links[i]->functionalWrite(pkt);
|
||||
}
|
||||
|
||||
return num_functional_writes;
|
||||
|
@ -232,19 +232,19 @@ GarnetNetwork::printLinkStats(ostream& out) const
|
|||
}
|
||||
|
||||
out << endl;
|
||||
for (int i = 0; i < m_link_ptr_vector.size(); i++) {
|
||||
for (int i = 0; i < m_links.size(); i++) {
|
||||
average_link_utilization +=
|
||||
(double(m_link_ptr_vector[i]->getLinkUtilization())) /
|
||||
(double(m_links[i]->getLinkUtilization())) /
|
||||
(double(curCycle() - g_ruby_start));
|
||||
|
||||
vector<int> vc_load = m_link_ptr_vector[i]->getVcLoad();
|
||||
vector<int> vc_load = m_links[i]->getVcLoad();
|
||||
for (int j = 0; j < vc_load.size(); j++) {
|
||||
assert(vc_load.size() == m_vcs_per_vnet*m_virtual_networks);
|
||||
average_vc_load[j] += vc_load[j];
|
||||
}
|
||||
}
|
||||
average_link_utilization =
|
||||
average_link_utilization/m_link_ptr_vector.size();
|
||||
average_link_utilization/m_links.size();
|
||||
out << "Average Link Utilization :: " << average_link_utilization
|
||||
<< " flits/cycle" << endl;
|
||||
out << "-------------" << endl;
|
||||
|
|
|
@ -93,9 +93,9 @@ class GarnetNetwork : public BaseGarnetNetwork
|
|||
GarnetNetwork(const GarnetNetwork& obj);
|
||||
GarnetNetwork& operator=(const GarnetNetwork& obj);
|
||||
|
||||
std::vector<Router *> m_router_ptr_vector; // All Routers in Network
|
||||
std::vector<NetworkLink *> m_link_ptr_vector; // All links in network
|
||||
std::vector<NetworkInterface *> m_ni_ptr_vector; // All NI's in Network
|
||||
std::vector<Router *> m_routers; // All Routers in Network
|
||||
std::vector<NetworkLink *> m_links; // All links in network
|
||||
std::vector<NetworkInterface *> m_nis; // All NI's in Network
|
||||
|
||||
int m_buffer_size;
|
||||
int m_number_of_pipe_stages;
|
||||
|
|
|
@ -83,7 +83,7 @@ SimpleNetwork::SimpleNetwork(const Params *p)
|
|||
for (vector<BasicRouter*>::const_iterator i = p->routers.begin();
|
||||
i != p->routers.end(); ++i) {
|
||||
Switch* s = safe_cast<Switch*>(*i);
|
||||
m_switch_ptr_vector.push_back(s);
|
||||
m_switches.push_back(s);
|
||||
s->init_net_ptr(this);
|
||||
}
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ SimpleNetwork::reset()
|
|||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < m_switch_ptr_vector.size(); i++){
|
||||
m_switch_ptr_vector[i]->clearBuffers();
|
||||
for(int i = 0; i < m_switches.size(); i++){
|
||||
m_switches[i]->clearBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ SimpleNetwork::~SimpleNetwork()
|
|||
deletePointers(m_toNetQueues[i]);
|
||||
deletePointers(m_fromNetQueues[i]);
|
||||
}
|
||||
deletePointers(m_switch_ptr_vector);
|
||||
deletePointers(m_switches);
|
||||
deletePointers(m_buffers_to_free);
|
||||
// delete m_topology_ptr;
|
||||
}
|
||||
|
@ -132,17 +132,17 @@ SimpleNetwork::makeOutLink(SwitchID src, NodeID dest, BasicLink* link,
|
|||
const NetDest& routing_table_entry)
|
||||
{
|
||||
assert(dest < m_nodes);
|
||||
assert(src < m_switch_ptr_vector.size());
|
||||
assert(m_switch_ptr_vector[src] != NULL);
|
||||
assert(src < m_switches.size());
|
||||
assert(m_switches[src] != NULL);
|
||||
|
||||
SimpleExtLink *simple_link = safe_cast<SimpleExtLink*>(link);
|
||||
|
||||
m_switch_ptr_vector[src]->addOutPort(m_fromNetQueues[dest],
|
||||
m_switches[src]->addOutPort(m_fromNetQueues[dest],
|
||||
routing_table_entry,
|
||||
simple_link->m_latency,
|
||||
simple_link->m_bw_multiplier);
|
||||
|
||||
m_endpoint_switches[dest] = m_switch_ptr_vector[src];
|
||||
m_endpoint_switches[dest] = m_switches[src];
|
||||
}
|
||||
|
||||
// From an endpoint node to a switch
|
||||
|
@ -152,7 +152,7 @@ SimpleNetwork::makeInLink(NodeID src, SwitchID dest, BasicLink* link,
|
|||
const NetDest& routing_table_entry)
|
||||
{
|
||||
assert(src < m_nodes);
|
||||
m_switch_ptr_vector[dest]->addInPort(m_toNetQueues[src]);
|
||||
m_switches[dest]->addInPort(m_toNetQueues[src]);
|
||||
}
|
||||
|
||||
// From a switch to a switch
|
||||
|
@ -177,8 +177,8 @@ SimpleNetwork::makeInternalLink(SwitchID src, SwitchID dest, BasicLink* link,
|
|||
// Connect it to the two switches
|
||||
SimpleIntLink *simple_link = safe_cast<SimpleIntLink*>(link);
|
||||
|
||||
m_switch_ptr_vector[dest]->addInPort(queues);
|
||||
m_switch_ptr_vector[src]->addOutPort(queues, routing_table_entry,
|
||||
m_switches[dest]->addInPort(queues);
|
||||
m_switches[src]->addOutPort(queues, routing_table_entry,
|
||||
simple_link->m_latency,
|
||||
simple_link->m_bw_multiplier);
|
||||
}
|
||||
|
@ -239,9 +239,9 @@ SimpleNetwork::printStats(ostream& out) const
|
|||
total_msg_counts[type] = 0;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_switch_ptr_vector.size(); i++) {
|
||||
for (int i = 0; i < m_switches.size(); i++) {
|
||||
const std::vector<Throttle*>* throttles =
|
||||
m_switch_ptr_vector[i]->getThrottles();
|
||||
m_switches[i]->getThrottles();
|
||||
|
||||
for (int p = 0; p < throttles->size(); p++) {
|
||||
|
||||
|
@ -281,16 +281,16 @@ SimpleNetwork::printStats(ostream& out) const
|
|||
<< " total_bytes: " << total_bytes << endl;
|
||||
|
||||
out << endl;
|
||||
for (int i = 0; i < m_switch_ptr_vector.size(); i++) {
|
||||
m_switch_ptr_vector[i]->printStats(out);
|
||||
for (int i = 0; i < m_switches.size(); i++) {
|
||||
m_switches[i]->printStats(out);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SimpleNetwork::clearStats()
|
||||
{
|
||||
for (int i = 0; i < m_switch_ptr_vector.size(); i++) {
|
||||
m_switch_ptr_vector[i]->clearStats();
|
||||
for (int i = 0; i < m_switches.size(); i++) {
|
||||
m_switches[i]->clearStats();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,8 +314,8 @@ SimpleNetworkParams::create()
|
|||
bool
|
||||
SimpleNetwork::functionalRead(Packet *pkt)
|
||||
{
|
||||
for (unsigned int i = 0; i < m_switch_ptr_vector.size(); i++) {
|
||||
if (m_switch_ptr_vector[i]->functionalRead(pkt)) {
|
||||
for (unsigned int i = 0; i < m_switches.size(); i++) {
|
||||
if (m_switches[i]->functionalRead(pkt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -334,8 +334,8 @@ SimpleNetwork::functionalWrite(Packet *pkt)
|
|||
{
|
||||
uint32_t num_functional_writes = 0;
|
||||
|
||||
for (unsigned int i = 0; i < m_switch_ptr_vector.size(); i++) {
|
||||
num_functional_writes += m_switch_ptr_vector[i]->functionalWrite(pkt);
|
||||
for (unsigned int i = 0; i < m_switches.size(); i++) {
|
||||
num_functional_writes += m_switches[i]->functionalWrite(pkt);
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < m_buffers_to_free.size(); ++i) {
|
||||
|
|
|
@ -105,7 +105,7 @@ class SimpleNetwork : public Network
|
|||
|
||||
std::vector<bool> m_in_use;
|
||||
std::vector<bool> m_ordered;
|
||||
std::vector<Switch*> m_switch_ptr_vector;
|
||||
std::vector<Switch*> m_switches;
|
||||
std::vector<MessageBuffer*> m_buffers_to_free;
|
||||
std::vector<Switch*> m_endpoint_switches;
|
||||
|
||||
|
|
|
@ -43,12 +43,12 @@ using m5::stl_helpers::operator<<;
|
|||
|
||||
Switch::Switch(const Params *p) : BasicRouter(p)
|
||||
{
|
||||
m_perfect_switch_ptr = new PerfectSwitch(m_id, this, p->virt_nets);
|
||||
m_perfect_switch = new PerfectSwitch(m_id, this, p->virt_nets);
|
||||
}
|
||||
|
||||
Switch::~Switch()
|
||||
{
|
||||
delete m_perfect_switch_ptr;
|
||||
delete m_perfect_switch;
|
||||
|
||||
// Delete throttles (one per output port)
|
||||
deletePointers(m_throttles);
|
||||
|
@ -61,13 +61,13 @@ void
|
|||
Switch::init()
|
||||
{
|
||||
BasicRouter::init();
|
||||
m_perfect_switch_ptr->init(m_network_ptr);
|
||||
m_perfect_switch->init(m_network_ptr);
|
||||
}
|
||||
|
||||
void
|
||||
Switch::addInPort(const vector<MessageBuffer*>& in)
|
||||
{
|
||||
m_perfect_switch_ptr->addInPort(in);
|
||||
m_perfect_switch->addInPort(in);
|
||||
|
||||
for (int i = 0; i < in.size(); i++) {
|
||||
in[i]->setReceiver(this);
|
||||
|
@ -104,7 +104,7 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
|
|||
}
|
||||
|
||||
// Hook the queues to the PerfectSwitch
|
||||
m_perfect_switch_ptr->addOutPort(intermediateBuffers, routing_table_entry);
|
||||
m_perfect_switch->addOutPort(intermediateBuffers, routing_table_entry);
|
||||
|
||||
// Hook the queues to the Throttle
|
||||
throttle_ptr->addLinks(intermediateBuffers, out);
|
||||
|
@ -113,13 +113,13 @@ Switch::addOutPort(const vector<MessageBuffer*>& out,
|
|||
void
|
||||
Switch::clearRoutingTables()
|
||||
{
|
||||
m_perfect_switch_ptr->clearRoutingTables();
|
||||
m_perfect_switch->clearRoutingTables();
|
||||
}
|
||||
|
||||
void
|
||||
Switch::clearBuffers()
|
||||
{
|
||||
m_perfect_switch_ptr->clearBuffers();
|
||||
m_perfect_switch->clearBuffers();
|
||||
for (int i = 0; i < m_throttles.size(); i++) {
|
||||
if (m_throttles[i] != NULL) {
|
||||
m_throttles[i]->clear();
|
||||
|
@ -130,7 +130,7 @@ Switch::clearBuffers()
|
|||
void
|
||||
Switch::reconfigureOutPort(const NetDest& routing_table_entry)
|
||||
{
|
||||
m_perfect_switch_ptr->reconfigureOutPort(routing_table_entry);
|
||||
m_perfect_switch->reconfigureOutPort(routing_table_entry);
|
||||
}
|
||||
|
||||
const Throttle*
|
||||
|
@ -150,9 +150,9 @@ void
|
|||
Switch::printStats(std::ostream& out) const
|
||||
{
|
||||
ccprintf(out, "switch_%d_inlinks: %d\n", m_id,
|
||||
m_perfect_switch_ptr->getInLinks());
|
||||
m_perfect_switch->getInLinks());
|
||||
ccprintf(out, "switch_%d_outlinks: %d\n", m_id,
|
||||
m_perfect_switch_ptr->getOutLinks());
|
||||
m_perfect_switch->getOutLinks());
|
||||
|
||||
// Average link utilizations
|
||||
double average_utilization = 0.0;
|
||||
|
@ -214,7 +214,7 @@ Switch::printStats(std::ostream& out) const
|
|||
void
|
||||
Switch::clearStats()
|
||||
{
|
||||
m_perfect_switch_ptr->clearStats();
|
||||
m_perfect_switch->clearStats();
|
||||
for (int i = 0; i < m_throttles.size(); i++) {
|
||||
if (m_throttles[i] != NULL)
|
||||
m_throttles[i]->clearStats();
|
||||
|
|
|
@ -84,7 +84,7 @@ class Switch : public BasicRouter
|
|||
Switch(const Switch& obj);
|
||||
Switch& operator=(const Switch& obj);
|
||||
|
||||
PerfectSwitch* m_perfect_switch_ptr;
|
||||
PerfectSwitch* m_perfect_switch;
|
||||
SimpleNetwork* m_network_ptr;
|
||||
std::vector<Throttle*> m_throttles;
|
||||
std::vector<MessageBuffer*> m_buffers_to_free;
|
||||
|
|
Loading…
Reference in a new issue