From 6100c3b821fc42717f9c506bb699cd43ea9abb1f Mon Sep 17 00:00:00 2001 From: David Sawatzke Date: Wed, 16 Apr 2025 12:33:06 +0200 Subject: [PATCH] cxxrtl: Perform bwmuxmap pass if required --- backends/cxxrtl/cxxrtl_backend.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/backends/cxxrtl/cxxrtl_backend.cc b/backends/cxxrtl/cxxrtl_backend.cc index b9958c5fb..c3d890a93 100644 --- a/backends/cxxrtl/cxxrtl_backend.cc +++ b/backends/cxxrtl/cxxrtl_backend.cc @@ -3406,9 +3406,10 @@ struct CxxrtlWorker { } } - void check_design(RTLIL::Design *design, bool &has_sync_init) + void check_design(RTLIL::Design *design, bool &has_sync_init, bool &has_bwmux) { has_sync_init = false; + has_bwmux = false; for (auto module : design->modules()) { if (module->get_blackbox_attribute() && !module->has_attribute(ID(cxxrtl_blackbox))) @@ -3424,6 +3425,10 @@ struct CxxrtlWorker { for (auto sync : proc.second->syncs) if (sync->type == RTLIL::STi) has_sync_init = true; + + for (auto cell : module->cells()) + if (cell->type == ID($bwmux)) + has_bwmux = true; } } @@ -3431,8 +3436,13 @@ struct CxxrtlWorker { { bool did_anything = false; bool has_sync_init; + bool has_bwmux; log_push(); - check_design(design, has_sync_init); + check_design(design, has_sync_init, has_bwmux); + if (has_bwmux) { + Pass::call(design, "bwmuxmap"); + did_anything = true; + } if (run_hierarchy) { Pass::call(design, "hierarchy -auto-top"); did_anything = true; @@ -3454,8 +3464,9 @@ struct CxxrtlWorker { } // Recheck the design if it was modified. if (did_anything) - check_design(design, has_sync_init); + check_design(design, has_sync_init, has_bwmux); log_assert(!has_sync_init); + log_assert(!has_bwmux); log_pop(); if (did_anything) log_spacer();