aboutsummaryrefslogtreecommitdiff
path: root/hwacha
diff options
context:
space:
mode:
authorYunsup Lee <yunsup@cs.berkeley.edu>2013-10-18 19:19:00 -0700
committerYunsup Lee <yunsup@cs.berkeley.edu>2013-10-18 19:19:00 -0700
commit787450f4d9b453ce89c871b3b380706d701c909a (patch)
tree5713e540fb6a9568cc453e92b70690f950086aa9 /hwacha
parentcb6cfc5f3ad18280c6dce1f03ee4ff87e4677dad (diff)
downloadspike-787450f4d9b453ce89c871b3b380706d701c909a.zip
spike-787450f4d9b453ce89c871b3b380706d701c909a.tar.gz
spike-787450f4d9b453ce89c871b3b380706d701c909a.tar.bz2
more hwacha supervisor stuff
Diffstat (limited to 'hwacha')
-rw-r--r--hwacha/decode_hwacha_ut.h3
-rw-r--r--hwacha/hwacha.cc14
-rw-r--r--hwacha/hwacha.h11
-rw-r--r--hwacha/insn_template_hwacha_ut.cc6
-rw-r--r--hwacha/insns/vxcptaux.h2
-rw-r--r--hwacha/insns/vxcptcause.h2
6 files changed, 21 insertions, 17 deletions
diff --git a/hwacha/decode_hwacha_ut.h b/hwacha/decode_hwacha_ut.h
index c2e0032..44b993b 100644
--- a/hwacha/decode_hwacha_ut.h
+++ b/hwacha/decode_hwacha_ut.h
@@ -6,7 +6,8 @@
#include "hwacha.h"
#include "hwacha_xcpt.h"
-#define UTIDX (i)
+#define UTIDX (h->get_ct_state()->count)
+#define WRITE_UTIDX(value) (h->get_ct_state()->count = (value))
#undef RS1
#undef RS2
diff --git a/hwacha/hwacha.cc b/hwacha/hwacha.cc
index 192d308..74cbbcf 100644
--- a/hwacha/hwacha.cc
+++ b/hwacha/hwacha.cc
@@ -5,15 +5,13 @@
void ct_state_t::reset()
{
- vl = 0;
- maxvl = 32;
nxpr = 32;
nfpr = 32;
+ maxvl = 32;
+ vl = 0;
+ count = 0;
vf_pc = -1;
-
- cause = 0;
- aux = 0;
}
void ut_state_t::reset()
@@ -97,10 +95,10 @@ bool hwacha_t::vf_active()
return false;
}
-void hwacha_t::take_exception(reg_t cause, reg_t aux)
+void hwacha_t::take_exception(reg_t c, reg_t a)
{
- get_ct_state()->cause = cause;
- get_ct_state()->aux = aux;
+ cause = c;
+ aux = a;
raise_interrupt();
if (!(p->get_state()->sr & SR_EI))
throw std::logic_error("hwacha exception posted, but SR_EI bit not set!");
diff --git a/hwacha/hwacha.h b/hwacha/hwacha.h
index 7504e57..100477c 100644
--- a/hwacha/hwacha.h
+++ b/hwacha/hwacha.h
@@ -11,11 +11,9 @@ struct ct_state_t
uint32_t nfpr;
uint32_t maxvl;
uint32_t vl;
+ uint32_t count;
reg_t vf_pc;
-
- reg_t cause;
- reg_t aux;
};
struct ut_state_t
@@ -30,7 +28,7 @@ struct ut_state_t
class hwacha_t : public extension_t
{
public:
- hwacha_t() : debug(false) {}
+ hwacha_t() : cause(0), aux(0), debug(false) {}
std::vector<insn_desc_t> get_instructions();
std::vector<disasm_insn_t*> get_disasms();
const char* name() { return "hwacha"; }
@@ -40,6 +38,8 @@ public:
ct_state_t* get_ct_state() { return &ct_state; }
ut_state_t* get_ut_state(int idx) { return &ut_state[idx]; }
bool vf_active();
+ reg_t get_cause() { return cause; }
+ reg_t get_aux() { return aux; }
void take_exception(reg_t, reg_t);
void clear_exception() { clear_interrupt(); }
@@ -50,6 +50,9 @@ private:
static const int max_uts = 2048;
ct_state_t ct_state;
ut_state_t ut_state[max_uts];
+ reg_t cause;
+ reg_t aux;
+
disassembler_t ut_disassembler;
bool debug;
};
diff --git a/hwacha/insn_template_hwacha_ut.cc b/hwacha/insn_template_hwacha_ut.cc
index 7dad75d..79e7c2f 100644
--- a/hwacha/insn_template_hwacha_ut.cc
+++ b/hwacha/insn_template_hwacha_ut.cc
@@ -15,8 +15,10 @@ reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc)
int xprlen = 64;
reg_t npc = sext_xprlen(pc + insn_length(OPCODE));
hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
- for (uint32_t i=0; i<VL; i++) {
+ do {
#include "insns_ut/NAME.h"
- }
+ WRITE_UTIDX(UTIDX+1);
+ } while (UTIDX < VL);
+ WRITE_UTIDX(0);
return npc;
}
diff --git a/hwacha/insns/vxcptaux.h b/hwacha/insns/vxcptaux.h
index 92e2920..77318c3 100644
--- a/hwacha/insns/vxcptaux.h
+++ b/hwacha/insns/vxcptaux.h
@@ -1,2 +1,2 @@
require_supervisor_hwacha;
-xd = h->get_ct_state()->aux;
+xd = h->get_aux();
diff --git a/hwacha/insns/vxcptcause.h b/hwacha/insns/vxcptcause.h
index e959247..3054ff9 100644
--- a/hwacha/insns/vxcptcause.h
+++ b/hwacha/insns/vxcptcause.h
@@ -1,3 +1,3 @@
require_supervisor_hwacha;
h->clear_exception();
-xd = h->get_ct_state()->cause;
+xd = h->get_cause();