Extract pads on multi die

This commit is contained in:
Miodrag Milanovic 2024-12-27 14:33:52 +01:00
parent 4aa6f2cdc3
commit da2dfca641
2 changed files with 116 additions and 39 deletions

View File

@ -19,7 +19,7 @@
import die
from die import Die
from dataclasses import dataclass
from typing import List
from typing import List, Dict
@dataclass
class Pad:
@ -30,12 +30,19 @@ class Pad:
function : str
bank : int
@dataclass
class Bank:
die : str
bank: str
@dataclass
class Chip:
name : str
die_width : int
die_height : int
dies : List[Die]
dies : Dict[str,Die]
packages: Dict[str,Dict[str, List[Bank]]]
not_exist: Dict[str,List[str]]
def max_row(self):
return self.die_height * die.num_rows() - 3
@ -55,32 +62,88 @@ class Chip:
def get_connections(self):
conn = dict()
for d in self.dies:
for d in self.dies.values():
d.create_in_die_connections(conn)
return conn.items()
def get_package_pads(self):
def get_packages(self):
return self.packages
def get_package_pads(self, package):
pads = []
for y in range(-2, die.max_row()+1):
for x in range(-2, die.max_col()+1):
if die.is_gpio(x,y):
pads.append(Pad(x,y,die.get_io_name(x,y),"GPIO","",0))
pkg = self.packages[package]
not_exist = self.not_exist[package]
for name, banks in pkg.items():
for bank in banks:
for p in ["A","B"]:
for num in range(9):
loc = self.dies[bank.die].io_pad_names[bank.bank][p][num]
pad_name = f"IO_{name}_{p}{num}"
if pad_name not in not_exist:
pads.append(Pad(loc.x,loc.y,pad_name,"GPIO","",0))
return pads
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)
])
"CCGM1A1": Chip("CCGM1A1", 1, 1, {
"1A" : Die("1A", 0, 0)
}, {
"FBGA324" : {
"EA" : [ Bank("1A", "N1") ],
"EB" : [ Bank("1A", "N2") ],
"NA" : [ Bank("1A", "E1") ],
"NB" : [ Bank("1A", "E2") ],
"WA" : [ Bank("1A", "S3") ],
"WB" : [ Bank("1A", "S1") ],
"WC" : [ Bank("1A", "S2") ],
"SA" : [ Bank("1A", "W1") ],
"SB" : [ Bank("1A", "W2") ]
}
}, { # non existing pins
"FBGA324" : []
}),
"CCGM1A2": Chip("CCGM1A2", 1, 2, {
"1A" : Die("1A", 0, 0),
"1B" : Die("1B", 0, 1)
}, {
"FBGA324" : {
"EA" : [ Bank("1B", "N1") ],
"EB" : [ Bank("1B", "N2") ],
"NA" : [ Bank("1A", "E1"), Bank("1B", "E1") ],
"NB" : [ Bank("1A", "E2") ],
"WA" : [ Bank("1A", "S3") ],
"WB" : [ Bank("1A", "S1"), Bank("1B", "S1") ],
"WC" : [ Bank("1A", "S2") ],
"SA" : [ Bank("1A", "W1") ],
"SB" : [ Bank("1A", "W2"), Bank("1B", "W2") ]
}
}, { # non existing pins
"FBGA324" : []
}),
"CCGM1A4": Chip("CCGM1A4", 2, 2, {
"1A" : Die("1A", 0, 0),
"1B" : Die("1B", 0, 1),
"2A" : Die("2A", 1, 0),
"2B" : Die("2B", 1, 1)
}, {
"FBGA324" : {
"EA" : [ Bank("1B", "N1") ],
"EB" : [ Bank("1B", "N2") ],
"NA" : [ Bank("1A", "E1"), Bank("1B", "E1"), Bank("2A", "E1"), Bank("2B", "E1") ],
"NB" : [ Bank("2A", "N1"), Bank("2B", "S1") ],
"WA" : [ Bank("1A", "S3") ],
"WB" : [ Bank("1A", "N1"), Bank("1B", "S1") ],
"WC" : [ Bank("1A", "S2") ],
"SA" : [ Bank("1A", "W1") ],
"SB" : [ Bank("1A", "W2"), Bank("1B", "W2"), Bank("2A", "W2"), Bank("2B", "W2") ]
}
}, { # non existing pins
"FBGA324" : [
"IO_SB_A0","IO_SB_B0",
"IO_SB_A1","IO_SB_B1",
"IO_SB_A2","IO_SB_B2",
"IO_SB_A3","IO_SB_B3"
]
}),
}
def get_all_devices():

View File

@ -98,43 +98,40 @@ def is_edge_io(x,y):
if (y==max_row() and x>=101 and x<=136): # IO Bank N2/EB
return True
@dataclass
class IOName:
bank : str
port : str
num : int
def get_io_name(x,y):
if (y==-2 and x>=5 and x<=40): # IO Bank S3/WA
x-=5
#return f"GPIO_S3_{('A' if x % 4==0 else 'B')}[{x//4}]"
return f"IO_WA_{('A' if x % 4==0 else 'B')}{x//4}"
return IOName("S3", "A" if x % 4==0 else "B", x//4)
if (y==-2 and x>=57 and x<=92): # IO Bank S1/WB
x-=57
#return f"GPIO_S1_{('A' if x % 4==0 else 'B')}[{x//4}]"
return f"IO_WB_{('A' if x % 4==0 else 'B')}{x//4}"
return IOName("S1", "A" if x % 4==0 else "B", x//4)
if (y==-2 and x>=101 and x<=136): # IO Bank S2/WC
x-=101
#return f"GPIO_S2_{('A' if x % 4==0 else 'B')}[{x//4}]"
return f"IO_WC_{('A' if x % 4==0 else 'B')}{x//4}"
return IOName("S2", "A" if x % 4==0 else "B", x//4)
if (x==-2 and y>=25 and y<=60): # IO Bank W1/SA
y-=25
#return f"GPIO_W1_{('A' if y % 4==0 else 'B')}[{y//4}]"
return f"IO_SA_{('A' if y % 4==0 else 'B')}{y//4}"
return IOName("W1", "A" if y % 4==0 else "B", y//4)
if (x==-2 and y>=69 and y<=104): # IO Bank W2/SB
y-=69
#return f"GPIO_W2_{('A' if y % 4==0 else 'B')}[{y//4}]"
return f"IO_SB_{('A' if y % 4==0 else 'B')}{y//4}"
return IOName("W2", "A" if y % 4==0 else "B", y//4)
if (x==max_col() and y>=25 and y<=60): # IO Bank E1/NA
y-=25
#return f"GPIO_E1_{('A' if y % 4==0 else 'B')}[{y//4}]"
return f"IO_NA_{('A' if y % 4==0 else 'B')}{y//4}"
return IOName("E1", "A" if y % 4==0 else "B", y//4)
if (x==max_col() and y>=69 and y<=104): # IO Bank E2/NB
y-=69
#return f"GPIO_E2_{('A' if y % 4==0 else 'B')}[{y//4}]"
return f"IO_NB_{('A' if y % 4==0 else 'B')}{y//4}"
return IOName("E2", "A" if y % 4==0 else "B", y//4)
if (y==max_row() and x>=57 and x<=92): # IO Bank N1/EA
x-=57
#return f"GPIO_N1_{('A' if x % 4==0 else 'B')}[{x//4}]"
return f"IO_EA_{('A' if x % 4==0 else 'B')}{x//4}"
return IOName("N1", "A" if x % 4==0 else "B", x//4)
if (y==max_row() and x>=101 and x<=136): # IO Bank N2/EB
x-=101
#return f"GPIO_N2_{('A' if x % 4==0 else 'B')}[{x//4}]"
return f"IO_EB_{('A' if x % 4==0 else 'B')}{x//4}"
return IOName("N2", "A" if x % 4==0 else "B", x//4)
def is_gpio(x,y):
if is_edge_io(x,y):
@ -190,6 +187,11 @@ class MUX:
invert: bool
visible: bool
@dataclass
class Location:
x : int
y : int
@dataclass
class Connection:
x : int
@ -729,6 +731,18 @@ class Die:
self.debug_conn = False
self.offset_x = die_x * num_cols()
self.offset_y = die_y * num_rows()
self.io_pad_names = dict()
for y in range(-2, max_row()+1):
for x in range(-2, max_col()+1):
if is_gpio(x,y):
io = get_io_name(x,y)
if io.bank not in self.io_pad_names:
self.io_pad_names[io.bank] = dict()
if io.port not in self.io_pad_names[io.bank]:
self.io_pad_names[io.bank][io.port] = dict()
if io.num not in self.io_pad_names[io.bank][io.port]:
self.io_pad_names[io.bank][io.port][io.num] = dict()
self.io_pad_names[io.bank][io.port][io.num] = Location(x + self.offset_x, y + self.offset_y)
def create_conn(self, src_x,src_y, src, dst_x, dst_y, dst):
key_val = f"{src_x + self.offset_x}/{src_y + self.offset_y}/{src}"