diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-07-18 13:05:51 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-07-18 13:05:51 +0200 |
commit | 0347c37d56374447d170e9a8f59e56f84cbefcce (patch) | |
tree | ada78ec11a4c109168dca3cc7aff1af2c3cda093 /icebox/icebox.py | |
parent | dfeb92a46b2228b4f3886a9c06502ccd0dde5562 (diff) | |
download | icestorm-0347c37d56374447d170e9a8f59e56f84cbefcce.tar.gz icestorm-0347c37d56374447d170e9a8f59e56f84cbefcce.tar.bz2 icestorm-0347c37d56374447d170e9a8f59e56f84cbefcce.zip |
Import of icestorm-snapshot-150401.zip
Diffstat (limited to 'icebox/icebox.py')
-rw-r--r-- | icebox/icebox.py | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/icebox/icebox.py b/icebox/icebox.py index f3dc113..01cda0d 100644 --- a/icebox/icebox.py +++ b/icebox/icebox.py @@ -27,10 +27,12 @@ class iceconfig: def clear(self): self.max_x = 0 self.max_y = 0 + self.device = "" self.logic_tiles = dict() self.io_tiles = dict() self.ram_tiles = dict() self.ram_init = dict() + self.extra_bits = set() def setup_empty_1k(self): self.clear() @@ -52,6 +54,12 @@ 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 lookup_extra_bit(self, bit): + assert self.device in extra_bits_db + if bit in extra_bits_db[self.device]: + return extra_bits_db[self.device][bit] + return ("UNKNOWN_FUNCTION",) + def tile(self, x, y): if (x, y) in self.io_tiles: return self.io_tiles[(x, y)] if (x, y) in self.logic_tiles: return self.logic_tiles[(x, y)] @@ -354,6 +362,8 @@ class iceconfig: assert expected_data_lines == 0 continue if line[0][0] != ".": + if expected_data_lines == -1: + continue if line[0][0] != "0" and line[0][0] != "1": print("%sWarning: ignoring data block in line %d: %s" % (logprefix, linenum, linetext.strip())) expected_data_lines = 0 @@ -362,7 +372,7 @@ class iceconfig: current_data.append(line[0]) expected_data_lines -= 1 continue - assert expected_data_lines == 0 + assert expected_data_lines <= 0 if line[0] in (".io_tile", ".logic_tile", ".ram_tile"): current_data = list() expected_data_lines = 16 @@ -377,8 +387,15 @@ class iceconfig: if line[0] == ".ram_tile": self.ram_tiles[(int(line[1]), int(line[2]))] = current_data continue + if line[0] == ".extra_bit": + self.extra_bits.add((int(line[1]), int(line[2]), int(line[3]))) + continue if line[0] == ".device": - assert line[1] == "1k" + assert line[1] in ["1k"] + self.device = line[1] + continue + if line[0] == ".comment": + expected_data_lines = -1 continue print("%sWarning: ignoring line %d: %s" % (logprefix, linenum, linetext.strip())) @@ -770,6 +787,12 @@ def parse_db(text): db.append(line) return db +extra_bits_db = { + "1k": { + (0, 331, 142): ("routing", "padin_1", "glb_netwk_1") + } +} + iotile_full_db = parse_db(iceboxdb.database_io_txt) logictile_db = parse_db(iceboxdb.database_logic_txt) ramtile_db = parse_db(iceboxdb.database_ram_txt) |