Unary minus

This commit is contained in:
Nick Gasson 2008-07-22 15:44:29 +01:00
parent 3ca85491ee
commit a5db0297b0
3 changed files with 7 additions and 0 deletions

View File

@ -149,6 +149,9 @@ static vhdl_expr *translate_unary(ivl_expr_t e)
case '~':
return new vhdl_unaryop_expr
(VHDL_UNARYOP_NOT, operand, new vhdl_type(*operand->get_type()));
case '-':
return new vhdl_unaryop_expr
(VHDL_UNARYOP_NEG, operand, new vhdl_type(*operand->get_type()));
case 'N': // NOR
return translate_reduction(SF_REDUCE_OR, true, operand);
case '|':

View File

@ -657,6 +657,9 @@ void vhdl_unaryop_expr::emit(std::ostream &of, int level) const
case VHDL_UNARYOP_NOT:
of << "not ";
break;
case VHDL_UNARYOP_NEG:
of << "-";
break;
}
operand_->emit(of, level);
of << ")";

View File

@ -107,6 +107,7 @@ private:
enum vhdl_unaryop_t {
VHDL_UNARYOP_NOT,
VHDL_UNARYOP_NEG,
};
class vhdl_unaryop_expr : public vhdl_expr {