#define fsgnj32(a, b, n, x) \
f32((((float32_t)f32(a)).v & ~F32_SIGN) | ((((x) ? ((float32_t)f32(a)).v : (n) ? F32_SIGN : 0) ^ ((float32_t)f32(b)).v) & F32_SIGN))
#define fsgnj64(a, b, n, x) \
- f64((f64(a).v & ~F64_SIGN) | ((((x) ? f64(a).v : (n) ? F64_SIGN : 0) ^ f64(b).v) & F64_SIGN))
+ f64((((float64_t)f64(a)).v & ~F64_SIGN) | ((((x) ? ((float64_t)f64(a)).v : (n) ? F64_SIGN : 0) ^ ((float64_t)f64(b)).v) & F64_SIGN))
#define isNaNF128(x) isNaNF128UI(x.v[1], x.v[0])
inline float128_t defaultNaNF128()
require_extension('D');
require_fp;
bool greater = f64_lt_quiet(f64(FRS2), f64(FRS1)) ||
- (f64_eq(f64(FRS2), f64(FRS1)) && (f64(FRS2).v & F64_SIGN));
-if (isNaNF64UI(f64(FRS1).v) && isNaNF64UI(f64(FRS2).v))
+ (f64_eq(f64(FRS2), f64(FRS1)) && (((float64_t)f64(FRS2)).v & F64_SIGN));
+if (isNaNF64UI(((float64_t)f64(FRS1)).v) && isNaNF64UI(((float64_t)f64(FRS2)).v))
WRITE_FRD(f64(defaultNaNF64UI));
else
- WRITE_FRD(greater || isNaNF64UI(f64(FRS2).v) ? FRS1 : FRS2);
+ WRITE_FRD(greater || isNaNF64UI(((float64_t)f64(FRS2)).v) ? FRS1 : FRS2);
set_fp_exceptions;
require_extension('D');
require_fp;
bool less = f64_lt_quiet(f64(FRS1), f64(FRS2)) ||
- (f64_eq(f64(FRS1), f64(FRS2)) && (f64(FRS1).v & F64_SIGN));
-if (isNaNF64UI(f64(FRS1).v) && isNaNF64UI(f64(FRS2).v))
+ (f64_eq(f64(FRS1), f64(FRS2)) && (((float64_t)f64(FRS1)).v & F64_SIGN));
+if (isNaNF64UI(((float64_t)f64(FRS1)).v) && isNaNF64UI(((float64_t)f64(FRS2)).v))
WRITE_FRD(f64(defaultNaNF64UI));
else
- WRITE_FRD(less || isNaNF64UI(f64(FRS2).v) ? FRS1 : FRS2);
+ WRITE_FRD(less || isNaNF64UI(((float64_t)f64(FRS2)).v) ? FRS1 : FRS2);
set_fp_exceptions;
require_extension('D');
require_fp;
softfloat_roundingMode = RM;
-WRITE_FRD(f64_mulAdd(f64(FRS1), f64(FRS2), f64(f64(FRS3).v ^ F64_SIGN)));
+WRITE_FRD(f64_mulAdd(f64(FRS1), f64(FRS2), f64(((float64_t)f64(FRS3)).v ^ F64_SIGN)));
set_fp_exceptions;
require_extension('D');
require_fp;
softfloat_roundingMode = RM;
-WRITE_FRD(f64_mulAdd(f64(f64(FRS1).v ^ F64_SIGN), f64(FRS2), f64(f64(FRS3).v ^ F64_SIGN)));
+WRITE_FRD(f64_mulAdd(f64(((float64_t)f64(FRS1)).v ^ F64_SIGN), f64(FRS2), f64(((float64_t)f64(FRS3)).v ^ F64_SIGN)));
+
set_fp_exceptions;
require_extension('D');
require_fp;
softfloat_roundingMode = RM;
-WRITE_FRD(f64_mulAdd(f64(f64(FRS1).v ^ F64_SIGN), f64(FRS2), f64(FRS3)));
+WRITE_FRD(f64_mulAdd(f64(((float64_t)f64(FRS1)).v ^ F64_SIGN), f64(FRS2), f64(FRS3)));
set_fp_exceptions;
void (sv_proc_t::WRITE_FRD)(sv_float64_t value)
{
- fprintf(stderr, "WRITE_FRD sv_float64_t %g\n", (double)value.v);
+ fprintf(stderr, "WRITE_FRD sv_float64_t %g\n",
+ (double)((float64_t)value).v);
DO_WRITE_FREG( _insn->rd(), freg(value) );
}
//typedef reg_t sv_reg_t;
//typedef sreg_t sv_sreg_t;
//typedef float32_t sv_float32_t;
-typedef float64_t sv_float64_t;
+//typedef float64_t sv_float64_t;
typedef float128_t sv_float128_t;
//typedef freg_t sv_freg_t;
operator float32_t() const& { return reg; }
};
+class sv_float64_t : public sv_regbase_t {
+public:
+ sv_float64_t(float64_t _reg) : sv_regbase_t(), reg(_reg) { } // default elwidth
+ sv_float64_t(float64_t _reg, uint8_t _elwidth) :
+ sv_regbase_t(_elwidth), reg(_reg)
+ {}
+ sv_float64_t(float64_t _reg, int xlen, uint8_t _elwidth) :
+ sv_regbase_t(xlen, _elwidth), reg(_reg)
+ {}
+
+ float64_t reg;
+public:
+
+ operator float64_t() const& { return reg; }
+};
+
#endif