mirror of https://github.com/openXC7/prjxray.git
017-clbprecyinit: base SLICE X/Y on ROI X/Y
Signed-off-by: John McMaster <johndmcmaster@gmail.com>
This commit is contained in:
parent
eba322d11a
commit
f36ed2ff3e
|
|
@ -3,21 +3,13 @@ random.seed(0)
|
|||
import os
|
||||
import re
|
||||
from prjxray import verilog
|
||||
|
||||
|
||||
def slice_xy():
|
||||
'''Return (X1, X2), (Y1, Y2) from XRAY_ROI, exclusive end (for xrange)'''
|
||||
# SLICE_X12Y100:SLICE_X27Y149
|
||||
# Note XRAY_ROI_GRID_* is something else
|
||||
m = re.match(
|
||||
r'SLICE_X([0-9]*)Y([0-9]*):SLICE_X([0-9]*)Y([0-9]*)',
|
||||
os.getenv('XRAY_ROI'))
|
||||
ms = [int(m.group(i + 1)) for i in range(4)]
|
||||
return ((ms[0], ms[2] + 1), (ms[1], ms[3] + 1))
|
||||
|
||||
from prjxray import util
|
||||
|
||||
CLBN = 400
|
||||
SLICEX, SLICEY = slice_xy()
|
||||
SLICEX, SLICEY = util.site_xy_minmax([
|
||||
'SLICEL',
|
||||
'SLICEM',
|
||||
])
|
||||
# 800
|
||||
SLICEN = (SLICEY[1] - SLICEY[0]) * (SLICEX[1] - SLICEX[0])
|
||||
print('//SLICEX: %s' % str(SLICEX))
|
||||
|
|
|
|||
|
|
@ -35,6 +35,27 @@ def get_roi():
|
|||
return Roi(db=db, x1=x1, x2=x2, y1=y1, y2=y2)
|
||||
|
||||
|
||||
def gen_sites_xy(site_types):
|
||||
for _tile_name, site_name, _site_type in get_roi().gen_sites(site_types):
|
||||
m = re.match(r'.*_X([0-9]*)Y([0-9]*)', site_name)
|
||||
x, y = int(m.group(1)), int(m.group(2))
|
||||
yield (site_name, (x, y))
|
||||
|
||||
|
||||
def site_xy_minmax(site_types):
|
||||
'''Return (X1, X2), (Y1, Y2) from XY_ROI, exclusive end (for xrange)'''
|
||||
xmin = 9999
|
||||
xmax = -1
|
||||
ymin = 9999
|
||||
ymax = -1
|
||||
for _site_name, (x, y) in gen_sites_xy(site_types):
|
||||
xmin = min(xmin, x)
|
||||
xmax = max(xmax, x)
|
||||
ymin = min(ymin, y)
|
||||
ymax = max(ymax, y)
|
||||
return (xmin, xmax + 1), (ymin, ymax + 1)
|
||||
|
||||
|
||||
# we know that all bits for CLB MUXes are in frames 30 and 31, so filter all other bits
|
||||
def bitfilter_clb_mux(frame_idx, bit_idx):
|
||||
return frame_idx in [30, 31]
|
||||
|
|
|
|||
Loading…
Reference in New Issue