From 305ee78eaf72e2bd6e2d58054b7a84bc7e4c2397 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 21 Dec 2018 12:29:33 +0000 Subject: [PATCH] back.pysim: give numeric names to unnamed subfragments in VCD. --- nmigen/back/pysim.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nmigen/back/pysim.py b/nmigen/back/pysim.py index 2d86d0a..bd90d7a 100644 --- a/nmigen/back/pysim.py +++ b/nmigen/back/pysim.py @@ -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): -- 2.30.2