Running `simulate` without specifying a VCD file yields an unhelpful error message (AttributeError: 'NoneType' object has no attribute 'register_var') #319
Issue
This isn't hard to reproduce with any of the provided examples, say ctr.py. Running python ctr.py simulate -c 10, for example, produces a Python traceback rather than a friendly error message.
Traceback (most recent call last):
File "ctr.py", line 19, in <module>
main(ctr, ports=[ctr.o])
File "/path-to-python/site-packages/nmigen/cli.py", line 76, in main
main_runner(parser, parser.parse_args(), *args, **kwargs)
File "/path-to-python/site-packages/nmigen/cli.py", line 69, in main_runner
traces=ports) as sim:
File "/path-to-python/site-packages/nmigen/back/pysim.py", line 915, in __init__
self._state.start_waveform(_VCDWaveformWriter(self._signal_names, **kwargs))
File "/path-to-python/nmigen/back/pysim.py", line 115, in __init__
vcd_var = self.vcd_writer.register_var(
AttributeError: 'NoneType' object has no attribute 'register_var'
I can only assume it's down to this line (pysim.py:82):
self.vcd_writer = vcd_file and VCDWriter(self.vcd_file,
timescale="100 ps", comment="Generated by nMigen")
Expected behaviour
Either VCD_FILE is a required parameter, a default is specified or a more user-friendly error message is generated.
Issue This isn't hard to reproduce with any of the provided examples, say
ctr.py
. Runningpython ctr.py simulate -c 10
, for example, produces a Python traceback rather than a friendly error message.I can only assume it's down to this line (pysim.py:82):
Expected behaviour Either
VCD_FILE
is a required parameter, a default is specified or a more user-friendly error message is generated.