From 2a7139115c08af847a5e9d19be3229dd627f4be9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Jun 2017 10:28:22 -0700 Subject: work in progress chipdb --- icebox/Makefile | 9 ++-- icebox/icebox.py | 123 +++++++++++++++++++++++++++++++++++++++++------- icebox/icebox_chipdb.py | 23 +++++---- 3 files changed, 128 insertions(+), 27 deletions(-) (limited to 'icebox') diff --git a/icebox/Makefile b/icebox/Makefile index 446fb18..fed3d6d 100644 --- a/icebox/Makefile +++ b/icebox/Makefile @@ -1,6 +1,6 @@ include ../config.mk -all: chipdb-384.txt chipdb-1k.txt chipdb-8k.txt +all: chipdb-384.txt chipdb-1k.txt chipdb-5k.txt chipdb-8k.txt chipdb-384.txt: icebox.py iceboxdb.py icebox_chipdb.py python3 icebox_chipdb.py -3 > chipdb-384.new @@ -10,12 +10,16 @@ chipdb-1k.txt: icebox.py iceboxdb.py icebox_chipdb.py python3 icebox_chipdb.py > chipdb-1k.new mv chipdb-1k.new chipdb-1k.txt +chipdb-5k.txt: icebox.py iceboxdb.py icebox_chipdb.py + python3 icebox_chipdb.py -5 > chipdb-5k.new + mv chipdb-5k.new chipdb-5k.txt + chipdb-8k.txt: icebox.py iceboxdb.py icebox_chipdb.py python3 icebox_chipdb.py -8 > chipdb-8k.new mv chipdb-8k.new chipdb-8k.txt clean: - rm -f chipdb-1k.txt chipdb-8k.txt chipdb-384.txt + rm -f chipdb-1k.txt chipdb-8k.txt chipdb-384.txt chipdb-5k.txt rm -f icebox.pyc iceboxdb.pyc install: all @@ -52,4 +56,3 @@ uninstall: -rmdir $(DESTDIR)$(PREFIX)/share/icebox .PHONY: all clean install uninstall - diff --git a/icebox/icebox.py b/icebox/icebox.py index 289f070..79608be 100644 --- a/icebox/icebox.py +++ b/icebox/icebox.py @@ -76,6 +76,26 @@ class iceconfig: self.io_tiles[(0, y)] = ["0" * 18 for i in range(16)] self.io_tiles[(self.max_x, y)] = ["0" * 18 for i in range(16)] + def setup_empty_5k(self): + self.clear() + self.device = "5k" + self.max_x = 26 + self.max_y = 33 + + for x in range(1, self.max_x): + for y in range(1, self.max_y): + if x in (6, 18): + if y % 2 == 1: + self.ramb_tiles[(x, y)] = ["0" * 42 for i in range(16)] + else: + self.ramt_tiles[(x, y)] = ["0" * 42 for i in range(16)] + else: + self.logic_tiles[(x, y)] = ["0" * 54 for i in range(16)] + + for x in range(1, self.max_x): + self.io_tiles[(x, 0)] = ["0" * 18 for i in range(16)] + self.io_tiles[(x, self.max_y)] = ["0" * 18 for i in range(16)] + def setup_empty_8k(self): self.clear() self.device = "8k" @@ -116,6 +136,7 @@ class iceconfig: def pinloc_db(self): if self.device == "384": return pinloc_db["384-qn32"] if self.device == "1k": return pinloc_db["1k-tq144"] + if self.device == "5k": return pinloc_db["5k-sg48"] if self.device == "8k": return pinloc_db["8k-ct256"] assert False @@ -137,6 +158,8 @@ class iceconfig: def pll_list(self): if self.device == "1k": return ["1k"] + if self.device == "5k": + return ["5k"] if self.device == "8k": return ["8k_0", "8k_1"] if self.device == "384": @@ -474,6 +497,8 @@ class iceconfig: seed_segments.add((idx[0], idx[1], "lutff_7/cout")) if self.device == "1k": add_seed_segments(idx, tile, logictile_db) + elif self.device == "5k": + add_seed_segments(idx, tile, logictile_5k_db) elif self.device == "8k": add_seed_segments(idx, tile, logictile_8k_db) elif self.device == "384": @@ -484,6 +509,8 @@ class iceconfig: for idx, tile in self.ramb_tiles.items(): if self.device == "1k": add_seed_segments(idx, tile, rambtile_db) + elif self.device == "5k": + add_seed_segments(idx, tile, rambtile_5k_db) elif self.device == "8k": add_seed_segments(idx, tile, rambtile_8k_db) else: @@ -492,6 +519,8 @@ class iceconfig: for idx, tile in self.ramt_tiles.items(): if self.device == "1k": add_seed_segments(idx, tile, ramttile_db) + elif self.device == "5k": + add_seed_segments(idx, tile, ramttile_5k_db) elif self.device == "8k": add_seed_segments(idx, tile, ramttile_8k_db) else: @@ -611,7 +640,7 @@ class iceconfig: self.extra_bits.add((int(line[1]), int(line[2]), int(line[3]))) continue if line[0] == ".device": - assert line[1] in ["1k", "8k", "384"] + assert line[1] in ["1k", "5k", "8k", "384"] self.device = line[1] continue if line[0] == ".sym": @@ -1021,24 +1050,27 @@ def run_checks_neigh(): def run_checks(): run_checks_neigh() -def parse_db(text, grep_8k=False, grep_384=False): +def parse_db(text, device="1k"): db = list() for line in text.split("\n"): line_384 = line.replace("384_glb_netwk_", "glb_netwk_") line_1k = line.replace("1k_glb_netwk_", "glb_netwk_") + line_5k = line.replace("5k_glb_netwk_", "glb_netwk_") line_8k = line.replace("8k_glb_netwk_", "glb_netwk_") if line_1k != line: - if grep_8k: - continue - if grep_384: + if device != "1k": continue line = line_1k elif line_8k != line: - if not grep_8k: + if device != "8k": continue line = line_8k + elif line_5k != line: + if device != "5k": + continue + line = line_5k elif line_384 != line: - if not grep_384: + if device != "384": continue line = line_384 line = line.split("\t") @@ -1164,6 +1196,7 @@ noplls_db = { "1k-cb121": [ "1k" ], "1k-vq100": [ "1k" ], "384-qn32": [ "384" ], + "5k-sg48": [ "5k" ], } pllinfo_db = { @@ -1448,6 +1481,8 @@ pllinfo_db = { }, } +# TODO(tannewt): Correct these values for 5k once we figure out how to get the +# info. padin_pio_db = { "1k": [ (13, 8, 1), # glb_netwk_0 @@ -1459,6 +1494,16 @@ padin_pio_db = { ( 6, 0, 1), # glb_netwk_6 ( 6, 17, 1), # glb_netwk_7 ], + "5k": [ + (33, 16, 1), + ( 0, 16, 1), + (17, 33, 0), + (17, 0, 0), + ( 0, 17, 0), + (33, 17, 0), + (16, 0, 1), + (16, 33, 1), + ], "8k": [ (33, 16, 1), ( 0, 16, 1), @@ -1847,6 +1892,9 @@ ieren_db = { ], } +# This dictionary maps package variants to a table of pin names and their +# corresponding grid location (x, y, block). This is most easily found through +# the package view in iCEcube2 by hovering the mouse over each pin. pinloc_db = { "1k-swg16tr": [ ( "A2", 6, 17, 1), @@ -3850,17 +3898,61 @@ pinloc_db = { ( "G3", 3, 0, 0), ( "G4", 4, 0, 1), ( "G6", 5, 0, 1), - ] + ], + "5k-sg48": [ + ( "2", 8, 0, 0), + ( "3", 9, 0, 1), + ( "4", 9, 0, 0), + ( "6", 13, 0, 1), + ( "9", 15, 0, 0), + ( "10", 16, 0, 0), + ( "11", 17, 0, 0), + ( "12", 18, 0, 0), + ( "13", 19, 0, 0), + ( "14", 23, 0, 0), + ( "15", 24, 0, 0), + ( "16", 24, 0, 1), + ( "17", 23, 0, 1), + ( "18", 22, 0, 1), + ( "19", 21, 0, 1), + ( "20", 19, 0, 1), + ( "21", 18, 0, 1), + ( "23", 19, 31, 0), + ( "25", 19, 31, 1), + ( "26", 18, 31, 0), + ( "27", 18, 31, 1), + ( "28", 17, 31, 0), + ( "31", 16, 31, 1), + ( "32", 16, 31, 0), + ( "34", 13, 31, 1), + ( "35", 12, 31, 1), + ( "36", 9, 31, 1), + ( "37", 13, 31, 0), + ( "38", 8, 31, 1), + ( "39", 4, 31, 0), + ( "40", 5, 31, 0), + ( "41", 6, 31, 0), + ( "42", 8, 31, 0), + ( "43", 9, 31, 0), + ( "44", 6, 0, 1), + ( "45", 7, 0, 1), + ( "46", 5, 0, 0), + ( "47", 6, 0, 0), + ( "48", 7, 0, 0), + ], } iotile_full_db = parse_db(iceboxdb.database_io_txt) -logictile_db = parse_db(iceboxdb.database_logic_txt) -logictile_8k_db = parse_db(iceboxdb.database_logic_txt, True) -logictile_384_db = parse_db(iceboxdb.database_logic_txt, False, True) -rambtile_db = parse_db(iceboxdb.database_ramb_txt) -ramttile_db = parse_db(iceboxdb.database_ramt_txt) -rambtile_8k_db = parse_db(iceboxdb.database_ramb_8k_txt, True) -ramttile_8k_db = parse_db(iceboxdb.database_ramt_8k_txt, True) +logictile_db = parse_db(iceboxdb.database_logic_txt, "1k") +logictile_5k_db = parse_db(iceboxdb.database_logic_txt, "5k") +logictile_8k_db = parse_db(iceboxdb.database_logic_txt, "8k") +logictile_384_db = parse_db(iceboxdb.database_logic_txt, "384") +rambtile_db = parse_db(iceboxdb.database_ramb_txt, "1k") +ramttile_db = parse_db(iceboxdb.database_ramt_txt, "1k") +rambtile_5k_db = parse_db(iceboxdb.database_ramb_8k_txt, "5k") +ramttile_5k_db = parse_db(iceboxdb.database_ramt_8k_txt, "5k") +rambtile_8k_db = parse_db(iceboxdb.database_ramb_8k_txt, "8k") +ramttile_8k_db = parse_db(iceboxdb.database_ramt_8k_txt, "8k") iotile_l_db = list() iotile_r_db = list() @@ -3914,4 +4006,3 @@ for db in [iotile_l_db, iotile_r_db, iotile_t_db, iotile_b_db, logictile_db, log if __name__ == "__main__": run_checks() - diff --git a/icebox/icebox_chipdb.py b/icebox/icebox_chipdb.py index 7988e6a..ca7f483 100755 --- a/icebox/icebox_chipdb.py +++ b/icebox/icebox_chipdb.py @@ -19,6 +19,7 @@ import icebox import getopt, sys, re mode_384 = False +mode_5k = False mode_8k = False def usage(): @@ -28,19 +29,24 @@ Usage: icebox_chipdb [options] [bitmap.asc] -3 create chipdb for 384 device + -5 + create chipdb for 5k device + -8 create chipdb for 8k device """) sys.exit(0) try: - opts, args = getopt.getopt(sys.argv[1:], "38") + opts, args = getopt.getopt(sys.argv[1:], "358") except: usage() for o, a in opts: if o == "-8": mode_8k = True + elif o == "-5": + mode_5k = True elif o == "-3": mode_384 = True else: @@ -49,6 +55,8 @@ for o, a in opts: ic = icebox.iceconfig() if mode_8k: ic.setup_empty_8k() +elif mode_5k: + ic.setup_empty_5k() elif mode_384: ic.setup_empty_384() else: @@ -142,7 +150,7 @@ print("""# # # declares a special-purpose cell that is not part of the FPGA fabric # -# +# # .extra_bits # FUNCTION BANK_NUM ADDR_X ADDR_Y # ... @@ -233,21 +241,21 @@ print() def print_tile_nonrouting_bits(tile_type, idx): tx = idx[0] ty = idx[1] - + tile = ic.tile(tx, ty) - + print(".%s_tile_bits %d %d" % (tile_type, len(tile[0]), len(tile))) - + function_bits = dict() for entry in ic.tile_db(tx, ty): if not ic.tile_has_entry(tx, ty, entry): continue if entry[1] in ("routing", "buffer"): continue - + func = ".".join(entry[1:]) function_bits[func] = entry[0] - + for x in sorted(function_bits): print(" ".join([x] + function_bits[x])) print() @@ -318,4 +326,3 @@ for idx in sorted(all_tiles): assert (idx[0], idx[1], entry[2]) in seg_to_net print("%s %d" % (pattern, seg_to_net[(idx[0], idx[1], entry[2])])) print() - -- cgit v1.2.3