diff --git a/tgt-vhdl/expr.cc b/tgt-vhdl/expr.cc index f64ac4ac6..9e383dfc9 100644 --- a/tgt-vhdl/expr.cc +++ b/tgt-vhdl/expr.cc @@ -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 '|': diff --git a/tgt-vhdl/vhdl_syntax.cc b/tgt-vhdl/vhdl_syntax.cc index 3cc70853a..a14f11e6d 100644 --- a/tgt-vhdl/vhdl_syntax.cc +++ b/tgt-vhdl/vhdl_syntax.cc @@ -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 << ")"; diff --git a/tgt-vhdl/vhdl_syntax.hh b/tgt-vhdl/vhdl_syntax.hh index fcf06286a..c6a2c727f 100644 --- a/tgt-vhdl/vhdl_syntax.hh +++ b/tgt-vhdl/vhdl_syntax.hh @@ -107,6 +107,7 @@ private: enum vhdl_unaryop_t { VHDL_UNARYOP_NOT, + VHDL_UNARYOP_NEG, }; class vhdl_unaryop_expr : public vhdl_expr {