Skip to content

Commit

Permalink
Use device wrapper class
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicko committed Dec 27, 2024
1 parent f92728b commit 6cc8c2e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions himbaechel/uarch/gatemate/gen/arch_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

sys.path.append(os.path.expanduser(args.lib))
sys.path += args.lib
import chip
import die

@dataclass
Expand All @@ -64,7 +65,8 @@ def set_timings(ch):
def main():
# Range needs to be +1, but we are adding +2 more to coordinates, since
# they are starting from -2 instead of zero required for nextpnr
ch = Chip("gatemate", args.device, die.max_col() + 3, die.max_row() + 3)
dev = chip.get_device(args.device)
ch = Chip("gatemate", args.device, dev.max_col() + 3, dev.max_row() + 3)
# Init constant ids
ch.strs.read_constids(path.join(path.dirname(__file__), "..", "constids.inc"))
ch.read_gfxids(path.join(path.dirname(__file__), "..", "gfxids.inc"))
Expand Down Expand Up @@ -156,19 +158,19 @@ def main():
tt.create_pip("GPIO.DI", "GPIO.IN2")

# Setup tile grid
for x in range(die.max_col() + 3):
for y in range(die.max_row() + 3):
ch.set_tile_type(x, y, die.get_tile_type(x - 2,y - 2))
for x in range(dev.max_col() + 3):
for y in range(dev.max_row() + 3):
ch.set_tile_type(x, y, dev.get_tile_type(x - 2,y - 2))
# Create nodes between tiles
for _,nodes in die.get_connections():
for _,nodes in dev.get_connections():
node = []
for conn in nodes:
node.append(NodeWire(conn.x + 2, conn.y + 2, conn.name))
ch.add_node(node)
set_timings(ch)

pkg = ch.create_package("FBGA324")
for pad in die.get_package_pads():
for pad in dev.get_package_pads():
pkg.create_pad(pad.name, f"X{pad.x+2}Y{pad.y+2}", pad.bel, pad.function, pad.bank)

ch.write_bba(args.bba)
Expand Down

0 comments on commit 6cc8c2e

Please sign in to comment.