aboutsummaryrefslogtreecommitdiffstats
path: root/passes/fsm
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-08-30 14:43:06 +0200
committerClifford Wolf <clifford@clifford.at>2014-08-30 14:43:06 +0200
commit3a7d5d188d4b9cfeb225e0f5dea07ee7a40eceed (patch)
tree21ae31ab348b710986149d74ee5bd60544b3a6f6 /passes/fsm
parentf910481f35109d7333088ac79bb25729e516fa00 (diff)
downloadyosys-3a7d5d188d4b9cfeb225e0f5dea07ee7a40eceed.tar.gz
yosys-3a7d5d188d4b9cfeb225e0f5dea07ee7a40eceed.tar.bz2
yosys-3a7d5d188d4b9cfeb225e0f5dea07ee7a40eceed.zip
Don't change existing binary FSM encoding if it is already optimal
Diffstat (limited to 'passes/fsm')
-rw-r--r--passes/fsm/fsm_recode.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/passes/fsm/fsm_recode.cc b/passes/fsm/fsm_recode.cc
index 9c0da0a37..ea10cdf80 100644
--- a/passes/fsm/fsm_recode.cc
+++ b/passes/fsm/fsm_recode.cc
@@ -82,7 +82,12 @@ static void fsm_recode(RTLIL::Cell *cell, RTLIL::Module *module, FILE *fm_set_fs
fsm_data.state_bits = fsm_data.state_table.size();
} else
if (encoding == "binary") {
- fsm_data.state_bits = ceil(log2(fsm_data.state_table.size()));
+ int new_num_state_bits = ceil(log2(fsm_data.state_table.size()));
+ if (fsm_data.state_bits == new_num_state_bits) {
+ log(" existing encoding is already a packed binary encoding.\n");
+ return;
+ }
+ fsm_data.state_bits = new_num_state_bits;
} else
log_error("FSM encoding `%s' is not supported!\n", encoding.c_str());