Merge pull request #1406 from antmicro/iserdes-features-rename

ISERDES feature rename
This commit is contained in:
Maciej Kurc 2020-07-30 09:08:57 +02:00 committed by GitHub
commit 4e63f301b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 5 deletions

View File

@ -64,10 +64,10 @@ def run():
if i == "NETWORKING":
for j in data_rates:
for k in data_widths[j]:
tag = "ISERDES.%s.%s.%s" % (i, j, k)
tag = "ISERDES.%s.%s.W%s" % (i, j, k)
segmk.add_site_tag(loc, tag, 0)
else:
segmk.add_site_tag(loc, "ISERDES.%s.DDR.4" % i, 0)
segmk.add_site_tag(loc, "ISERDES.%s.DDR.W4" % i, 0)
segmk.add_site_tag(loc, "ISERDES.NUM_CE.N1", 0)
segmk.add_site_tag(loc, "ISERDES.NUM_CE.N2", 0)
@ -120,7 +120,7 @@ def run():
if i == "NETWORKING":
for j in data_rates:
for k in data_widths[j]:
tag = "ISERDES.%s.%s.%s" % (i, j, k)
tag = "ISERDES.%s.%s.W%s" % (i, j, k)
val = 0
if i == iface_type:
@ -129,7 +129,7 @@ def run():
segmk.add_site_tag(loc, tag, 1)
else:
if i == iface_type:
segmk.add_site_tag(loc, "ISERDES.%s.DDR.4" % i, 1)
segmk.add_site_tag(loc, "ISERDES.%s.DDR.W4" % i, 1)
if "NUM_CE" in params:
value = params["NUM_CE"]

View File

@ -9,9 +9,39 @@
#
# SPDX-License-Identifier: ISC
import os, sys
import os, sys, re
from prjxray import util
TAG_PART_RE = re.compile(r"^[a-zA-Z][0-9a-zA-Z_]*(\[[0-9]+\])?$")
def check_tag_name(tag):
'''
Checks if the tag name given by the used conforms to the valid fasm
name rules.
>>> check_tag_name("CELL.feature19.ENABLED")
True
>>> check_tag_name("FEATURE")
True
>>> check_tag_name("TAG.")
False
>>> check_tag_name(".TAG")
False
>>> check_tag_name("CELL..FEATURE")
False
>>> check_tag_name("CELL.3ENABLE")
False
>>> check_tag_name("FEATURE.12.ON")
False
'''
for part in tag.split("."):
if not len(part) or TAG_PART_RE.match(part) is None:
return False
return True
def run(fn_ins, fn_out, strict=False, track_origin=False, verbose=False):
# tag to bits
@ -27,6 +57,9 @@ def run(fn_ins, fn_out, strict=False, track_origin=False, verbose=False):
assert mode is not None or mode != "always", "strict: got ill defined line: %s" % (
line, )
if not check_tag_name(tag):
assert not strict, "strict: Invalid tag name '{}'".format(tag)
if tag in tags:
orig_bits, orig_line, orig_origin = tags[tag]
if orig_bits != bits: