* device/lib/_fsadd.c: handle overflows
* device/lib/_fsmul.c,
* device/lib/_fsdiv.c: use __INFINITY
* device/lib/_fseq.c,
* device/lib/_fsneq.c: handle -0.0
* sim/ucsim/s51.src/uc89c51r.cc,
* sim/ucsim/s51.src/uc89c51rcl.h: bugfix auxr should be auxr1
* sim/ucsim/sim.src/hwcl.h: */* confuses VC
* src/mcs51/gen.c (genSend): fixed bug with --xstack
* support/regression/ports/mcs51-xstack-auto/spec.mk: print floats
* support/regression/tests/snprintf.c: test bug with --xstack
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5164
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2008-05-20 Maarten Brock <sourceforge.brock AT dse.nl>
+
+ * device/include/float.h: added __INFINITY
+ * device/lib/_fsadd.c: handle overflows
+ * device/lib/_fsmul.c,
+ * device/lib/_fsdiv.c: use __INFINITY
+ * device/lib/_fseq.c,
+ * device/lib/_fsneq.c: handle -0.0
+ * sim/ucsim/s51.src/uc89c51r.cc,
+ * sim/ucsim/s51.src/uc89c51rcl.h: bugfix auxr should be auxr1
+ * sim/ucsim/sim.src/hwcl.h: */* confuses VC
+ * src/mcs51/gen.c (genSend): fixed bug with --xstack
+ * support/regression/ports/mcs51-xstack-auto/spec.mk: print floats
+ * support/regression/tests/snprintf.c: test bug with --xstack
+
2008-05-19 Philipp Klaus Krause <pkk AT spth.de>
* src/SDCCpeeph.c (callFuncByName):
/* the following deal with IEEE single-precision numbers */
#define EXCESS 126
#define SIGNBIT ((unsigned long)0x80000000)
+#define __INFINITY ((unsigned long)0x7F800000)
#define HIDDEN (unsigned long)(1ul << 23)
#define SIGN(fp) (((unsigned long)(fp) >> (8*sizeof(fp)-1)) & 1)
#define EXP(fp) (((unsigned long)(fp) >> 23) & (unsigned int) 0x00FF)
volatile long mant1, mant2;
volatile union float_long fl1, fl2;
volatile int exp1, exp2;
- volatile unsigned long sign = 0;
+ char sign = 0;
fl1.f = a1;
fl2.f = a2;
if (mant1 < 0)
{
mant1 = -mant1;
- sign = SIGNBIT;
+ sign = 1;
}
else if (!mant1)
return (0);
while (mant1 & 0xff000000) {
if (mant1&1)
mant1 += 2;
- mant1 >>= 1 ;
+ mant1 >>= 1;
exp1++;
}
mant1 &= ~HIDDEN;
/* pack up and go home */
- fl1.l = PACK (sign, (unsigned long) exp1, mant1);
-
+ if (exp1 >= 0x100)
+ fl1.l = (sign ? SIGNBIT : 0) | __INFINITY;
+ else if (exp1 < 0)
+ fl1.l = 0;
+ else
+ fl1.l = PACK (sign ? SIGNBIT : 0 , exp1, mant1);
return (fl1.f);
}
/* pack up and go home */
if (exp >= 0x100)
- fl1.l = (sign ? SIGNBIT : 0) | 0x7F800000;
+ fl1.l = (sign ? SIGNBIT : 0) | __INFINITY;
else if (exp < 0)
fl1.l = 0;
else
if (fl1.l == fl2.l)
return (1);
+ if (((fl1.l | fl2.l) & 0x7FFFFFFF) == 0)
+ return (1);
return (0);
}
/* pack up and go home */
if (exp >= 0x100)
- fl1.l = (sign ? SIGNBIT : 0) | 0x7F800000;
+ fl1.l = (sign ? SIGNBIT : 0) | __INFINITY;
else if (exp < 0)
fl1.l = 0;
else
fl1.f = a1;
fl2.f = a2;
-#if 0
- if (fl1.l<0 && fl2.l<0)
- {
- fl1.l ^= SIGNBIT;
- fl2.l ^= SIGNBIT;
- }
-#endif
-
if (fl1.l == fl2.l)
return (0);
+ if (((fl1.l | fl2.l) & 0x7FFFFFFF) == 0)
+ return (0);
return (1);
}
* Simulator of microcontrollers (uc89c51r.cc)
*
* Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
- *
+ *
* To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
*
*/
fprintf(stderr, "No SFR to register %s[%d] into\n", id_string, id);
}
//auxr= sfr->register_hw(AUXR, this, 0);
- register_cell(sfr, AUXR, &auxr, wtd_restore);
+ register_cell(sfr, AUXR1, &auxr1, wtd_restore);
return(0);
}
void
cl_89c51r_dummy_hw::write(class cl_memory_cell *cell, t_mem *val)
{
- if (cell == auxr)
- auxr->set_bit0(0x04);
+ if (cell == auxr1)
+ auxr1->set_bit0(0x04);
}
class cl_89c51r_dummy_hw: public cl_hw
{
protected:
- class cl_memory_cell *auxr;
+ class cl_memory_cell *auxr1;
public:
cl_89c51r_dummy_hw(class cl_uc *auc);
virtual int init(void);
virtual class cl_hw *make_partner(enum hw_cath cath, int id);
virtual t_mem read(class cl_memory_cell *cell) { return(cell->get()); }
- virtual void write(class cl_memory_cell */*cell*/, t_mem */*val*/) {}
+ virtual void write(class cl_memory_cell * /*cell*/, t_mem * /*val*/) {}
virtual void set_cmd(class cl_cmdline *cmdline, class cl_console_base *con);
virtual class cl_memory_cell *register_cell(class cl_address_space *mem,
virtual int tick(int cycles);
virtual void reset(void) {}
- virtual void happen(class cl_hw */*where*/, enum hw_event /*he*/,
- void */*params*/) {}
+ virtual void happen(class cl_hw * /*where*/, enum hw_event /*he*/,
+ void * /*params*/) {}
virtual void inform_partners(enum hw_event he, void *params);
virtual void print_info(class cl_console_base *con);
}
}
- if (bit_count)
+ if (options.useXstack || bit_count)
{
saveRegisters (setFirstItem (sendSet));
+ }
+
+ if (bit_count)
+ {
emitcode ("mov", "bits,b");
}
LIBBUILDDIR = $(top_builddir)/device/lib
LIBDIR = $(PORT_CASES_DIR)/lib
-LIBSDCCFLAGS+= --stack-auto --xstack --std-c99
+LIBSDCCFLAGS+= --stack-auto --xstack --std-c99 -DUSE_FLOATS=1
SDCCFLAGS += --stack-auto --xstack --std-sdcc99
SOURCES = _atoi.c _atol.c _autobaud.c _bp.c _schar2fs.c \
} static const cases[]={
// arg, fmt, result
// ... there should be more ...
- #if defined(SDCC) && !defined(SDCC_ds390)
+ #if defined(SDCC) && !defined(SDCC_ds390) && !(defined(SDCC_mcs51) && defined(SDCC_USE_XSTACK))
{1.0, "%f", "<NO FLOAT>"},
#else
{1.0, "%f", "1.000000"},