summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Yunsup Lee <yunsup@cs.berkeley.edu>2010-10-05 16:29:13 -0700
committerGravatar Yunsup Lee <yunsup@cs.berkeley.edu>2010-10-05 16:29:13 -0700
commita68fd2347494ba7b05ed977a7a3f7586e8c816fd (patch)
tree4f061492210d27c008cbd33dd0ec2eb6c213d7e5
parent40c524172fdddcd9562adbc28f7f2457940df814 (diff)
[opcodes] updated parse-opcodes for latex tables
-rw-r--r--inst.v24
-rw-r--r--instr-table.tex482
-rwxr-xr-xparse-opcodes150
3 files changed, 378 insertions, 278 deletions
diff --git a/inst.v b/inst.v
index b5df390..8a427a4 100644
--- a/inst.v
+++ b/inst.v
@@ -2,12 +2,12 @@
`define J 32'b11000_???????????????????????????
`define JAL 32'b11001_???????????????????????????
`define LUI 32'b1110001_?????_????????????????????
-`define BEQ 32'b1110011_00000_?????_000_????????????
-`define BNE 32'b1110011_00000_?????_001_????????????
-`define BLT 32'b1110011_00000_?????_100_????????????
-`define BGE 32'b1110011_00000_?????_101_????????????
-`define BLTU 32'b1110011_00000_?????_110_????????????
-`define BGEU 32'b1110011_00000_?????_111_????????????
+`define BEQ 32'b1110011_?????_?????_000_????????????
+`define BNE 32'b1110011_?????_?????_001_????????????
+`define BLT 32'b1110011_?????_?????_100_????????????
+`define BGE 32'b1110011_?????_?????_101_????????????
+`define BLTU 32'b1110011_?????_?????_110_????????????
+`define BGEU 32'b1110011_?????_?????_111_????????????
`define ADDI 32'b1110100_?????_?????_000_????????????
`define SLTI 32'b1110100_?????_?????_010_????????????
`define SLTIU 32'b1110100_?????_?????_011_????????????
@@ -59,10 +59,10 @@
`define LHU 32'b1111000_?????_?????_101_????????????
`define LWU 32'b1111000_?????_?????_110_????????????
`define SYNCI 32'b1111000_00000_?????_111_????????????
-`define SB 32'b1111001_00000_?????_000_????????????
-`define SH 32'b1111001_00000_?????_001_????????????
-`define SW 32'b1111001_00000_?????_010_????????????
-`define SD 32'b1111001_00000_?????_011_????????????
+`define SB 32'b1111001_?????_?????_000_????????????
+`define SH 32'b1111001_?????_?????_001_????????????
+`define SW 32'b1111001_?????_?????_010_????????????
+`define SD 32'b1111001_?????_?????_011_????????????
`define AMOW_ADD 32'b1111010_?????_?????_0100000000_?????
`define AMOW_SWAP 32'b1111010_?????_?????_0100000001_?????
`define AMOW_AND 32'b1111010_?????_?????_0100000010_?????
@@ -142,8 +142,8 @@
`define MTF_D 32'b1101010_00000_?????_1110111001_?????
`define L_S 32'b1101000_?????_?????_010_????????????
`define L_D 32'b1101000_?????_?????_011_????????????
-`define S_S 32'b1101001_00000_?????_010_????????????
-`define S_D 32'b1101001_00000_?????_011_????????????
+`define S_S 32'b1101001_?????_?????_010_????????????
+`define S_D 32'b1101001_?????_?????_011_????????????
`define MADD_S 32'b1101011_?????_?????_00000_?????_?????
`define MSUB_S 32'b1101011_?????_?????_00001_?????_?????
`define NMSUB_S 32'b1101011_?????_?????_00010_?????_?????
diff --git a/instr-table.tex b/instr-table.tex
index 37b8d2a..6fb52f2 100644
--- a/instr-table.tex
+++ b/instr-table.tex
@@ -37,7 +37,7 @@
\cline{2-10}
&
\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rdi} &
+\multicolumn{1}{c|}{rdi/rs2} &
\multicolumn{1}{c|}{rs1} &
\multicolumn{1}{c|}{funct3} &
\multicolumn{4}{c|}{immediate} & I-type \\
@@ -81,7 +81,7 @@
&
\multicolumn{9}{c}{} & \\
&
-\multicolumn{9}{c}{\bf Control Instructions} & \\
+\multicolumn{9}{c}{\bf Control Transfer Instructions} & \\
\cline{2-10}
@@ -490,7 +490,7 @@
\cline{2-10}
&
\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rdi} &
+\multicolumn{1}{c|}{rdi/rs2} &
\multicolumn{1}{c|}{rs1} &
\multicolumn{1}{c|}{funct3} &
\multicolumn{4}{c|}{immediate} & I-type \\
@@ -976,7 +976,7 @@
\cline{2-10}
&
\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rdi} &
+\multicolumn{1}{c|}{rdi/rs2} &
\multicolumn{1}{c|}{rs1} &
\multicolumn{1}{c|}{funct3} &
\multicolumn{4}{c|}{immediate} & I-type \\
@@ -1104,8 +1104,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000000101} &
-\multicolumn{1}{c|}{rdr} & SGNINJ.S rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100000000} &
+\multicolumn{1}{c|}{rdr} & ADD.D rdr,rs1,rs2 \\
\cline{2-10}
@@ -1113,8 +1113,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000000110} &
-\multicolumn{1}{c|}{rdr} & SGNINJN.S rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100000001} &
+\multicolumn{1}{c|}{rdr} & SUB.D rdr,rs1,rs2 \\
\cline{2-10}
@@ -1122,17 +1122,17 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000000111} &
-\multicolumn{1}{c|}{rdr} & SGNMUL.S rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100000010} &
+\multicolumn{1}{c|}{rdr} & MUL.D rdr,rs1,rs2 \\
\cline{2-10}
&
\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001000} &
-\multicolumn{1}{c|}{rdr} & TRUNC.L.S rdr,rs1 \\
+\multicolumn{4}{c|}{1100000011} &
+\multicolumn{1}{c|}{rdr} & DIV.D rdr,rs1,rs2 \\
\cline{2-10}
@@ -1140,62 +1140,95 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001001} &
-\multicolumn{1}{c|}{rdr} & TRUNCU.L.S rdr,rs1 \\
+\multicolumn{4}{c|}{1100000100} &
+\multicolumn{1}{c|}{rdr} & SQRT.D rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001010} &
-\multicolumn{1}{c|}{rdr} & TRUNC.W.S rdr,rs1 \\
+\multicolumn{2}{c|}{00000} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & MADD.S rdr,rs1,rs2,rs3 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001011} &
-\multicolumn{1}{c|}{rdr} & TRUNCU.W.S rdr,rs1 \\
+\multicolumn{2}{c|}{00001} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & MSUB.S rdr,rs1,rs2,rs3 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001100} &
-\multicolumn{1}{c|}{rdr} & CVT.S.L rdr,rs1 \\
+\multicolumn{2}{c|}{00010} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & NMSUB.S rdr,rs1,rs2,rs3 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001101} &
-\multicolumn{1}{c|}{rdr} & CVTU.S.L rdr,rs1 \\
+\multicolumn{2}{c|}{00011} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & NMADD.S rdr,rs1,rs2,rs3 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001110} &
-\multicolumn{1}{c|}{rdr} & CVT.S.W rdr,rs1 \\
+\multicolumn{2}{c|}{11000} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & MADD.D rdr,rs1,rs2,rs3 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{0000001111} &
-\multicolumn{1}{c|}{rdr} & CVTU.S.W rdr,rs1 \\
+\multicolumn{2}{c|}{11001} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & MSUB.D rdr,rs1,rs2,rs3 \\
+\cline{2-10}
+
+
+&
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{2}{c|}{11010} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & NMSUB.D rdr,rs1,rs2,rs3 \\
+\cline{2-10}
+
+
+&
+\multicolumn{2}{|c|}{1101011} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{2}{c|}{11011} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & NMADD.D rdr,rs1,rs2,rs3 \\
+\cline{2-10}
+
+
+&
+\multicolumn{9}{c}{} & \\
+&
+\multicolumn{9}{c}{\bf Floating Point Compare Instructions} & \\
\cline{2-10}
@@ -1230,8 +1263,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100000000} &
-\multicolumn{1}{c|}{rdr} & ADD.D rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100010101} &
+\multicolumn{1}{c|}{rdr} & C.EQ.D rdr,rs1,rs2 \\
\cline{2-10}
@@ -1239,8 +1272,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100000001} &
-\multicolumn{1}{c|}{rdr} & SUB.D rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100010110} &
+\multicolumn{1}{c|}{rdr} & C.LT.D rdr,rs1,rs2 \\
\cline{2-10}
@@ -1248,8 +1281,15 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100000010} &
-\multicolumn{1}{c|}{rdr} & MUL.D rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100010111} &
+\multicolumn{1}{c|}{rdr} & C.LE.D rdr,rs1,rs2 \\
+\cline{2-10}
+
+
+&
+\multicolumn{9}{c}{} & \\
+&
+\multicolumn{9}{c}{\bf Floating Point Move \& Conversion Instructions} & \\
\cline{2-10}
@@ -1257,17 +1297,26 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100000011} &
-\multicolumn{1}{c|}{rdr} & DIV.D rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{0000000101} &
+\multicolumn{1}{c|}{rdr} & SGNINJ.S rdr,rs1,rs2 \\
\cline{2-10}
&
\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100000100} &
-\multicolumn{1}{c|}{rdr} & SQRT.D rdr,rs1 \\
+\multicolumn{4}{c|}{0000000110} &
+\multicolumn{1}{c|}{rdr} & SGNINJN.S rdr,rs1,rs2 \\
+\cline{2-10}
+
+
+&
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{4}{c|}{0000000111} &
+\multicolumn{1}{c|}{rdr} & SGNMUL.S rdr,rs1,rs2 \\
\cline{2-10}
@@ -1302,8 +1351,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001000} &
-\multicolumn{1}{c|}{rdr} & TRUNC.L.D rdr,rs1 \\
+\multicolumn{4}{c|}{0000110011} &
+\multicolumn{1}{c|}{rdr} & CVT.S.D rdr,rs1 \\
\cline{2-10}
@@ -1311,26 +1360,90 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001001} &
-\multicolumn{1}{c|}{rdr} & TRUNCU.L.D rdr,rs1 \\
+\multicolumn{4}{c|}{1100110000} &
+\multicolumn{1}{c|}{rdr} & CVT.D.S rdr,rs1 \\
\cline{2-10}
+\end{tabular}
+\end{center}
+\end{small}
+
+\label{instr-table}
+\end{table}
+
+
+\newpage
+
+\begin{table}[p]
+\begin{small}
+\begin{center}
+\begin{tabular}{rcccccccccl}
+ &
+\hspace*{0.6in} &
+\hspace*{0.2in} &
+\hspace*{0.5in} &
+\hspace*{0.5in} &
+\hspace*{0.3in} &
+\hspace*{0.2in} &
+\hspace*{0.4in} &
+\hspace*{0.1in} &
+\hspace*{0.5in} \\
+ &
+\instbitrange{31}{27} &
+\instbitrange{26}{25} &
+\instbitrange{24}{20} &
+\instbitrange{19}{15} &
+\instbitrange{14}{12} &
+\instbitrange{11}{10} &
+\instbitrange{9}{6} &
+\instbit{5} &
+\instbitrange{4}{0} \\
+\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
+\multicolumn{1}{|c|}{opcode5} &
+\multicolumn{8}{c|}{jump target} & J-type \\
+\cline{2-10}
+&
+\multicolumn{2}{|c|}{opcode} &
+\multicolumn{1}{c|}{rdi} &
+\multicolumn{6}{c|}{LUI-immediate} & LUI-type \\
+\cline{2-10}
+&
+\multicolumn{2}{|c|}{opcode} &
+\multicolumn{1}{c|}{rdi/rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001010} &
-\multicolumn{1}{c|}{rdr} & TRUNC.W.D rdr,rs1 \\
+\multicolumn{1}{c|}{funct3} &
+\multicolumn{4}{c|}{immediate} & I-type \\
+\cline{2-10}
+&
+\multicolumn{2}{|c|}{opcode} &
+\multicolumn{1}{c|}{rdi} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{3}{c|}{funct9} &
+\multicolumn{2}{c|}{shamt} & ISH-type \\
+\cline{2-10}
+&
+\multicolumn{2}{|c|}{opcode} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{4}{c|}{funct10} &
+\multicolumn{1}{c|}{rdr} & R-type \\
+\cline{2-10}
+&
+\multicolumn{2}{|c|}{opcode} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{2}{c|}{funct5} &
+\multicolumn{2}{c|}{rs3} &
+\multicolumn{1}{c|}{rdr} & R4-type \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{00000} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001011} &
-\multicolumn{1}{c|}{rdr} & TRUNCU.W.D rdr,rs1 \\
+\multicolumn{9}{c}{} & \\
+&
+\multicolumn{9}{c}{\bf Integer to Floating Point Move \& Conversion Instructions} & \\
\cline{2-10}
@@ -1338,8 +1451,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001100} &
-\multicolumn{1}{c|}{rdr} & CVT.D.L rdr,rs1 \\
+\multicolumn{4}{c|}{0000001100} &
+\multicolumn{1}{c|}{rdr} & CVT.S.L rdr,rs1 \\
\cline{2-10}
@@ -1347,8 +1460,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001101} &
-\multicolumn{1}{c|}{rdr} & CVTU.D.L rdr,rs1 \\
+\multicolumn{4}{c|}{0000001101} &
+\multicolumn{1}{c|}{rdr} & CVTU.S.L rdr,rs1 \\
\cline{2-10}
@@ -1356,8 +1469,8 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001110} &
-\multicolumn{1}{c|}{rdr} & CVT.D.W rdr,rs1 \\
+\multicolumn{4}{c|}{0000001110} &
+\multicolumn{1}{c|}{rdr} & CVT.S.W rdr,rs1 \\
\cline{2-10}
@@ -1365,249 +1478,186 @@
\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100001111} &
-\multicolumn{1}{c|}{rdr} & CVTU.D.W rdr,rs1 \\
+\multicolumn{4}{c|}{0000001111} &
+\multicolumn{1}{c|}{rdr} & CVTU.S.W rdr,rs1 \\
\cline{2-10}
&
\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100010101} &
-\multicolumn{1}{c|}{rdr} & C.EQ.D rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100001100} &
+\multicolumn{1}{c|}{rdr} & CVT.D.L rdr,rs1 \\
\cline{2-10}
&
\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100010110} &
-\multicolumn{1}{c|}{rdr} & C.LT.D rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100001101} &
+\multicolumn{1}{c|}{rdr} & CVTU.D.L rdr,rs1 \\
\cline{2-10}
&
\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{1100010111} &
-\multicolumn{1}{c|}{rdr} & C.LE.D rdr,rs1,rs2 \\
+\multicolumn{4}{c|}{1100001110} &
+\multicolumn{1}{c|}{rdr} & CVT.D.W rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{00000} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & MADD.S rdr,rs1,rs2,rs3 \\
+\multicolumn{4}{c|}{1100001111} &
+\multicolumn{1}{c|}{rdr} & CVTU.D.W rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
+\multicolumn{2}{|c|}{1101010} &
\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{00001} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & MSUB.S rdr,rs1,rs2,rs3 \\
+\multicolumn{4}{c|}{1110011001} &
+\multicolumn{1}{c|}{rdr} & MTFLH.D rdr,rs1,rs2 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{00010} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & NMSUB.S rdr,rs1,rs2,rs3 \\
+\multicolumn{4}{c|}{0010111001} &
+\multicolumn{1}{c|}{rdr} & MTF.S rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{00011} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & NMADD.S rdr,rs1,rs2,rs3 \\
+\multicolumn{4}{c|}{1110111001} &
+\multicolumn{1}{c|}{rdr} & MTF.D rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
-\multicolumn{1}{c|}{rs2} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{11000} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & MADD.D rdr,rs1,rs2,rs3 \\
+\multicolumn{9}{c}{} & \\
+&
+\multicolumn{9}{c}{\bf Floating Point to Integer Move \& Conversion Instructions} & \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{11001} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & MSUB.D rdr,rs1,rs2,rs3 \\
+\multicolumn{4}{c|}{0000001000} &
+\multicolumn{1}{c|}{rdr} & TRUNC.L.S rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{11010} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & NMSUB.D rdr,rs1,rs2,rs3 \\
+\multicolumn{4}{c|}{0000001001} &
+\multicolumn{1}{c|}{rdr} & TRUNCU.L.S rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101011} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{11011} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & NMADD.D rdr,rs1,rs2,rs3 \\
+\multicolumn{4}{c|}{0000001010} &
+\multicolumn{1}{c|}{rdr} & TRUNC.W.S rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{9}{c}{} & \\
-&
-\multicolumn{9}{c}{\bf Floating Point Compare Instructions} & \\
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{4}{c|}{0000001011} &
+\multicolumn{1}{c|}{rdr} & TRUNCU.W.S rdr,rs1 \\
\cline{2-10}
&
\multicolumn{2}{|c|}{1101010} &
-\multicolumn{1}{c|}{rs2} &
\multicolumn{1}{c|}{00000} &
-\multicolumn{4}{c|}{1101011000} &
-\multicolumn{1}{c|}{rdr} & MFFH.D rdr,rs2 \\
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{4}{c|}{1100001000} &
+\multicolumn{1}{c|}{rdr} & TRUNC.L.D rdr,rs1 \\
\cline{2-10}
-\end{tabular}
-\end{center}
-\end{small}
-
-\label{instr-table}
-\end{table}
-
-
-\newpage
-
-\begin{table}[p]
-\begin{small}
-\begin{center}
-\begin{tabular}{rcccccccccl}
- &
-\hspace*{0.6in} &
-\hspace*{0.2in} &
-\hspace*{0.5in} &
-\hspace*{0.5in} &
-\hspace*{0.3in} &
-\hspace*{0.2in} &
-\hspace*{0.4in} &
-\hspace*{0.1in} &
-\hspace*{0.5in} \\
- &
-\instbitrange{31}{27} &
-\instbitrange{26}{25} &
-\instbitrange{24}{20} &
-\instbitrange{19}{15} &
-\instbitrange{14}{12} &
-\instbitrange{11}{10} &
-\instbitrange{9}{6} &
-\instbit{5} &
-\instbitrange{4}{0} \\
-\cline{2-10}
-&
-\multicolumn{1}{|c|}{opcode5} &
-\multicolumn{8}{c|}{jump target} & J-type \\
-\cline{2-10}
-&
-\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rdi} &
-\multicolumn{6}{c|}{LUI-immediate} & LUI-type \\
-\cline{2-10}
-&
-\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rdi} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{1}{c|}{funct3} &
-\multicolumn{4}{c|}{immediate} & I-type \\
-\cline{2-10}
-&
-\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rdi} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{3}{c|}{funct9} &
-\multicolumn{2}{c|}{shamt} & ISH-type \\
-\cline{2-10}
&
-\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{4}{c|}{funct10} &
-\multicolumn{1}{c|}{rdr} & R-type \\
+\multicolumn{4}{c|}{1100001001} &
+\multicolumn{1}{c|}{rdr} & TRUNCU.L.D rdr,rs1 \\
\cline{2-10}
+
+
&
-\multicolumn{2}{|c|}{opcode} &
-\multicolumn{1}{c|}{rs2} &
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
\multicolumn{1}{c|}{rs1} &
-\multicolumn{2}{c|}{funct5} &
-\multicolumn{2}{c|}{rs3} &
-\multicolumn{1}{c|}{rdr} & R4-type \\
+\multicolumn{4}{c|}{1100001010} &
+\multicolumn{1}{c|}{rdr} & TRUNC.W.D rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{9}{c}{} & \\
-&
-\multicolumn{9}{c}{\bf Integer/Floating Point Moves\&Conversion Instructions} & \\
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{1}{c|}{rs1} &
+\multicolumn{4}{c|}{1100001011} &
+\multicolumn{1}{c|}{rdr} & TRUNCU.W.D rdr,rs1 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101000} &
-\multicolumn{1}{c|}{rdi} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{1}{c|}{010} &
-\multicolumn{4}{c|}{imm12} & L.S rdi,rs1,imm12 \\
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{4}{c|}{1100111000} &
+\multicolumn{1}{c|}{rdr} & MFFL.D rdr,rs2 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101000} &
-\multicolumn{1}{c|}{rdi} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{1}{c|}{011} &
-\multicolumn{4}{c|}{imm12} & L.D rdi,rs1,imm12 \\
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{4}{c|}{1101011000} &
+\multicolumn{1}{c|}{rdr} & MFFH.D rdr,rs2 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101000} &
-\multicolumn{1}{c|}{rdi} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{1}{c|}{010} &
-\multicolumn{4}{c|}{imm12} & L.S rdi,rs1,imm12 \\
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{4}{c|}{0001111000} &
+\multicolumn{1}{c|}{rdr} & MFF.S rdr,rs2 \\
\cline{2-10}
&
-\multicolumn{2}{|c|}{1101000} &
-\multicolumn{1}{c|}{rdi} &
-\multicolumn{1}{c|}{rs1} &
-\multicolumn{1}{c|}{011} &
-\multicolumn{4}{c|}{imm12} & L.D rdi,rs1,imm12 \\
+\multicolumn{2}{|c|}{1101010} &
+\multicolumn{1}{c|}{rs2} &
+\multicolumn{1}{c|}{00000} &
+\multicolumn{4}{c|}{1101111000} &
+\multicolumn{1}{c|}{rdr} & MFF.D rdr,rs2 \\
\cline{2-10}
diff --git a/parse-opcodes b/parse-opcodes
index 12ae1d2..4c0b164 100755
--- a/parse-opcodes
+++ b/parse-opcodes
@@ -327,7 +327,7 @@ def print_header():
\\cline{2-10}
&
\\multicolumn{2}{|c|}{opcode} &
-\\multicolumn{1}{c|}{rdi} &
+\\multicolumn{1}{c|}{rdi/rs2} &
\\multicolumn{1}{c|}{rs1} &
\\multicolumn{1}{c|}{funct3} &
\\multicolumn{4}{c|}{immediate} & I-type \\\\
@@ -375,76 +375,126 @@ def print_footer(caption):
\\end{table}
""" % (caption and '\\caption{Instruction listing for RISC-V}' or '')
-def print_insts(opcode,type,min,max):
- for name in namelist:
- if yank(match[name],25,7) == opcode:
- if type == -1 or types[name] == type:
- if types[name] == 0:
- print_unimp_type(name,match[name],arguments[name])
- elif types[name] == 1:
- print_j_type(name,match[name],arguments[name])
- elif types[name] == 2:
- print_lui_type(name,match[name],arguments[name])
- elif types[name] == 3:
- print_i_type(name,match[name],arguments[name])
- elif types[name] == 4 \
- and (min == -1 or yank(match[name],5,10) >= min) \
- and (max == -1 or yank(match[name],5,10) <= max):
- print_r_type(name,match[name],arguments[name])
- elif types[name] == 5:
- print_r4_type(name,match[name],arguments[name])
- elif types[name] == 6:
- print_ish_type(name,match[name],arguments[name])
- elif types[name] == 7:
- print_ishw_type(name,match[name],arguments[name])
+def print_insts(opcode,name,type,min,max):
+ for n in namelist:
+ if yank(match[n],25,7) == opcode or n == name:
+ if type == -1 or types[n] == type:
+ if types[n] == 0:
+ print_unimp_type(n,match[n],arguments[n])
+ elif types[n] == 1:
+ print_j_type(n,match[n],arguments[n])
+ elif types[n] == 2:
+ print_lui_type(n,match[n],arguments[n])
+ elif types[n] == 3:
+ print_i_type(n,match[n],arguments[n])
+ elif types[n] == 4 \
+ and (min == -1 or yank(match[n],5,10) >= min) \
+ and (max == -1 or yank(match[n],5,10) <= max):
+ print_r_type(n,match[n],arguments[n])
+ elif types[n] == 5:
+ print_r4_type(n,match[n],arguments[n])
+ elif types[n] == 6:
+ print_ish_type(n,match[n],arguments[n])
+ elif types[n] == 7:
+ print_ishw_type(n,match[n],arguments[n])
def make_latex_table():
print_header()
print_subtitle('Unimplemented Instruction')
- print_insts(0x00,-1,-1,-1)
- print_subtitle('Control Instructions')
- print_insts(0x60,-1,-1,-1)
- print_insts(0x64,-1,-1,-1)
- print_insts(0x7b,-1,0x000,0x002)
- print_insts(0x73,-1,-1,-1)
+ print_insts(0x00,'',-1,-1,-1)
+ print_subtitle('Control Transfer Instructions')
+ print_insts(0x60,'',-1,-1,-1)
+ print_insts(0x64,'',-1,-1,-1)
+ print_insts(0x7b,'',-1,0x000,0x002)
+ print_insts(0x73,'',-1,-1,-1)
print_subtitle('Memory Instructions')
- print_insts(0x78,-1,-1,-1)
- print_insts(0x79,-1,-1,-1)
+ print_insts(0x78,'',-1,-1,-1)
+ print_insts(0x79,'',-1,-1,-1)
print_subtitle('Atomic Memory Instructions')
- print_insts(0x7a,-1,-1,-1)
+ print_insts(0x7a,'',-1,-1,-1)
print_footer(0)
print_header()
print_subtitle('Integer Compute Instructions')
- print_insts(0x71,-1,-1,-1)
- print_insts(0x74,-1,-1,-1)
- print_insts(0x75,-1,-1,-1)
+ print_insts(0x71,'',-1,-1,-1)
+ print_insts(0x74,'',-1,-1,-1)
+ print_insts(0x75,'',-1,-1,-1)
print_subtitle('32-bit Integer Compute Instructions')
- print_insts(0x76,-1,-1,-1)
- print_insts(0x77,-1,-1,-1)
+ print_insts(0x76,'',-1,-1,-1)
+ print_insts(0x77,'',-1,-1,-1)
print_footer(0)
print_header()
print_subtitle('Floating Point Memory Instructions')
- print_insts(0x68,-1,-1,-1)
- print_insts(0x69,-1,-1,-1)
+ print_insts(0x68,'',-1,-1,-1)
+ print_insts(0x69,'',-1,-1,-1)
print_subtitle('Floating Point Compute Instructions')
- print_insts(0x6a,-1,0x000,0x01F)
- print_insts(0x6a,-1,0x300,0x31F)
- print_insts(0x6b,-1,-1,-1)
+ print_insts(-1,'add.s',-1,-1,-1)
+ print_insts(-1,'sub.s',-1,-1,-1)
+ print_insts(-1,'mul.s',-1,-1,-1)
+ print_insts(-1,'div.s',-1,-1,-1)
+ print_insts(-1,'sqrt.s',-1,-1,-1)
+ print_insts(-1,'add.d',-1,-1,-1)
+ print_insts(-1,'sub.d',-1,-1,-1)
+ print_insts(-1,'mul.d',-1,-1,-1)
+ print_insts(-1,'div.d',-1,-1,-1)
+ print_insts(-1,'sqrt.d',-1,-1,-1)
+ print_insts(-1,'madd.s',-1,-1,-1)
+ print_insts(-1,'msub.s',-1,-1,-1)
+ print_insts(-1,'nmsub.s',-1,-1,-1)
+ print_insts(-1,'nmadd.s',-1,-1,-1)
+ print_insts(-1,'madd.d',-1,-1,-1)
+ 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(0x6a,-1,0x040,0x05F)
- print_insts(0x6a,-1,0x340,0x35F)
+ 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('Floating Point Move \& Conversion Instructions')
+ print_insts(-1,'sgninj.s',-1,-1,-1)
+ print_insts(-1,'sgninjn.s',-1,-1,-1)
+ print_insts(-1,'sgnmul.s',-1,-1,-1)
+ print_insts(-1,'sgninj.d',-1,-1,-1)
+ print_insts(-1,'sgninjn.d',-1,-1,-1)
+ 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_subtitle('Integer/Floating Point Moves\&Conversion Instructions')
- print_insts(0x68,-1,0x020,0x03F)
- print_insts(0x68,-1,0x320,0x33F)
+ 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)
+ print_insts(-1,'cvt.s.w',-1,-1,-1)
+ print_insts(-1,'cvtu.s.w',-1,-1,-1)
+ print_insts(-1,'cvt.d.l',-1,-1,-1)
+ 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,'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,'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_subtitle('Miscellaneous Instructions')
- print_insts(0x7b,-1,0x080,0x300)
+ print_insts(0x7b,'',-1,0x080,0x300)
print_subtitle('Privileged Instructions')
- print_insts(0x7e,-1,-1,-1)
+ print_insts(0x7e,'',-1,-1,-1)
print_footer(1)
def str_verilog_arg(arg0,arg1,match,arguments):
@@ -486,7 +536,7 @@ def print_verilog_i_type(name,match,arguments):
( \
name.replace('.','_').upper(), \
binary(yank(match,25,7),7), \
- str_verilog_arg('rdi','',match,arguments), \
+ str_verilog_arg('rdi','rs2',match,arguments), \
str_verilog_arg('rs1','',match,arguments), \
binary(yank(match,12,3),3), \
str_verilog_arg('imm12','',match,arguments) \