diff --git a/tgt-vhdl/lpm.cc b/tgt-vhdl/lpm.cc index e3370b263..b3d92b466 100644 --- a/tgt-vhdl/lpm.cc +++ b/tgt-vhdl/lpm.cc @@ -40,36 +40,6 @@ static vhdl_expr *part_select_base(vhdl_scope *scope, ivl_lpm_t lpm) return off->cast(&integer); } -vhdl_var_ref *lpm_output(vhdl_scope *scope, ivl_lpm_t lpm) -{ - vhdl_var_ref *out = nexus_to_var_ref(scope, ivl_lpm_q(lpm, 0)); - if (NULL == out) { - vhdl_type *type = - vhdl_type::type_for(ivl_lpm_width(lpm), - ivl_lpm_signed(lpm) != 0); - string name("LPM"); - name += ivl_lpm_basename(lpm); - name += "_Out"; - - if (!scope->have_declared(name)) { - scope->add_decl - (new vhdl_signal_decl(name.c_str(), new vhdl_type(*type))); - } - - out = new vhdl_var_ref(name.c_str(), type); - } - - if (ivl_lpm_type(lpm) == IVL_LPM_PART_PV) { - vhdl_expr *off = part_select_base(scope, lpm); - assert(off); - - out->set_slice(off, ivl_lpm_width(lpm) - 1); - } - - return out; -} - - static vhdl_expr *concat_lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm) { vhdl_type *result_type = @@ -295,7 +265,14 @@ int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm) if (NULL == f) return 0; - vhdl_var_ref *out = lpm_output(arch->get_scope(), lpm); + vhdl_var_ref *out = nexus_to_var_ref(arch->get_scope(), ivl_lpm_q(lpm, 0)); + if (ivl_lpm_type(lpm) == IVL_LPM_PART_PV) { + vhdl_expr *off = part_select_base(arch->get_scope(), lpm); + assert(off); + + out->set_slice(off, ivl_lpm_width(lpm) - 1); + } + arch->add_stmt(new vhdl_cassign_stmt(out, f)); return 0; diff --git a/tgt-vhdl/vhdl_target.h b/tgt-vhdl/vhdl_target.h index b42bad48a..bd786a3ca 100644 --- a/tgt-vhdl/vhdl_target.h +++ b/tgt-vhdl/vhdl_target.h @@ -23,7 +23,6 @@ int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm); vhdl_expr *translate_expr(ivl_expr_t e); vhdl_expr *translate_time_expr(ivl_expr_t e); -vhdl_var_ref *lpm_output(vhdl_scope *scope, ivl_lpm_t lpm); void remember_entity(vhdl_entity *ent); vhdl_entity *find_entity(const string &tname);