From 645ee2003faa5865cef9f4e39efae63f20f4a4d7 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Thu, 12 Jun 2008 10:56:28 +0100 Subject: [PATCH] Translation for unary not --- tgt-vhdl/expr.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tgt-vhdl/expr.cc b/tgt-vhdl/expr.cc index d14e3fc99..55ef380b3 100644 --- a/tgt-vhdl/expr.cc +++ b/tgt-vhdl/expr.cc @@ -57,8 +57,19 @@ static vhdl_expr *translate_number(ivl_expr_t e) static vhdl_expr *translate_unary(ivl_expr_t e) { - std::cout << "Unary opcode " << ivl_expr_opcode(e) << std::endl; - return NULL; + vhdl_expr *operand = translate_expr(ivl_expr_oper1(e)); + if (NULL == operand) + return NULL; + + switch (ivl_expr_opcode(e)) { + case '!': + return new vhdl_unaryop_expr + (VHDL_UNARYOP_NOT, operand, new vhdl_type(*operand->get_type())); + default: + error("No translation for unary opcode '%c'\n", + ivl_expr_opcode(e)); + return NULL; + } } /*