aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2011-04-07 15:41:00 -0700
committerAndrew Waterman <waterman@s144.Millennium.Berkeley.EDU>2011-04-07 15:41:00 -0700
commit474eb8f8c73714e74d0075a588ff75b5d6636b2a (patch)
treeb2f6684f73f19beb01aa6dea878ef9d874e138e2
parentebd32f03d1183282ffe7ac9cc1d87802e201bd23 (diff)
downloadriscv-opcodes-474eb8f8c73714e74d0075a588ff75b5d6636b2a.zip
riscv-opcodes-474eb8f8c73714e74d0075a588ff75b5d6636b2a.tar.gz
riscv-opcodes-474eb8f8c73714e74d0075a588ff75b5d6636b2a.tar.bz2
[pk,sim] fixed parse-opcodes bug
was causing spurious illegal instruction traps
-rwxr-xr-xparse-opcodes4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse-opcodes b/parse-opcodes
index 7ba1bbe..6857c58 100755
--- a/parse-opcodes
+++ b/parse-opcodes
@@ -102,7 +102,7 @@ def make_switch(match,mask):
for funct in range(0,1<<funct_size):
has_some_instruction = 0
for name in match.iterkeys():
- if (opc << opcode_base | funct << funct_base) == (match[name] & (opcode_mask | funct_mask)):
+ if ((opc << opcode_base | funct << funct_base) & mask[name]) == (match[name] & (opcode_mask | funct_mask)):
has_some_instruction = 1
if not has_some_instruction: continue
print ' case 0x%x:' % funct
@@ -120,7 +120,7 @@ def make_switch(match,mask):
for name in match.iterkeys():
name2 = name.replace('.','_')
# case 2: general case: opcode + funct incompletely describe insn
- if (opc << opcode_base | funct << funct_base) == (match[name] & (opcode_mask | funct_mask)):
+ if ((opc << opcode_base | funct << funct_base) & mask[name]) == (match[name] & (opcode_mask | funct_mask)):
print ' if((insn.bits & 0x%x) == 0x%x)' % (mask[name],match[name])
print ' {'
print ' #include "insns/%s.h"' % name2