From 0f50849fbb10d7dc22656af36c39ed7812ab2c26 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Fri, 20 Jun 2008 18:26:39 +0100 Subject: [PATCH] Add call to To_Integer when printing signed/unsigned --- tgt-vhdl/display.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tgt-vhdl/display.cc b/tgt-vhdl/display.cc index 998666a0e..a461f9017 100644 --- a/tgt-vhdl/display.cc +++ b/tgt-vhdl/display.cc @@ -38,9 +38,17 @@ static void display_write(stmt_container *container, vhdl_expr *expr) new vhdl_var_ref(DISPLAY_LINE, vhdl_type::line()); write->add_expr(ref); - // Need to add a call to Type'Image for types not - // supported by std.textio - if (expr->get_type()->get_name() != VHDL_TYPE_STRING) { + vhdl_type_name_t type = expr->get_type()->get_name(); + if (type == VHDL_TYPE_SIGNED || type == VHDL_TYPE_UNSIGNED) { + vhdl_fcall *toint = + new vhdl_fcall("To_Integer", vhdl_type::integer()); + toint->add_expr(expr); + + write->add_expr(toint); + } + else if (type != VHDL_TYPE_STRING) { + // Need to add a call to Type'Image for types not + // supported by std.textio std::string name(expr->get_type()->get_string()); name += "'Image";