From a0d9e4b9414cfa481b1e5cddc18cb9cc32b0fb93 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 11 Oct 2018 07:34:13 +0100 Subject: [PATCH] add more experimenting on operators --- operators/operators.cc | 6 ++++++ operators/operators.h | 16 ++++++++++++++++ operators/operators_test.h | 1 - 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/operators/operators.cc b/operators/operators.cc index 79f74a5..cb687d8 100644 --- a/operators/operators.cc +++ b/operators/operators.cc @@ -1 +1,7 @@ #include "operators.h" + +reg reg::operator+(reg const& s2) +{ + return 0; //reg(opc, elwidth, v + opc->cvt(s2.v)); +} + diff --git a/operators/operators.h b/operators/operators.h index b9abb3e..219bbe2 100644 --- a/operators/operators.h +++ b/operators/operators.h @@ -8,6 +8,20 @@ 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; + +class reg +{ +public: + opcvt *opc; + uint8_t elwidth; + uint64_t v; + reg(opcvt *o) : opc(o), elwidth(0), v(0) {} + reg(opcvt *o, uint8_t elw, uint64_t _v) : opc(o), elwidth(elw), v(_v) {} + + reg operator+ (reg const& s2); +}; + class opcvt { public: @@ -22,4 +36,6 @@ public: //R operator+ (op2 &s2) { return typecvt(s1 + typecvt(s2)); } //operator R() { return typecvt(s1); } + + //void WRITE_RD(reg_t); }; diff --git a/operators/operators_test.h b/operators/operators_test.h index e9a8d31..e69de29 100644 --- a/operators/operators_test.h +++ b/operators/operators_test.h @@ -1 +0,0 @@ -#define require_rv64 -- 2.30.2