forked from Github_Repos/cvw
Removed outdated sample testfloat calls
This commit is contained in:
parent
c3d07b2c46
commit
171b943254
@ -1,19 +0,0 @@
|
|||||||
# Makefile
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CFLAGS = -O3
|
|
||||||
LIBS = -lm
|
|
||||||
LFLAGS = -L.
|
|
||||||
IFLAGS = -I../../../addins/SoftFloat-3e/source/include/
|
|
||||||
LIBS = ../../../addins/SoftFloat-3e/build/Linux-x86_64-GCC/softfloat.a
|
|
||||||
SRCS = $(wildcard *.c)
|
|
||||||
|
|
||||||
PROGS = $(patsubst %.c,%,$(SRCS))
|
|
||||||
|
|
||||||
all: $(PROGS)
|
|
||||||
|
|
||||||
%: %.c
|
|
||||||
$(CC) $(CFLAGS) $(IFLAGS) $(LFLAGS) -o $@ $< $(LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(PROGS)
|
|
Binary file not shown.
@ -1,52 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "softfloat.h"
|
|
||||||
#include "softfloat_types.h"
|
|
||||||
|
|
||||||
int float_rounding_mode = 0;
|
|
||||||
|
|
||||||
union dp {
|
|
||||||
unsigned short x[4];
|
|
||||||
double y;
|
|
||||||
} X;
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
uint8_t rounding_mode;
|
|
||||||
uint8_t exceptions;
|
|
||||||
|
|
||||||
uint64_t n, d, result;
|
|
||||||
float64_t d_n, d_d, d_result;
|
|
||||||
|
|
||||||
n = 0x3feffffffefffff6;
|
|
||||||
d = 0xffeffffffffffffe;
|
|
||||||
//n = 0x00000000400001ff;
|
|
||||||
//d = 0x3ffffdfffffffbfe;
|
|
||||||
|
|
||||||
d_n.v = n;
|
|
||||||
d_d.v = d;
|
|
||||||
|
|
||||||
softfloat_roundingMode = rounding_mode;
|
|
||||||
softfloat_exceptionFlags = 0;
|
|
||||||
softfloat_detectTininess = softfloat_tininess_beforeRounding;
|
|
||||||
|
|
||||||
d_result = f64_div(d_n, d_d);
|
|
||||||
|
|
||||||
//result = d_result.v;
|
|
||||||
//exceptions = softfloat_exceptionFlags & 0x1f;
|
|
||||||
|
|
||||||
X.x[3] = (d_result.v & 0xffff000000000000) >> 48;
|
|
||||||
X.x[2] = (d_result.v & 0x0000ffff00000000) >> 32;
|
|
||||||
X.x[1] = (d_result.v & 0x00000000ffff0000) >> 16;
|
|
||||||
X.x[0] = (d_result.v & 0x000000000000ffff);
|
|
||||||
|
|
||||||
printf("Number = %.4x\n", X.x[3]);
|
|
||||||
printf("Number = %.4x\n", X.x[2]);
|
|
||||||
printf("Number = %.4x\n", X.x[1]);
|
|
||||||
printf("Number = %.4x\n", X.x[0]);
|
|
||||||
printf("Number = %1.25lg\n", X.y);
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Binary file not shown.
@ -1,47 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include "softfloat.h"
|
|
||||||
#include "softfloat_types.h"
|
|
||||||
|
|
||||||
int float_rounding_mode = 0;
|
|
||||||
|
|
||||||
union sp {
|
|
||||||
unsigned short x[2];
|
|
||||||
float y;
|
|
||||||
} X;
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
uint8_t rounding_mode;
|
|
||||||
uint8_t exceptions;
|
|
||||||
|
|
||||||
uint32_t multiplier, multiplicand, addend, result;
|
|
||||||
float32_t f_multiplier, f_multiplicand, f_addend, f_result;
|
|
||||||
|
|
||||||
multiplier = 0xbf800000;
|
|
||||||
multiplicand = 0xbf800000;
|
|
||||||
addend = 0xffaaaaaa;
|
|
||||||
|
|
||||||
f_multiplier.v = multiplier;
|
|
||||||
f_multiplicand.v = multiplicand;
|
|
||||||
f_addend.v = addend;
|
|
||||||
|
|
||||||
softfloat_roundingMode = rounding_mode;
|
|
||||||
softfloat_exceptionFlags = 0;
|
|
||||||
softfloat_detectTininess = softfloat_tininess_beforeRounding;
|
|
||||||
|
|
||||||
f_result = f32_mulAdd(f_multiplier, f_multiplicand, f_addend);
|
|
||||||
|
|
||||||
result = f_result.v;
|
|
||||||
exceptions = softfloat_exceptionFlags & 0x1f;
|
|
||||||
|
|
||||||
printf("%x\n", f_result.v);
|
|
||||||
|
|
||||||
// Print out SP number
|
|
||||||
X.x[1] = (f_result.v & 0xffff0000) >> 16;
|
|
||||||
X.x[0] = (f_result.v & 0x0000ffff);
|
|
||||||
printf("Number = %f\n", X.y);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user