3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-28 17:08:46 +00:00

opt_muxtree: set iterations limit based on number of muxes

This commit is contained in:
Carlo Alberto Ferraris 2022-11-03 21:18:21 +09:00 committed by GitHub
parent d8ea5ef6e2
commit 551d36d384
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ struct OptMuxtreeWorker
RTLIL::Module *module; RTLIL::Module *module;
SigMap assign_map; SigMap assign_map;
int removed_count; int removed_count;
int glob_abort_cnt = 100000; int glob_abort_cnt;
struct bitinfo_t { struct bitinfo_t {
bool seen_non_mux; bool seen_non_mux;
@ -147,6 +147,10 @@ struct OptMuxtreeWorker
return; return;
} }
// Limit the number of iterations based on the number of muxes.
// The multiplier (100) is arbitrary.
glob_abort_cnt = GetSize(mux2info) * 100;
// Populate mux2info[].ports[]: // Populate mux2info[].ports[]:
// .input_muxes // .input_muxes
for (int i = 0; i < GetSize(bit2info); i++) for (int i = 0; i < GetSize(bit2info); i++)