+#include "stdint.h"
+#include "decode.h"
+
+typedef uint64_t (*cvt)(uint64_t r);
+
+uint64_t u64_u64_cvt(reg_t r) { return r; }
+uint64_t u64_u16_cvt(reg_t r) { return (uint64_t)(uint16_t)r; }
+
+uint64_t (sext32)(reg_t r) { return sext32(r); }
+
+class opcvt
+{
+public:
+ cvt cv_rd;
+ cvt cv_rs1;
+ cvt cv_rs2;
+ opcvt(cvt _cv_rd, cvt _cv_rs1, cvt _cv_rs2) :
+ cv_rd(_cv_rd), cv_rs1(_cv_rs1), cv_rs2(_cv_rs2) {}
+
+ void add(reg_t &rd, const reg_t &rs1, const reg_t &rs2)
+ { rd = cv_rd(cv_rs1(rs1) + cv_rs2(rs2)); }
+
+ //R operator+ (op2 &s2) { return typecvt(s1 + typecvt(s2)); }
+ //operator R() { return typecvt(s1); }
+};
#include <stdio.h>
+#include "operators.h"
+#include "operators_test.h"
+#include "decode.h"
+
int main(int argc, char *argv[])
{
- printf("hello\n");
+ /*op2<uint16_t, uint16_t, uint32_t> o(0xfff0);
+ uint32_t p = 0xfffffef;
+ o = o + p;
+ */
+ opcvt cvt(u64_u64_cvt, u64_u64_cvt, sext32);
+ uint64_t o = 0xff00;
+ uint64_t s1 = 0x1ff01;
+ uint64_t s2 = 0x2ff01;
+ cvt.add(o, s1, s2);
+ printf("hello %lx\n", o);
}