From 2e97b2818593374d37af00a601e3c460337e586e Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 28 Aug 2008 18:33:13 -0700 Subject: [PATCH] More NaN constant fixes. This patch cleans up %loadi/wr regarding NaN values. It also fixes the code generator to correctly output a NaN value as a Cr<> constant. --- tgt-vvp/vvp_scope.c | 4 ++++ vvp/vthread.cc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tgt-vvp/vvp_scope.c b/tgt-vvp/vvp_scope.c index 433263b24..e018166bb 100644 --- a/tgt-vvp/vvp_scope.c +++ b/tgt-vvp/vvp_scope.c @@ -330,6 +330,10 @@ char* draw_Cr_to_string(double value) snprintf(tmp, sizeof(tmp), "Cr"); return strdup(tmp); } + if (value != value) { + snprintf(tmp, sizeof(tmp), "Cr"); + return strdup(tmp); + } int sign = 0; if (value < 0) { diff --git a/vvp/vthread.cc b/vvp/vthread.cc index 05344f160..a19eb59ce 100644 --- a/vvp/vthread.cc +++ b/vvp/vthread.cc @@ -2663,7 +2663,7 @@ bool of_LOADI_WR(vthread_t thr, vvp_code_t cp) return true; } // Detect NaN - if (exp==0x3fff && cp->number!=0) { + if (exp==0x3fff) { thr->words[idx].w_real = nan(""); return true; }