Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gowin: Himbaechel arch #1184

Merged
merged 39 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3bc88d0
wip start
yrabbit Jun 28, 2023
e54f7aa
generate bba
yrabbit Jun 28, 2023
9139fef
gowin: Add himbaechel arch
yrabbit Jun 28, 2023
c344914
gowin: add global VCC and VSS networks
yrabbit Jun 30, 2023
995fd23
gowin: add support for all DFF types
yrabbit Jun 30, 2023
fbae840
gowin: Himbaechel, fix style
yrabbit Jul 1, 2023
3e4edfb
gowin: Himbaechel. Add a wideluts
yrabbit Jul 2, 2023
8576708
gowin: Himbaechel. Add ALU.
yrabbit Jul 5, 2023
d101fe8
gowin: Himbaechel. Add the LUTRAM
yrabbit Jul 6, 2023
b4712ff
gowin: Himbaechel. Add a clock router.
yrabbit Jul 12, 2023
27bfbbc
gowin: Himbaechel. Add bundle data generation.
yrabbit Jul 12, 2023
cf94939
gowin: Himbaechel. Add constraint file processing.
yrabbit Jul 14, 2023
c07f5ef
gowin: Himbaechel. Implement the GSR primitive
yrabbit Jul 19, 2023
3b9ac71
gowin: Himbaechel. Use pin functions info
yrabbit Jul 20, 2023
3522e00
gowin: Himbaechel. Implement PLLs
yrabbit Jul 22, 2023
4f9919e
gowin: Himbaechel. Add extra chip data
yrabbit Jul 23, 2023
91e09ef
gowin: Himbaechel. Add simplified IO
yrabbit Jul 25, 2023
80a359b
gowin: Himbaechel. Add redundant checks
yrabbit Jul 27, 2023
c250bef
gowin: Himbaechel. Add SERDES and differential IO
yrabbit Aug 6, 2023
41c328b
gowin: Himbaechel. Add OSER8
yrabbit Aug 7, 2023
cf5f952
gowin: Himbaechel. Add OSER10 and OVIDEO
yrabbit Aug 8, 2023
a8570f3
gowin: Himbaechel. Add IDES primitives
yrabbit Aug 10, 2023
bc1c67a
gowin: Himbaechel. Unify the creation of tail types
yrabbit Aug 12, 2023
eac2eb1
gowin: Himbaechel. Add OSER16 and IDES16
yrabbit Aug 13, 2023
83835e4
gowin: Himbaechel. Add the GW1N-4 simple IOs
yrabbit Aug 15, 2023
0c41254
gowin: Himbaechel. Fix DESER and PLL
yrabbit Aug 17, 2023
422de29
Merge branch 'master' into h-gw
yrabbit Aug 17, 2023
8925b86
gowin: Himbaechel. Refactor.
yrabbit Aug 17, 2023
a9f3bb2
gowin: Himbaechel. Improve error messages
yrabbit Aug 17, 2023
da2fc67
gowin: Himbaechel. Fix IO for GW1NZ-1
yrabbit Aug 19, 2023
e597fca
Merge branch 'master' into h-gw
yrabbit Aug 19, 2023
7af5270
gowin: Himbaechel. Add rough CMake stuff
yrabbit Aug 19, 2023
cf7dd93
gowin: Himbaechel. Improve CMake thing a little
yrabbit Aug 19, 2023
9bfb0cf
gowin: Himbaechel. Handling of disabled units
yrabbit Aug 21, 2023
40e23a7
gowin: Himbaechel. Install bases
yrabbit Aug 23, 2023
251e511
Merge branch 'master' into h-gw
yrabbit Aug 25, 2023
44bd264
gowin: Himbaechel. Fix problems.
yrabbit Aug 25, 2023
6fd0dab
Merge branch 'master' into h-gw
yrabbit Aug 30, 2023
6a1842f
Merge branch 'master' into h-gw
yrabbit Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion himbaechel/family.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(HIMBAECHEL_UARCHES "example")
set(HIMBAECHEL_UARCHES "example;gowin")
foreach(uarch ${HIMBAECHEL_UARCHES})
aux_source_directory(${family}/uarch/${uarch} HM_UARCH_FILES)
foreach(target ${family_targets})
Expand Down
86 changes: 81 additions & 5 deletions himbaechel/himbaechel_dbgen/chip.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ def create_pip(self, src: str, dst: str):
def has_wire(self, wire: str):
# Check if a wire has already been created
return self.strs.id(wire) in self._wire2idx
def set_wire_type(self, wire: str, type: str):
# wire type change
self.wires[self._wire2idx[self.strs.id(wire)]].wire_type = self.strs.id(type)
def serialise_lists(self, context: str, bba: BBAWriter):
# list children of members
for i, bel in enumerate(self.bels):
Expand Down Expand Up @@ -371,6 +374,62 @@ def serialise(self, context: str, bba: BBAWriter):
bba.ref(f"{context}_extra_data")
else:
bba.u32(0)

@dataclass
class PadInfo(BBAStruct):
# package pin name
package_pin: IdString
# reference to corresponding bel
tile: IdString
bel: IdString
# function name
pad_function: IdString
# index of pin bank
pad_bank: int
# extra pad flags
flags: int
extra_data: object = None

def serialise_lists(self, context: str, bba: BBAWriter):
if self.extra_data is not None:
self.extra_data.serialise_lists(f"{context}_extra_data", bba)
bba.label(f"{context}_extra_data")
self.extra_data.serialise(f"{context}_extra_data", bba)
def serialise(self, context: str, bba: BBAWriter):
bba.u32(self.package_pin.index)
bba.u32(self.tile.index)
bba.u32(self.bel.index)
bba.u32(self.pad_function.index)
bba.u32(self.pad_bank)
bba.u32(self.flags)
if self.extra_data is not None:
bba.ref(f"{context}_extra_data")
else:
bba.u32(0)

@dataclass
class PackageInfo(BBAStruct):
strs: StringPool
name: IdString
pads: list[int] = field(default_factory=list)

def create_pad(self, package_pin: str, tile: str, bel: str, pad_function: str, pad_bank: int, flags: int = 0):
pad = PadInfo(package_pin = self.strs.id(package_pin), tile = self.strs.id(tile), bel = self.strs.id(bel),
pad_function = self.strs.id(pad_function), pad_bank = pad_bank, flags = flags)
self.pads.append(pad)
return pad

def serialise_lists(self, context: str, bba: BBAWriter):
for i, pad in enumerate(self.pads):
pad.serialise_lists(f"{context}_pad{i}", bba)
bba.label(f"{context}_pads")
for i, pad in enumerate(self.pads):
pad.serialise(f"{context}_pad{i}", bba)

def serialise(self, context: str, bba: BBAWriter):
bba.u32(self.name.index)
bba.slice(f"{context}_pads", len(self.pads))

class Chip:
def __init__(self, uarch: str, name: str, width: int, height: int):
self.strs = StringPool()
Expand All @@ -385,6 +444,7 @@ def __init__(self, uarch: str, name: str, width: int, height: int):
self.node_shape_idx = dict()
self.tile_shapes = []
self.tile_shapes_idx = dict()
self.packages = []
self.extra_data = None
def create_tile_type(self, name: str):
tt = TileType(self.strs, self.strs.id(name))
Expand Down Expand Up @@ -449,6 +509,11 @@ def flatten_tile_shapes(self):
self.tile_shapes_idx[key] = tile.shape_idx
print(f"{len(self.tile_shapes)} unique tile routing shapes")

def create_package(self, name: str):
pkg = PackageInfo(self.strs, self.strs.id(name))
self.packages.append(pkg)
return pkg

def serialise(self, bba: BBAWriter):
self.flatten_tile_shapes()
# TODO: preface, etc
Expand All @@ -459,11 +524,17 @@ def serialise(self, bba: BBAWriter):
shp.serialise_lists(f"nshp{i}", bba)
for i, tsh in enumerate(self.tile_shapes):
tsh.serialise_lists(f"tshp{i}", bba)
for i, pkg in enumerate(self.packages):
pkg.serialise_lists(f"pkg{i}", bba)
for y, row in enumerate(self.tiles):
for x, tinst in enumerate(row):
tinst.serialise_lists(f"tinst_{x}_{y}", bba)

self.strs.serialise_lists(f"constids", bba)
if self.extra_data is not None:
self.extra_data.serialise_lists("extra_data", bba)
bba.label("extra_data")
self.extra_data.serialise("extra_data", bba)

bba.label(f"tile_types")
for i, tt in enumerate(self.tile_types):
Expand All @@ -474,6 +545,9 @@ def serialise(self, bba: BBAWriter):
bba.label(f"tile_shapes")
for i, tsh in enumerate(self.tile_shapes):
tsh.serialise(f"tshp{i}", bba)
bba.label(f"packages")
for i, pkg in enumerate(self.packages):
pkg.serialise(f"pkg{i}", bba)
bba.label(f"tile_insts")
for y, row in enumerate(self.tiles):
for x, tinst in enumerate(row):
Expand All @@ -496,16 +570,18 @@ def serialise(self, bba: BBAWriter):
bba.slice("tile_insts", self.width*self.height)
bba.slice("node_shapes", len(self.node_shapes))
bba.slice("tile_shapes", len(self.tile_shapes))
# packages: not yet used
bba.u32(0)
bba.u32(0)
# packages
bba.slice("packages", len(self.packages))
# speed grades: not yet used
bba.u32(0)
bba.u32(0)
# db-defined constids
bba.ref("constids")
# extra data: not yet used
bba.u32(0)
# extra data
if self.extra_data is not None:
bba.ref("extra_data")
else:
bba.u32(0)

def write_bba(self, filename):
with open(filename, "w") as f:
Expand Down
Loading