diff options
author | Jerry Shih <bignose1007@gmail.com> | 2019-05-09 13:19:27 +0800 |
---|---|---|
committer | Jerry Shih <bignose1007@gmail.com> | 2019-05-09 13:35:44 +0800 |
commit | a938c4a62e49d90e179f48a8de77a14eeaa61606 (patch) | |
tree | d57d7bad5087cda9871e2f372ff5ee8d24338ab9 /riscv/disasm.h | |
parent | 51a372c8e71059dcdf6a554a0a461ab30b0381a8 (diff) | |
download | spike-a938c4a62e49d90e179f48a8de77a14eeaa61606.zip spike-a938c4a62e49d90e179f48a8de77a14eeaa61606.tar.gz spike-a938c4a62e49d90e179f48a8de77a14eeaa61606.tar.bz2 |
Add a tool "spike-log-parser" to get the instruction name from spike log.
Usage:
./spike-log-parser < $(log_file)
Here is the example log:
x15 a5 <- 0x000000008004935e 2147783518
core 0: 0x000000008000c362 (0xca278793) addi a5, a5, -862
x15 a5 <- 0x0000000080049000 2147782656
core 0: 0x000000008000c366 (0x0000639c) c.ld a5, 0(a5)
x15 a5 <- 0x0000000000000000 0
core 0: 0x000000008000c368 (0xfef43423) sd a5, -24(s0)
The output will be:
addi
c.ld
sd
Diffstat (limited to 'riscv/disasm.h')
-rw-r--r-- | riscv/disasm.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/riscv/disasm.h b/riscv/disasm.h index d322731..3d1e95e 100644 --- a/riscv/disasm.h +++ b/riscv/disasm.h @@ -40,6 +40,11 @@ class disasm_insn_t return (insn.bits() & mask) == match; } + const char* get_name() const + { + return name; + } + std::string to_string(insn_t insn) const { std::stringstream s; @@ -83,12 +88,15 @@ class disassembler_t public: disassembler_t(int xlen); ~disassembler_t(); + std::string disassemble(insn_t insn) const; + const disasm_insn_t* lookup(insn_t insn) const; + void add_insn(disasm_insn_t* insn); + private: static const int HASH_SIZE = 256; std::vector<const disasm_insn_t*> chain[HASH_SIZE+1]; - const disasm_insn_t* lookup(insn_t insn) const; }; #endif |