summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--instr-table.tex18
-rw-r--r--opcodes8
-rwxr-xr-xparse-opcodes24
3 files changed, 28 insertions, 22 deletions
diff --git a/instr-table.tex b/instr-table.tex
index f70e4a4..754816b 100644
--- a/instr-table.tex
+++ b/instr-table.tex
@@ -421,20 +421,22 @@
&
-\multicolumn{1}{|c|}{rd} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{5}{c|}{imm12} &
+\multicolumn{1}{|c|}{00000} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{4}{c|}{0000000} &
\multicolumn{2}{c|}{001} &
-\multicolumn{1}{c|}{0101111} & FENCE.I rd,rs1,imm12 \\
+\multicolumn{1}{c|}{0101111} & FENCE.I \\
\cline{2-11}
&
-\multicolumn{1}{|c|}{rd} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{5}{c|}{imm12} &
+\multicolumn{1}{|c|}{00000} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{4}{c|}{0000000} &
\multicolumn{2}{c|}{010} &
-\multicolumn{1}{c|}{0101111} & FENCE rd,rs1,imm12 \\
+\multicolumn{1}{c|}{0101111} & FENCE \\
\cline{2-11}
diff --git a/opcodes b/opcodes
index f5ba9f4..24c3f0a 100644
--- a/opcodes
+++ b/opcodes
@@ -108,10 +108,10 @@ lr.d rd rs1 21..17=0 16=1 15..10=0 9..7=3 6..2=0x0A 1..0=3
sc.w rd rs1 rs2 16=1 15..10=1 9..7=2 6..2=0x0A 1..0=3
sc.d rd rs1 rs2 16=1 15..10=1 9..7=3 6..2=0x0A 1..0=3
-fence.i rd rs1 imm12 9..7=1 6..2=0x0B 1..0=3
-fence rd rs1 imm12 9..7=2 6..2=0x0B 1..0=3
-fence.v.l rd rs1 imm12 9..7=4 6..2=0x0B 1..0=3
-fence.v.g rd rs1 imm12 9..7=5 6..2=0x0B 1..0=3
+fence.i 31..10=ignore 9..7=1 6..2=0x0B 1..0=3
+fence 31..10=ignore 9..7=2 6..2=0x0B 1..0=3
+fence.v.l 31..10=ignore 9..7=4 6..2=0x0B 1..0=3
+fence.v.g 31..10=ignore 9..7=5 6..2=0x0B 1..0=3
syscall 31..27=0 26..22=0 21..17=0 16..10=0 9..7=0 6..2=0x1D 1..0=3
break 31..27=0 26..22=0 21..17=0 16..10=0 9..7=1 6..2=0x1D 1..0=3
diff --git a/parse-opcodes b/parse-opcodes
index d918d40..fceefdb 100755
--- a/parse-opcodes
+++ b/parse-opcodes
@@ -526,29 +526,33 @@ for line in sys.stdin:
for token in tokens[1:]:
if len(token.split('=')) == 2:
- tmp = token.split('=')
- val = int(tmp[1],0)
- if len(tmp[0].split('..')) == 2:
- tmp = tmp[0].split('..')
+ tokens = token.split('=')
+ if len(tokens[0].split('..')) == 2:
+ tmp = tokens[0].split('..')
hi = int(tmp[0])
lo = int(tmp[1])
if hi <= lo:
sys.exit("%s: bad range %d..%d" % (name,hi,lo))
else:
- hi = lo = int(tmp[0])
- if val >= (1 << (hi-lo+1)):
- sys.exit("%s: bad value %d for range %d..%d" % (name,val,hi,lo))
- mymatch = mymatch | (val << lo)
- mymask = mymask | ((1<<(hi+1))-(1<<lo))
+ hi = lo = int(tokens[0])
+
+ if tokens[1] != 'ignore':
+ val = int(tokens[1], 0)
+ if val >= (1 << (hi-lo+1)):
+ sys.exit("%s: bad value %d for range %d..%d" % (name,val,hi,lo))
+ mymatch = mymatch | (val << lo)
+ mymask = mymask | ((1<<(hi+1))-(1<<lo))
+
if cover & ((1<<(hi+1))-(1<<lo)):
sys.exit("%s: overspecified" % name)
cover = cover | ((1<<(hi+1))-(1<<lo))
+
elif token in arglut:
if cover & ((1<<(arglut[token][0]+1))-(1<<arglut[token][1])):
sys.exit("%s: overspecified" % name)
cover = cover | ((1<<(arglut[token][0]+1))-(1<<arglut[token][1]))
-
arguments[name].append(token)
+
else:
sys.exit("%s: unknown token %s" % (name,token))