Browse Source

fix parsing older stil files

devel
Stefan Holst 4 years ago
parent
commit
9ff2369a55
  1. 12
      src/kyupy/stil.py

12
src/kyupy/stil.py

@ -49,11 +49,10 @@ class StilFile:
for si_port in self.si_ports: for si_port in self.si_ports:
if si_port in call.parameters: if si_port in call.parameters:
sload[si_port] = call.parameters[si_port].replace('\n', '') sload[si_port] = call.parameters[si_port].replace('\n', '')
if call.name.endswith('_launch') or call.name.endswith('_capture'): if call.name.endswith('_launch'):
if len(launch) == 0: launch = dict((k, v.replace('\n', '')) for k, v in call.parameters.items())
launch = dict((k, v.replace('\n', '')) for k, v in call.parameters.items()) if call.name.endswith('_capture'):
else: capture = dict((k, v.replace('\n', '')) for k, v in call.parameters.items())
capture = dict((k, v.replace('\n', '')) for k, v in call.parameters.items())
def _maps(self, c): def _maps(self, c):
interface = list(c.interface) + [n for n in c.nodes if 'DFF' in n.kind] interface = list(c.interface) + [n for n in c.nodes if 'DFF' in n.kind]
@ -197,7 +196,7 @@ class StilTransformer(Transformer):
GRAMMAR = r""" GRAMMAR = r"""
start: "STIL" FLOAT _ignore _block* start: "STIL" FLOAT ( _ignore | ";" ) _block*
_block: signal_groups | scan_structures | pattern _block: signal_groups | scan_structures | pattern
| "Header" _ignore | "Header" _ignore
| "Signals" _ignore | "Signals" _ignore
@ -206,6 +205,7 @@ GRAMMAR = r"""
| "PatternExec" _ignore | "PatternExec" _ignore
| "Procedures" _ignore | "Procedures" _ignore
| "MacroDefs" _ignore | "MacroDefs" _ignore
| "UserKeywords" /[a-zA-Z]*;/
signal_groups: "SignalGroups" "{" signal_group* "}" signal_groups: "SignalGroups" "{" signal_group* "}"
signal_group: quoted "=" "'" quoted ( "+" quoted)* "'" _ignore? ";"? signal_group: quoted "=" "'" quoted ( "+" quoted)* "'" _ignore? ";"?

Loading…
Cancel
Save