diff options
author | Andrew Waterman <waterman@cs.berkeley.edu> | 2013-07-26 03:34:51 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@cs.berkeley.edu> | 2013-07-26 03:34:51 -0700 |
commit | 0de1489e8ab4a527fbcb1440a8fd5b2d4c8c9260 (patch) | |
tree | af8831954cb5a8b5d42aae8bed76a2a9b1a114c9 /riscv/insn_template.cc | |
parent | d237ebbd5c7a68443ec94c0127e98071b59399b0 (diff) | |
download | spike-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.cc | 25 |
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; +} |