mirror of
https://github.com/openhwgroup/cvw
synced 2025-01-24 13:34:28 +00:00
Moved fma directory
This commit is contained in:
parent
5a5142c14f
commit
274ecf13ad
@ -99,7 +99,7 @@ module postproc(
|
||||
always_comb begin
|
||||
ueb = ue-7'd15;
|
||||
if (ue >= 7'd46) begin // overflow
|
||||
uebiased = 5'd30;
|
||||
uebiased = 7'd30;
|
||||
uff = 10'h3ff;
|
||||
end else begin
|
||||
uebiased = ue-7'd15;
|
BIN
fma/fma16_testgen
Executable file
BIN
fma/fma16_testgen
Executable file
Binary file not shown.
@ -65,7 +65,7 @@ void genCase(FILE *fptr, float16_t x, float16_t y, float16_t z, int mul, int add
|
||||
resultmag.v &= 0x7FFF; // take absolute value
|
||||
if (f16_lt(resultmag, smallest) && (resultmag.v != 0x0000)) fprintf (fptr, "// skip denorm: ");
|
||||
if (resultmag.v == 0x0000 && !zeroAllowed) fprintf(fptr, "// skip zero: ");
|
||||
if (resultmag.v == 0x7C00 && !infAllowed) fprintf(fptr, "// Skip inf: ");
|
||||
if ((resultmag.v == 0x7C00 || resultmag.v == 0x7BFF) && !infAllowed) fprintf(fptr, "// Skip inf: ");
|
||||
if (resultmag.v > 0x7C00 && !nanAllowed) fprintf(fptr, "// Skip NaN: ");
|
||||
fprintf(fptr, "%04x_%04x_%04x_%02x_%04x // %s\n", x.v, y.v, z.v, op, result.v, calc);
|
||||
}
|
47
fma/fma32.c
Normal file
47
fma/fma32.c
Normal file
@ -0,0 +1,47 @@
|
||||
#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