Add vsetprec instruction prototype
authorQuan Nguyen <quannguyen@berkeley.edu>
Sat, 30 Nov 2013 04:10:46 +0000 (20:10 -0800)
committerQuan Nguyen <quannguyen@berkeley.edu>
Sat, 30 Nov 2013 04:10:46 +0000 (20:10 -0800)
hwacha/decode_hwacha.h
hwacha/hwacha.cc
hwacha/hwacha.h
hwacha/insns/vsetprec.h [new file with mode: 0644]
hwacha/opcodes_hwacha.h

index b7069fad74c08ed092599229c757390e543d6c90..badf75010b3eaeef6a545e9c3a6691f2cac0059a 100644 (file)
@@ -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())
index 8caf91ead81acfd9a692c85d3f7f12e3275954b1..1a89d733d1a3f18931def2b794f6f00cafa4a9a1 100644 (file)
@@ -11,6 +11,7 @@ void ct_state_t::reset()
   maxvl = 32;
   vl = 0;
   count = 0;
+  prec = 64;
 
   vf_pc = -1;
 }
index df0add3bc03d6c766a7323bc73ba18255f0f990a..bbdd7c730708bafc32a265049c5812cafd16907e 100644 (file)
@@ -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 (file)
index 0000000..b36f27c
--- /dev/null
@@ -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;
+}
index e384b375e79ea9c3a8866467ad9a07e5f1348878..297b3afca604d91a973de66a0e36553168012f1d 100644 (file)
@@ -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)