Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Add support for Zdinx extension #101

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion riscv_isac/InstructionObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ def evaluate_rs1_val_p_ext(self, instr_vars, arch_state):
def evaluate_rs1_val_sgn(self, instr_vars, arch_state):
return self.evaluate_reg_val_sgn(self.rs1[0], instr_vars['xlen'], arch_state)

@evaluator_func("rs1_val", lambda **params: not params['instr_name'] in unsgn_rs1 and not params['is_rvp'] and params['rs1'] is not None and (params['rs1'][1] == 'f' or params['inxFlag']))
def evaluate_rs1_val_fsgn(self, instr_vars, arch_state):
return self.evaluate_reg_val_zdinx32_ext(self.rs1[0], self.rs1_nregs,instr_vars['flen'],instr_vars['xlen'],arch_state)

@evaluator_func("rs1_val", lambda **params: not params['instr_name'] in unsgn_rs1 and not params['is_rvp'] and params['rs1'] is not None and (params['rs1'][1] == 'f' or params['inxFlag']))
def evaluate_rs1_val_fsgn(self, instr_vars, arch_state):
return self.evaluate_reg_val_fsgn(self.rs1[0], instr_vars['flen'], instr_vars['xlen'],arch_state)
Expand All @@ -549,7 +553,10 @@ def evaluate_rs2_val_p_ext(self, instr_vars, arch_state):
@evaluator_func("rs2_val", lambda **params: not params['instr_name'] in unsgn_rs2 and not params['is_rvp'] and params['rs2'] is not None and params['rs2'][1] == 'x' and not params['inxFlag'])
def evaluate_rs2_val_sgn(self, instr_vars, arch_state):
return self.evaluate_reg_val_sgn(self.rs2[0], instr_vars['xlen'], arch_state)


@evaluator_func("rs2_val", lambda **params: params['is_rvp'] and params['rs2'] is not None)
def evaluate_rs2_val_fsgn(self, instr_vars, arch_state):
return self.evaluate_reg_val_zdinx32_ext(self.rs2[0],instr_vars['flen'], instr_vars['xlen'], self.rs2_nregs, arch_state)

@evaluator_func("rs2_val", lambda **params: not params['instr_name'] in unsgn_rs2 and not params['is_rvp'] and params['rs2'] is not None and (params['rs2'][1] == 'f' or params['inxFlag']))
def evaluate_rs2_val_fsgn(self, instr_vars, arch_state):
Expand Down Expand Up @@ -636,6 +643,13 @@ def evaluate_reg_val_p_ext(self, reg_idx, nregs, arch_state):
reg_val = (reg_hi_val << 32) | reg_val
return reg_val

def evaluate_reg_val_zdinx32_ext(self, reg_idx, nregs, flen,arch_state,xlen):
reg_val = self.evaluate_reg_val_fsgn(reg_idx,flen,arch_state,xlen)
if nregs == 2:
reg_hi_val = self.evaluate_reg_val_fsgn(reg_idx+1,flen,arch_state,xlen)
reg_val = (reg_hi_val << 32) | reg_val
return reg_val

def sign_extend(self, value, e_bits, v_bits ):
return bin(value | ((1<<e_bits) - (1<<v_bits)))

Expand Down
Loading