1 2/* 3 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 48 unchanged lines hidden (view full) --- 57{ 58 return new SimpleNetwork(nodes); 59} 60*/ 61 62SimpleNetwork::SimpleNetwork(const Params *p) 63 : Network(p) 64{ |
65 // 66 // Note: the parent Network Object constructor is called before the 67 // SimpleNetwork child constructor. Therefore, the member variables 68 // used below should already be initialized. 69 // 70 |
71 m_endpoint_switches.setSize(m_nodes); 72 73 m_in_use.setSize(m_virtual_networks); 74 m_ordered.setSize(m_virtual_networks); 75 for (int i = 0; i < m_virtual_networks; i++) { 76 m_in_use[i] = false; 77 m_ordered[i] = false; 78 } --- 6 unchanged lines hidden (view full) --- 85 m_fromNetQueues[node].setSize(m_virtual_networks); 86 for (int j = 0; j < m_virtual_networks; j++) { 87 m_toNetQueues[node][j] = new MessageBuffer( 88 "toNet node "+int_to_string(node)+" j "+int_to_string(j)); 89 m_fromNetQueues[node][j] = new MessageBuffer( 90 "fromNet node "+int_to_string(node)+" j "+int_to_string(j)); 91 } 92 } |
93} |
94 |
95void SimpleNetwork::init() 96{ 97 98 Network::init(); 99 100 // 101 // The topology pointer should have already been initialized in the parent 102 // class network constructor. 103 // 104 assert(m_topology_ptr != NULL); |
105 int number_of_switches = m_topology_ptr->numSwitches(); 106 for (int i=0; i<number_of_switches; i++) { 107 m_switch_ptr_vector.insertAtBottom(new Switch(i, this)); 108 } 109 m_topology_ptr->createLinks(this, false); // false because this isn't a reconfiguration 110} 111 112void SimpleNetwork::reset() --- 165 unchanged lines hidden --- |