Merge branch 'vhdl'

This commit is contained in:
Stephen Williams 2008-09-05 14:40:48 -07:00
commit 38970fea65
2 changed files with 8 additions and 1 deletions

View File

@ -33,6 +33,11 @@ vhdl_expr *vhdl_expr::cast(const vhdl_type *to)
// << " to=" << to->get_string() << " (" // << " to=" << to->get_string() << " ("
// << to->get_width() << ")" << std::endl; // << to->get_width() << ")" << std::endl;
// If this expression hasn't been given a type then
// we can't generate any type conversion code
if (NULL == type_)
return this;
if (to->get_name() == type_->get_name()) { if (to->get_name() == type_->get_name()) {
if (to->get_width() == type_->get_width()) if (to->get_width() == type_->get_width())
return this; // Identical return this; // Identical

View File

@ -241,6 +241,8 @@ static vhdl_expr *lpm_to_expr(vhdl_scope *scope, ivl_lpm_t lpm)
return concat_lpm_to_expr(scope, lpm); return concat_lpm_to_expr(scope, lpm);
case IVL_LPM_CMP_GE: case IVL_LPM_CMP_GE:
return rel_lpm_to_expr(scope, lpm, VHDL_BINOP_GEQ); return rel_lpm_to_expr(scope, lpm, VHDL_BINOP_GEQ);
case IVL_LPM_CMP_GT:
return rel_lpm_to_expr(scope, lpm, VHDL_BINOP_GT);
case IVL_LPM_CMP_EQ: case IVL_LPM_CMP_EQ:
case IVL_LPM_CMP_EEQ: case IVL_LPM_CMP_EEQ:
return rel_lpm_to_expr(scope, lpm, VHDL_BINOP_EQ); return rel_lpm_to_expr(scope, lpm, VHDL_BINOP_EQ);
@ -323,7 +325,7 @@ int draw_lpm(vhdl_arch *arch, ivl_lpm_t lpm)
out->set_slice(off, ivl_lpm_width(lpm) - 1); out->set_slice(off, ivl_lpm_width(lpm) - 1);
} }
arch->add_stmt(new vhdl_cassign_stmt(out, f)); arch->add_stmt(new vhdl_cassign_stmt(out, f->cast(out->get_type())));
return 0; return 0;
} }