From 654e7c60197e94c34ac1bb10246298dacbb03bcf Mon Sep 17 00:00:00 2001 From: Roger Chang Date: Tue, 12 Dec 2023 16:04:09 +0800 Subject: [PATCH] arch: Fix inst flag of RISC-V vector store macro instructions Correct the instruction flags of RISC-V vector store instructions, such as `vse64_v`, `vse32_v`. The `vse64_v` in `decoder.isa` is `Mem_vc.as()[i] = Vs3_ud[i];` and it will generate the code `Mem.as()[i] = Vs3[i];`. The current regex of assignRE only mark the operand `Mem` as `dest` only if meet the formats like `Mem = Rd` or `Mem[i] = Rd` because the code ` = Rd` or `[i] = Rd` match the `assignRE` respectively. For the expression `Mem.as()[i]`, the operand `Mem` will falsely mark the operand as `src` because the code `.as()[i]` is not match the `assignRE`. The PR will ensure the operand `Mem` is dest for the format like `Mem.as()[i] = yyy`. Change-Id: I9c57986a64f1efb81eb9c7ade90712b118e0788d --- src/arch/isa_parser/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/arch/isa_parser/util.py b/src/arch/isa_parser/util.py index 9e330adc1f..ee1758d263 100755 --- a/src/arch/isa_parser/util.py +++ b/src/arch/isa_parser/util.py @@ -69,7 +69,9 @@ commentRE = re.compile( # destination. basically we're looking for an '=' that's not '=='. # The heinous tangle before that handles the case where the operand # has an array subscript. -assignRE = re.compile(r"(\[[^\]]+\])?\s*=(?!=)", re.MULTILINE) +assignRE = re.compile( + r"((\.as<[^>]+>\(\s*\))?\[[^\]]+\])?\s*=(?!=)", re.MULTILINE +) # # Munge a somewhat arbitrarily formatted piece of Python code