From: Luke Kenneth Casson Leighton Date: Thu, 18 Oct 2018 22:12:00 +0000 (+0100) Subject: typedef on sv_reg_t to reg_t (and signed variant) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b453812e012b5425117b3fa756d9feffd5adcd8f;p=riscv-isa-sim.git typedef on sv_reg_t to reg_t (and signed variant) still working on redirecting everything through a planned class that can be polymorphic overloaded... eventually --- diff --git a/riscv/sv.cc b/riscv/sv.cc index 4bc0f96..e8ae90a 100644 --- a/riscv/sv.cc +++ b/riscv/sv.cc @@ -200,7 +200,7 @@ uint64_t sv_insn_t::rd_bitset(reg_t reg, uint64_t bit, bool set) } else { val &= ~(1<rd(), freg(value) ); } -/* -void (sv_proc_t::WRITE_RD)(bool value) +//void (sv_proc_t::WRITE_RD)(bool value) +//{ +// WRITE_REG( _insn->rd(), value ? 1 : 0); +//} + +// +//void (sv_proc_t::WRITE_RD)(sv_reg_t value) +//{ +// WRITE_REG( _insn->rd(), value/*.get_data()*/ ); +//} + + +//void (sv_proc_t::WRITE_RVC_RS1S)(sv_sreg_t value) +//{ +// WRITE_REG(_insn->rvc_rs1s(), value/*.get_data()*/ ); +//} + +void (sv_proc_t::WRITE_RVC_RS1S)(sv_reg_t value) { - WRITE_REG( _insn->rd(), value ? 1 : 0); + WRITE_REG(_insn->rvc_rs1s(), value/*.get_data()*/ ); } -void (sv_proc_t::WRITE_RD)(sv_reg_t value) + +void (sv_proc_t::WRITE_RVC_RS2S)(sv_reg_t value) { - WRITE_REG( _insn->rd(), value.get_data() ); + WRITE_REG(_insn->rvc_rs2s(), value/*.get_data()*/ ); } -*/ -void (sv_proc_t::WRITE_RD)(uint64_t value) +//void (sv_proc_t::WRITE_RVC_RS2S)(sv_sreg_t value) +//{ +// WRITE_REG(_insn->rvc_rs2s(), value/*.get_data()*/ ); +//} + +void (sv_proc_t::WRITE_RD)(sv_reg_t value) { - WRITE_REG( _insn->rd(), value ); // XXX TODO: replace properly + WRITE_REG( _insn->rd(), value/*.get_data()*/ ); // XXX TODO: replace properly } -void (sv_proc_t::WRITE_REG)(reg_t reg, uint64_t value) +//void (sv_proc_t::WRITE_RD)(sv_sreg_t value) +//{ +// WRITE_REG( _insn->rd(), value/*.get_data()*/ ); // XXX TODO: replace properly +//} + +//void (sv_proc_t::WRITE_REG)(reg_t reg, sv_sreg_t value) +//{ +// //WRITE_REG( reg, value/*.get_data()*/ ); // XXX TODO: replace properly +// STATE.XPR.write(reg, value/*.get_data()*/); +//} + +void (sv_proc_t::WRITE_REG)(reg_t reg, sv_reg_t value) { - WRITE_REG( reg, value ); // XXX TODO: replace properly - //STATE.XPR.write(reg, value); + //WRITE_REG( reg, value/*.get_data()*/ ); // XXX TODO: replace properly + STATE.XPR.write(reg, value/*.get_data()*/); } +//void (sv_proc_t::WRITE_REG)(reg_t reg, uint64_t value) +//{ +// //WRITE_REG( reg, value ); // XXX TODO: replace properly +// STATE.XPR.write(reg, value); +//} + /* void (sv_proc_t::WRITE_RD)(int_fast64_t value) { @@ -54,23 +94,23 @@ void (sv_proc_t::WRITE_RD)(uint_fast64_t value) */ /* -reg_t (sv_proc_t::READ_REG)(uint64_t i) +sv_reg_t (sv_proc_t::READ_REG)(uint64_t i) { return READ_REG ( i ); } */ -reg_t sv_proc_t::get_rs1() +sv_reg_t sv_proc_t::get_rs1() { return (_insn->p->get_state()->XPR[_insn->rs1()]); } -reg_t sv_proc_t::get_rs2() +sv_reg_t sv_proc_t::get_rs2() { return (_insn->p->get_state()->XPR[_insn->rs2()]); } -reg_t sv_proc_t::get_rvc_rs1s() +sv_reg_t sv_proc_t::get_rvc_rs1s() { fprintf(stderr, "get_rvc_rs1s %ld\n", _insn->rvc_rs1s()); sv_reg_entry *r = _insn->get_regentry(_insn->_rvc_rs1s(), true); @@ -80,79 +120,94 @@ reg_t sv_proc_t::get_rvc_rs1s() return (_insn->p->get_state()->XPR[_insn->rvc_rs1s()]); } -reg_t sv_proc_t::get_rvc_rs2s() +sv_reg_t sv_proc_t::get_shamt() +{ + return sv_reg_t(_insn->i_imm()/*.get_data()*/ & 0x3F); +} + +sv_reg_t sv_proc_t::get_rvc_rs2s() { return (_insn->p->get_state()->XPR[_insn->rvc_rs2s()]); } -reg_t sv_proc_t::get_rvc_rs1() +sv_reg_t sv_proc_t::get_rvc_rs1() { return (_insn->p->get_state()->XPR[_insn->rvc_rs1()]); } -reg_t sv_proc_t::get_rvc_rs2() +sv_reg_t sv_proc_t::get_rvc_rs2() { return (_insn->p->get_state()->XPR[_insn->rvc_rs2()]); } -reg_t sv_proc_t::get_rs3() +sv_reg_t sv_proc_t::get_rs3() { return (_insn->p->get_state()->XPR[_insn->rs3()]); } -reg_t sv_proc_t::get_rvc_sp() +sv_reg_t sv_proc_t::get_rvc_sp() { return (_insn->p->get_state()->XPR[X_SP]); } -reg_t sv_proc_t::uint64_max() +sv_reg_t sv_proc_t::uint64_max() { return ((UINT64_C(18446744073709551615))); } /* -reg_t (sv_proc_t::sext_xlen)(uint64_t x) +sv_reg_t (sv_proc_t::sext_xlen)(uint64_t x) { x = (((sreg_t)(x) << (64-xlen)) >> (64-xlen)); return sv_uint64_t(x); } */ -reg_t (sv_proc_t::sext_xlen)(reg_t x) +sv_sreg_t (sv_proc_t::sext_xlen)(sv_sreg_t v) +{ + int64_t x = v/*.get_data()*/; + x = (((sreg_t)(x) << (64-xlen)) >> (64-xlen)); + return sv_sreg_t(x); +} + +sv_sreg_t (sv_proc_t::sext_xlen)(sv_reg_t v) { - //uint64_t x = v.as_uint64(); + uint64_t x = v/*.get_data()*/; x = (((sreg_t)(x) << (64-xlen)) >> (64-xlen)); - return x; - //return sv_uint64_t(x); + return sv_sreg_t((sreg_t)x); } -reg_t (sv_proc_t::zext_xlen)(reg_t x) +sv_reg_t (sv_proc_t::zext_xlen)(sv_reg_t v) { - //uint64_t x = v.as_uint64(); + uint64_t x = v/*.get_data()*/; x = (((reg_t)(x) << (64-xlen)) >> (64-xlen)); - return x; - //return sv_uint64_t(x); + return sv_reg_t(x); } /* -reg_t (sv_proc_t::sext32)(uint_fast32_t v) +sv_reg_t (sv_proc_t::sext32)(uint_fast32_t v) { return sext32((uint64_t)v); // XXX TODO do properly } */ -reg_t (sv_proc_t::sext32)(reg_t x) +sv_sreg_t (sv_proc_t::sext32)(sv_reg_t v) { - //uint64_t x = v.as_uint64(); + uint64_t x = v/*.get_data()*/; x = ((sreg_t)(int32_t)(x)); - return x; - //return sv_uint64_t(x); + return sv_sreg_t((int64_t)x); } -reg_t (sv_proc_t::zext32)(reg_t x) +//sv_sreg_t (sv_proc_t::sext32)(sv_sreg_t v) +//{ +// int64_t x = v/*.get_data()*/; +// x = ((sreg_t)(int32_t)(x)); +// return sv_sreg_t(x); +//} + +sv_reg_t (sv_proc_t::zext32)(sv_reg_t v) { - //uint64_t x = v.as_uint64(); + uint64_t x = v/*.get_data()*/; x = ((reg_t)(uint32_t)(x)); - return x; - //return sv_uint64_t(x); + return sv_reg_t(x); } freg_t sv_proc_t::get_frs1() @@ -185,7 +240,7 @@ sv_reg_t::operator sv_sreg_t () sv_reg_t::operator int32_t () { uint64_t x = get_data(); - sreg_t _x = (sreg_t) x; + sv_sreg_t _x = (sv_sreg_t) x; sv_sreg_t y = sv_sreg_t ( _x ); return y; } @@ -217,114 +272,343 @@ sv_reg_t::operator char () // XXX TODO, make_sv_char_t } sv_reg_t::operator uint32_t () // TODO, make_sv_uint32_t - { return make_sv_uint64_t( (sreg_t) (as_uint64()) ); } -sv_reg_t::operator sreg_t () - { return make_sv_int64_t( (sreg_t) (as_uint64()) ); } + { return make_sv_uint64_t( (sv_sreg_t) (as_uint64()) ); } +sv_reg_t::operator sv_sreg_t () + { return make_sv_int64_t( (sv_sreg_t) (as_uint64()) ); } -sv_reg_t::operator reg_t () +sv_reg_t::operator sv_reg_t () { uint64_t x = get_data(); sv_uint64_t y = sv_uint64_t ( x ); return y; } */ -reg_t sv_proc_t::rv_add(reg_t lhs, reg_t rhs) +sv_reg_t sv_proc_t::rv_add(sv_reg_t lhs, sv_reg_t rhs) +{ + return lhs/*.get_data()*/ + rhs/*.get_data()*/; +} + +sv_reg_t sv_proc_t::rv_sub(sv_reg_t lhs, sv_reg_t rhs) +{ + return lhs/*.get_data()*/ - rhs/*.get_data()*/; +} + +sv_sreg_t sv_proc_t::rv_div(sv_sreg_t lhs, sv_sreg_t rhs) +{ + return lhs/*.get_data()*/ / rhs/*.get_data()*/; +} + +sv_reg_t sv_proc_t::rv_div(sv_reg_t lhs, sv_reg_t rhs) { - return lhs + rhs; + return lhs/*.get_data()*/ / rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_sub(reg_t lhs, reg_t rhs) +sv_sreg_t sv_proc_t::rv_rem(sv_sreg_t lhs, sv_sreg_t rhs) { - return lhs - rhs; + return lhs/*.get_data()*/ % rhs/*.get_data()*/; } -sreg_t sv_proc_t::rv_div(sreg_t lhs, sreg_t rhs) +sv_reg_t sv_proc_t::rv_rem(sv_reg_t lhs, sv_reg_t rhs) { - return lhs / rhs; + return lhs/*.get_data()*/ % rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_div(reg_t lhs, reg_t rhs) +sv_reg_t sv_proc_t::rv_mul(sv_reg_t lhs, sv_reg_t rhs) { - return lhs / rhs; + return lhs/*.get_data()*/ * rhs/*.get_data()*/; } -sreg_t sv_proc_t::rv_rem(sreg_t lhs, sreg_t rhs) +sv_sreg_t sv_proc_t::rv_mul(sv_sreg_t lhs, sv_reg_t rhs) { - return lhs % rhs; + return lhs/*.get_data()*/ * rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_rem(reg_t lhs, reg_t rhs) +sv_sreg_t sv_proc_t::rv_mul(sv_sreg_t lhs, sv_sreg_t rhs) { - return lhs % rhs; + return lhs/*.get_data()*/ * rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_mul(reg_t lhs, reg_t rhs) +sv_reg_t sv_proc_t::rv_and(sv_reg_t lhs, sv_reg_t rhs) { - return lhs * rhs; + return lhs/*.get_data()*/ & rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_and(reg_t lhs, reg_t rhs) +sv_reg_t sv_proc_t::rv_or(sv_reg_t lhs, sv_reg_t rhs) { - return lhs & rhs; + return lhs/*.get_data()*/ | rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_or(reg_t lhs, reg_t rhs) +sv_reg_t sv_proc_t::rv_xor(sv_reg_t lhs, sv_reg_t rhs) { - return lhs | rhs; + return lhs/*.get_data()*/ ^ rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_xor(reg_t lhs, reg_t rhs) +sv_reg_t sv_proc_t::rv_sl(sv_reg_t lhs, sv_reg_t rhs) +{ + return lhs/*.get_data()*/ << rhs/*.get_data()*/; +} + +//sv_sreg_t sv_proc_t::rv_sr(sv_sreg_t lhs, sv_reg_t rhs) +//{ +// return lhs/*.get_data()*/ >> rhs/*.get_data()*/; +//} + +sv_reg_t sv_proc_t::rv_sr(sv_reg_t lhs, sv_reg_t rhs) { - return lhs ^ rhs; + return lhs/*.get_data()*/ >> rhs/*.get_data()*/; } -reg_t sv_proc_t::rv_sl(reg_t lhs, reg_t rhs) +bool sv_proc_t::rv_lt(sv_reg_t lhs, sv_reg_t rhs) +{ + return lhs/*.get_data()*/ < rhs/*.get_data()*/; +} + +bool sv_proc_t::rv_lt(sv_sreg_t lhs, sv_sreg_t rhs) +{ + return lhs/*.get_data()*/ < rhs/*.get_data()*/; +} + +bool sv_proc_t::rv_gt(sv_reg_t lhs, sv_reg_t rhs) +{ + return lhs/*.get_data()*/ > rhs/*.get_data()*/; +} + +bool sv_proc_t::rv_gt(sv_sreg_t lhs, sv_sreg_t rhs) +{ + return lhs/*.get_data()*/ > rhs/*.get_data()*/; +} + +bool sv_proc_t::rv_ge(sv_reg_t lhs, sv_reg_t rhs) +{ + return lhs/*.get_data()*/ >= rhs/*.get_data()*/; +} + +bool sv_proc_t::rv_ge(sv_sreg_t lhs, sv_sreg_t rhs) +{ + return lhs/*.get_data()*/ >= rhs/*.get_data()*/; +} + +bool sv_proc_t::rv_eq(sv_reg_t lhs, sv_reg_t rhs) +{ + return lhs/*.get_data()*/ == rhs/*.get_data()*/; +} + +bool sv_proc_t::rv_ne(sv_reg_t lhs, sv_reg_t rhs) +{ + return (lhs/*.get_data()*/ != rhs/*.get_data()*/); +} + +sv_sreg_t sv_proc_t::sv_reg_to_sreg(sv_reg_t v) +{ + uint64_t x = v/*.get_data()*/; + return sv_sreg_t(sreg_t(x)); +} + +sv_reg_t sv_proc_t::sv_reg_int32(sv_reg_t v) +{ + int32_t x = (int32_t)v/*.get_data()*/; + return sv_reg_t((uint64_t)x); +} + +sv_reg_t sv_proc_t::sv_reg_uint32(sv_reg_t v) +{ + uint32_t x = (uint32_t)v/*.get_data()*/; + return sv_reg_t((uint64_t)x); +} + +float32_t (sv_proc_t::f32)(freg_t x) +{ + return ::f32(x); +} +float32_t (sv_proc_t::f32)(sv_reg_t v) { - return lhs << rhs; + uint64_t x = v/*.get_data()*/; + return ::f32(x); } -reg_t sv_proc_t::rv_sr(reg_t lhs, reg_t rhs) +float64_t (sv_proc_t::f64)(freg_t v) { - return lhs >> rhs; + return ::f64(v); } -reg_t sv_proc_t::rv_lt(reg_t lhs, reg_t rhs) +float64_t (sv_proc_t::f64)(sv_reg_t v) { - return lhs < rhs; + uint64_t x = v/*.get_data()*/; + return ::f64(x); } -sreg_t sv_proc_t::rv_lt(sreg_t lhs, sreg_t rhs) +sv_reg_t (sv_proc_t::f32_classify)(float32_t a) { - return lhs < rhs; + return sv_reg_t(::f32_classify(a)); } -reg_t sv_proc_t::rv_gt(reg_t lhs, reg_t rhs) +sv_reg_t (sv_proc_t::f64_classify)(float64_t a) { - return lhs > rhs; + return sv_reg_t(::f64_classify(a)); } -sreg_t sv_proc_t::rv_gt(sreg_t lhs, sreg_t rhs) +sv_reg_t (sv_proc_t::f128_classify)(float128_t a) { - return lhs > rhs; + return sv_reg_t(::f128_classify(a)); } -reg_t sv_proc_t::rv_ge(reg_t lhs, reg_t rhs) +float32_t (sv_proc_t::i32_to_f32)( sv_reg_t v ) { - return lhs >= rhs; + uint64_t x = v/*.get_data()*/; + return ::i32_to_f32(x); } -sreg_t sv_proc_t::rv_ge(sreg_t lhs, sreg_t rhs) +float64_t (sv_proc_t::ui32_to_f64)( sv_reg_t v ) { - return lhs >= rhs; + uint64_t x = v/*.get_data()*/; + return ::ui32_to_f64(x); } -reg_t sv_proc_t::rv_eq(reg_t lhs, reg_t rhs) +float64_t (sv_proc_t::i32_to_f64)( sv_reg_t v ) { - return lhs == rhs; + uint64_t x = v/*.get_data()*/; + return ::i32_to_f64(x); } -reg_t sv_proc_t::rv_ne(reg_t lhs, reg_t rhs) +float32_t (sv_proc_t::ui32_to_f32)( sv_reg_t v ) { - return lhs != rhs; + uint64_t x = v/*.get_data()*/; + return ::ui32_to_f32(x); } +float32_t (sv_proc_t::i64_to_f32)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::i64_to_f32(x); +} + +float32_t (sv_proc_t::ui64_to_f32)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::ui64_to_f32(x); +} + +float64_t (sv_proc_t::i64_to_f64)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::i64_to_f64(x); +} + +float64_t (sv_proc_t::ui64_to_f64)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::ui64_to_f64(x); +} + +float128_t (sv_proc_t::ui64_to_f128)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::ui64_to_f128(x); +} + +float128_t (sv_proc_t::i64_to_f128)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::i64_to_f128(x); +} + +float128_t (sv_proc_t::i32_to_f128)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::i32_to_f128(x); +} + +float128_t (sv_proc_t::ui32_to_f128)( sv_reg_t v ) +{ + uint64_t x = v/*.get_data()*/; + return ::ui32_to_f128(x); +} + +sv_reg_t (sv_proc_t::f32_to_ui32)( float32_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f32_to_ui32(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f32_to_i32)( float32_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f32_to_i32(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f32_to_i64)( float32_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f32_to_i64(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f32_to_ui64)( float32_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f32_to_ui64(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f64_to_ui32)( float64_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f64_to_ui32(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f64_to_i32)( float64_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f64_to_i32(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f64_to_i64)( float64_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f64_to_i64(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f64_to_ui64)( float64_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f64_to_ui64(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f128_to_ui64)( float128_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f128_to_ui64(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f128_to_ui32)( float128_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f128_to_ui32(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f128_to_i32)( float128_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f128_to_i32(a, roundingMode, exact)); +} + +sv_reg_t (sv_proc_t::f128_to_i64)( float128_t a, uint_fast8_t roundingMode, + bool exact ) +{ + return sv_reg_t(::f128_to_i64(a, roundingMode, exact)); +} + +sv_sreg_t (sv_proc_t::mulhsu)(sv_sreg_t a, sv_reg_t b) +{ + return sv_sreg_t(::mulhsu(a/*.get_data()*/, b/*.get_data()*/)); +} + +sv_sreg_t (sv_proc_t::mulh)(sv_sreg_t a, sv_sreg_t b) +{ + return sv_sreg_t(::mulh(a/*.get_data()*/, b/*.get_data()*/)); +} + +sv_reg_t (sv_proc_t::mulhu)(sv_reg_t a, sv_reg_t b) +{ + return sv_reg_t(::mulhu(a/*.get_data()*/, b/*.get_data()*/)); +} + + diff --git a/riscv/sv_insn_redirect.h b/riscv/sv_insn_redirect.h index 8942114..045d2ab 100644 --- a/riscv/sv_insn_redirect.h +++ b/riscv/sv_insn_redirect.h @@ -15,10 +15,13 @@ #undef RVC_RS2 #undef RVC_RS1S #undef RVC_RS2S -//#undef WRITE_REG +#undef WRITE_REG #undef WRITE_FRD +#undef WRITE_RVC_RS1S +#undef WRITE_RVC_RS2S #undef WRITE_RD #undef RVC_SP +#undef SHAMT #undef sext_xlen #undef zext_xlen #undef sext32 @@ -38,8 +41,12 @@ class insn_t; #define RVC_RS1S get_rvc_rs1s() #define RVC_RS2S get_rvc_rs2s() #define RVC_SP get_rvc_sp() +#define SHAMT get_shamt() #define UINT64_MAX uint64_max() +typedef reg_t sv_reg_t; +typedef sreg_t sv_sreg_t; + class sv_proc_t { public: @@ -48,8 +55,15 @@ public: //void (WRITE_RD)(sv_reg_t &value); //void (WRITE_RD)(int_fast64_t value); // XXX TODO investigate //void (WRITE_RD)(uint_fast64_t value); // XXX TODO investigate - void (WRITE_RD)(uint64_t value); // XXX TODO investigate - void (WRITE_REG)(reg_t reg, uint64_t value); + void (WRITE_RD)(sv_reg_t value); // XXX TODO investigate + //void (WRITE_RD)(sv_sreg_t value); // XXX TODO investigate + void (WRITE_RVC_RS2S)(sv_reg_t value); // XXX TODO investigate + //void (WRITE_RVC_RS2S)(sv_sreg_t value); // XXX TODO investigate + void (WRITE_RVC_RS1S)(sv_reg_t value); // XXX TODO investigate + //void (WRITE_RVC_RS1S)(sv_sreg_t value); // XXX TODO investigate + //void (WRITE_REG)(reg_t reg, uint64_t value); + void (WRITE_REG)(reg_t reg, sv_reg_t value); + //void (WRITE_REG)(reg_t reg, sv_sreg_t value); void (WRITE_FRD)(freg_t value); void (WRITE_FRD)(float64_t value); void (WRITE_FRD)(float32_t value); @@ -73,49 +87,110 @@ public: this->insn._insn = i; } - reg_t get_rs1(); - reg_t get_rs2(); - reg_t get_rs3(); + sv_reg_t get_rs1(); + sv_reg_t get_rs2(); + sv_reg_t get_rs3(); + + sv_reg_t get_rvc_sp(); + sv_reg_t get_rvc_rs1(); + sv_reg_t get_rvc_rs2(); + sv_reg_t get_rvc_rs1s(); + sv_reg_t get_rvc_rs2s(); - reg_t get_rvc_sp(); - reg_t get_rvc_rs1(); - reg_t get_rvc_rs2(); - reg_t get_rvc_rs1s(); - reg_t get_rvc_rs2s(); + sv_reg_t get_shamt(); - reg_t uint64_max(); + sv_reg_t uint64_max(); freg_t get_frs1(); freg_t get_frs2(); - reg_t (sext_xlen)(reg_t v); // WARNING... - reg_t (zext_xlen)(reg_t v); + sv_sreg_t (sext_xlen)(sv_sreg_t v); // WARNING... + sv_sreg_t (sext_xlen)(sv_reg_t v); // WARNING... + sv_reg_t (zext_xlen)(sv_reg_t v); //reg_t (sext_xlen)(sv_reg_t &v); //reg_t (sext32)(uint_fast32_t v); // XXX TODO - reg_t (sext32)(reg_t v); + sv_sreg_t (sext32)(sv_reg_t v); + //sv_sreg_t (sext32)(sv_sreg_t v); //reg_t (sext32)(sv_reg_t &v); - reg_t (zext32)(reg_t v); - - reg_t rv_add(reg_t lhs, reg_t rhs); - reg_t rv_sub(reg_t lhs, reg_t rhs); - reg_t rv_div(reg_t lhs, reg_t rhs); - sreg_t rv_div(sreg_t lhs, sreg_t rhs); - reg_t rv_rem(reg_t lhs, reg_t rhs); - sreg_t rv_rem(sreg_t lhs, sreg_t rhs); - reg_t rv_mul(reg_t lhs, reg_t rhs); - reg_t rv_and(reg_t lhs, reg_t rhs); - reg_t rv_or(reg_t lhs, reg_t rhs); - reg_t rv_xor(reg_t lhs, reg_t rhs); - reg_t rv_sl(reg_t lhs, reg_t rhs); - reg_t rv_sr(reg_t lhs, reg_t rhs); - reg_t rv_lt(reg_t lhs, reg_t rhs); - sreg_t rv_lt(sreg_t lhs, sreg_t rhs); - reg_t rv_gt(reg_t lhs, reg_t rhs); - sreg_t rv_gt(sreg_t lhs, sreg_t rhs); - reg_t rv_ge(reg_t lhs, reg_t rhs); - sreg_t rv_ge(sreg_t lhs, sreg_t rhs); - reg_t rv_eq(reg_t lhs, reg_t rhs); - reg_t rv_ne(reg_t lhs, reg_t rhs); + sv_reg_t (zext32)(sv_reg_t v); + + sv_reg_t rv_add(sv_reg_t lhs, sv_reg_t rhs); + sv_reg_t rv_sub(sv_reg_t lhs, sv_reg_t rhs); + sv_reg_t rv_div(sv_reg_t lhs, sv_reg_t rhs); + sv_sreg_t rv_div(sv_sreg_t lhs, sv_sreg_t rhs); + sv_reg_t rv_rem(sv_reg_t lhs, sv_reg_t rhs); + sv_sreg_t rv_rem(sv_sreg_t lhs, sv_sreg_t rhs); + sv_reg_t rv_mul(sv_reg_t lhs, sv_reg_t rhs); + sv_sreg_t rv_mul(sv_sreg_t lhs, sv_reg_t rhs); + sv_sreg_t rv_mul(sv_sreg_t lhs, sv_sreg_t rhs); + sv_reg_t rv_and(sv_reg_t lhs, sv_reg_t rhs); + sv_reg_t rv_or(sv_reg_t lhs, sv_reg_t rhs); + sv_reg_t rv_xor(sv_reg_t lhs, sv_reg_t rhs); + sv_reg_t rv_sl(sv_reg_t lhs, sv_reg_t rhs); + sv_reg_t rv_sr(sv_reg_t lhs, sv_reg_t rhs); + //sv_sreg_t rv_sr(sv_sreg_t lhs, sv_reg_t rhs); + bool rv_lt(sv_reg_t lhs, sv_reg_t rhs); + bool rv_lt(sv_sreg_t lhs, sv_sreg_t rhs); + bool rv_gt(sv_reg_t lhs, sv_reg_t rhs); + bool rv_gt(sv_sreg_t lhs, sv_sreg_t rhs); + bool rv_ge(sv_reg_t lhs, sv_reg_t rhs); + bool rv_ge(sv_sreg_t lhs, sv_sreg_t rhs); + bool rv_eq(sv_reg_t lhs, sv_reg_t rhs); + bool rv_ne(sv_reg_t lhs, sv_reg_t rhs); + + sv_sreg_t sv_reg_to_sreg(sv_reg_t); + sv_reg_t sv_reg_uint32(sv_reg_t); + sv_reg_t sv_reg_int32(sv_reg_t); + + float64_t (f64)(freg_t v); + float64_t (f64)(sv_reg_t v); + float32_t (f32)(sv_reg_t v); + float32_t (f32)(freg_t v); + sv_reg_t (f32_classify)(float32_t a); + sv_reg_t (f64_classify)(float64_t a); + sv_reg_t (f128_classify)(float128_t a); + float32_t (i32_to_f32)(sv_reg_t a); + float32_t (i64_to_f32)(sv_reg_t a); + float32_t (ui64_to_f32)(sv_reg_t a); + float32_t (ui32_to_f32)(sv_reg_t a); + float64_t (i64_to_f64)(sv_reg_t a); + float64_t (ui64_to_f64)(sv_reg_t a); + float64_t (ui32_to_f64)(sv_reg_t a); + float64_t (i32_to_f64)(sv_reg_t a); + float128_t (i32_to_f128)(sv_reg_t a); + float128_t (ui32_to_f128)(sv_reg_t a); + float128_t (i64_to_f128)(sv_reg_t a); + float128_t (ui64_to_f128)(sv_reg_t a); + sv_reg_t (f32_to_ui32)( float32_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f32_to_i32)( float32_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f32_to_i64)( float32_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f32_to_ui64)( float32_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f64_to_ui64)( float64_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f64_to_i32)( float64_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f64_to_ui32)( float64_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f64_to_i64)( float64_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f128_to_ui32)( float128_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f128_to_i32)( float128_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f128_to_i64)( float128_t a, uint_fast8_t roundingMode, + bool exact ); + sv_reg_t (f128_to_ui64)( float128_t a, uint_fast8_t roundingMode, + bool exact ); + + + sv_sreg_t (mulhsu)(sv_sreg_t a, sv_reg_t b); + sv_reg_t (mulhu)(sv_reg_t a, sv_reg_t b); + sv_sreg_t (mulh)(sv_sreg_t a, sv_sreg_t b); + #include "sv_insn_decl.h" };