diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-06-17 15:05:17 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-06-17 15:05:17 +0200 |
commit | 1f9c28ba58cdf13bfef46a283c60c6e337b10311 (patch) | |
tree | 5ee2c1a22dd7c1ae0a929b7ebc78f5b7055eb4ae | |
parent | a3e08422995ff6eb590666c196fbdb0ce0e28e52 (diff) | |
download | nextpnr-1f9c28ba58cdf13bfef46a283c60c6e337b10311.tar.gz nextpnr-1f9c28ba58cdf13bfef46a283c60c6e337b10311.tar.bz2 nextpnr-1f9c28ba58cdf13bfef46a283c60c6e337b10311.zip |
Move SwitchInfoPOD to chipdb blob
Signed-off-by: Clifford Wolf <clifford@clifford.at>
-rw-r--r-- | ice40/chip.h | 2 | ||||
-rw-r--r-- | ice40/chipdb.py | 38 |
2 files changed, 25 insertions, 15 deletions
diff --git a/ice40/chip.h b/ice40/chip.h index 9f15bf60..8298d837 100644 --- a/ice40/chip.h +++ b/ice40/chip.h @@ -188,8 +188,8 @@ static const int max_switch_bits = 5; struct SwitchInfoPOD { + int32_t num_bits; int8_t x, y; - int num_bits; ConfigBitPOD cbits[max_switch_bits]; } __attribute__((packed)); diff --git a/ice40/chipdb.py b/ice40/chipdb.py index c0ac646c..93f0d883 100644 --- a/ice40/chipdb.py +++ b/ice40/chipdb.py @@ -734,28 +734,38 @@ for info in pipinfo: bba.u16(info["switch_mask"], "switch_mask") bba.u32(info["switch_index"], "switch_index") -bba.finalize() -if compact_output: - bba.write_compact_c(sys.stdout) -else: - bba.write_verbose_c(sys.stdout) - switchinfo = [] -switchid = 0 for switch in switches: dst, x, y, bits = switch bitlist = [] for b in bits: m = cbit_re.match(b) assert m - bitlist.append("{%d, %d}" % (int(m.group(1)), int(m.group(2)))) - cbits = ", ".join(bitlist) - switchinfo.append("{%d, %d, %d, {%s}}" % (x, y, len(bits), cbits)) - switchid += 1 + bitlist.append((int(m.group(1)), int(m.group(2)))) + si = dict() + si["x"] = x + si["y"] = y + si["bits"] = bitlist + switchinfo.append(si) + +bba.l("switch_data_%s" % dev_name, "SwitchInfoPOD", export=True) +for info in switchinfo: + bba.u32(len(info["bits"]), "num_bits") + bba.u8(info["x"], "x") + bba.u8(info["y"], "y") + for i in range(5): + if i < len(info["bits"]): + bba.u8(info["bits"][i][0], "row<%d>" % i) + bba.u8(info["bits"][i][1], "col<%d>" % i) + else: + bba.u8(0, "row<%d> (unused)" % i) + bba.u8(0, "col<%d> (unused)" % i) -print("static SwitchInfoPOD switch_data_%s[%d] = {" % (dev_name, len(switchinfo))) -print(" " + ",\n ".join(switchinfo)) -print("};") +bba.finalize() +if compact_output: + bba.write_compact_c(sys.stdout) +else: + bba.write_verbose_c(sys.stdout) print("static TileInfoPOD tile_data_%s[%d] = {" % (dev_name, num_tile_types)) print(" " + ",\n ".join(tileinfo)) |