Skip to content

Commit

Permalink
fix to add to valid routes checker so that it actually works.
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-stokes committed Feb 2, 2015
1 parent 3cd73ec commit ac13cee
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def _start_trace_via_routing_tables(
self._routing_tables.get_routing_table_for_chip(source_placement.x,
source_placement.y)
visited_routers = set()
visited_routers.add(current_router_table)
current_router_table_tuple = (current_router_table.x,
current_router_table.y)
visited_routers.add(current_router_table_tuple)
#get src router
entry = self._locate_routing_entry(current_router_table, key)
self._recursive_trace_to_dests(
Expand Down Expand Up @@ -188,7 +190,8 @@ def _recursive_trace_to_dests(self, entry, current_router, chip_x, chip_y,
self._routing_tables.get_routing_table_for_chip(
link.destination_x, link.destination_y)
#check that we've not visited this router before
self._check_visited_routers(chip_x, chip_y, visited_routers)
self._check_visited_routers(next_router.x, next_router.y,
visited_routers)
#locate next entry
entry = self._locate_routing_entry(next_router, key)
# get next route value from the new router
Expand All @@ -211,7 +214,10 @@ def _check_visited_routers(chip_x, chip_y, visited_routers):
visited_routers_router = (chip_x, chip_y)
if visited_routers_router in visited_routers:
raise exceptions.PacmanRoutingException(
"visited this router before, there is a cycle here")
"visited this router before, there is a cycle here. "
"The routers I've currently visited are {} and the router im "
"visitiing is {}"
.format(visited_routers, visited_routers_router))
else:
visited_routers.add(visited_routers_router)

Expand Down

0 comments on commit ac13cee

Please sign in to comment.