aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2023-01-14 02:10:36 -0800
committerGitHub <noreply@github.com>2023-01-14 02:10:36 -0800
commitb9c3ee2d65f6f06319829bdcc15e18c9bdb7975e (patch)
tree79ca89972751d49ba214c9ca9b16c203e1c852e4
parent4daf1ab88b4e821cca64b76217411f5c6cd4c250 (diff)
parent01c36086d51a3fbec7fa04d2f92a79a32faa8ad2 (diff)
downloadriscv-opcodes-b9c3ee2d65f6f06319829bdcc15e18c9bdb7975e.zip
riscv-opcodes-b9c3ee2d65f6f06319829bdcc15e18c9bdb7975e.tar.gz
riscv-opcodes-b9c3ee2d65f6f06319829bdcc15e18c9bdb7975e.tar.bz2
Merge pull request #155 from riscv/fix-issues-from-153
Fix issues from #153
-rw-r--r--README.md9
-rwxr-xr-xparse.py6
-rw-r--r--rv32_i9
-rw-r--r--unratified/rv128_i3
4 files changed, 21 insertions, 6 deletions
diff --git a/README.md b/README.md
index d41015a..dec6003 100644
--- a/README.md
+++ b/README.md
@@ -81,6 +81,15 @@ Instruction syntaxes used in this project are broadly categorized into three:
```
$import rv32_zkne::aes32esmi
```
+
+### RESTRICTIONS
+
+Following are the restrictions one should keep in mind while defining $pseudo\_ops and $imported\_ops
+
+- Pseudo-op or already imported instructions cannot be imported again in another file. One should
+ always import base-instructions only.
+- While defining a $pseudo\_op, the base-instruction itself cannot be a $pseudo\_op
+
## Flow for parse.py
The `parse.py` python file is used to perform checks on the current set of instruction encodings and also generates multiple artifacts : latex tables, encoding.h header file, etc. This section will provide a brief overview of the flow within the python file.
diff --git a/parse.py b/parse.py
index a4a437c..e808f65 100755
--- a/parse.py
+++ b/parse.py
@@ -290,7 +290,7 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
# extension. Else throw error.
found = False
for oline in open(ext_file):
- if not re.findall(f'^\s*{orig_inst}',oline):
+ if not re.findall(f'^\s*{orig_inst}\s+',oline):
continue
else:
found = True
@@ -310,9 +310,9 @@ def create_inst_dict(file_filter, include_pseudo=False, include_pseudo_ops=[]):
# update the final dict with the instruction
if name not in instr_dict:
instr_dict[name] = single_dict
- logging.debug(f' including pseudo_ops:{name}')
+ logging.debug(f' including pseudo_ops:{name}')
else:
- logging.debug(f'Skipping pseudo_op {pseudo_inst} since original instruction {orig_inst} already selected in list')
+ logging.debug(f' Skipping pseudo_op {pseudo_inst} since original instruction {orig_inst} already selected in list')
# third pass if for imported instructions
logging.debug('Collecting imported instructions')
diff --git a/rv32_i b/rv32_i
index 7e4da0f..59e79da 100644
--- a/rv32_i
+++ b/rv32_i
@@ -1,3 +1,6 @@
-$pseudo_op rv128_i::slli slli_rv32 rd rs1 shamtw 31..25=0 14..12=1 6..2=0x04 1..0=3
-$pseudo_op rv128_i::srli srli_rv32 rd rs1 shamtw 31..25=0 14..12=5 6..2=0x04 1..0=3
-$pseudo_op rv128_i::srai srai_rv32 rd rs1 shamtw 31..25=32 14..12=5 6..2=0x04 1..0=3
+$pseudo_op rv64_i::slli slli rd rs1 shamtw 31..25=0 14..12=1 6..2=0x04 1..0=3
+$pseudo_op rv64_i::srli srli rd rs1 shamtw 31..25=0 14..12=5 6..2=0x04 1..0=3
+$pseudo_op rv64_i::srai srai rd rs1 shamtw 31..25=32 14..12=5 6..2=0x04 1..0=3
+$pseudo_op rv64_i::slli slli_rv32 rd rs1 shamtw 31..25=0 14..12=1 6..2=0x04 1..0=3
+$pseudo_op rv64_i::srli srli_rv32 rd rs1 shamtw 31..25=0 14..12=5 6..2=0x04 1..0=3
+$pseudo_op rv64_i::srai srai_rv32 rd rs1 shamtw 31..25=32 14..12=5 6..2=0x04 1..0=3
diff --git a/unratified/rv128_i b/unratified/rv128_i
index 191d61a..bb2c10b 100644
--- a/unratified/rv128_i
+++ b/unratified/rv128_i
@@ -16,6 +16,9 @@ ldu rd rs1 imm12 14..12=7 6..2=0x00 1..0=3
sq imm12hi rs1 rs2 imm12lo 14..12=4 6..2=0x08 1..0=3
+$pseudo_op rv64_i::slli slli rd rs1 31..27=0 shamtq 14..12=1 6..2=0x04 1..0=3
+$pseudo_op rv64_i::srli srli rd rs1 31..27=0 shamtq 14..12=5 6..2=0x04 1..0=3
+$pseudo_op rv64_i::srai srai rd rs1 31..27=8 shamtq 14..12=5 6..2=0x04 1..0=3
$pseudo_op rv64_i::slli slli_rv128 rd rs1 31..27=0 shamtq 14..12=1 6..2=0x04 1..0=3
$pseudo_op rv64_i::srli srli_rv128 rd rs1 31..27=0 shamtq 14..12=5 6..2=0x04 1..0=3
$pseudo_op rv64_i::srai srai_rv128 rd rs1 31..27=8 shamtq 14..12=5 6..2=0x04 1..0=3