diff options
Diffstat (limited to 'icebox/icebox.py')
-rw-r--r-- | icebox/icebox.py | 270 |
1 files changed, 248 insertions, 22 deletions
diff --git a/icebox/icebox.py b/icebox/icebox.py index 289f070..577eaca 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": @@ -185,20 +208,28 @@ class iceconfig: assert False def tile_db(self, x, y): - if x == 0: return iotile_l_db + # Only these devices have IO on the left and right sides. + if self.device in ["384", "1k", "8k"]: + if x == 0: return iotile_l_db + if x == self.max_x: return iotile_r_db if y == 0: return iotile_b_db - if x == self.max_x: return iotile_r_db if y == self.max_y: return iotile_t_db if self.device == "1k": if (x, y) in self.logic_tiles: return logictile_db if (x, y) in self.ramb_tiles: return rambtile_db if (x, y) in self.ramt_tiles: return ramttile_db - if self.device == "8k": + elif self.device == "5k": + if (x, y) in self.logic_tiles: return logictile_5k_db + if (x, y) in self.ramb_tiles: return rambtile_5k_db + if (x, y) in self.ramt_tiles: return ramttile_5k_db + elif self.device == "8k": if (x, y) in self.logic_tiles: return logictile_8k_db if (x, y) in self.ramb_tiles: return rambtile_8k_db if (x, y) in self.ramt_tiles: return ramttile_8k_db - if self.device == "384": + elif self.device == "384": if (x, y) in self.logic_tiles: return logictile_384_db + + print("Tile type unknown at (%d, %d)" % (x, y)) assert False def tile_type(self, x, y): @@ -474,6 +505,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 +517,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 +527,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: @@ -539,7 +576,9 @@ class iceconfig: for s in self.expand_net(queue.pop()): if s not in segments: segments.add(s) - assert s not in seen_segments + if s in seen_segments: + print("//", s, "has already been seen. Check your bitmapping.") + assert False seen_segments.add(s) seed_segments.discard(s) if s in connected_segments: @@ -611,7 +650,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": @@ -983,7 +1022,8 @@ def key_netname(netname): def run_checks_neigh(): print("Running consistency checks on neighbour finder..") ic = iceconfig() - ic.setup_empty_1k() + # ic.setup_empty_1k() + ic.setup_empty_5k() # ic.setup_empty_8k() # ic.setup_empty_384() @@ -999,8 +1039,12 @@ def run_checks_neigh(): for x in range(ic.max_x+1): for y in range(ic.max_x+1): + # Skip the corners. if x in (0, ic.max_x) and y in (0, ic.max_y): continue + # Skip the sides of a 5k device. + if ic.device == "5k" and x in (0, ic.max_x): + continue add_segments((x, y), ic.tile_db(x, y)) if (x, y) in ic.logic_tiles: all_segments.add((x, y, "lutff_7/cout")) @@ -1021,24 +1065,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") @@ -1059,6 +1106,16 @@ extra_bits_db = { (0, 330, 143): ("padin_glb_netwk", "6"), (0, 331, 143): ("padin_glb_netwk", "7"), }, + "5k": { + (0, 870, 270): ("padin_glb_netwk", "0"), + (0, 871, 270): ("padin_glb_netwk", "1"), + (1, 870, 271): ("padin_glb_netwk", "2"), + (1, 871, 271): ("padin_glb_netwk", "3"), + (1, 870, 270): ("padin_glb_netwk", "4"), + (1, 871, 270): ("padin_glb_netwk", "5"), + (0, 870, 271): ("padin_glb_netwk", "6"), + (0, 871, 271): ("padin_glb_netwk", "7"), + }, "8k": { (0, 870, 270): ("padin_glb_netwk", "0"), (0, 871, 270): ("padin_glb_netwk", "1"), @@ -1092,6 +1149,8 @@ gbufin_db = { ( 6, 0, 5), ( 6, 17, 4), ], + "5k": [ + ], "8k": [ (33, 16, 7), ( 0, 16, 6), @@ -1114,6 +1173,14 @@ gbufin_db = { ] } +# To figure these out: +# 1. Copy io_latched.sh and convert it for your pinout (like io_latched_5k.sh). +# 2. Run it. It will create an io_latched_<device>.work directory with a bunch of files. +# 3. Grep the *.ve files in that directory for "'fabout')". The coordinates +# before it are where the io latches are. +# +# Note: This may not work if your icepack configuration of cell sizes is incorrect because +# icebox_vlog.py won't correctly interpret the meaning of particular bits. iolatch_db = { "1k": [ ( 0, 7), @@ -1121,6 +1188,10 @@ iolatch_db = { ( 5, 0), ( 8, 17), ], + "5k": [ + (14, 0), + (14, 31), + ], "8k": [ ( 0, 15), (33, 18), @@ -1135,12 +1206,20 @@ iolatch_db = { ], } +# The x, y cell locations of the WARMBOOT controls. Run tests/sb_warmboot.v +# through icecube.sh to determine these values. warmbootinfo_db = { "1k": { "BOOT": ( 12, 0, "fabout" ), "S0": ( 13, 1, "fabout" ), "S1": ( 13, 2, "fabout" ), }, + "5k": { + # These are the right locations but may be the wrong order. + "BOOT": ( 22, 0, "fabout" ), + "S0": ( 23, 0, "fabout" ), + "S1": ( 24, 0, "fabout" ), + }, "8k": { "BOOT": ( 31, 0, "fabout" ), "S0": ( 33, 1, "fabout" ), @@ -1164,6 +1243,7 @@ noplls_db = { "1k-cb121": [ "1k" ], "1k-vq100": [ "1k" ], "384-qn32": [ "384" ], + "5k-sg48": [ "5k" ], } pllinfo_db = { @@ -1260,6 +1340,99 @@ pllinfo_db = { "SDI": ( 4, 0, "fabout"), "SCLK": ( 3, 0, "fabout"), }, + "5k": { + "LOC" : (16, 0), + + # 3'b000 = "DISABLED" + # 3'b010 = "SB_PLL40_PAD" + # 3'b100 = "SB_PLL40_2_PAD" + # 3'b110 = "SB_PLL40_2F_PAD" + # 3'b011 = "SB_PLL40_CORE" + # 3'b111 = "SB_PLL40_2F_CORE" + "PLLTYPE_0": ( 16, 0, "PLLCONFIG_5"), + "PLLTYPE_1": ( 18, 0, "PLLCONFIG_1"), + "PLLTYPE_2": ( 18, 0, "PLLCONFIG_3"), + + # 3'b000 = "DELAY" + # 3'b001 = "SIMPLE" + # 3'b010 = "PHASE_AND_DELAY" + # 3'b110 = "EXTERNAL" + "FEEDBACK_PATH_0": ( 18, 0, "PLLCONFIG_5"), + "FEEDBACK_PATH_1": ( 15, 0, "PLLCONFIG_9"), + "FEEDBACK_PATH_2": ( 16, 0, "PLLCONFIG_1"), + + # 1'b0 = "FIXED" + # 1'b1 = "DYNAMIC" (also set FDA_FEEDBACK=4'b1111) + "DELAY_ADJMODE_FB": ( 17, 0, "PLLCONFIG_4"), + + # 1'b0 = "FIXED" + # 1'b1 = "DYNAMIC" (also set FDA_RELATIVE=4'b1111) + "DELAY_ADJMODE_REL": ( 17, 0, "PLLCONFIG_9"), + + # 2'b00 = "GENCLK" + # 2'b01 = "GENCLK_HALF" + # 2'b10 = "SHIFTREG_90deg" + # 2'b11 = "SHIFTREG_0deg" + "PLLOUT_SELECT_A_0": ( 16, 0, "PLLCONFIG_6"), + "PLLOUT_SELECT_A_1": ( 16, 0, "PLLCONFIG_7"), + + # 2'b00 = "GENCLK" + # 2'b01 = "GENCLK_HALF" + # 2'b10 = "SHIFTREG_90deg" + # 2'b11 = "SHIFTREG_0deg" + "PLLOUT_SELECT_B_0": ( 16, 0, "PLLCONFIG_2"), + "PLLOUT_SELECT_B_1": ( 16, 0, "PLLCONFIG_3"), + + # Numeric Parameters + "SHIFTREG_DIV_MODE": ( 16, 0, "PLLCONFIG_4"), + "FDA_FEEDBACK_0": ( 16, 0, "PLLCONFIG_9"), + "FDA_FEEDBACK_1": ( 17, 0, "PLLCONFIG_1"), + "FDA_FEEDBACK_2": ( 17, 0, "PLLCONFIG_2"), + "FDA_FEEDBACK_3": ( 17, 0, "PLLCONFIG_3"), + "FDA_RELATIVE_0": ( 17, 0, "PLLCONFIG_5"), + "FDA_RELATIVE_1": ( 17, 0, "PLLCONFIG_6"), + "FDA_RELATIVE_2": ( 17, 0, "PLLCONFIG_7"), + "FDA_RELATIVE_3": ( 17, 0, "PLLCONFIG_8"), + "DIVR_0": ( 14, 0, "PLLCONFIG_1"), + "DIVR_1": ( 14, 0, "PLLCONFIG_2"), + "DIVR_2": ( 14, 0, "PLLCONFIG_3"), + "DIVR_3": ( 14, 0, "PLLCONFIG_4"), + "DIVF_0": ( 14, 0, "PLLCONFIG_5"), + "DIVF_1": ( 14, 0, "PLLCONFIG_6"), + "DIVF_2": ( 14, 0, "PLLCONFIG_7"), + "DIVF_3": ( 14, 0, "PLLCONFIG_8"), + "DIVF_4": ( 14, 0, "PLLCONFIG_9"), + "DIVF_5": ( 15, 0, "PLLCONFIG_1"), + "DIVF_6": ( 15, 0, "PLLCONFIG_2"), + "DIVQ_0": ( 15, 0, "PLLCONFIG_3"), + "DIVQ_1": ( 15, 0, "PLLCONFIG_4"), + "DIVQ_2": ( 15, 0, "PLLCONFIG_5"), + "FILTER_RANGE_0": ( 15, 0, "PLLCONFIG_6"), + "FILTER_RANGE_1": ( 15, 0, "PLLCONFIG_7"), + "FILTER_RANGE_2": ( 15, 0, "PLLCONFIG_8"), + "TEST_MODE": ( 16, 0, "PLLCONFIG_8"), + + # PLL Ports + "PLLOUT_A": ( 16, 0, 1), + "PLLOUT_B": ( 17, 0, 0), + "REFERENCECLK": ( 13, 0, "fabout"), + "EXTFEEDBACK": ( 14, 0, "fabout"), + "DYNAMICDELAY_0": ( 5, 0, "fabout"), + "DYNAMICDELAY_1": ( 6, 0, "fabout"), + "DYNAMICDELAY_2": ( 7, 0, "fabout"), + "DYNAMICDELAY_3": ( 8, 0, "fabout"), + "DYNAMICDELAY_4": ( 9, 0, "fabout"), + "DYNAMICDELAY_5": ( 10, 0, "fabout"), + "DYNAMICDELAY_6": ( 11, 0, "fabout"), + "DYNAMICDELAY_7": ( 12, 0, "fabout"), + "LOCK": ( 1, 1, "neigh_op_bnl_1"), + "BYPASS": ( 19, 0, "fabout"), + "RESETB": ( 20, 0, "fabout"), + "LATCHINPUTVALUE": ( 15, 0, "fabout"), + "SDO": ( 32, 1, "neigh_op_bnr_3"), + "SDI": ( 22, 0, "fabout"), + "SCLK": ( 21, 0, "fabout"), + }, "8k_0": { "LOC" : (16, 0), @@ -1459,6 +1632,13 @@ padin_pio_db = { ( 6, 0, 1), # glb_netwk_6 ( 6, 17, 1), # glb_netwk_7 ], + "5k": [ + ( 6, 0, 1), + (19, 0, 1), + ( 6, 31, 0), + (12, 31, 1), + (13, 31, 0), + ], "8k": [ (33, 16, 1), ( 0, 16, 1), @@ -1847,6 +2027,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 +4033,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 +4141,3 @@ for db in [iotile_l_db, iotile_r_db, iotile_t_db, iotile_b_db, logictile_db, log if __name__ == "__main__": run_checks() - |