MeshDirCorners_XY.py (11666:10d59d546ea2) MeshDirCorners_XY.py (13731:67cd980cb20f)
1# Copyright (c) 2010 Advanced Micro Devices, Inc.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

121 latency = link_latency))
122
123 network.ext_links = ext_links
124
125 # Create the mesh links.
126 int_links = []
127
128 # East output to West input links (weight = 1)
1# Copyright (c) 2010 Advanced Micro Devices, Inc.
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

121 latency = link_latency))
122
123 network.ext_links = ext_links
124
125 # Create the mesh links.
126 int_links = []
127
128 # East output to West input links (weight = 1)
129 for row in xrange(num_rows):
130 for col in xrange(num_columns):
129 for row in range(num_rows):
130 for col in range(num_columns):
131 if (col + 1 < num_columns):
132 east_out = col + (row * num_columns)
133 west_in = (col + 1) + (row * num_columns)
134 int_links.append(IntLink(link_id=link_count,
135 src_node=routers[east_out],
136 dst_node=routers[west_in],
137 src_outport="East",
138 dst_inport="West",
139 latency = link_latency,
140 weight=1))
141 link_count += 1
142
143 # West output to East input links (weight = 1)
131 if (col + 1 < num_columns):
132 east_out = col + (row * num_columns)
133 west_in = (col + 1) + (row * num_columns)
134 int_links.append(IntLink(link_id=link_count,
135 src_node=routers[east_out],
136 dst_node=routers[west_in],
137 src_outport="East",
138 dst_inport="West",
139 latency = link_latency,
140 weight=1))
141 link_count += 1
142
143 # West output to East input links (weight = 1)
144 for row in xrange(num_rows):
145 for col in xrange(num_columns):
144 for row in range(num_rows):
145 for col in range(num_columns):
146 if (col + 1 < num_columns):
147 east_in = col + (row * num_columns)
148 west_out = (col + 1) + (row * num_columns)
149 int_links.append(IntLink(link_id=link_count,
150 src_node=routers[west_out],
151 dst_node=routers[east_in],
152 src_outport="West",
153 dst_inport="East",
154 latency = link_latency,
155 weight=1))
156 link_count += 1
157
158 # North output to South input links (weight = 2)
146 if (col + 1 < num_columns):
147 east_in = col + (row * num_columns)
148 west_out = (col + 1) + (row * num_columns)
149 int_links.append(IntLink(link_id=link_count,
150 src_node=routers[west_out],
151 dst_node=routers[east_in],
152 src_outport="West",
153 dst_inport="East",
154 latency = link_latency,
155 weight=1))
156 link_count += 1
157
158 # North output to South input links (weight = 2)
159 for col in xrange(num_columns):
160 for row in xrange(num_rows):
159 for col in range(num_columns):
160 for row in range(num_rows):
161 if (row + 1 < num_rows):
162 north_out = col + (row * num_columns)
163 south_in = col + ((row + 1) * num_columns)
164 int_links.append(IntLink(link_id=link_count,
165 src_node=routers[north_out],
166 dst_node=routers[south_in],
167 src_outport="North",
168 dst_inport="South",
169 latency = link_latency,
170 weight=2))
171 link_count += 1
172
173 # South output to North input links (weight = 2)
161 if (row + 1 < num_rows):
162 north_out = col + (row * num_columns)
163 south_in = col + ((row + 1) * num_columns)
164 int_links.append(IntLink(link_id=link_count,
165 src_node=routers[north_out],
166 dst_node=routers[south_in],
167 src_outport="North",
168 dst_inport="South",
169 latency = link_latency,
170 weight=2))
171 link_count += 1
172
173 # South output to North input links (weight = 2)
174 for col in xrange(num_columns):
175 for row in xrange(num_rows):
174 for col in range(num_columns):
175 for row in range(num_rows):
176 if (row + 1 < num_rows):
177 north_in = col + (row * num_columns)
178 south_out = col + ((row + 1) * num_columns)
179 int_links.append(IntLink(link_id=link_count,
180 src_node=routers[south_out],
181 dst_node=routers[north_in],
182 src_outport="South",
183 dst_inport="North",
184 latency = link_latency,
185 weight=2))
186 link_count += 1
187
188
189 network.int_links = int_links
176 if (row + 1 < num_rows):
177 north_in = col + (row * num_columns)
178 south_out = col + ((row + 1) * num_columns)
179 int_links.append(IntLink(link_id=link_count,
180 src_node=routers[south_out],
181 dst_node=routers[north_in],
182 src_outport="South",
183 dst_inport="North",
184 latency = link_latency,
185 weight=2))
186 link_count += 1
187
188
189 network.int_links = int_links