aboutsummaryrefslogtreecommitdiff
path: root/riscv/insn_template.cc
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2013-07-26 03:34:51 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2013-07-26 03:34:51 -0700
commit0de1489e8ab4a527fbcb1440a8fd5b2d4c8c9260 (patch)
treeaf8831954cb5a8b5d42aae8bed76a2a9b1a114c9 /riscv/insn_template.cc
parentd237ebbd5c7a68443ec94c0127e98071b59399b0 (diff)
downloadspike-0de1489e8ab4a527fbcb1440a8fd5b2d4c8c9260.zip
spike-0de1489e8ab4a527fbcb1440a8fd5b2d4c8c9260.tar.gz
spike-0de1489e8ab4a527fbcb1440a8fd5b2d4c8c9260.tar.bz2
Generate instruction decoder dynamically
This will make it easier for accelerators to add instructions.
Diffstat (limited to 'riscv/insn_template.cc')
-rw-r--r--riscv/insn_template.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/riscv/insn_template.cc b/riscv/insn_template.cc
new file mode 100644
index 0000000..3aca669
--- /dev/null
+++ b/riscv/insn_template.cc
@@ -0,0 +1,25 @@
+// See LICENSE for license details.
+
+#include "processor.h"
+#include "config.h"
+#include "sim.h"
+#include "softfloat.h"
+#include "platform.h" // softfloat isNaNF32UI, etc.
+#include "internals.h" // ditto
+#include <assert.h>
+
+reg_t processor_t::rv32_NAME(insn_t insn, reg_t pc)
+{
+ int xprlen = 32;
+ reg_t npc = sext_xprlen(pc + insn_length(OPCODE));
+ #include "insns/NAME.h"
+ return npc;
+}
+
+reg_t processor_t::rv64_NAME(insn_t insn, reg_t pc)
+{
+ int xprlen = 64;
+ reg_t npc = sext_xprlen(pc + insn_length(OPCODE));
+ #include "insns/NAME.h"
+ return npc;
+}