aboutsummaryrefslogtreecommitdiff
path: root/parse-opcodes
diff options
context:
space:
mode:
Diffstat (limited to 'parse-opcodes')
-rwxr-xr-xparse-opcodes205
1 files changed, 145 insertions, 60 deletions
diff --git a/parse-opcodes b/parse-opcodes
index b3b93ab..50e602c 100755
--- a/parse-opcodes
+++ b/parse-opcodes
@@ -149,16 +149,17 @@ def str_arg(arg0,arg1,match,arguments):
def str_inst(name,arguments):
ret = name.upper() + ' '
for idx in range(len(arguments)):
- ret = ret + arguments[idx]
- if idx != len(arguments)-1:
- ret = ret + ','
+ if arguments[idx] != 'rm':
+ ret = ret + arguments[idx]
+ if idx != len(arguments)-1:
+ ret = ret + ','
return ret
def print_unimp_type(name,match,arguments):
print """
&
-\\multicolumn{9}{|c|}{%s} & %s \\\\
-\\cline{2-10}
+\\multicolumn{11}{|c|}{%s} & %s \\\\
+\\cline{2-12}
""" % \
( \
'0'*32, \
@@ -169,8 +170,8 @@ def print_j_type(name,match,arguments):
print """
&
\\multicolumn{1}{|c|}{%s} &
-\\multicolumn{8}{c|}{%s} & %s \\\\
-\\cline{2-10}
+\\multicolumn{10}{c|}{%s} & %s \\\\
+\\cline{2-12}
""" % \
( \
binary(yank(match,27,5),5), \
@@ -183,8 +184,8 @@ def print_lui_type(name,match,arguments):
&
\\multicolumn{2}{|c|}{%s} &
\\multicolumn{1}{c|}{%s} &
-\\multicolumn{6}{c|}{%s} & %s \\\\
-\\cline{2-10}
+\\multicolumn{8}{c|}{%s} & %s \\\\
+\\cline{2-12}
""" % \
( \
binary(yank(match,25,7),7), \
@@ -199,9 +200,9 @@ def print_i_type(name,match,arguments):
\\multicolumn{2}{|c|}{%s} &
\\multicolumn{1}{c|}{%s} &
\\multicolumn{1}{c|}{%s} &
-\\multicolumn{1}{c|}{%s} &
-\\multicolumn{4}{c|}{%s} & %s \\\\
-\\cline{2-10}
+\\multicolumn{2}{c|}{%s} &
+\\multicolumn{5}{c|}{%s} & %s \\\\
+\\cline{2-12}
""" % \
( \
binary(yank(match,25,7),7), \
@@ -218,9 +219,9 @@ def print_ish_type(name,match,arguments):
\\multicolumn{2}{|c|}{%s} &
\\multicolumn{1}{c|}{%s} &
\\multicolumn{1}{c|}{%s} &
-\\multicolumn{3}{c|}{%s} &
+\\multicolumn{5}{c|}{%s} &
\\multicolumn{2}{c|}{%s} & %s \\\\
-\\cline{2-10}
+\\cline{2-12}
""" % \
( \
binary(yank(match,25,7),7), \
@@ -237,10 +238,10 @@ def print_ishw_type(name,match,arguments):
\\multicolumn{2}{|c|}{%s} &
\\multicolumn{1}{c|}{%s} &
\\multicolumn{1}{c|}{%s} &
-\\multicolumn{3}{c|}{%s} &
+\\multicolumn{5}{c|}{%s} &
\\multicolumn{1}{c|}{0} &
\\multicolumn{1}{c|}{%s} & %s \\\\
-\\cline{2-10}
+\\cline{2-12}
""" % \
( \
binary(yank(match,25,7),7), \
@@ -257,9 +258,9 @@ def print_r_type(name,match,arguments):
\\multicolumn{2}{|c|}{%s} &
\\multicolumn{1}{c|}{%s} &
\\multicolumn{1}{c|}{%s} &
-\\multicolumn{4}{c|}{%s} &
+\\multicolumn{6}{c|}{%s} &
\\multicolumn{1}{c|}{%s} & %s \\\\
-\\cline{2-10}
+\\cline{2-12}
""" % \
( \
binary(yank(match,25,7),7), \
@@ -270,16 +271,39 @@ def print_r_type(name,match,arguments):
str_inst(name,arguments) \
)
-def print_r4_type(name,match,arguments):
+def print_r_rm_type(name,match,arguments):
print """
&
\\multicolumn{2}{|c|}{%s} &
\\multicolumn{1}{c|}{%s} &
\\multicolumn{1}{c|}{%s} &
+\\multicolumn{1}{c|}{%s} &
\\multicolumn{2}{c|}{%s} &
+\\multicolumn{3}{c|}{%s} &
+\\multicolumn{1}{c|}{%s} & %s \\\\
+\\cline{2-12}
+ """ % \
+ ( \
+ binary(yank(match,25,7),7), \
+ str_arg('rs2','',match,arguments), \
+ str_arg('rs1','',match,arguments), \
+ binary(yank(match,13,2),2), \
+ str_arg('rm','',match,arguments), \
+ binary(yank(match,5,6),6), \
+ str_arg('rdr','',match,arguments), \
+ str_inst(name,arguments) \
+ )
+
+def print_r4_type(name,match,arguments):
+ print """
+&
+\\multicolumn{2}{|c|}{%s} &
+\\multicolumn{1}{c|}{%s} &
+\\multicolumn{1}{c|}{%s} &
+\\multicolumn{4}{c|}{%s} &
\\multicolumn{2}{c|}{%s} &
\\multicolumn{1}{c|}{%s} & %s \\\\
-\\cline{2-10}
+\\cline{2-12}
""" % \
( \
binary(yank(match,25,7),7), \
@@ -291,6 +315,31 @@ def print_r4_type(name,match,arguments):
str_inst(name,arguments) \
)
+def print_r4_rm_type(name,match,arguments):
+ print """
+&
+\\multicolumn{2}{|c|}{%s} &
+\\multicolumn{1}{c|}{%s} &
+\\multicolumn{1}{c|}{%s} &
+\\multicolumn{1}{c|}{%s} &
+\\multicolumn{2}{c|}{%s} &
+\\multicolumn{1}{c|}{%s} &
+\\multicolumn{2}{c|}{%s} &
+\\multicolumn{1}{c|}{%s} & %s \\\\
+\\cline{2-12}
+ """ % \
+ ( \
+ binary(yank(match,25,7),7), \
+ str_arg('rs2','',match,arguments), \
+ str_arg('rs1','',match,arguments), \
+ binary(yank(match,13,2),2), \
+ str_arg('rm','',match,arguments), \
+ binary(yank(match,10,1),1), \
+ str_arg('rs3','',match,arguments), \
+ str_arg('rdr','',match,arguments), \
+ str_inst(name,arguments) \
+ )
+
def print_header():
print """
\\newpage
@@ -298,14 +347,16 @@ def print_header():
\\begin{table}[p]
\\begin{small}
\\begin{center}
-\\begin{tabular}{rcccccccccl}
+\\begin{tabular}{rcccccccccccl}
&
\\hspace*{0.6in} &
\\hspace*{0.2in} &
\\hspace*{0.5in} &
\\hspace*{0.5in} &
-\\hspace*{0.3in} &
-\\hspace*{0.2in} &
+\\hspace*{0.5in} &
+\\hspace*{0.1in} &
+\\hspace*{0.1in} &
+\\hspace*{0.1in} &
\\hspace*{0.4in} &
\\hspace*{0.1in} &
\\hspace*{0.5in} \\\\
@@ -314,59 +365,61 @@ def print_header():
\\instbitrange{26}{25} &
\\instbitrange{24}{20} &
\\instbitrange{19}{15} &
-\\instbitrange{14}{12} &
-\\instbitrange{11}{10} &
+\\instbitrange{14}{13} &
+\\instbit{12} &
+\\instbit{11} &
+\\instbit{10} &
\\instbitrange{9}{6} &
\\instbit{5} &
\\instbitrange{4}{0} \\\\
-\\cline{2-10}
+\\cline{2-12}
&
\\multicolumn{1}{|c|}{opcode5} &
-\\multicolumn{8}{c|}{jump target} & J-type \\\\
-\\cline{2-10}
+\\multicolumn{10}{c|}{jump target} & J-type \\\\
+\\cline{2-12}
&
\\multicolumn{2}{|c|}{opcode} &
\\multicolumn{1}{c|}{rdi} &
-\\multicolumn{6}{c|}{LUI-immediate} & LUI-type \\\\
-\\cline{2-10}
+\\multicolumn{8}{c|}{LUI-immediate} & LUI-type \\\\
+\\cline{2-12}
&
\\multicolumn{2}{|c|}{opcode} &
\\multicolumn{1}{c|}{rdi/rs2} &
\\multicolumn{1}{c|}{rs1} &
-\\multicolumn{1}{c|}{funct3} &
-\\multicolumn{4}{c|}{immediate} & I-type \\\\
-\\cline{2-10}
+\\multicolumn{2}{c|}{funct3} &
+\\multicolumn{5}{c|}{immediate} & I-type \\\\
+\\cline{2-12}
&
\\multicolumn{2}{|c|}{opcode} &
\\multicolumn{1}{c|}{rdi} &
\\multicolumn{1}{c|}{rs1} &
-\\multicolumn{3}{c|}{funct9} &
+\\multicolumn{5}{c|}{funct9} &
\\multicolumn{2}{c|}{shamt} & ISH-type \\\\
-\\cline{2-10}
+\\cline{2-12}
&
\\multicolumn{2}{|c|}{opcode} &
\\multicolumn{1}{c|}{rs2} &
\\multicolumn{1}{c|}{rs1} &
-\\multicolumn{4}{c|}{funct10} &
+\\multicolumn{6}{c|}{funct10} &
\\multicolumn{1}{c|}{rdr} & R-type \\\\
-\\cline{2-10}
+\\cline{2-12}
&
\\multicolumn{2}{|c|}{opcode} &
\\multicolumn{1}{c|}{rs2} &
\\multicolumn{1}{c|}{rs1} &
-\\multicolumn{2}{c|}{funct5} &
+\\multicolumn{4}{c|}{funct5} &
\\multicolumn{2}{c|}{rs3} &
\\multicolumn{1}{c|}{rdr} & R4-type \\\\
-\\cline{2-10}
+\\cline{2-12}
"""
def print_subtitle(title):
print """
&
-\\multicolumn{9}{c}{} & \\\\
+\\multicolumn{11}{c}{} & \\\\
&
-\\multicolumn{9}{c}{\\bf %s} & \\\\
-\\cline{2-10}
+\\multicolumn{11}{c}{\\bf %s} & \\\\
+\\cline{2-12}
""" % title
def print_footer(caption):
@@ -401,6 +454,10 @@ def print_insts(opcode,name,type,min,max):
print_ish_type(n,match[n],arguments[n])
elif types[n] == 7:
print_ishw_type(n,match[n],arguments[n])
+ elif types[n] == 8:
+ print_r4_rm_type(n,match[n],arguments[n])
+ elif types[n] == 9:
+ print_r_rm_type(n,match[n],arguments[n])
def make_latex_table():
print_header()
@@ -451,13 +508,27 @@ def make_latex_table():
print_insts(-1,'msub.d',-1,-1,-1)
print_insts(-1,'nmsub.d',-1,-1,-1)
print_insts(-1,'nmadd.d',-1,-1,-1)
- print_subtitle('Floating-Point Compare Instructions')
- print_insts(-1,'c.eq.s',-1,-1,-1)
- print_insts(-1,'c.lt.s',-1,-1,-1)
- print_insts(-1,'c.le.s',-1,-1,-1)
- print_insts(-1,'c.eq.d',-1,-1,-1)
- print_insts(-1,'c.lt.d',-1,-1,-1)
- print_insts(-1,'c.le.d',-1,-1,-1)
+ print_insts(-1,'add.s.rm',-1,-1,-1)
+ print_insts(-1,'sub.s.rm',-1,-1,-1)
+ print_insts(-1,'mul.s.rm',-1,-1,-1)
+ print_insts(-1,'div.s.rm',-1,-1,-1)
+ print_insts(-1,'sqrt.s.rm',-1,-1,-1)
+ print_insts(-1,'add.d.rm',-1,-1,-1)
+ print_insts(-1,'sub.d.rm',-1,-1,-1)
+ print_insts(-1,'mul.d.rm',-1,-1,-1)
+ print_insts(-1,'div.d.rm',-1,-1,-1)
+ print_insts(-1,'sqrt.d.rm',-1,-1,-1)
+ print_insts(-1,'madd.s.rm',-1,-1,-1)
+ print_insts(-1,'msub.s.rm',-1,-1,-1)
+ print_insts(-1,'nmsub.s.rm',-1,-1,-1)
+ print_insts(-1,'nmadd.s.rm',-1,-1,-1)
+ print_insts(-1,'madd.d.rm',-1,-1,-1)
+ print_insts(-1,'msub.d.rm',-1,-1,-1)
+ print_insts(-1,'nmsub.d.rm',-1,-1,-1)
+ print_insts(-1,'nmadd.d.rm',-1,-1,-1)
+ print_footer(0)
+
+ print_header()
print_subtitle('Floating-Point Move \& Conversion Instructions')
print_insts(-1,'sgninj.s',-1,-1,-1)
print_insts(-1,'sgninjn.s',-1,-1,-1)
@@ -467,9 +538,7 @@ def make_latex_table():
print_insts(-1,'sgnmul.d',-1,-1,-1)
print_insts(-1,'cvt.s.d',-1,-1,-1)
print_insts(-1,'cvt.d.s',-1,-1,-1)
- print_footer(0)
-
- print_header()
+ print_insts(-1,'cvt.s.d.rm',-1,-1,-1)
print_subtitle('Integer to Floating-Point Move \& Conversion Instructions')
print_insts(-1,'cvt.s.l',-1,-1,-1)
print_insts(-1,'cvtu.s.l',-1,-1,-1)
@@ -479,22 +548,38 @@ def make_latex_table():
print_insts(-1,'cvtu.d.l',-1,-1,-1)
print_insts(-1,'cvt.d.w',-1,-1,-1)
print_insts(-1,'cvtu.d.w',-1,-1,-1)
+ print_insts(-1,'cvt.s.l.rm',-1,-1,-1)
+ print_insts(-1,'cvtu.s.l.rm',-1,-1,-1)
+ print_insts(-1,'cvt.s.w.rm',-1,-1,-1)
+ print_insts(-1,'cvtu.s.w.rm',-1,-1,-1)
+ print_insts(-1,'cvt.d.l.rm',-1,-1,-1)
+ print_insts(-1,'cvtu.d.l.rm',-1,-1,-1)
print_insts(-1,'mtflh.d',-1,-1,-1)
print_insts(-1,'mtf.s',-1,-1,-1)
print_insts(-1,'mtf.d',-1,-1,-1)
print_subtitle('Floating-Point to Integer Move \& Conversion Instructions')
- print_insts(-1,'trunc.l.s',-1,-1,-1)
- print_insts(-1,'truncu.l.s',-1,-1,-1)
- print_insts(-1,'trunc.w.s',-1,-1,-1)
- print_insts(-1,'truncu.w.s',-1,-1,-1)
- print_insts(-1,'trunc.l.d',-1,-1,-1)
- print_insts(-1,'truncu.l.d',-1,-1,-1)
- print_insts(-1,'trunc.w.d',-1,-1,-1)
- print_insts(-1,'truncu.w.d',-1,-1,-1)
+ print_insts(-1,'cvt.l.s.rm',-1,-1,-1)
+ print_insts(-1,'cvtu.l.s.rm',-1,-1,-1)
+ print_insts(-1,'cvt.w.s.rm',-1,-1,-1)
+ print_insts(-1,'cvtu.w.s.rm',-1,-1,-1)
+ print_insts(-1,'cvt.l.d.rm',-1,-1,-1)
+ print_insts(-1,'cvtu.l.d.rm',-1,-1,-1)
+ print_insts(-1,'cvt.w.d.rm',-1,-1,-1)
+ print_insts(-1,'cvtu.w.d.rm',-1,-1,-1)
print_insts(-1,'mffl.d',-1,-1,-1)
print_insts(-1,'mffh.d',-1,-1,-1)
print_insts(-1,'mff.s',-1,-1,-1)
print_insts(-1,'mff.d',-1,-1,-1)
+ print_footer(0)
+
+ print_header()
+ print_subtitle('Floating-Point Compare Instructions')
+ print_insts(-1,'c.eq.s',-1,-1,-1)
+ print_insts(-1,'c.lt.s',-1,-1,-1)
+ print_insts(-1,'c.le.s',-1,-1,-1)
+ print_insts(-1,'c.eq.d',-1,-1,-1)
+ print_insts(-1,'c.lt.d',-1,-1,-1)
+ print_insts(-1,'c.le.d',-1,-1,-1)
print_subtitle('Miscellaneous Instructions')
print_insts(0x7b,'',-1,0x080,0x300)
print_subtitle('Privileged Instructions')