From 05c08f12f8a5f4bfab176e70f0999f8bfbf27699 Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Sat, 14 Jan 2023 13:34:05 +0530 Subject: fix regex fpr pseudo op lookup to ensure that we don't hit on substrings --- parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parse.py b/parse.py index a4a437c..4d7bab6 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 -- cgit v1.1 From 65096f2eb0265ef9b895c6c6d839c7ce31f40754 Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Sat, 14 Jan 2023 13:34:19 +0530 Subject: indenting logs for better readability --- parse.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parse.py b/parse.py index 4d7bab6..e808f65 100755 --- a/parse.py +++ b/parse.py @@ -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') -- cgit v1.1 From 8f30840398855fe4ae74cf951a3259614f26be05 Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Sat, 14 Jan 2023 13:36:35 +0530 Subject: adding pseudo_ops for shift-ops where the mnemonics remain the same --- rv32_i | 6 +++--- unratified/rv128_i | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rv32_i b/rv32_i index 7e4da0f..6c66673 100644 --- a/rv32_i +++ b/rv32_i @@ -1,3 +1,3 @@ -$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 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 -- cgit v1.1 From 946f4dd3e77c2492ef06cf141822eb92fcf4fb65 Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Sat, 14 Jan 2023 13:37:02 +0530 Subject: rv32_i shift pseudo ops should depend on rv64_i (not rv128_i) --- rv32_i | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rv32_i b/rv32_i index 6c66673..59e79da 100644 --- a/rv32_i +++ b/rv32_i @@ -1,3 +1,6 @@ $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 -- cgit v1.1 From 01c36086d51a3fbec7fa04d2f92a79a32faa8ad2 Mon Sep 17 00:00:00 2001 From: Neel Gala Date: Sat, 14 Jan 2023 13:48:36 +0530 Subject: updated readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) 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. -- cgit v1.1