From 46278407c4b178c7f6caaed6eb15ca614bf44f39 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 13 Dec 2024 15:00:29 +0100 Subject: [PATCH] Sync chipdb and pack/unpack --- gatemate/die.py | 4 +-- libgm/include/TileBitDatabase.hpp | 1 + libgm/src/TileBitDatabase.cpp | 49 +++++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/gatemate/die.py b/gatemate/die.py index c799270..6710c7f 100644 --- a/gatemate/die.py +++ b/gatemate/die.py @@ -310,10 +310,10 @@ def get_mux_connections_for_type(type): for p in range(1,13): plane = f"{p:02d}" for i in range(8): - create_mux(f"IM.P{plane}.D{i}", f"IM.P{plane}.Y", 3, i, True) + create_mux(f"IM.P{plane}.D{i}", f"IM.P{plane}.Y", 3, i, True, f"IM.P{plane}") if "OM" in type and p>=9: for i in range(4): - create_mux(f"OM.P{plane}.D{i}", f"OM.P{plane}.Y", 2, i, True) + create_mux(f"OM.P{plane}.D{i}", f"OM.P{plane}.Y", 2, i, True, f"OM.P{plane}") if "SB_BIG" in type: # SB_BIG diff --git a/libgm/include/TileBitDatabase.hpp b/libgm/include/TileBitDatabase.hpp index f2e4371..f28d59d 100644 --- a/libgm/include/TileBitDatabase.hpp +++ b/libgm/include/TileBitDatabase.hpp @@ -71,6 +71,7 @@ class TileBitDatabase : public BaseBitDatabase void add_cpe(int index, int start); void add_ff_init(int index, int start); void add_inmux(int index, int plane, int start); + void add_outmux(int index, int plane, int start); void add_gpio(int start); void add_edge_io(int index, int start); diff --git a/libgm/src/TileBitDatabase.cpp b/libgm/src/TileBitDatabase.cpp index 39f8211..183ced1 100644 --- a/libgm/src/TileBitDatabase.cpp +++ b/libgm/src/TileBitDatabase.cpp @@ -113,30 +113,54 @@ TileConfig BaseBitDatabase::data_to_config(const vector &data) return cfg; } -void TileBitDatabase::add_sb_big(int index, int start) { add_word_settings(stringf("SB_BIG_%02d", index), start, 15); } +void TileBitDatabase::add_sb_big(int index, int start) +{ + add_word_settings(stringf("SB_BIG.P%02d.YDIAG", index), start + 0, 3); + add_word_settings(stringf("SB_BIG.P%02d.Y1", index), start + 3, 3); + add_word_settings(stringf("SB_BIG.P%02d.Y2", index), start + 6, 3); + add_word_settings(stringf("SB_BIG.P%02d.Y3", index), start + 9, 3); + add_word_settings(stringf("SB_BIG.P%02d.Y4", index), start + 12, 3); +} -void TileBitDatabase::add_sb_sml(int index, int start) { add_word_settings(stringf("SB_SML_%02d", index), start, 12); } +void TileBitDatabase::add_sb_sml(int index, int start) +{ + add_word_settings(stringf("SB_SML.P%02d.YDIAG", index), start + 0, 3); + add_word_settings(stringf("SB_SML.P%02d.Y1", index), start + 3, 2); + add_word_settings(stringf("SB_SML.P%02d.Y2", index), start + 5, 2); + add_word_settings(stringf("SB_SML.P%02d.Y3", index), start + 7, 2); + add_word_settings(stringf("SB_SML.P%02d.Y4", index), start + 9, 2); +} void TileBitDatabase::add_sb_drive(int index, int start) { - add_word_settings(stringf("SB_DRIVE_%02d", index), start, 4); + for (int i = 0; i < 4; i++) + add_word_settings(stringf("SB_DRIVE.P%02d.D%d", index, i), start + i, 1); } -void TileBitDatabase::add_cpe(int index, int start) { add_word_settings(stringf("CPE_%d", index), start, 80); } +void TileBitDatabase::add_cpe(int index, int start) { add_word_settings(stringf("CPE%d.INIT", index), start, 80); } void TileBitDatabase::add_ff_init(int index, int start) { - add_word_settings(stringf("CPE_%d.FF_INIT", index), start, 2); + add_word_settings(stringf("CPE%d.FF_INIT", index), start, 2); } void TileBitDatabase::add_inmux(int index, int plane, int start) { - add_word_settings(stringf("INMUX_%d_%02d", index, plane), start, 4); + add_word_settings(stringf("IM%d.P%02d", index, plane), start, 3); } -void TileBitDatabase::add_gpio(int start) { add_word_settings("GPIO", start, 72); } +void TileBitDatabase::add_outmux(int index, int plane, int start) +{ + add_word_settings(stringf("OM%d.P%02d", index, plane), start, 2); +} -void TileBitDatabase::add_edge_io(int index, int start) { add_word_settings(stringf("EDGE_IO_%d", index), start, 16); } +void TileBitDatabase::add_gpio(int start) { add_word_settings("GPIO.INIT", start, 72); } + +void TileBitDatabase::add_edge_io(int index, int start) +{ + for (int i = 0; i < 12; i++) + add_word_settings(stringf("IOES%d.SB_IN_{%d}", index, i + 1), start + i, 1); +} void TileBitDatabase::add_right_edge(int index, int start) { @@ -183,7 +207,14 @@ TileBitDatabase::TileBitDatabase(const int x, const int y) : BaseBitDatabase(Die for (int i = 0; i < 4; i++) { for (int j = 0; j < 6; j++) { add_inmux(i + 1, j * 2 + 1, pos * 8); - add_inmux(i + 1, j * 2 + 2, pos * 8 + 4); + add_inmux(i + 1, j * 2 + 2, pos * 8 + 3); + pos++; + } + } + for (int i = 0; i < 2; i++) { + pos = 54 + i * 6; + for (int j = 9; j <= 12; j++) { + add_outmux(i ? 4 : 1, j, pos * 8 + 6); pos++; } }