projects
/
riscv-isa-sim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bf8c76b
)
properly sign-extend instructions in spike-dasm
author
Andrew Waterman
<waterman@cs.berkeley.edu>
Thu, 29 Jan 2015 20:49:30 +0000
(12:49 -0800)
committer
Andrew Waterman
<waterman@cs.berkeley.edu>
Thu, 29 Jan 2015 20:49:57 +0000
(12:49 -0800)
spike_main/spike-dasm.cc
patch
|
blob
|
history
diff --git
a/spike_main/spike-dasm.cc
b/spike_main/spike-dasm.cc
index d0af451f737c309d901ef1b253074f6c51b513ef..7f15db0bb168be15967d1b14572cba92f75087bb 100644
(file)
--- a/
spike_main/spike-dasm.cc
+++ b/
spike_main/spike-dasm.cc
@@
-31,8
+31,13
@@
int main(int argc, char** argv)
if (end == string::npos)
break;
+ char* endp;
size_t numstart = start + strlen("DASM(");
- insn_bits_t bits = strtoull(&s[numstart], NULL, 16);
+ int64_t bits = strtoull(&s[numstart], &endp, 16);
+ size_t nbits = 4 * (endp - &s[numstart]);
+ if (nbits < 64)
+ bits = bits << (64 - nbits) >> (64 - nbits);
+
string dis = d.disassemble(bits);
s = s.substr(0, start) + dis + s.substr(end+1);
start += dis.length();