Float point display in arm-elf-sid
Harry Hsin-Hua Pan(潘欣華) <[email protected]>
| Newsgroups | gmane.comp.emulators.sid.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, I've tried to build a SID with --target=arm-elf Then I ran a test to displaying a float point. But I got an incorrect display like following: <arm-elf-sid-dir>/bin $arm-elf-gcc test.c -o test.arm $ ./arm-elf-sid -EL test.arm hello! world i=2 f=-2589673925853444962162817833395304976613376.000000 j=125 While tracing this issue, I found the arm7.cxx seems to not support "rotate right with extend" (RRX). (Readers could refer to ARM DDI 0100E page A-17) So I updated my arm7.cxx then re-built again. Now I got correct display like following: $ ./arm-elf-sid -EL test.arm hello! world i=2 f=123.456001 j=125 This issue seems to explain the strange result in the SID screen shot here. http://sources.redhat.com/sid/screenshots/run-dhrystone.jpg I attached my patch which was generated with the CVS snapshot in 20060325. I didn't verified it to check whether there is another side effect. So, would somebody like to verify this patch? Regards, Harry.
sid-20060325-patch.diff
(application/octet-stream, 640 B)
--- sid-20060325/sid/component/cgen-cpu/arm7t/arm7f.cxx 2004-08-04 23:42:00.000000000 +0800
+++ sid-20060325-patch/sid/component/cgen-cpu/arm7t/arm7f.cxx 2006-03-29 12:56:55.021225400 +0800
@@ -1443,7 +1443,11 @@
case SHIFT_TYPE_LSL : return rm << shift;
case SHIFT_TYPE_LSR : return (USI) rm >> shift;
case SHIFT_TYPE_ASR : return rm >> shift;
- case SHIFT_TYPE_ROR : return RORSI (rm, shift);
+ case SHIFT_TYPE_ROR : //return RORSI (rm, shift); // old
+ if (shift == 0) // it is RRX
+ return ((USI)rm >> 1) | ((USI)this->hardware.h_cbit << 31);
+ else
+ return RORSI (rm, shift);
}
abort();
}
test.c
(application/octet-stream, 277 B)
#include <stdio.h>
static char hello[] = "hello! world";
int main(void)
{
int i = 2;
float f = 123.456;
int j;
printf("%s\n", hello);
printf("i=%d\n", i);
check_point01:
printf("f=%f\n", f);
j = (int)f + i;
printf("j=%d\n", j);
return 0;
}