From 4a0685aa1c80ff13da2084cd0b16620d031212c8 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Thu, 10 Apr 2025 20:12:00 +0200 Subject: [PATCH] dump: sort lhs and rhs in a connection --- backends/rtlil/rtlil_backend.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backends/rtlil/rtlil_backend.cc b/backends/rtlil/rtlil_backend.cc index 08cd7f754..1ad17d485 100644 --- a/backends/rtlil/rtlil_backend.cc +++ b/backends/rtlil/rtlil_backend.cc @@ -314,6 +314,11 @@ void RTLIL_BACKEND::dump_module(std::ostream &f, std::string indent, RTLIL::Modu module = new_module; module->sort(); std::sort(module->connections_.begin(), module->connections_.end()); + for (auto& [lhs, rhs] : module->connections_) { + if (std::string(log_signal(lhs)) < std::string(log_signal(rhs))) { + std::swap(lhs, rhs); + } + } } if (print_header)