Network.hh (6372:f1a41ea3bbab) Network.hh (6493:1fa51760a963)
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

--- 57 unchanged lines hidden (view full) ---

66 virtual ~Network() {}
67
68 // Public Methods
69 int getBufferSize() { return m_buffer_size; }
70 int getNumberOfVirtualNetworks() { return m_virtual_networks; }
71 int getEndpointBandwidth() { return m_endpoint_bandwidth; }
72 bool getAdaptiveRouting() {return m_adaptive_routing; }
73 int getLinkLatency() { return m_link_latency; }
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

--- 57 unchanged lines hidden (view full) ---

66 virtual ~Network() {}
67
68 // Public Methods
69 int getBufferSize() { return m_buffer_size; }
70 int getNumberOfVirtualNetworks() { return m_virtual_networks; }
71 int getEndpointBandwidth() { return m_endpoint_bandwidth; }
72 bool getAdaptiveRouting() {return m_adaptive_routing; }
73 int getLinkLatency() { return m_link_latency; }
74 int MessageSizeType_to_int(MessageSizeType size_type);
74
75
76
75 // returns the queue requested for the given component
76 virtual MessageBuffer* getToNetQueue(NodeID id, bool ordered, int netNumber) = 0;
77 virtual MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int netNumber) = 0;
78 virtual const Vector<Throttle*>* getThrottles(NodeID id) const { return NULL; }
79
80 virtual int getNumNodes() {return 1;}
81
82 virtual void makeOutLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) = 0;

--- 19 unchanged lines hidden (view full) ---

102 const string m_name;
103 int m_nodes;
104 int m_virtual_networks;
105 int m_buffer_size;
106 int m_endpoint_bandwidth;
107 Topology* m_topology_ptr;
108 bool m_adaptive_routing;
109 int m_link_latency;
77 // returns the queue requested for the given component
78 virtual MessageBuffer* getToNetQueue(NodeID id, bool ordered, int netNumber) = 0;
79 virtual MessageBuffer* getFromNetQueue(NodeID id, bool ordered, int netNumber) = 0;
80 virtual const Vector<Throttle*>* getThrottles(NodeID id) const { return NULL; }
81
82 virtual int getNumNodes() {return 1;}
83
84 virtual void makeOutLink(SwitchID src, NodeID dest, const NetDest& routing_table_entry, int link_latency, int link_weight, int bw_multiplier, bool isReconfiguration) = 0;

--- 19 unchanged lines hidden (view full) ---

104 const string m_name;
105 int m_nodes;
106 int m_virtual_networks;
107 int m_buffer_size;
108 int m_endpoint_bandwidth;
109 Topology* m_topology_ptr;
110 bool m_adaptive_routing;
111 int m_link_latency;
112 int m_control_msg_size;
113 int m_data_msg_size;
110};
111
112// Output operator declaration
113ostream& operator<<(ostream& out, const Network& obj);
114
115// ******************* Definitions *******************
116
117// Output operator definition
118extern inline
119ostream& operator<<(ostream& out, const Network& obj)
120{
121 obj.print(out);
122 out << flush;
123 return out;
124}
125
114};
115
116// Output operator declaration
117ostream& operator<<(ostream& out, const Network& obj);
118
119// ******************* Definitions *******************
120
121// Output operator definition
122extern inline
123ostream& operator<<(ostream& out, const Network& obj)
124{
125 obj.print(out);
126 out << flush;
127 return out;
128}
129
126// Code to map network message size types to an integer number of bytes
127const int CONTROL_MESSAGE_SIZE = 8;
128const int DATA_MESSAGE_SIZE = (RubySystem::getBlockSizeBytes()+8);
129
130extern inline
131int MessageSizeType_to_int(MessageSizeType size_type)
132{
133 switch(size_type) {
134 case MessageSizeType_Undefined:
135 ERROR_MSG("Can't convert Undefined MessageSizeType to integer");
136 break;
137 case MessageSizeType_Control:
138 case MessageSizeType_Request_Control:
139 case MessageSizeType_Reissue_Control:
140 case MessageSizeType_Response_Control:
141 case MessageSizeType_Writeback_Control:
142 case MessageSizeType_Forwarded_Control:
143 case MessageSizeType_Invalidate_Control:
144 case MessageSizeType_Unblock_Control:
145 case MessageSizeType_Persistent_Control:
146 case MessageSizeType_Completion_Control:
147 return CONTROL_MESSAGE_SIZE;
148 break;
149 case MessageSizeType_Data:
150 case MessageSizeType_Response_Data:
151 case MessageSizeType_ResponseLocal_Data:
152 case MessageSizeType_ResponseL2hit_Data:
153 case MessageSizeType_Writeback_Data:
154 return DATA_MESSAGE_SIZE;
155 break;
156 default:
157 ERROR_MSG("Invalid range for type MessageSizeType");
158 break;
159 }
160 return 0;
161}
162
163#endif //NETWORK_H
130#endif //NETWORK_H