From e671e751982cfa065bb6430a0b5b33cd5f9ddfec Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sun, 8 Feb 2015 00:13:48 -0800 Subject: [PATCH] Use xlen, not xprlen, to refer to x-register width --- hwacha/insn_template_hwacha.cc | 4 ++-- hwacha/insn_template_hwacha_ut.cc | 4 ++-- riscv/decode.h | 10 +++++----- riscv/insn_template.cc | 8 ++++---- riscv/insns/add.h | 2 +- riscv/insns/addi.h | 2 +- riscv/insns/auipc.h | 2 +- riscv/insns/csrrc.h | 2 +- riscv/insns/csrrci.h | 2 +- riscv/insns/csrrs.h | 2 +- riscv/insns/csrrsi.h | 2 +- riscv/insns/csrrw.h | 2 +- riscv/insns/csrrwi.h | 2 +- riscv/insns/div.h | 6 +++--- riscv/insns/divu.h | 6 +++--- riscv/insns/mul.h | 2 +- riscv/insns/rem.h | 6 +++--- riscv/insns/remu.h | 8 ++++---- riscv/insns/sll.h | 2 +- riscv/insns/sra.h | 2 +- riscv/insns/sub.h | 2 +- 21 files changed, 39 insertions(+), 39 deletions(-) diff --git a/hwacha/insn_template_hwacha.cc b/hwacha/insn_template_hwacha.cc index cb44cac..d225949 100644 --- a/hwacha/insn_template_hwacha.cc +++ b/hwacha/insn_template_hwacha.cc @@ -3,8 +3,8 @@ reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc) { - int xprlen = 64; - reg_t npc = sext_xprlen(pc + insn_length(OPCODE)); + int xlen = 64; + reg_t npc = sext_xlen(pc + insn_length(OPCODE)); hwacha_t* h = static_cast(p->get_extension()); rocc_insn_union_t u; u.i = insn; diff --git a/hwacha/insn_template_hwacha_ut.cc b/hwacha/insn_template_hwacha_ut.cc index d312e93..7f5dc0e 100644 --- a/hwacha/insn_template_hwacha_ut.cc +++ b/hwacha/insn_template_hwacha_ut.cc @@ -3,8 +3,8 @@ reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc) { - int xprlen = 64; - reg_t npc = sext_xprlen(pc + insn_length(OPCODE)); + int xlen = 64; + reg_t npc = sext_xlen(pc + insn_length(OPCODE)); hwacha_t* h = static_cast(p->get_extension()); do { #include "insns_ut/NAME.h" diff --git a/riscv/decode.h b/riscv/decode.h index 274ab2a..6ac465a 100644 --- a/riscv/decode.h +++ b/riscv/decode.h @@ -135,7 +135,7 @@ private: if(rm > 4) throw trap_illegal_instruction(); \ rm; }) -#define xpr64 (xprlen == 64) +#define xpr64 (xlen == 64) #define require_supervisor if(unlikely(!(STATE.sr & SR_S))) throw trap_privileged_instruction() #define require_xpr64 if(unlikely(!xpr64)) throw trap_illegal_instruction() @@ -147,16 +147,16 @@ private: #endif #define require_accelerator if(unlikely(!(STATE.sr & SR_EA))) throw trap_accelerator_disabled() -#define cmp_trunc(reg) (reg_t(reg) << (64-xprlen)) +#define cmp_trunc(reg) (reg_t(reg) << (64-xlen)) #define set_fp_exceptions ({ STATE.fflags |= softfloat_exceptionFlags; \ softfloat_exceptionFlags = 0; }) #define sext32(x) ((sreg_t)(int32_t)(x)) #define zext32(x) ((reg_t)(uint32_t)(x)) -#define sext_xprlen(x) (((sreg_t)(x) << (64-xprlen)) >> (64-xprlen)) -#define zext_xprlen(x) (((reg_t)(x) << (64-xprlen)) >> (64-xprlen)) +#define sext_xlen(x) (((sreg_t)(x) << (64-xlen)) >> (64-xlen)) +#define zext_xlen(x) (((reg_t)(x) << (64-xlen)) >> (64-xlen)) -#define set_pc(x) (npc = sext_xprlen(x)) +#define set_pc(x) (npc = sext_xlen(x)) #define validate_csr(which, write) ({ \ unsigned my_priv = (STATE.sr & SR_S) ? 1 : 0; \ diff --git a/riscv/insn_template.cc b/riscv/insn_template.cc index d2c0fce..35f67a0 100644 --- a/riscv/insn_template.cc +++ b/riscv/insn_template.cc @@ -4,16 +4,16 @@ reg_t rv32_NAME(processor_t* p, insn_t insn, reg_t pc) { - int xprlen = 32; - reg_t npc = sext_xprlen(pc + insn_length(OPCODE)); + int xlen = 32; + reg_t npc = sext_xlen(pc + insn_length(OPCODE)); #include "insns/NAME.h" return npc; } reg_t rv64_NAME(processor_t* p, insn_t insn, reg_t pc) { - int xprlen = 64; - reg_t npc = sext_xprlen(pc + insn_length(OPCODE)); + int xlen = 64; + reg_t npc = sext_xlen(pc + insn_length(OPCODE)); #include "insns/NAME.h" return npc; } diff --git a/riscv/insns/add.h b/riscv/insns/add.h index d7a5c98..895e2b1 100644 --- a/riscv/insns/add.h +++ b/riscv/insns/add.h @@ -1 +1 @@ -WRITE_RD(sext_xprlen(RS1 + RS2)); +WRITE_RD(sext_xlen(RS1 + RS2)); diff --git a/riscv/insns/addi.h b/riscv/insns/addi.h index c861a97..1bb5dce 100644 --- a/riscv/insns/addi.h +++ b/riscv/insns/addi.h @@ -1 +1 @@ -WRITE_RD(sext_xprlen(RS1 + insn.i_imm())); +WRITE_RD(sext_xlen(RS1 + insn.i_imm())); diff --git a/riscv/insns/auipc.h b/riscv/insns/auipc.h index d724d10..1a2b169 100644 --- a/riscv/insns/auipc.h +++ b/riscv/insns/auipc.h @@ -1 +1 @@ -WRITE_RD(sext_xprlen(insn.u_imm() + pc)); +WRITE_RD(sext_xlen(insn.u_imm() + pc)); diff --git a/riscv/insns/csrrc.h b/riscv/insns/csrrc.h index 8719267..4667fc8 100644 --- a/riscv/insns/csrrc.h +++ b/riscv/insns/csrrc.h @@ -1,4 +1,4 @@ int csr = validate_csr(insn.csr(), true); reg_t old = p->get_pcr(csr); p->set_pcr(csr, old & ~RS1); -WRITE_RD(sext_xprlen(old)); +WRITE_RD(sext_xlen(old)); diff --git a/riscv/insns/csrrci.h b/riscv/insns/csrrci.h index 51a2cde..172aea0 100644 --- a/riscv/insns/csrrci.h +++ b/riscv/insns/csrrci.h @@ -1,4 +1,4 @@ int csr = validate_csr(insn.csr(), true); reg_t old = p->get_pcr(csr); p->set_pcr(csr, old & ~(reg_t)insn.rs1()); -WRITE_RD(sext_xprlen(old)); +WRITE_RD(sext_xlen(old)); diff --git a/riscv/insns/csrrs.h b/riscv/insns/csrrs.h index 675cb86..6616855 100644 --- a/riscv/insns/csrrs.h +++ b/riscv/insns/csrrs.h @@ -1,4 +1,4 @@ int csr = validate_csr(insn.csr(), insn.rs1() != 0); reg_t old = p->get_pcr(csr); p->set_pcr(csr, old | RS1); -WRITE_RD(sext_xprlen(old)); +WRITE_RD(sext_xlen(old)); diff --git a/riscv/insns/csrrsi.h b/riscv/insns/csrrsi.h index 094e91a..913c20a 100644 --- a/riscv/insns/csrrsi.h +++ b/riscv/insns/csrrsi.h @@ -1,4 +1,4 @@ int csr = validate_csr(insn.csr(), true); reg_t old = p->get_pcr(csr); p->set_pcr(csr, old | insn.rs1()); -WRITE_RD(sext_xprlen(old)); +WRITE_RD(sext_xlen(old)); diff --git a/riscv/insns/csrrw.h b/riscv/insns/csrrw.h index 3d1ea32..b981665 100644 --- a/riscv/insns/csrrw.h +++ b/riscv/insns/csrrw.h @@ -1,4 +1,4 @@ int csr = validate_csr(insn.csr(), true); reg_t old = p->get_pcr(csr); p->set_pcr(csr, RS1); -WRITE_RD(sext_xprlen(old)); +WRITE_RD(sext_xlen(old)); diff --git a/riscv/insns/csrrwi.h b/riscv/insns/csrrwi.h index 081b4e9..cbee6b9 100644 --- a/riscv/insns/csrrwi.h +++ b/riscv/insns/csrrwi.h @@ -1,4 +1,4 @@ int csr = validate_csr(insn.csr(), true); reg_t old = p->get_pcr(csr); p->set_pcr(csr, insn.rs1()); -WRITE_RD(sext_xprlen(old)); +WRITE_RD(sext_xlen(old)); diff --git a/riscv/insns/div.h b/riscv/insns/div.h index 261880f..3ad613a 100644 --- a/riscv/insns/div.h +++ b/riscv/insns/div.h @@ -1,8 +1,8 @@ -sreg_t lhs = sext_xprlen(RS1); -sreg_t rhs = sext_xprlen(RS2); +sreg_t lhs = sext_xlen(RS1); +sreg_t rhs = sext_xlen(RS2); if(rhs == 0) WRITE_RD(UINT64_MAX); else if(lhs == INT64_MIN && rhs == -1) WRITE_RD(lhs); else - WRITE_RD(sext_xprlen(lhs / rhs)); + WRITE_RD(sext_xlen(lhs / rhs)); diff --git a/riscv/insns/divu.h b/riscv/insns/divu.h index fd878a2..4887ce0 100644 --- a/riscv/insns/divu.h +++ b/riscv/insns/divu.h @@ -1,6 +1,6 @@ -reg_t lhs = zext_xprlen(RS1); -reg_t rhs = zext_xprlen(RS2); +reg_t lhs = zext_xlen(RS1); +reg_t rhs = zext_xlen(RS2); if(rhs == 0) WRITE_RD(UINT64_MAX); else - WRITE_RD(sext_xprlen(lhs / rhs)); + WRITE_RD(sext_xlen(lhs / rhs)); diff --git a/riscv/insns/mul.h b/riscv/insns/mul.h index 9725bfd..c6b5331 100644 --- a/riscv/insns/mul.h +++ b/riscv/insns/mul.h @@ -1 +1 @@ -WRITE_RD(sext_xprlen(RS1 * RS2)); +WRITE_RD(sext_xlen(RS1 * RS2)); diff --git a/riscv/insns/rem.h b/riscv/insns/rem.h index fa98ac6..d074f26 100644 --- a/riscv/insns/rem.h +++ b/riscv/insns/rem.h @@ -1,8 +1,8 @@ -sreg_t lhs = sext_xprlen(RS1); -sreg_t rhs = sext_xprlen(RS2); +sreg_t lhs = sext_xlen(RS1); +sreg_t rhs = sext_xlen(RS2); if(rhs == 0) WRITE_RD(lhs); else if(lhs == INT64_MIN && rhs == -1) WRITE_RD(0); else - WRITE_RD(sext_xprlen(lhs % rhs)); + WRITE_RD(sext_xlen(lhs % rhs)); diff --git a/riscv/insns/remu.h b/riscv/insns/remu.h index 646bb3a..c291947 100644 --- a/riscv/insns/remu.h +++ b/riscv/insns/remu.h @@ -1,6 +1,6 @@ -reg_t lhs = zext_xprlen(RS1); -reg_t rhs = zext_xprlen(RS2); +reg_t lhs = zext_xlen(RS1); +reg_t rhs = zext_xlen(RS2); if(rhs == 0) - WRITE_RD(sext_xprlen(RS1)); + WRITE_RD(sext_xlen(RS1)); else - WRITE_RD(sext_xprlen(lhs % rhs)); + WRITE_RD(sext_xlen(lhs % rhs)); diff --git a/riscv/insns/sll.h b/riscv/insns/sll.h index 48c0acf..7db7613 100644 --- a/riscv/insns/sll.h +++ b/riscv/insns/sll.h @@ -1 +1 @@ -WRITE_RD(sext_xprlen(RS1 << (RS2 & (xprlen-1)))); +WRITE_RD(sext_xlen(RS1 << (RS2 & (xlen-1)))); diff --git a/riscv/insns/sra.h b/riscv/insns/sra.h index 45c9657..403b9b7 100644 --- a/riscv/insns/sra.h +++ b/riscv/insns/sra.h @@ -1 +1 @@ -WRITE_RD(sext_xprlen(sext_xprlen(RS1) >> (RS2 & (xprlen-1)))); +WRITE_RD(sext_xlen(sext_xlen(RS1) >> (RS2 & (xlen-1)))); diff --git a/riscv/insns/sub.h b/riscv/insns/sub.h index 95fb83e..9ed48f7 100644 --- a/riscv/insns/sub.h +++ b/riscv/insns/sub.h @@ -1 +1 @@ -WRITE_RD(sext_xprlen(RS1 - RS2)); +WRITE_RD(sext_xlen(RS1 - RS2)); -- 2.30.2