diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_mux_utils.c b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_mux_utils.c index 1dd1b1af5..f47574b08 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_mux_utils.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/base/fpga_x2p_mux_utils.c @@ -496,12 +496,22 @@ void decode_cmos_mux_sram_bits(t_spice_model* mux_spice_model, case SPICE_MODEL_STRUCTURE_ONELEVEL: (*mux_level) = 1; (*bit_len) = num_mux_input; + /* Mux has local encoders are different in the number of bits */ + if (TRUE == mux_spice_model->design_tech_info.mux_info->local_encoder) { + (*bit_len) = determine_mux_local_encoder_num_inputs(*bit_len); + } (*conf_bits) = decode_onelevel_mux_sram_bits(num_mux_input, (*mux_level), datapath_id, mux_spice_model->design_tech_info.mux_info->local_encoder); break; case SPICE_MODEL_STRUCTURE_MULTILEVEL: (*mux_level) = mux_spice_model->design_tech_info.mux_info->mux_num_level; - (*bit_len) = determine_num_input_basis_multilevel_mux(num_mux_input, (*mux_level)) * (*mux_level); + /* Mux has local encoders are different in the number of bits */ + if (TRUE == mux_spice_model->design_tech_info.mux_info->local_encoder) { + int num_bits_per_level = determine_mux_local_encoder_num_inputs(determine_num_input_basis_multilevel_mux(num_mux_input, (*mux_level))); + (*bit_len) = (*mux_level) * num_bits_per_level; + } else { + (*bit_len) = (*mux_level) * determine_num_input_basis_multilevel_mux(num_mux_input, (*mux_level)); + } (*conf_bits) = decode_multilevel_mux_sram_bits(num_mux_input, (*mux_level), datapath_id, mux_spice_model->design_tech_info.mux_info->local_encoder); break; diff --git a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c index 78ef46f0d..aae1ec553 100644 --- a/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c +++ b/vpr7_x2p/vpr/SRC/fpga_x2p/verilog/verilog_submodules.c @@ -2989,8 +2989,9 @@ void dump_verilog_submodule_local_encoders(t_sram_orgz_info* cur_sram_orgz_info, temp = temp->next; continue; } - /* Bypass those without local encoders */ - if (FALSE == cur_spice_mux_model->spice_model->design_tech_info.mux_info->local_encoder) { + /* Bypass those without local encoders, we only care SPICE models whose type is MUX! */ + if ( (SPICE_MODEL_MUX != cur_spice_mux_model->spice_model->type) + || (FALSE == cur_spice_mux_model->spice_model->design_tech_info.mux_info->local_encoder) ) { /* Move on to the next*/ temp = temp->next; continue;