Start adding multi die support
This commit is contained in:
parent
95a1c1a0ea
commit
e22d59f669
|
|
@ -0,0 +1,67 @@
|
|||
#
|
||||
# prjpeppercorn -- GateMate FPGAs Bitstream Documentation and Tools
|
||||
#
|
||||
# Copyright (C) 2024 The Project Peppercorn Authors.
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
# copyright notice and this permission notice appear in all copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
|
||||
import die
|
||||
from dataclasses import dataclass
|
||||
from typing import List
|
||||
|
||||
@dataclass
|
||||
class Die:
|
||||
name : str
|
||||
die_x : int
|
||||
die_y : int
|
||||
|
||||
@dataclass
|
||||
class Chip:
|
||||
name : str
|
||||
die_width : int
|
||||
die_height : int
|
||||
dies : List[Die]
|
||||
|
||||
def max_row(self):
|
||||
return self.die_height * die.num_rows() - 3
|
||||
|
||||
def max_col(self):
|
||||
return self.die_width * die.num_cols() - 3
|
||||
|
||||
def get_tile_types(self,x,y):
|
||||
x_pos = (x + 2) % die.num_cols() - 2
|
||||
y_pos = (y + 2) % die.num_rows() - 2
|
||||
return die.get_tile_types(x_pos,y_pos)
|
||||
|
||||
CCGM1_DEVICES = {
|
||||
"CCGM1A1": Chip("CCGM1A1", 1, 1, [
|
||||
Die("1A", 0, 0)
|
||||
]),
|
||||
"CCGM1A2": Chip("CCGM1A2", 1, 2, [
|
||||
Die("1A", 0, 0),
|
||||
Die("1B", 0, 1)
|
||||
]),
|
||||
"CCGM1A4": Chip("CCGM1A4", 2, 2, [
|
||||
Die("1A", 0, 0),
|
||||
Die("1B", 0, 1),
|
||||
Die("2A", 1, 0),
|
||||
Die("2B", 1, 1)
|
||||
])
|
||||
}
|
||||
|
||||
def get_all_devices():
|
||||
return CCGM1_DEVICES
|
||||
|
||||
def get_device(name):
|
||||
return CCGM1_DEVICES[name]
|
||||
|
|
@ -30,6 +30,12 @@ def max_row():
|
|||
def max_col():
|
||||
return 163
|
||||
|
||||
def num_rows():
|
||||
return max_row() + 3
|
||||
|
||||
def num_cols():
|
||||
return max_col() + 3
|
||||
|
||||
def is_sb(x,y):
|
||||
if (x>=-1 and x<=162 and y>=-1 and y<=130):
|
||||
return (x+1) % 2 == (y+1) % 2
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ from os import path
|
|||
from string import Template
|
||||
import html_tilegrid
|
||||
import shutil
|
||||
import chip
|
||||
|
||||
GM_DOCS_INDEX = """
|
||||
<html>
|
||||
|
|
@ -56,7 +57,7 @@ def main():
|
|||
docs_toc += f"<h3>{family.upper()} Family</h3>"
|
||||
docs_toc += "<h4>Bitstream Documentation</h4>"
|
||||
docs_toc += "<ul>"
|
||||
for device in ["A1"]:
|
||||
for device in chip.get_all_devices():
|
||||
print("Device: " + device)
|
||||
docs_toc += f'<li><a href="{device}.html">{device} Documentation</a></li>'
|
||||
html_tilegrid.main(["html_tilegrid", family, device, path.join("work_html",device + ".html")])
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
import sys
|
||||
import argparse
|
||||
import chip
|
||||
import die
|
||||
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
|
@ -58,9 +59,10 @@ def get_colour(ttype):
|
|||
|
||||
def main(argv):
|
||||
args = parser.parse_args(argv[1:])
|
||||
ch = chip.get_device(args.device)
|
||||
|
||||
max_row = die.max_row()
|
||||
max_col = die.max_col()
|
||||
max_row = ch.max_row()
|
||||
max_col = ch.max_col()
|
||||
tiles = []
|
||||
|
||||
for i in range(-2, max_row+1):
|
||||
|
|
@ -71,7 +73,7 @@ def main(argv):
|
|||
|
||||
for y in range(-2, max_row+1):
|
||||
for x in range(-2, max_col+1):
|
||||
for type in die.get_tile_types(x,y):
|
||||
for type in ch.get_tile_types(x,y):
|
||||
tiles[max_row-y][x+2].append((f"{x},{y}", type))
|
||||
|
||||
f = args.outfile
|
||||
|
|
|
|||
Loading…
Reference in New Issue