From a6f972e5df9fa11470a0b9894147af9dc7edeedf Mon Sep 17 00:00:00 2001 From: Weiwei Li Date: Thu, 2 Jun 2022 08:55:17 +0800 Subject: [PATCH 1/3] add decode logic for cbo.* instructions in the decoder plugin trunc the rs1_val to the page offset --- riscv_isac/InstructionObject.py | 3 +++ riscv_isac/plugins/internaldecoder.py | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/riscv_isac/InstructionObject.py b/riscv_isac/InstructionObject.py index 2490257..dc3cdee 100644 --- a/riscv_isac/InstructionObject.py +++ b/riscv_isac/InstructionObject.py @@ -165,6 +165,9 @@ def evaluate_instr_vars(self, xlen, flen, arch_state, csr_regfile, instr_vars): if self.instr_name in ['ld','sd','fld','fsd']: ea_align = (rs1_val + imm_val) % 8 + if self.instr_name == "cbo.zero": + rs1_val = rs1_val & 0xFFF + instr_vars.update({ 'rs1_val': rs1_val, 'rs2_val': rs2_val, diff --git a/riscv_isac/plugins/internaldecoder.py b/riscv_isac/plugins/internaldecoder.py index 0e9a4ea..d401343 100644 --- a/riscv_isac/plugins/internaldecoder.py +++ b/riscv_isac/plugins/internaldecoder.py @@ -13,7 +13,7 @@ def __init__(self): 0b0100011: self.store_ops, 0b0010011: self.arithi_ops, 0b0110011: self.arith_ops, - 0b0001111: self.fence_ops, + 0b0001111: self.fence_cbo_ops, 0b1110011: self.priviledged_ops, 0b0011011: self.rv64i_arithi_ops, 0b0111011: self.rv64i_arith_ops, @@ -1310,19 +1310,34 @@ def arith_ops(self, instrObj): return instrObj - def fence_ops(self, instrObj): + def fence_cbo_ops(self, instrObj): instr = instrObj.instr funct3 = (instr & self.FUNCT3_MASK) >> 12 + rd = (instr & self.RD_MASK) >> 7 + cbo_op = instr >> 20 pred = (instr >> 20) & 0x0000000f succ = (instr >> 24) & 0x0000000f + rs1 = ((instr & self.RS1_MASK) >> 15, 'x') + if funct3 == 0b000: instrObj.succ = succ instrObj.pred = pred instrObj.instr_name = 'fence' if funct3 == 0b001: instrObj.instr_name = 'fence.i' + if funct3 == 0b010: + if rd == 0: + instrObj.rs1 = rs1 + if cbo_op == 0b000000000001: + instrObj.instr_name = 'cbo.clean' + if cbo_op == 0b000000000010: + instrObj.instr_name = 'cbo.flush' + if cbo_op == 0b000000000000: + instrObj.instr_name = 'cbo.inval' + if cbo_op == 0b000000000100: + instrObj.instr_name = 'cbo.zero' return instrObj From aa666755563d737fbe9a9846facfb50fb5954d5b Mon Sep 17 00:00:00 2001 From: Weiwei Li Date: Thu, 2 Jun 2022 09:00:12 +0800 Subject: [PATCH 2/3] update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 254edbc..c1fb286 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.16.2] - 2022-12-09 +- Add decode logic for cbo.* instructions in the decoder plugin ## [0.16.1] - 2022-10-20 - Fix length of commitval to 32 bits if flen is 32 for f registers in sail parser. @@ -19,6 +21,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Add fields(frm, fcsr, nan_prefix) for fp instructions ## [0.13.2] - 2022-05-23 + - Error reporting for missing coverlabel in cgf file ## [0.13.1] - 2022-05-07 From 35814e6efd3d3672627af4d6b8136cbf2ee17864 Mon Sep 17 00:00:00 2001 From: Weiwei Li Date: Fri, 9 Dec 2022 16:15:15 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Bump=20version:=200.16.1=20=E2=86=92=200.16?= =?UTF-8?q?.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- riscv_isac/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/riscv_isac/__init__.py b/riscv_isac/__init__.py index 04e7412..e4e54ac 100644 --- a/riscv_isac/__init__.py +++ b/riscv_isac/__init__.py @@ -4,5 +4,5 @@ __author__ = """InCore Semiconductors Pvt Ltd""" __email__ = 'info@incoresemi.com' -__version__ = '0.16.1' +__version__ = '0.16.2' diff --git a/setup.cfg b/setup.cfg index 1cadfd2..475f3d6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.16.1 +current_version = 0.16.2 commit = True tag = True diff --git a/setup.py b/setup.py index b2702af..9dffae7 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def read_requires(): setup( name='riscv_isac', - version='0.16.1', + version='0.16.2', description="RISC-V ISAC", long_description=readme + '\n\n', classifiers=[