Expose extra tile information

This commit is contained in:
Miodrag Milanovic 2025-01-23 12:52:36 +01:00
parent 033532d5d0
commit c62215338f
2 changed files with 41 additions and 0 deletions

View File

@ -60,6 +60,14 @@ class Chip:
y_pos = (y + 2) % die.num_rows() - 2
return die.get_tile_type(x_pos,y_pos)
def get_tile_info(self,x,y):
x_pos = (x + 2) % die.num_cols() - 2
y_pos = (y + 2) % die.num_rows() - 2
x_die = (x + 2) // die.num_cols()
y_die = (y + 2) // die.num_rows()
die_num = x_die + y_die * self.die_width
return die.get_tile_info(die_num, x_pos, y_pos)
def get_connections(self):
conn = dict()
for d in self.dies.values():

View File

@ -200,6 +200,12 @@ class Connection:
y : int
name : str
@dataclass(eq=True, order=True)
class TileInfo:
die : int
bit_x : int
bit_y : int
prim_index : int
PRIMITIVES_PINS = {
"CPE": [
@ -926,6 +932,33 @@ def get_tile_type_list():
return tt
def get_bitstream_tile(x, y):
# Edge blocks are bit bigger
if x == -2:
x += 1
if x == max_col():
x -= 1
if y == -2:
y += 1
if y == max_row():
y -= 1
return (x + 1) // 2, (y + 1) // 2
def get_tile_info(d,x,y):
bx, by = get_bitstream_tile(x,y)
pos = 0
if is_cpe(x,y):
pos = ((x+1) % 2) * 2 + ((y+1) % 2) + 1
if is_edge_top(x,y):
pos = (x - 1) % 2 + 1
if is_edge_bottom(x,y):
pos = (x - 1) % 2 + 1
if is_edge_left(x,y):
pos = (y - 1) % 2 + 1
if is_edge_right(x,y):
pos = (y - 1) % 2 + 1
return TileInfo(d, bx, by, pos)
def alt_plane(dir,plane):
alt = [[5, 6, 7, 8, 1, 2, 3, 4,11,12, 9,10],
[9,10,11,12, 9,10,11,12,12,11,10, 9]]