Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial constant routing support for 7-series #511

Merged
merged 2 commits into from Apr 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 13 additions & 6 deletions testarch/utils/testarch_graph.py
Expand Up @@ -66,7 +66,12 @@ def alt_pos(begin, end, swap):
def create_tracks_from_points(
name, graph, unique_pos, short, grid_width, grid_height
):
xs, ys = points.decompose_points_into_tracks(unique_pos)
xs, ys = points.decompose_points_into_tracks(
unique_pos,
grid_width,
grid_height,
right_only=True,
)
tracks_list, track_connections = tracks.make_tracks(
xs, ys, unique_pos, grid_width, grid_height
)
Expand Down Expand Up @@ -103,13 +108,15 @@ def create_global_constant_tracks(graph, mux, short, grid_width, grid_height):

for x in range(grid_width):
for y in range(grid_height):
if x == 0 and y == 0:
if x == 0:
continue
if y == 0:
continue
if x == 0 and y == grid_height - 1:
if x == grid_width - 1:
continue
if x == grid_width - 1 and y == grid_height - 1:
if y == grid_height - 1:
continue
if x == grid_width - 1 and y == 0:
if x == grid_width - 2 and y == grid_height - 2:
continue

unique_pos.add((x, y))
Expand Down Expand Up @@ -161,7 +168,7 @@ def create_global_constant_tracks(graph, mux, short, grid_width, grid_height):
)
break

assert made_connection
assert made_connection, (pin, pin_map)

assert found_vcc
assert found_gnd
Expand Down
5 changes: 3 additions & 2 deletions utils/lib/connection_database.py
Expand Up @@ -76,8 +76,9 @@ def get_wire_pkey(conn, tile_name, wire):
""", (tile_name, wire)
)

(wire_pkey, ) = c.fetchone()
return wire_pkey
results = c.fetchone()
assert results is not None, (tile_name, wire)
return results[0]


def get_track_model(conn, track_pkey):
Expand Down
11 changes: 11 additions & 0 deletions utils/lib/connection_database.sql
Expand Up @@ -238,3 +238,14 @@ CREATE TABLE y_list(
idx INT,
info INT
);

-- Table that represents the (optional) VCC and GND global sources.
-- VPR cannot natively take advantage of local VCC and GND sources, so
-- a global source is generated, and local sources will connect to the global
-- sources.
CREATE TABLE constant_sources(
vcc_track_pkey INT,
gnd_track_pkey INT,
FOREIGN KEY(vcc_track_pkey) REFERENCES track(pkey),
FOREIGN KEY(gnd_track_pkey) REFERENCES track(pkey)
);
38 changes: 36 additions & 2 deletions utils/lib/rr_graph/channel2.py
Expand Up @@ -9,13 +9,47 @@


class Channel(object):
""" Packs tracks into ptc tracks

>>> tracks = [
... (1, 3, 0),
... (1, 1, 1),
... (4, 5, 2),
... (4, 4, 3),
... (0, 10, 4),
... ]
>>> channel_model = Channel(tracks)
>>> channel_model.pack_tracks()
>>> for ptc, tree in enumerate(channel_model.trees):
... print('ptc={}'.format(ptc))
... for itr in tree:
... x, y, idx = tracks[itr[2]]
... assert idx == itr[2]
... print(' tracks[{}] = ({}, {})'.format(itr[2], x, y))
ptc=0
tracks[4] = (0, 10)
ptc=1
tracks[2] = (4, 5)
tracks[0] = (1, 3)
ptc=2
tracks[3] = (4, 4)
tracks[1] = (1, 1)
>>> for ptc, min_v, max_v in channel_model.fill_empty(0, 10):
... print('ptc={} ({}, {})'.format(ptc, min_v, max_v))
ptc=1 (0, 0)
ptc=1 (6, 10)
ptc=2 (0, 0)
ptc=2 (2, 3)
ptc=2 (5, 10)
"""

def __init__(self, tracks):
self.trees = []
self.tracks = sorted(tracks, key=lambda x: x[1] - x[0])

def place_track(self, track):
for idx, tree in enumerate(self.trees):
if not tree.overlaps(track[0], track[1]):
if not tree.overlaps(track[0], track[1] + 1):
tree.add(
Interval(begin=track[0], end=track[1] + 1, data=track[2])
)
Expand All @@ -32,7 +66,7 @@ def pack_tracks(self):

def fill_empty(self, min_value, max_value):
for idx, tree in enumerate(self.trees):
tracks = list(tree.items())
tracks = sorted(tree.items(), key=lambda x: x[0])

if min_value <= tracks[0].begin - 1:
yield (idx, min_value, tracks[0].begin - 1)
Expand Down
2 changes: 1 addition & 1 deletion utils/lib/rr_graph/graph2.py
Expand Up @@ -349,7 +349,7 @@ def add_switch(self, switch):
switch = Switch(**switch_dict)

assert switch.name not in self.switch_name_map
self.switch_name_map[switch.name] = switch
self.switch_name_map[switch.name] = switch.id
self.switches.append(switch)

return switch.id
Expand Down