aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuan Nguyen <quannguyen@berkeley.edu>2013-11-29 20:10:46 -0800
committerQuan Nguyen <quannguyen@berkeley.edu>2013-11-29 20:10:46 -0800
commit05f9118e82283a6225534098487fa2011d065fd1 (patch)
tree45e5a41816aab6ed899ffc09d5ecdf842618bcf1
parentaf0a01988181dff9b36c560611af1d95f6add849 (diff)
downloadriscv-isa-sim-05f9118e82283a6225534098487fa2011d065fd1.zip
riscv-isa-sim-05f9118e82283a6225534098487fa2011d065fd1.tar.gz
riscv-isa-sim-05f9118e82283a6225534098487fa2011d065fd1.tar.bz2
Add vsetprec instruction prototype
-rw-r--r--hwacha/decode_hwacha.h1
-rw-r--r--hwacha/hwacha.cc1
-rw-r--r--hwacha/hwacha.h1
-rw-r--r--hwacha/insns/vsetprec.h13
-rw-r--r--hwacha/opcodes_hwacha.h1
5 files changed, 17 insertions, 0 deletions
diff --git a/hwacha/decode_hwacha.h b/hwacha/decode_hwacha.h
index b7069fa..badf750 100644
--- a/hwacha/decode_hwacha.h
+++ b/hwacha/decode_hwacha.h
@@ -20,6 +20,7 @@
#define WRITE_VL(vlnext) (h->get_ct_state()->vl = (vlnext))
#define WRITE_UTIDX(value) (h->get_ct_state()->count = (value))
#define WRITE_VF_PC(pcnext) (h->get_ct_state()->vf_pc = (pcnext))
+#define WRITE_PREC(precision) (h->get_ct_state()->prec = (precision))
#define INSN_RS1 (insn.rs1())
#define INSN_RS2 (insn.rs2())
diff --git a/hwacha/hwacha.cc b/hwacha/hwacha.cc
index 8caf91e..1a89d73 100644
--- a/hwacha/hwacha.cc
+++ b/hwacha/hwacha.cc
@@ -11,6 +11,7 @@ void ct_state_t::reset()
maxvl = 32;
vl = 0;
count = 0;
+ prec = 64;
vf_pc = -1;
}
diff --git a/hwacha/hwacha.h b/hwacha/hwacha.h
index df0add3..bbdd7c7 100644
--- a/hwacha/hwacha.h
+++ b/hwacha/hwacha.h
@@ -12,6 +12,7 @@ struct ct_state_t
uint32_t maxvl;
uint32_t vl;
uint32_t count;
+ uint32_t prec;
reg_t vf_pc;
};
diff --git a/hwacha/insns/vsetprec.h b/hwacha/insns/vsetprec.h
new file mode 100644
index 0000000..b36f27c
--- /dev/null
+++ b/hwacha/insns/vsetprec.h
@@ -0,0 +1,13 @@
+uint32_t prec = u.r.funct;
+switch (prec) {
+ case 16:
+ case 32:
+ case 64:
+ printf("Precision set to %d bits\n", prec);
+ WRITE_PREC(prec);
+ break;
+
+ default:
+ h->take_exception(HWACHA_CAUSE_ILLEGAL_CFG, 2);
+ break;
+}
diff --git a/hwacha/opcodes_hwacha.h b/hwacha/opcodes_hwacha.h
index e384b37..297b3af 100644
--- a/hwacha/opcodes_hwacha.h
+++ b/hwacha/opcodes_hwacha.h
@@ -26,6 +26,7 @@ DECLARE_INSN(vlsegwu, 0xc00205b, 0x1ff0707f)
DECLARE_INSN(vmsv, 0x200202b, 0xfff0707f)
DECLARE_INSN(vmvv, 0x200002b, 0xfff0707f)
DECLARE_INSN(vsetcfg, 0x200b, 0x7fff)
+DECLARE_INSN(vsetprec, 0x805b, 0xfffff)
DECLARE_INSN(vsetvl, 0x600b, 0xfff0707f)
DECLARE_INSN(vssegb, 0x207b, 0x1ff0707f)
DECLARE_INSN(vssegd, 0x600207b, 0x1ff0707f)