Commit c2d1f2e6 authored by Andrey Filippov's avatar Andrey Filippov

More parsing of synthesis tools output

parent 92c30747
...@@ -5,6 +5,11 @@ import re ...@@ -5,6 +5,11 @@ import re
pattern=re.compile("\[[^[:]*:\d*]") pattern=re.compile("\[[^[:]*:\d*]")
START_REF="(\\" START_REF="(\\"
END_REF=" )" END_REF=" )"
patternFlatRef=re.compile("\(([A-Za-z_$][A-Za-z_$0-9]*)\)")
patternHierRef=re.compile("\(\\\(\S*) \)")
patternModule= re.compile("module ([A-Za-z_$][A-Za-z_$0-9]*)\.")
#PREFIX_REF="@{" #PREFIX_REF="@{"
#SUFFIX_REF="}@" #SUFFIX_REF="}@"
PREFIX_REF="" PREFIX_REF=""
...@@ -48,13 +53,20 @@ def hasFileVivado(string): # [*:*] ...@@ -48,13 +53,20 @@ def hasFileVivado(string): # [*:*]
def getLineSignalBit(string): def getLineSignalBit(string):
# sys.stdout.write(START_REF) # sys.stdout.write(START_REF)
if START_REF in string: m=patternHierRef.search(string)
start = string.find(START_REF) if not m:
end = string.find(END_REF,start) m=patternFlatRef.search(string)
if end <0: # if START_REF in string:
return None if m:
line=string[:start]+PREFIX_REF+"%s"+SUFFIX_REF+string[end+len(END_REF):] # start = string.find(START_REF)
ref=string[start+len(START_REF):end] # end = string.find(END_REF,start)
# if end <0:
# return None
# line=string[:start]+PREFIX_REF+"%s"+SUFFIX_REF+string[end+len(END_REF):]
# ref=string[start+len(START_REF):end]
line=string[:m.start(0)]+PREFIX_REF+"%s"+SUFFIX_REF+string[m.end(0):]
# ref=string[m.start(1):m.end(1)]
ref=m.group(1)
# replace "/" (used in Xilinx Vivado) with "." for Verilog # replace "/" (used in Xilinx Vivado) with "." for Verilog
ref=ref.replace("/",".") ref=ref.replace("/",".")
if "[" in ref: if "[" in ref:
...@@ -103,13 +115,17 @@ def printLineRef(pRef): ...@@ -103,13 +115,17 @@ def printLineRef(pRef):
global global_mode global global_mode
global global_db global global_db
global global_top_module global global_top_module
mod=global_top_module
m=patternModule.search(pRef[0])
if m:
mod=m.group(1)
if pRef: if pRef:
ranges=getRanges(pRef) ranges=getRanges(pRef)
if ranges: if ranges:
# line=pRef[0] # line=pRef[0]
ref=pRef[1]; ref=pRef[1];
if global_top_module: if mod:
ref= global_top_module+"."+ref ref= mod+"."+ref
for rng in ranges: for rng in ranges:
if (rng[0]<0): if (rng[0]<0):
sys.stdout.write(pRef[0]%(ref)) sys.stdout.write(pRef[0]%(ref))
......
...@@ -261,7 +261,7 @@ ...@@ -261,7 +261,7 @@
<parameter id="bufr" label="Maximum bufr number" tooltip= "Maximum number of regional clock buffers" <parameter id="bufr" label="Maximum bufr number" tooltip= "Maximum number of regional clock buffers"
default="" visible="true" omit="" type="String" format="Dash"/> default="" visible="true" omit="" type="String" format="Dash"/>
<parameter id="bus_delimiter" label="Bus delimiters" tooltip= "Bus delimiter characters" <parameter id="bus_delimiter" label="Bus delimiters" tooltip= "Bus delimiter characters"
default="&lt;&gt;" visible="true" omit="&lt;&gt;" type="BusDelimeterType" format="QuotedDash"/> default="&lt;&gt;" visible="true" omit="&lt;&gt;" type="BusDelimeterType" format="Dash"/>
<parameter id="case" label="Case" tooltip= "Treating the character case" <parameter id="case" label="Case" tooltip= "Treating the character case"
default="maintain" visible="true" omit="maintain" type="CaseType" format="Dash"/> default="maintain" visible="true" omit="maintain" type="CaseType" format="Dash"/>
<parameter id="decoder_extract" label="Decoder extract" tooltip= "Automatic Decoder extract" <parameter id="decoder_extract" label="Decoder extract" tooltip= "Automatic Decoder extract"
...@@ -290,7 +290,7 @@ ...@@ -290,7 +290,7 @@
<parameter id="hdl_compilation_order" label="Compilation order" tooltip= "HDL compilation order" <parameter id="hdl_compilation_order" label="Compilation order" tooltip= "HDL compilation order"
default="auto" visible="true" omit="auto" type="AutoUserType" format="Dash"/> default="auto" visible="true" omit="auto" type="AutoUserType" format="Dash"/>
<parameter id="hierarchy_separator" label="Hierarchy separator" tooltip= "Hierarchy separator character" <parameter id="hierarchy_separator" label="Hierarchy separator" tooltip= "Hierarchy separator character"
default="/" visible="true" omit="/" type="HierarchySeparatorType" format="QuotedDash"/> default="/" visible="true" omit="/" type="HierarchySeparatorType" format="Dash"/>
<parameter id="ifmt" label="input format" tooltip= "Type of the HDL source files" <parameter id="ifmt" label="input format" tooltip= "Type of the HDL source files"
default="mixed" visible="true" omit="mixed" type="InputFormatType" format="Dash"/> default="mixed" visible="true" omit="mixed" type="InputFormatType" format="Dash"/>
<!-- Try if XST can accept multiple source files as '-ifn file1.v file2.v -other_option, if not - will generate/use command file --> <!-- Try if XST can accept multiple source files as '-ifn file1.v file2.v -other_option, if not - will generate/use command file -->
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
visible="true" type="String" format="CopyValue"/> visible="true" type="String" format="CopyValue"/>
<parameter id="InstanceSuffix" label="Instance suffix" <parameter id="InstanceSuffix" label="Instance suffix"
tooltip= "Regular expression to match/remove name suffixes automatically added by the tools" tooltip= "Regular expression to match/remove name suffixes automatically added by the tools"
default="_reg" default="_reg|__parameterized[0-9]*"
visible="true" type="String" format="CopyValue"/> visible="true" type="String" format="CopyValue"/>
<parameter id="parser_mode" label="Parser mode" tooltip= "Parser mode (consolidation of bits of the same instance)" <parameter id="parser_mode" label="Parser mode" tooltip= "Parser mode (consolidation of bits of the same instance)"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment