Fix case where booleans are compared against vectors

This commit is contained in:
Nick Gasson 2008-07-07 16:31:27 +01:00
parent 6b73cc39a5
commit 3987e0753d
1 changed files with 9 additions and 1 deletions

View File

@ -100,6 +100,14 @@ static vhdl_expr *translate_unary(ivl_expr_t e)
static vhdl_expr *translate_numeric(vhdl_expr *lhs, vhdl_expr *rhs,
vhdl_binop_t op)
{
// May need to make either side Boolean for operators
// to work
vhdl_type boolean(VHDL_TYPE_BOOLEAN);
if (lhs->get_type()->get_name() == VHDL_TYPE_BOOLEAN)
rhs = rhs->cast(&boolean);
else if (rhs->get_type()->get_name() == VHDL_TYPE_BOOLEAN)
lhs = lhs->cast(&boolean);
vhdl_type *rtype = new vhdl_type(*lhs->get_type());
return new vhdl_binop_expr(lhs, op, rhs, rtype);
}