From d4d1a1bfd76be252a26029492b7bdb944147e359 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 3 Jul 2024 21:44:31 +0200 Subject: [PATCH] gen/fhdl/hierarchy: Sort instances to generate deterministic hierarchy in verilog. --- litex/gen/fhdl/hierarchy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/gen/fhdl/hierarchy.py b/litex/gen/fhdl/hierarchy.py index 720fe0207..663dc6e1b 100644 --- a/litex/gen/fhdl/hierarchy.py +++ b/litex/gen/fhdl/hierarchy.py @@ -41,7 +41,7 @@ class LiteXHierarchyExplorer: r += self.get_tree(mod, ident + 1) # Instances. - for s in module._fragment.specials: + for s in sorted(module._fragment.specials, key=lambda x: str(x)): if (self.depth is None) or (ident <= self.depth): if isinstance(s, Instance): show = with_instances