void (sv_proc_t::WRITE_RD)(reg_t value)
{
- WRITE_RD( value );
+ WRITE_REG( insn->rd(), value );
}
/*
}
*/
-RS1::operator reg_t () const & {
- return _insn->p->get_state()->XPR[_insn->rs1()];
+reg_t sv_proc_t::get_rs1()
+{
+ return insn->p->get_state()->XPR[insn->rs1()];
}
-RS2::operator reg_t () const & {
- return _insn->p->get_state()->XPR[_insn->rs2()];
+reg_t sv_proc_t::get_rs2()
+{
+ return insn->p->get_state()->XPR[insn->rs2()];
+}
+
+freg_t sv_proc_t::get_frs1()
+{
+ return READ_FREG(insn->rs1());
}
#undef RS1
#undef RS2
+#undef FRS1
class processor_t;
class insn_t;
-class RS1 {
+/*
+class FRS1 {
public:
sv_insn_t *_insn;
- RS1() : _insn(NULL) {}
+ FRS1() : _insn(NULL) {}
//sv_insn_t & operator = (sv_insn_t &i)
//{ _insn = &i; return i; }
- operator reg_t () const &;
+ operator freg_t () const &;
};
+*/
+
+#define FRS1 get_frs1()
+#define RS1 get_rs1()
+#define RS2 get_rs2()
+/*
class RS2 {
public:
sv_insn_t *_insn;
//{ _insn = &i; return i; }
operator reg_t () const &;
};
+*/
class sv_proc_t
{
public:
- sv_proc_t(processor_t *_p) : p(_p) {}
+ sv_proc_t(processor_t *_p) : p(_p), insn(NULL) {}
void (WRITE_RD)(reg_t value);
//reg_t (READ_REG)(uint64_t i);
processor_t *p;
-
- class RS1 RS1;
- class RS2 RS2;
-
- class {
- public:
- sv_insn_t *_insn;
- sv_insn_t & operator = (sv_insn_t &i)
- { _insn = &i; return i; }
- operator sv_insn_t () const & { return *_insn; }
- uint64_t rd() { return _insn->rd(); }
- } insn;
+ sv_insn_t *insn;
void set_insn(sv_insn_t *i) {
- this->insn = *i;
- RS1._insn = i;
- RS2._insn = i;
+ this->insn = i;
}
+ reg_t get_rs1();
+ reg_t get_rs2();
+
+ freg_t get_frs1();
+
#include "sv_insn_decl.h"
};