#define F32_SIGN ((uint32_t)1 << 31)
#define F64_SIGN ((uint64_t)1 << 63)
#define fsgnj32(a, b, n, x) \
- f32((f32(a).v & ~F32_SIGN) | ((((x) ? f32(a).v : (n) ? F32_SIGN : 0) ^ f32(b).v) & F32_SIGN))
+ 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))
require_extension('F');
require_fp;
bool greater = f32_lt_quiet(f32(FRS2), f32(FRS1)) ||
- (f32_eq(f32(FRS2), f32(FRS1)) && (f32(FRS2).v & F32_SIGN));
-if (isNaNF32UI(f32(FRS1).v) && isNaNF32UI(f32(FRS2).v))
+ (f32_eq(f32(FRS2), f32(FRS1)) && (((float32_t)f32(FRS2)).v & F32_SIGN));
+if (isNaNF32UI(((float32_t)f32(FRS1)).v) && isNaNF32UI(((float32_t)f32(FRS2)).v))
WRITE_FRD(f32(defaultNaNF32UI));
else
- WRITE_FRD(greater || isNaNF32UI(f32(FRS2).v) ? FRS1 : FRS2);
+ WRITE_FRD(greater || isNaNF32UI(((float32_t)f32(FRS2)).v) ? FRS1 : FRS2);
set_fp_exceptions;
require_extension('F');
require_fp;
bool less = f32_lt_quiet(f32(FRS1), f32(FRS2)) ||
- (f32_eq(f32(FRS1), f32(FRS2)) && (f32(FRS1).v & F32_SIGN));
-if (isNaNF32UI(f32(FRS1).v) && isNaNF32UI(f32(FRS2).v))
+ (f32_eq(f32(FRS1), f32(FRS2)) && (((float32_t)f32(FRS1)).v & F32_SIGN));
+if (isNaNF32UI(((float32_t)f32(FRS1)).v) && isNaNF32UI(((float32_t)f32(FRS2)).v))
WRITE_FRD(f32(defaultNaNF32UI));
else
- WRITE_FRD(less || isNaNF32UI(f32(FRS2).v) ? FRS1 : FRS2);
+ WRITE_FRD(less || isNaNF32UI(((float32_t)f32(FRS2)).v) ? FRS1 : FRS2);
set_fp_exceptions;
require_extension('F');
require_fp;
softfloat_roundingMode = RM;
-WRITE_FRD(f32_mulAdd(f32(FRS1), f32(FRS2), f32(f32(FRS3).v ^ F32_SIGN)));
+WRITE_FRD(f32_mulAdd(f32(FRS1), f32(FRS2), f32(((float32_t)f32(FRS3)).v ^ F32_SIGN)));
set_fp_exceptions;
require_extension('F');
require_fp;
softfloat_roundingMode = RM;
-WRITE_FRD(f32_mulAdd(f32(f32(FRS1).v ^ F32_SIGN), f32(FRS2), f32(f32(FRS3).v ^ F32_SIGN)));
+WRITE_FRD(f32_mulAdd(f32(((float32_t)f32(FRS1)).v ^ F32_SIGN), f32(FRS2), f32(((float32_t)f32(FRS3)).v ^ F32_SIGN)));
set_fp_exceptions;
require_extension('F');
require_fp;
softfloat_roundingMode = RM;
-WRITE_FRD(f32_mulAdd(f32(f32(FRS1).v ^ F32_SIGN), f32(FRS2), f32(FRS3)));
+WRITE_FRD(f32_mulAdd(f32(((float32_t)f32(FRS1)).v ^ F32_SIGN), f32(FRS2), f32(FRS3)));
set_fp_exceptions;
void (sv_proc_t::WRITE_FRD)(sv_float32_t value)
{
- fprintf(stderr, "WRITE_FRD sv_float32_t %f\n", (float)value.v);
+ fprintf(stderr, "WRITE_FRD sv_float32_t %f\n",
+ (float)((float32_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 float32_t sv_float32_t;
typedef float64_t sv_float64_t;
typedef float128_t sv_float128_t;
//typedef freg_t sv_freg_t;
operator freg_t() const& { return reg; }
};
+class sv_float32_t : public sv_regbase_t {
+public:
+ sv_float32_t(float32_t _reg) : sv_regbase_t(), reg(_reg) { } // default elwidth
+ sv_float32_t(float32_t _reg, uint8_t _elwidth) :
+ sv_regbase_t(_elwidth), reg(_reg)
+ {}
+ sv_float32_t(float32_t _reg, int xlen, uint8_t _elwidth) :
+ sv_regbase_t(xlen, _elwidth), reg(_reg)
+ {}
+
+ float32_t reg;
+public:
+
+ operator float32_t() const& { return reg; }
+};
+
#endif