mirror of https://github.com/openXC7/prjxray.git
Code formatting.
Signed-off-by: Maciej Kurc <mkurc@antmicro.com>
This commit is contained in:
parent
89abe7ad47
commit
205bc5c1df
|
|
@ -23,7 +23,8 @@ def main():
|
||||||
# Load PIP lists
|
# Load PIP lists
|
||||||
piplists = ['cmt_top_l_upper_t.txt', 'cmt_top_r_upper_t.txt']
|
piplists = ['cmt_top_l_upper_t.txt', 'cmt_top_r_upper_t.txt']
|
||||||
for piplist in piplists:
|
for piplist in piplists:
|
||||||
with open(os.path.join(os.getenv('FUZDIR'), '..', 'piplist', 'build', 'cmt_top', piplist)) as f:
|
with open(os.path.join(os.getenv('FUZDIR'), '..', 'piplist', 'build',
|
||||||
|
'cmt_top', piplist)) as f:
|
||||||
for l in f:
|
for l in f:
|
||||||
tile_type, dst, src = l.strip().split('.')
|
tile_type, dst, src = l.strip().split('.')
|
||||||
if tile_type not in pipdata:
|
if tile_type not in pipdata:
|
||||||
|
|
@ -34,7 +35,8 @@ def main():
|
||||||
# Load PPIP lists (to exclude them)
|
# Load PPIP lists (to exclude them)
|
||||||
ppiplists = ['ppips_cmt_top_l_upper_t.db', 'ppips_cmt_top_r_upper_t.db']
|
ppiplists = ['ppips_cmt_top_l_upper_t.db', 'ppips_cmt_top_r_upper_t.db']
|
||||||
for ppiplist in ppiplists:
|
for ppiplist in ppiplists:
|
||||||
fname = os.path.join(os.getenv('FUZDIR'), '..', '071-ppips', 'build', ppiplist)
|
fname = os.path.join(
|
||||||
|
os.getenv('FUZDIR'), '..', '071-ppips', 'build', ppiplist)
|
||||||
with open(fname, 'r') as f:
|
with open(fname, 'r') as f:
|
||||||
for l in f:
|
for l in f:
|
||||||
pip_data, pip_type = l.strip().split()
|
pip_data, pip_type = l.strip().split()
|
||||||
|
|
@ -93,7 +95,10 @@ def main():
|
||||||
# Ignore pseudo pips
|
# Ignore pseudo pips
|
||||||
for ppip in ppipdata[tile_type]:
|
for ppip in ppipdata[tile_type]:
|
||||||
if ppip == (src, dst):
|
if ppip == (src, dst):
|
||||||
ignpip.add((src, dst, ))
|
ignpip.add((
|
||||||
|
src,
|
||||||
|
dst,
|
||||||
|
))
|
||||||
|
|
||||||
for tile, pips_srcs_dsts in tiledata.items():
|
for tile, pips_srcs_dsts in tiledata.items():
|
||||||
tile_type = pips_srcs_dsts["type"]
|
tile_type = pips_srcs_dsts["type"]
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ def gen_sites():
|
||||||
yield tile_name, site_name, phasers
|
yield tile_name, site_name, phasers
|
||||||
|
|
||||||
|
|
||||||
def get_random_route_from_site_pin(db, tile_name, site_name, site_pin, direction, occupied_wires):
|
def get_random_route_from_site_pin(
|
||||||
|
db, tile_name, site_name, site_pin, direction, occupied_wires):
|
||||||
|
|
||||||
grid = db.grid()
|
grid = db.grid()
|
||||||
tile = db.tilegrid[tile_name]
|
tile = db.tilegrid[tile_name]
|
||||||
|
|
@ -50,7 +51,8 @@ def get_random_route_from_site_pin(db, tile_name, site_name, site_pin, direction
|
||||||
site_type = tile["sites"][site_name]
|
site_type = tile["sites"][site_name]
|
||||||
|
|
||||||
tile = db.get_tile_type(tile_type)
|
tile = db.get_tile_type(tile_type)
|
||||||
site = [s for s in tile.get_sites() if s.type == site_type][0] # FIXME: find correct site by vivado loc
|
site = [s for s in tile.get_sites() if s.type == site_type
|
||||||
|
][0] # FIXME: find correct site by vivado loc
|
||||||
|
|
||||||
# Find site wire
|
# Find site wire
|
||||||
wire = None
|
wire = None
|
||||||
|
|
@ -111,25 +113,29 @@ module top();
|
||||||
endpoints = {}
|
endpoints = {}
|
||||||
|
|
||||||
pins = [
|
pins = [
|
||||||
# ('CLKIN1', 'up'),
|
# ('CLKIN1', 'up'),
|
||||||
# ('CLKIN2', 'up'),
|
# ('CLKIN2', 'up'),
|
||||||
('CLKFBIN', 'up'),
|
('CLKFBIN', 'up'),
|
||||||
('CLKFBOUT', 'down'),
|
('CLKFBOUT', 'down'),
|
||||||
# ('CLKOUT0', 'down'),
|
# ('CLKOUT0', 'down'),
|
||||||
# ('CLKOUT1', 'down'),
|
# ('CLKOUT1', 'down'),
|
||||||
# ('CLKOUT2', 'down'),
|
# ('CLKOUT2', 'down'),
|
||||||
# ('CLKOUT3', 'down'),
|
# ('CLKOUT3', 'down'),
|
||||||
]
|
]
|
||||||
|
|
||||||
occupied_wires = set()
|
occupied_wires = set()
|
||||||
for pin, dir in pins:
|
for pin, dir in pins:
|
||||||
|
|
||||||
route = get_random_route_from_site_pin(db, tile, site, pin, dir, occupied_wires)
|
route = get_random_route_from_site_pin(
|
||||||
|
db, tile, site, pin, dir, occupied_wires)
|
||||||
if route is None:
|
if route is None:
|
||||||
endpoints[pin] = ""
|
endpoints[pin] = ""
|
||||||
continue
|
continue
|
||||||
|
|
||||||
routes[pin] = (route, dir,)
|
routes[pin] = (
|
||||||
|
route,
|
||||||
|
dir,
|
||||||
|
)
|
||||||
endpoints[pin] = route[-1] if dir == 'down' else route[0]
|
endpoints[pin] = route[-1] if dir == 'down' else route[0]
|
||||||
|
|
||||||
internal_feedback = endpoints['CLKFBOUT'].endswith('CLKFBIN')
|
internal_feedback = endpoints['CLKFBOUT'].endswith('CLKFBIN')
|
||||||
|
|
@ -139,10 +145,14 @@ module top();
|
||||||
# Store them in random order so the TCL script will try to route
|
# Store them in random order so the TCL script will try to route
|
||||||
# in random order.
|
# in random order.
|
||||||
lines = []
|
lines = []
|
||||||
for pin, (route, dir,) in routes.items():
|
for pin, (
|
||||||
|
route,
|
||||||
|
dir,
|
||||||
|
) in routes.items():
|
||||||
|
|
||||||
route_str = " ".join(route)
|
route_str = " ".join(route)
|
||||||
lines.append('{} {} {} {} {}\n'.format(tile, site, pin, dir, route_str))
|
lines.append(
|
||||||
|
'{} {} {} {} {}\n'.format(tile, site, pin, dir, route_str))
|
||||||
|
|
||||||
random.shuffle(lines)
|
random.shuffle(lines)
|
||||||
routes_file.writelines(lines)
|
routes_file.writelines(lines)
|
||||||
|
|
@ -236,7 +246,8 @@ module top();
|
||||||
);""".format(idx=clkout, site=site, phaser_loc=phasers['OUT'][0]))
|
);""".format(idx=clkout, site=site, phaser_loc=phasers['OUT'][0]))
|
||||||
|
|
||||||
if internal_feedback:
|
if internal_feedback:
|
||||||
print("""
|
print(
|
||||||
|
"""
|
||||||
assign clkfbin_{site} = clkfbout_mult_{site};
|
assign clkfbin_{site} = clkfbout_mult_{site};
|
||||||
""".format(site=site))
|
""".format(site=site))
|
||||||
else:
|
else:
|
||||||
|
|
@ -249,17 +260,20 @@ module top();
|
||||||
.O(clkfbin_{site})
|
.O(clkfbin_{site})
|
||||||
);""".format(site=site))
|
);""".format(site=site))
|
||||||
elif clkfbin_src == '0':
|
elif clkfbin_src == '0':
|
||||||
print("""
|
print(
|
||||||
|
"""
|
||||||
assign clkfbin_{site} = 1'b0;
|
assign clkfbin_{site} = 1'b0;
|
||||||
""".format(site=site))
|
""".format(site=site))
|
||||||
elif clkfbin_src == '1':
|
elif clkfbin_src == '1':
|
||||||
print("""
|
print(
|
||||||
|
"""
|
||||||
assign clkfbin_{site} = 1'b1;
|
assign clkfbin_{site} = 1'b1;
|
||||||
""".format(site=site))
|
""".format(site=site))
|
||||||
elif clkfbin_src is None:
|
elif clkfbin_src is None:
|
||||||
pass
|
pass
|
||||||
elif clkfbin_src == 'logic':
|
elif clkfbin_src == 'logic':
|
||||||
print("""
|
print(
|
||||||
|
"""
|
||||||
(* KEEP, DONT_TOUCH *)
|
(* KEEP, DONT_TOUCH *)
|
||||||
LUT6 # (.INIT(64'h5555555555555555))
|
LUT6 # (.INIT(64'h5555555555555555))
|
||||||
clkfbin_logic_{site} (
|
clkfbin_logic_{site} (
|
||||||
|
|
@ -271,14 +285,15 @@ module top();
|
||||||
clkin_is_none = False
|
clkin_is_none = False
|
||||||
|
|
||||||
for clkin in range(2):
|
for clkin in range(2):
|
||||||
clkin_src = random.choice((
|
clkin_src = random.choice(
|
||||||
'BUFH',
|
(
|
||||||
'BUFR',
|
'BUFH',
|
||||||
# '0',
|
'BUFR',
|
||||||
# '1',
|
# '0',
|
||||||
'logic',
|
# '1',
|
||||||
# None,
|
'logic',
|
||||||
))
|
# None,
|
||||||
|
))
|
||||||
if clkin == 1 and clkin_is_none and clkin_src is None:
|
if clkin == 1 and clkin_is_none and clkin_src is None:
|
||||||
clkin_src = 'BUFH'
|
clkin_src = 'BUFH'
|
||||||
|
|
||||||
|
|
@ -309,7 +324,8 @@ module top();
|
||||||
assign clkin{idx}_{site} = 1;
|
assign clkin{idx}_{site} = 1;
|
||||||
""".format(idx=clkin + 1, site=site))
|
""".format(idx=clkin + 1, site=site))
|
||||||
elif clkin_src == 'logic':
|
elif clkin_src == 'logic':
|
||||||
print("""
|
print(
|
||||||
|
"""
|
||||||
(* KEEP, DONT_TOUCH *)
|
(* KEEP, DONT_TOUCH *)
|
||||||
LUT6 # (.INIT(64'h5555555555555555))
|
LUT6 # (.INIT(64'h5555555555555555))
|
||||||
clkin{idx}_logic_{site} (
|
clkin{idx}_logic_{site} (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue