void (sv_proc_t::WRITE_FRD)(sv_float64_t value)
{
+ reg_t reg = _insn->rd().reg;
fprintf(stderr, "WRITE_FRD sv_float64_t %g\n",
(double)((float64_t)value).v);
- sv_freg_t v = sv_freg_t(freg(value), xlen, value.get_elwidth());
- DO_WRITE_FREG( _insn->rd(), v );
+ uint8_t dest_elwidth = _insn->reg_elwidth(reg, false);
+ freg_t v;
+ switch (dest_elwidth)
+ {
+ // 8-bit
+ case 1: throw trap_illegal_instruction(0); // XXX for now
+ // 16-bit data, up-convert to f32
+ case 2:
+ {
+ float16_t x16 = ::f64_to_f16((float64_t)value);
+ v = freg(x16);
+ break;
+ }
+ case 3:
+ {
+ float32_t x32 = ::f64_to_f32((float64_t)value);
+ v = freg(x32);
+ break;
+ }
+ default:
+ {
+ v = freg(value);
+ break;
+ }
+ }
+ sv_freg_t vf = sv_freg_t(v, xlen, value.get_elwidth());
+ DO_WRITE_FREG( _insn->rd(), vf );
}
void (sv_proc_t::WRITE_FRD)(sv_float128_t value)