Unary minus
This commit is contained in:
parent
3ca85491ee
commit
a5db0297b0
|
|
@ -149,6 +149,9 @@ static vhdl_expr *translate_unary(ivl_expr_t e)
|
||||||
case '~':
|
case '~':
|
||||||
return new vhdl_unaryop_expr
|
return new vhdl_unaryop_expr
|
||||||
(VHDL_UNARYOP_NOT, operand, new vhdl_type(*operand->get_type()));
|
(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
|
case 'N': // NOR
|
||||||
return translate_reduction(SF_REDUCE_OR, true, operand);
|
return translate_reduction(SF_REDUCE_OR, true, operand);
|
||||||
case '|':
|
case '|':
|
||||||
|
|
|
||||||
|
|
@ -657,6 +657,9 @@ void vhdl_unaryop_expr::emit(std::ostream &of, int level) const
|
||||||
case VHDL_UNARYOP_NOT:
|
case VHDL_UNARYOP_NOT:
|
||||||
of << "not ";
|
of << "not ";
|
||||||
break;
|
break;
|
||||||
|
case VHDL_UNARYOP_NEG:
|
||||||
|
of << "-";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
operand_->emit(of, level);
|
operand_->emit(of, level);
|
||||||
of << ")";
|
of << ")";
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ private:
|
||||||
|
|
||||||
enum vhdl_unaryop_t {
|
enum vhdl_unaryop_t {
|
||||||
VHDL_UNARYOP_NOT,
|
VHDL_UNARYOP_NOT,
|
||||||
|
VHDL_UNARYOP_NEG,
|
||||||
};
|
};
|
||||||
|
|
||||||
class vhdl_unaryop_expr : public vhdl_expr {
|
class vhdl_unaryop_expr : public vhdl_expr {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue