diff --git a/himbaechel/uarch/gowin/gowin.h b/himbaechel/uarch/gowin/gowin.h index b064c3622a..0c7a24d9c4 100644 --- a/himbaechel/uarch/gowin/gowin.h +++ b/himbaechel/uarch/gowin/gowin.h @@ -110,7 +110,9 @@ NPNR_PACKED_STRUCT(struct Tile_extra_data_POD { int32_t class_id; int16_t io16_x_off; int16_t io16_y_off; - int32_t i3c_capable; + int32_t tile_flags; + // tile flags + static constexpr int32_t TILE_I3C_CAPABLE_IO = 1; }); NPNR_PACKED_STRUCT(struct Bottom_io_cnd_POD { diff --git a/himbaechel/uarch/gowin/gowin_arch_gen.py b/himbaechel/uarch/gowin/gowin_arch_gen.py index 3bb7fad596..7c2169ca26 100644 --- a/himbaechel/uarch/gowin/gowin_arch_gen.py +++ b/himbaechel/uarch/gowin/gowin_arch_gen.py @@ -21,6 +21,9 @@ CHIP_NEED_BLKSEL_FIX = 0x8 CHIP_HAS_BANDGAP = 0x10 +# Tile flags +TILE_I3C_CAPABLE_IO = 0x1 + # Z of the bels # sync with C++ part! LUT0_Z = 0 # z(DFFx) = z(LUTx) + 1 @@ -126,7 +129,7 @@ class TileExtraData(BBAStruct): # then we assign them to the same LOGIC class. io16_x_off: int = 0 # OSER16/IDES16 offsets to the aux cell io16_y_off: int = 0 - i3c_capable: int = 0 # IO can be used as I3C + tile_flags: int = 0 def serialise_lists(self, context: str, bba: BBAWriter): pass @@ -134,7 +137,7 @@ def serialise(self, context: str, bba: BBAWriter): bba.u32(self.tile_class.index) bba.u16(self.io16_x_off) bba.u16(self.io16_y_off) - bba.u32(self.i3c_capable) + bba.u32(self.tile_flags) @dataclass class BottomIOCnd(BBAStruct): @@ -585,7 +588,7 @@ def create_extra_funcs(tt: TileType, db: chipdb, x: int, y: int): else: tt.add_bel_pin(bel, port, wire, PinType.INPUT) elif func == 'i3c_capable': - tt.extra_data.i3c_capable = 1 + tt.extra_data.tile_flags |= TILE_I3C_CAPABLE_IO elif func == 'mipi_obuf': bel = tt.create_bel('MIPI_OBUF', 'MIPI_OBUF', MIPIOBUF_Z) elif func == 'mipi_ibuf': diff --git a/himbaechel/uarch/gowin/gowin_utils.cc b/himbaechel/uarch/gowin/gowin_utils.cc index b7ca7aef7c..f1d1c7a855 100644 --- a/himbaechel/uarch/gowin/gowin_utils.cc +++ b/himbaechel/uarch/gowin/gowin_utils.cc @@ -36,7 +36,7 @@ bool GowinUtils::get_i3c_capable(int x, int y) int tile = tile_by_xy(ctx->chip_info, x, y); const Tile_extra_data_POD *extra = reinterpret_cast(chip_tile_info(ctx->chip_info, tile).extra_data.get()); - return extra->i3c_capable != 0; + return extra->tile_flags & Tile_extra_data_POD::TILE_I3C_CAPABLE_IO; } // pin functions: GCLKT_4, SSPI_CS, READY etc