Don't change existing binary FSM encoding if it is already optimal

This commit is contained in:
Clifford Wolf 2014-08-30 14:43:06 +02:00
parent f910481f35
commit 3a7d5d188d
1 changed files with 6 additions and 1 deletions

View File

@ -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(); fsm_data.state_bits = fsm_data.state_table.size();
} else } else
if (encoding == "binary") { 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 } else
log_error("FSM encoding `%s' is not supported!\n", encoding.c_str()); log_error("FSM encoding `%s' is not supported!\n", encoding.c_str());