#include <stdio.h>
#include "decode.h"
#include "sv_decode.h"
-//#include "sv_reg.h"
+#include "sv_reg.h"
#undef RS1
#undef RS2
#define SHAMT get_shamt()
#define UINT64_MAX uint64_max()
-typedef reg_t sv_reg_t;
-typedef sreg_t sv_sreg_t;
+//typedef reg_t sv_reg_t;
+//typedef sreg_t sv_sreg_t;
class sv_proc_t
{
#ifndef SV_REG_H
#define SV_REG_H
+class sv_sreg_t;
+
class sv_reg_t {
public:
- sv_reg_t(uint64_t _reg) : reg(_reg), elwidth(0) {} // default elwidth
+ sv_reg_t(uint64_t _reg) : reg(_reg), elwidth(0) { } // default elwidth
sv_reg_t(uint64_t _reg, uint8_t _elwidth) : reg(_reg), elwidth(_elwidth) {}
uint64_t reg;
public:
uint64_t get_data() { return reg; }
uint8_t get_width() { return elwidth; }
+
+ //operator uint32_t() { return (uint32_t)get_data(); }
+ operator uint64_t() { return (uint64_t)get_data(); }
+ //operator int64_t() { return (int64_t)get_data(); }
+ operator sv_sreg_t();
};
class sv_sreg_t {
public:
int64_t get_data() { return reg; }
uint8_t get_width() { return elwidth; }
+
+ operator int64_t() { return (int64_t)get_data(); }
+ operator sv_reg_t() { return sv_reg_t((uint64_t)reg, elwidth); }
};
+inline sv_reg_t::operator sv_sreg_t() { return sv_sreg_t((int64_t)reg, elwidth); }
#endif