From 0e102a94b27a4d3e72d24e383a50b3b4f690069a Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 10 Oct 2006 23:54:28 +0000 Subject: [PATCH] Fix rendering of signed numbers in real expressions. --- tgt-vvp/eval_real.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tgt-vvp/eval_real.c b/tgt-vvp/eval_real.c index 99d1a847e..a9c82f721 100644 --- a/tgt-vvp/eval_real.c +++ b/tgt-vvp/eval_real.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: eval_real.c,v 1.15 2006/08/09 05:19:08 steve Exp $" +#ident "$Id: eval_real.c,v 1.16 2006/10/10 23:54:28 steve Exp $" #endif /* @@ -112,13 +112,23 @@ static int draw_number_real(ivl_expr_t exp) const char*bits = ivl_expr_bits(exp); unsigned wid = ivl_expr_width(exp); unsigned long mant = 0; + int vexp = 0x1000; for (idx = 0 ; idx < wid ; idx += 1) { if (bits[idx] == '1') mant |= 1 << idx; } - fprintf(vvp_out, " %%loadi/wr %d, %lu, 4096;\n", res, mant); + /* If this is actually a negative number, then get the + positive equivilent, and set the sign bit in the exponent + field. */ + if (ivl_expr_signed(exp) && (bits[wid-1] == '1')) { + mant = (0-mant) & ((1UL<