2 * Copyright (c) 2008 Princeton University
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 * Authors: Niket Agarwal
31 #ifndef __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__
32 #define __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__
37 #include "mem/ruby/network/garnet/NetworkHeader.hh"
38 #include "mem/ruby/network/garnet/BaseGarnetNetwork.hh"
39 #include "mem/ruby/network/Network.hh"
40 #include "params/GarnetNetwork_d.hh"
42 class NetworkInterface_d;
50 class GarnetNetwork_d : public BaseGarnetNetwork
53 typedef GarnetNetwork_dParams Params;
54 GarnetNetwork_d(const Params *p);
60 int getNumNodes() { return m_nodes; }
62 // returns the queue requested for the given component
63 MessageBuffer* getToNetQueue(NodeID id, bool ordered, int network_num);
64 MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int network_num);
67 void printStats(std::ostream& out) const;
68 void printConfig(std::ostream& out) const;
69 void print(std::ostream& out) const;
72 set_vnet_type(int vc, VNET_type vnet_type)
74 int vnet = vc/getVCsPerClass();
75 m_vnet_type[vnet] = vnet_type;
81 int vnet = vc/getVCsPerClass();
82 return m_vnet_type[vnet];
86 inline void increment_injected_flits() { m_flits_injected++; }
87 inline void increment_received_flits() { m_flits_received++; }
90 increment_network_latency(Time latency)
92 m_network_latency += latency;
96 increment_queueing_latency(Time latency)
98 m_queueing_latency += latency;
101 bool isVNetOrdered(int vnet) { return m_ordered[vnet]; }
102 bool validVirtualNetwork(int vnet) { return m_in_use[vnet]; }
103 Time getRubyStartTime();
107 // Methods used by Topology to setup the network
108 void makeOutLink(SwitchID src, NodeID dest,
109 const NetDest& routing_table_entry, int link_latency, int link_weight,
110 int bw_multiplier, bool isReconfiguration);
111 void makeInLink(SwitchID src, NodeID dest,
112 const NetDest& routing_table_entry, int link_latency,
113 int bw_multiplier, bool isReconfiguration);
114 void makeInternalLink(SwitchID src, NodeID dest,
115 const NetDest& routing_table_entry, int link_latency, int link_weight,
116 int bw_multiplier, bool isReconfiguration);
119 void checkNetworkAllocation(NodeID id, bool ordered, int network_num);
121 GarnetNetwork_d(const GarnetNetwork_d& obj);
122 GarnetNetwork_d& operator=(const GarnetNetwork_d& obj);
124 std::vector<VNET_type > m_vnet_type;
125 // int m_virtual_networks;
127 int m_flits_received, m_flits_injected;
128 double m_network_latency, m_queueing_latency;
130 std::vector<bool> m_in_use;
131 std::vector<bool> m_ordered;
133 std::vector<std::vector<MessageBuffer*> > m_toNetQueues;
134 std::vector<std::vector<MessageBuffer*> > m_fromNetQueues;
136 std::vector<Router_d *> m_router_ptr_vector; // All Routers in Network
137 std::vector<NetworkLink_d *> m_link_ptr_vector; // All links in the network
138 std::vector<CreditLink_d *> m_creditlink_ptr_vector; // All links in net
139 std::vector<NetworkInterface_d *> m_ni_ptr_vector; // All NI's in Network
141 // Topology* m_topology_ptr;
146 operator<<(std::ostream& out, const GarnetNetwork_d& obj)
153 #endif // __MEM_RUBY_NETWORK_GARNET_FIXED_PIPELINE_GARNETNETWORK_D_HH__