mirror of https://github.com/openXC7/prjxray.git
Merge pull request #1180 from litghost/add_clock_regions
Add clock_region to tilegrid.json for constructing clock networks.
This commit is contained in:
commit
143ea98723
|
|
@ -17,15 +17,22 @@ def load_tiles(tiles_fn):
|
|||
tile_type, tile_name, grid_x, grid_y = record[0:4]
|
||||
grid_x, grid_y = int(grid_x), int(grid_y)
|
||||
sites = {}
|
||||
for i in range(4, len(record), 2):
|
||||
site_type, site_name = record[i:i + 2]
|
||||
sites[site_name] = site_type
|
||||
clock_region = None
|
||||
if len(record) >= 5:
|
||||
clock_region = record[4]
|
||||
if clock_region == "NA":
|
||||
clock_region = None
|
||||
for i in range(5, len(record), 2):
|
||||
site_type, site_name = record[i:i + 2]
|
||||
sites[site_name] = site_type
|
||||
|
||||
tile = {
|
||||
'type': tile_type,
|
||||
'name': tile_name,
|
||||
'grid_x': grid_x,
|
||||
'grid_y': grid_y,
|
||||
'sites': sites,
|
||||
'clock_region': clock_region,
|
||||
}
|
||||
tiles.append(tile)
|
||||
|
||||
|
|
@ -59,6 +66,9 @@ def make_database(tiles, pin_func):
|
|||
"pin_functions": {},
|
||||
}
|
||||
|
||||
if tile["clock_region"]:
|
||||
database[tile["name"]]["clock_region"] = tile["clock_region"]
|
||||
|
||||
for site in database[tile["name"]]["sites"]:
|
||||
if site in pin_func:
|
||||
database[tile["name"]]["pin_functions"][site] = pin_func[site]
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ proc write_tiles_txt {} {
|
|||
set sites [get_sites -quiet -of_objects $tile]
|
||||
set typed_sites {}
|
||||
|
||||
set clock_region "NA"
|
||||
|
||||
if [llength $sites] {
|
||||
set site_types [get_property SITE_TYPE $sites]
|
||||
foreach t $site_types s $sites {
|
||||
|
|
@ -23,10 +25,15 @@ proc write_tiles_txt {} {
|
|||
if [llength $package_pin] {
|
||||
puts $fp_pin "$s [get_property PIN_FUNC $package_pin]"
|
||||
}
|
||||
set clock_region [get_property CLOCK_REGION $s]
|
||||
}
|
||||
}
|
||||
if {[llength $clock_region] == 0} {
|
||||
set clock_region "NA"
|
||||
}
|
||||
|
||||
puts $fp "$type $tile $grid_x $grid_y $typed_sites"
|
||||
|
||||
puts $fp "$type $tile $grid_x $grid_y $clock_region $typed_sites"
|
||||
}
|
||||
close $fp_pin
|
||||
close $fp
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
from prjxray import segment_map
|
||||
from prjxray.grid_types import BlockType, GridLoc, GridInfo, BitAlias, Bits, BitsInfo
|
||||
from prjxray.grid_types import BlockType, GridLoc, GridInfo, BitAlias, Bits, BitsInfo, ClockRegion
|
||||
from prjxray.tile_segbits_alias import TileSegbitsAlias
|
||||
import re
|
||||
|
||||
CLOCK_REGION_RE = re.compile('X([0-9])Y([0-9])')
|
||||
|
||||
|
||||
class Grid(object):
|
||||
|
|
@ -16,6 +19,8 @@ class Grid(object):
|
|||
self.loc = {}
|
||||
self.tileinfo = {}
|
||||
|
||||
clock_regions = {}
|
||||
|
||||
for tile in self.tilegrid:
|
||||
tileinfo = self.tilegrid[tile]
|
||||
grid_loc = GridLoc(tileinfo['grid_x'], tileinfo['grid_y'])
|
||||
|
|
@ -46,11 +51,26 @@ class Grid(object):
|
|||
alias=alias,
|
||||
)
|
||||
|
||||
clock_region = None
|
||||
if 'clock_region' in tileinfo:
|
||||
if tileinfo['clock_region'] is not None:
|
||||
if tileinfo['clock_region'] not in clock_regions:
|
||||
m = CLOCK_REGION_RE.fullmatch(tileinfo['clock_region'])
|
||||
assert m is not None, tileinfo['clock_region']
|
||||
|
||||
clock_regions[tileinfo['clock_region']] = ClockRegion(
|
||||
name=tileinfo['clock_region'],
|
||||
x=int(m.group(1)),
|
||||
y=int(m.group(2)))
|
||||
|
||||
clock_region = clock_regions[tileinfo['clock_region']]
|
||||
|
||||
self.tileinfo[tile] = GridInfo(
|
||||
bits=bits,
|
||||
sites=tileinfo['sites'],
|
||||
tile_type=tileinfo['type'],
|
||||
pin_functions=tileinfo.get('pin_functions', {}),
|
||||
clock_region=clock_region,
|
||||
)
|
||||
|
||||
x, y = zip(*self.loc.keys())
|
||||
|
|
|
|||
|
|
@ -11,7 +11,9 @@ class BlockType(enum.Enum):
|
|||
|
||||
|
||||
GridLoc = namedtuple('GridLoc', 'grid_x grid_y')
|
||||
GridInfo = namedtuple('GridInfo', 'bits sites tile_type pin_functions')
|
||||
ClockRegion = namedtuple('ClockRegion', 'name x y')
|
||||
GridInfo = namedtuple(
|
||||
'GridInfo', 'bits sites tile_type pin_functions clock_region')
|
||||
BitAlias = namedtuple('BitAlias', 'tile_type start_offset sites')
|
||||
Bits = namedtuple('Bits', 'base_address frames offset words alias')
|
||||
BitsInfo = namedtuple('BitsInfo', 'block_type tile bits')
|
||||
|
|
|
|||
Loading…
Reference in New Issue