Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: amaranth-lang/amaranth
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b452e0e87172
Choose a base ref
...
head repository: amaranth-lang/amaranth
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 66295fa388be
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Dec 11, 2021

  1. Copy the full SHA
    66295fa View commit details
Showing with 20 additions and 2 deletions.
  1. +5 −0 amaranth/sim/pysim.py
  2. +15 −2 tests/test_sim.py
5 changes: 5 additions & 0 deletions amaranth/sim/pysim.py
Original file line number Diff line number Diff line change
@@ -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 @@ def __init__(self, fragment, *, vcd_file, gtkw_file=None, traces=()):
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:
17 changes: 15 additions & 2 deletions tests/test_sim.py
Original file line number Diff line number Diff line change
@@ -806,8 +806,9 @@ def test_vcd_wrong_nonzero_time(self):
sim.run_until(1e-5)
with self.assertRaisesRegex(ValueError,
r"^Cannot start writing waveforms after advancing simulation time$"):
with sim.write_vcd(open(os.path.devnull, "wt")):
pass
with open(os.path.devnull, "w") as f:
with sim.write_vcd(f):
pass


class SimulatorRegressionTestCase(FHDLTestCase):
@@ -827,3 +828,15 @@ def process():
self.assertEqual((yield -(Const(0b11, 2).as_signed())), 1)
sim.add_process(process)
sim.run()

def test_bug_595(self):
dut = Module()
with dut.FSM(name="name with space"):
with dut.State(0):
pass
sim = Simulator(dut)
with self.assertRaisesRegex(NameError,
r"^Signal 'top\.name with space_state' contains a whitespace character$"):
with open(os.path.devnull, "w") as f:
with sim.write_vcd(f):
sim.run()