From c6f934964fc05470a96b93422b52477b30e0d50e Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Mon, 22 Jun 2015 13:56:33 +0200 Subject: [PATCH] vhdlpp: NOT is translated to either ~(...) or !(...) depending on the argument type. --- vhdlpp/expression_emit.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vhdlpp/expression_emit.cc b/vhdlpp/expression_emit.cc index 9db26de6b..530e64d8d 100644 --- a/vhdlpp/expression_emit.cc +++ b/vhdlpp/expression_emit.cc @@ -24,6 +24,7 @@ # include "architec.h" # include "package.h" # include "std_funcs.h" +# include "std_types.h" # include "parse_types.h" # include # include @@ -955,7 +956,14 @@ int ExpUAbs::emit(ostream&out, Entity*ent, ScopeBase*scope) int ExpUNot::emit(ostream&out, Entity*ent, ScopeBase*scope) { int errors = 0; - out << "~("; + + const VType*op_type = peek_operand()->probe_type(ent, scope); + + if(op_type && op_type->type_match(&type_BOOLEAN)) + out << "!("; + else + out << "~("; + errors += emit_operand1(out, ent, scope); out << ")"; return errors;