back.pysim: give numeric names to unnamed subfragments in VCD.
authorwhitequark <cz@m-labs.hk>
Fri, 21 Dec 2018 12:29:33 +0000 (12:29 +0000)
committerwhitequark <cz@m-labs.hk>
Fri, 21 Dec 2018 12:29:33 +0000 (12:29 +0000)
nmigen/back/pysim.py

index 2d86d0ae7b2c3a69175bf315a4f884ba751be8d1..bd90d7a5af83548c361232138587f83a36e51822 100644 (file)
@@ -417,8 +417,11 @@ class Simulator:
         hierarchy = {}
         def add_fragment(fragment, scope=()):
             hierarchy[fragment] = scope
-            for subfragment, name in fragment.subfragments:
-                add_fragment(subfragment, (*scope, name))
+            for index, (subfragment, name) in enumerate(fragment.subfragments):
+                if name is None:
+                    add_fragment(subfragment, (*scope, "#{}".format(index)))
+                else:
+                    add_fragment(subfragment, (*scope, name))
         add_fragment(root_fragment)
 
         def add_signal(signal):