URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 148 |
Rev 158 |
/* WinBond bug report
|
/* WinBond bug report
|
|
|
Please don't use "gcc -O3 -S hello.c" command, because it
|
Please don't use "gcc -O3 -S hello.c" command, because it
|
will optimize "i/5" to be "2" in compile time.
|
will optimize "i/5" to be "2" in compile time.
|
|
|
*/
|
*/
|
|
|
#include <stdio.h>
|
#include <stdio.h>
|
#define TESTSEED 10
|
#define TESTSEED 10
|
|
|
main ()
|
main ()
|
{
|
{
|
int a1,b1,c1;
|
int a1,b1,c1;
|
long a2,b2,c2;
|
long a2,b2,c2;
|
double a3,b3,c3;
|
double a3,b3,c3;
|
float a4,b4,c4;
|
float a4,b4,c4;
|
char buf[20];
|
char buf[20];
|
|
|
/* integer tests */
|
/* integer tests */
|
for (a1 = 1; a1 < 16; a1++) {
|
for (a1 = 1; a1 < 16; a1++) {
|
b1 = TESTSEED/a1;
|
b1 = TESTSEED/a1;
|
c1 = TESTSEED%a1;
|
c1 = TESTSEED%a1;
|
printf ("%d/%d = %d, ^ = %d\n", TESTSEED, a1, b1, c1);
|
printf ("%d/%d = %d, ^ = %d\n", TESTSEED, a1, b1, c1);
|
if ((c1 + (a1 * b1)) == TESTSEED) {
|
if ((c1 + (a1 * b1)) == TESTSEED) {
|
sprintf (buf, "div %d by %d", TESTSEED, a1);
|
sprintf (buf, "div %d by %d", TESTSEED, a1);
|
pass (buf);
|
pass (buf);
|
} else {
|
} else {
|
sprintf (buf, "div %d by %d", TESTSEED, a1);
|
sprintf (buf, "div %d by %d", TESTSEED, a1);
|
fail (buf);
|
fail (buf);
|
}
|
}
|
fflush (stdout);
|
fflush (stdout);
|
}
|
}
|
}
|
}
|
|
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.