sim.pysim: refuse to write VCD files with whitespace in signal names.

Closes #595.
This commit is contained in:
whitequark 2021-12-11 11:12:25 +00:00
parent b452e0e871
commit 66295fa388
2 changed files with 20 additions and 2 deletions

View file

@ -1,5 +1,6 @@
from contextlib import contextmanager
import itertools
import re
from vcd import VCDWriter
from vcd.gtkw import GTKWSave
@ -94,6 +95,10 @@ class _VCDWriter:
var_init = signal.reset
for (*var_scope, var_name) in names:
if re.search(r"[ \t\r\n]", var_name):
raise NameError("Signal '{}.{}' contains a whitespace character"
.format(".".join(var_scope), var_name))
suffix = None
while True:
try: