mirror of https://github.com/openXC7/prjxray.git
Remove remaining usage of height, as words is the key.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
This commit is contained in:
parent
3c211aa462
commit
bf8fd49ba4
|
|
@ -6,6 +6,30 @@ import util as localutil
|
|||
import os.path
|
||||
|
||||
|
||||
def check_frames(tagstr, addrlist):
|
||||
frames = set()
|
||||
for addrstr in addrlist:
|
||||
frame = parse_addr(addrstr, get_base_frame=True)
|
||||
frames.add(frame)
|
||||
assert len(frames) == 1, (
|
||||
"{}: More than one base address".format(tagstr), map(hex, frames))
|
||||
|
||||
|
||||
def parse_addr(line, only_frame=False, get_base_frame=False):
|
||||
# 00020027_003_03
|
||||
line = line.split("_")
|
||||
frame = int(line[0], 16)
|
||||
wordidx = int(line[1], 10)
|
||||
bitidx = int(line[2], 10)
|
||||
|
||||
if get_base_frame:
|
||||
delta = frame % 128
|
||||
frame -= delta
|
||||
return frame
|
||||
|
||||
return frame, wordidx, bitidx
|
||||
|
||||
|
||||
def load_db(fn):
|
||||
for l in open(fn, "r"):
|
||||
l = l.strip()
|
||||
|
|
@ -14,9 +38,9 @@ def load_db(fn):
|
|||
parts = l.split(' ')
|
||||
tagstr = parts[0]
|
||||
addrlist = parts[1:]
|
||||
localutil.check_frames(tagstr, addrlist)
|
||||
check_frames(tagstr, addrlist)
|
||||
# Take the first address in the list
|
||||
frame, wordidx, bitidx = localutil.parse_addr(addrlist[0])
|
||||
frame, wordidx, bitidx = parse_addr(addrlist[0])
|
||||
|
||||
bitidx_up = False
|
||||
|
||||
|
|
@ -51,18 +75,16 @@ def run(fn_in, fn_out, verbose=False):
|
|||
# FIXME: generate frames from part file (or equivilent)
|
||||
# See https://github.com/SymbiFlow/prjxray/issues/327
|
||||
# FIXME: generate words from pitch
|
||||
int_frames, int_words, _ = localutil.get_entry('INT', 'CLB_IO_CLK')
|
||||
int_frames, int_words = localutil.get_int_params()
|
||||
tdb_fns = [
|
||||
("iob/build/segbits_tilegrid.tdb", 42, 4),
|
||||
# FIXME: height
|
||||
("mmcm/build/segbits_tilegrid.tdb", 30, 101),
|
||||
# FIXME: height
|
||||
("pll/build/segbits_tilegrid.tdb", 30, 101),
|
||||
("monitor/build/segbits_tilegrid.tdb", 30, 101),
|
||||
("bram/build/segbits_tilegrid.tdb", 28, 10),
|
||||
("bram_block/build/segbits_tilegrid.tdb", 128, 10),
|
||||
("clb/build/segbits_tilegrid.tdb", 36, 2),
|
||||
("dsp/build/segbits_tilegrid.tdb", 28, 2),
|
||||
("dsp/build/segbits_tilegrid.tdb", 28, 10),
|
||||
("clb_int/build/segbits_tilegrid.tdb", int_frames, int_words),
|
||||
("iob_int/build/segbits_tilegrid.tdb", int_frames, int_words),
|
||||
("bram_int/build/segbits_tilegrid.tdb", int_frames, int_words),
|
||||
|
|
|
|||
|
|
@ -1,107 +1,30 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import print_function
|
||||
from prjxray import util
|
||||
'''
|
||||
Local utils script to hold shared code of the 005-tilegrid fuzzer scripts
|
||||
'''
|
||||
|
||||
|
||||
def check_frames(tagstr, addrlist):
|
||||
frames = set()
|
||||
for addrstr in addrlist:
|
||||
frame = parse_addr(addrstr, get_base_frame=True)
|
||||
frames.add(frame)
|
||||
assert len(frames) == 1, (
|
||||
"{}: More than one base address".format(tagstr), map(hex, frames))
|
||||
|
||||
|
||||
def parse_addr(line, only_frame=False, get_base_frame=False):
|
||||
# 00020027_003_03
|
||||
line = line.split("_")
|
||||
frame = int(line[0], 16)
|
||||
wordidx = int(line[1], 10)
|
||||
bitidx = int(line[2], 10)
|
||||
|
||||
if get_base_frame:
|
||||
delta = frame % 128
|
||||
frame -= delta
|
||||
return frame
|
||||
|
||||
return frame, wordidx, bitidx
|
||||
|
||||
|
||||
def propagate_up_INT(grid_x, grid_y, database, tiles_by_grid, wordbase):
|
||||
for i in range(50):
|
||||
grid_y -= 1
|
||||
loc = (grid_x, grid_y)
|
||||
if loc not in tiles_by_grid:
|
||||
continue
|
||||
|
||||
tile = database[tiles_by_grid[loc]]
|
||||
|
||||
if wordbase == 50:
|
||||
wordbase += 1
|
||||
else:
|
||||
wordbase += 2
|
||||
|
||||
yield tile, wordbase
|
||||
|
||||
|
||||
def add_baseaddr(tile_baseaddrs, tile_name, baseaddr, verbose=False):
|
||||
bt = util.addr2btype(baseaddr)
|
||||
tile_baseaddr = tile_baseaddrs.setdefault(tile_name, {})
|
||||
if bt in tile_baseaddr:
|
||||
# actually lets just fail these, better to remove at tcl level to speed up processing
|
||||
assert 0, 'duplicate base address'
|
||||
assert tile_baseaddr[bt] == [baseaddr, 0]
|
||||
else:
|
||||
tile_baseaddr[bt] = [baseaddr, 0]
|
||||
verbose and print(
|
||||
"baseaddr: %s.%s @ %s.0x%08x" %
|
||||
(tile["name"], site_name, bt, baseaddr))
|
||||
|
||||
|
||||
def get_entry(tile_type, block_type):
|
||||
"""
|
||||
FIXME: review IOB
|
||||
# IOB
|
||||
# design_IOB_X0Y100.delta:+bit_00020027_000_29
|
||||
# design_IOB_X0Y104.delta:+bit_00020027_008_29
|
||||
# design_IOB_X0Y112.delta:+bit_00020027_024_29
|
||||
# design_IOB_X0Y120.delta:+bit_00020027_040_29
|
||||
# design_IOB_X0Y128.delta:+bit_00020027_057_29
|
||||
# design_IOB_X0Y136.delta:+bit_00020027_073_29
|
||||
# design_IOB_X0Y144.delta:+bit_00020027_089_29
|
||||
# $XRAY_BLOCKWIDTH design_IOB_X0Y100.bit |grep 00020000
|
||||
# 0x00020000: 0x2A (42)
|
||||
("RIOI3", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("LIOI3", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("RIOI3_SING", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("LIOI3_SING", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("RIOI3_TBYTESRC", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("LIOI3_TBYTESRC", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("RIOI3_TBYTETERM", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("LIOI3_TBYTETERM", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("LIOB33", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("RIOB33", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("LIOB33", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("RIOB33_SING", "CLB_IO_CLK"): (42, 2, 4),
|
||||
("LIOB33_SING", "CLB_IO_CLK"): (42, 2, 4),
|
||||
"""
|
||||
""" Get frames and words for a given tile_type (e.g. CLBLL) and block_type (CLB_IO_CLK, BLOCK_RAM, etc). """
|
||||
return {
|
||||
# (tile_type, block_type): (frames, words, height)
|
||||
("CLBLL", "CLB_IO_CLK"): (36, 2, 2),
|
||||
("CLBLM", "CLB_IO_CLK"): (36, 2, 2),
|
||||
("HCLK", "CLB_IO_CLK"): (26, 1, 1),
|
||||
("INT", "CLB_IO_CLK"): (28, 2, 2),
|
||||
("CLBLL", "CLB_IO_CLK"): (36, 2, None),
|
||||
("CLBLM", "CLB_IO_CLK"): (36, 2, None),
|
||||
("HCLK", "CLB_IO_CLK"): (26, 1, None),
|
||||
("INT", "CLB_IO_CLK"): (28, 2, None),
|
||||
("BRAM", "CLB_IO_CLK"): (28, 10, None),
|
||||
("BRAM", "BLOCK_RAM"): (128, 10, None),
|
||||
("DSP", "CLB_IO_CLK"): (28, 2, 10),
|
||||
("INT_INTERFACE", "CLB_IO_CLK"): (28, 2, None),
|
||||
("BRAM_INT_INTERFACE", "CLB_IO_CLK"): (28, 2, None),
|
||||
("DSP", "CLB_IO_CLK"): (28, 2, None),
|
||||
}.get((tile_type, block_type), None)
|
||||
|
||||
|
||||
def get_int_params():
|
||||
int_frames, int_words, _ = get_entry('INT', 'CLB_IO_CLK')
|
||||
return int_frames, int_words
|
||||
|
||||
|
||||
def add_tile_bits(
|
||||
tile_name,
|
||||
tile_db,
|
||||
|
|
@ -109,7 +32,6 @@ def add_tile_bits(
|
|||
offset,
|
||||
frames,
|
||||
words,
|
||||
height=None,
|
||||
verbose=False):
|
||||
'''
|
||||
Record data structure geometry for the given tile baseaddr
|
||||
|
|
@ -150,16 +72,5 @@ def add_tile_bits(
|
|||
# Index of first word used within each frame
|
||||
block["offset"] = offset
|
||||
|
||||
# related to words...
|
||||
# deprecated field? Don't worry about for now
|
||||
# DSP has some differences between height and words
|
||||
# Number of words used by tile.
|
||||
block["words"] = words
|
||||
if height is None:
|
||||
height = words
|
||||
block["height"] = height
|
||||
|
||||
|
||||
def get_int_params():
|
||||
int_frames = 28
|
||||
int_words = 2
|
||||
return int_frames, int_words
|
||||
|
|
|
|||
|
|
@ -209,14 +209,13 @@ class Segmaker:
|
|||
"tags": dict(),
|
||||
# verify new entries match this
|
||||
"offset": bitj["offset"],
|
||||
"height": bitj["height"],
|
||||
"words": bitj["words"],
|
||||
"frames": bitj["frames"],
|
||||
})
|
||||
|
||||
base_frame = json_hex2i(bitj["baseaddr"])
|
||||
for wordidx in range(bitj["offset"],
|
||||
bitj["offset"] + bitj["height"]):
|
||||
bitj["offset"] + bitj["words"]):
|
||||
if base_frame not in self.bits:
|
||||
continue
|
||||
if wordidx not in self.bits[base_frame]:
|
||||
|
|
@ -247,7 +246,6 @@ class Segmaker:
|
|||
else:
|
||||
segment = segments[segname]
|
||||
assert segment["offset"] == bitj["offset"]
|
||||
assert segment["height"] == bitj["height"]
|
||||
assert segment["words"] == bitj["words"]
|
||||
assert segment["frames"] == bitj["frames"]
|
||||
return segment
|
||||
|
|
|
|||
|
|
@ -366,14 +366,14 @@ def mk_segtiles(tiles):
|
|||
seglets = segtiles.setdefault(ref_tile_name, [])
|
||||
ref_as = (
|
||||
ref_block["offset"],
|
||||
ref_block["offset"] + ref_block["height"] - 1)
|
||||
ref_block["offset"] + ref_block["words"] - 1)
|
||||
|
||||
for cmpi in range(refi + 1, len(values)):
|
||||
(_cmp_block_offset, cmp_tile_name, cmp_block,
|
||||
cmp_block_name) = values[cmpi]
|
||||
cmp_as = (
|
||||
cmp_block["offset"],
|
||||
cmp_block["offset"] + cmp_block["height"] - 1)
|
||||
cmp_block["offset"] + cmp_block["words"] - 1)
|
||||
|
||||
if overlap(ref_as, cmp_as):
|
||||
seglets.append((cmp_tile_name, cmp_block_name))
|
||||
|
|
|
|||
Loading…
Reference in New Issue