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);
}
}
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);
}
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(),
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;
}
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);
}
/*
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);
}
/*
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);
}
}
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;
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;
{
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;
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;
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);
}
}
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);
}
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);
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;
}
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
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
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);
}
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;
}
}
{
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;
}
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;
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;
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);
}
}
}
}
- 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();
}
}
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;
}
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
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
// 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);
}
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++) {
<< " 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();
}
}
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;
}
}
{
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) {
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;
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);
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);
}
// 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);
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();
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*
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;
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();
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;