Skip to content

Commit

Permalink
update handling of array signals
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasKl committed Apr 30, 2024
1 parent 70e7720 commit 163306b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion wal/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
scoped_symbol : "~" base_symbol
grouped_symbol : "#" base_symbol
!base_symbol : /[a-zA-Z_\.][=$\*\/>:\.\-_\?=%§!\\~+<>|,\w]*/ | /\\\S+/
!base_symbol : /[a-zA-Z_\.][=$\*\/>:\.\-_\?=%§^!\\~+<>|,\w]*/ | /\\\S+/
bit_symbol : sexpr_strict "[" sexpr "]"
sliced_symbol : sexpr_strict "[" sexpr ":" sexpr "]"
Expand Down
2 changes: 1 addition & 1 deletion wal/trace/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Trace:
'''A generic class for representing waveforms'''
SCOPE_SEPERATOR = '§'
SCOPE_SEPERATOR = '^'
SPECIAL_SIGNALS = ['SIGNALS', 'LOCAL-SIGNALS', 'INDEX', 'MAX-INDEX', 'TS', 'TRACE-NAME', 'TRACE-FILE', 'SCOPES', 'LOCAL-SCOPES']
SPECIAL_SIGNALS_SET = set(SPECIAL_SIGNALS)

Expand Down
12 changes: 6 additions & 6 deletions wal/trace/vcd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'''Trace implementation for the VCD file format '''
import re

from wal.trace.trace import Trace

Expand Down Expand Up @@ -49,12 +50,11 @@ def parse(self, vcddata):
id = tokens[i + 3]
name = tokens[i + 4]

# Remove array indices width annotations from name([..])
for delim in [('[', ']'), ('(', ')')]:
if name.endswith(delim[1]):
split = name.split(delim[0])
addr = split[-1].replace(delim[1], '>')
name = ''.join(split[:-1]) + '<' + addr
# remove slice info from names
name = re.sub(r'\[[0-9]+:[0-9]+\]', '', name)
# array signals should not clash with WAL operators
name = re.sub(r'\[([0-9]+)\]', r'<\1>', name)
name = re.sub(r'\(([0-9]+)\)', r'<\1>', name)

# only append scope. if not in root scope
if scope:
Expand Down

0 comments on commit 163306b

Please sign in to comment.