From 787450f4d9b453ce89c871b3b380706d701c909a Mon Sep 17 00:00:00 2001 From: Yunsup Lee Date: Fri, 18 Oct 2013 19:19:00 -0700 Subject: [PATCH] more hwacha supervisor stuff --- hwacha/decode_hwacha_ut.h | 3 ++- hwacha/hwacha.cc | 14 ++++++-------- hwacha/hwacha.h | 11 +++++++---- hwacha/insn_template_hwacha_ut.cc | 6 ++++-- hwacha/insns/vxcptaux.h | 2 +- hwacha/insns/vxcptcause.h | 2 +- 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 get_instructions(); std::vector 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(p->get_extension()); - for (uint32_t i=0; iget_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(); -- 2.30.2