From 06edcd91b7b633e3277141dd37aadb7d7fd2336f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 14 Oct 2018 05:22:18 +0100 Subject: [PATCH] redirect add to rv_add --- riscv/insns/add.h | 2 +- riscv/insns/addi.h | 2 +- riscv/insns/addiw.h | 2 +- riscv/sv_insn_redirect.cc | 5 +++++ riscv/sv_insn_redirect.h | 2 ++ 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/riscv/insns/add.h b/riscv/insns/add.h index 895e2b1..4e289ef 100644 --- a/riscv/insns/add.h +++ b/riscv/insns/add.h @@ -1 +1 @@ -WRITE_RD(sext_xlen(RS1 + RS2)); +WRITE_RD(sext_xlen(rv_add(RS1, RS2))); diff --git a/riscv/insns/addi.h b/riscv/insns/addi.h index 1bb5dce..231aef8 100644 --- a/riscv/insns/addi.h +++ b/riscv/insns/addi.h @@ -1 +1 @@ -WRITE_RD(sext_xlen(RS1 + insn.i_imm())); +WRITE_RD(sext_xlen(rv_add(RS1, insn.i_imm()))); diff --git a/riscv/insns/addiw.h b/riscv/insns/addiw.h index 4263ead..9f1cdd4 100644 --- a/riscv/insns/addiw.h +++ b/riscv/insns/addiw.h @@ -1,2 +1,2 @@ require_rv64; -WRITE_RD(sext32(insn.i_imm() + RS1)); +WRITE_RD(sext32(rv_add(insn.i_imm(), RS1))); diff --git a/riscv/sv_insn_redirect.cc b/riscv/sv_insn_redirect.cc index 02edba5..519248e 100644 --- a/riscv/sv_insn_redirect.cc +++ b/riscv/sv_insn_redirect.cc @@ -217,3 +217,8 @@ sv_reg_t::operator reg_t () return y; } */ +reg_t sv_proc_t::rv_add(reg_t lhs, reg_t rhs) +{ + return lhs + rhs; +} + diff --git a/riscv/sv_insn_redirect.h b/riscv/sv_insn_redirect.h index 29f680d..aef52ee 100644 --- a/riscv/sv_insn_redirect.h +++ b/riscv/sv_insn_redirect.h @@ -94,6 +94,8 @@ public: //reg_t (sext32)(sv_reg_t &v); reg_t (zext32)(reg_t v); + reg_t rv_add(reg_t lhs, reg_t rhs); + #include "sv_insn_decl.h" }; -- 2.30.2