projects
/
riscv-isa-sim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d8022e9
)
Use xlen, not xprlen, to refer to x-register width
author
Andrew Waterman
<waterman@cs.berkeley.edu>
Sun, 8 Feb 2015 08:13:48 +0000
(
00:13
-0800)
committer
Andrew Waterman
<waterman@cs.berkeley.edu>
Sun, 8 Feb 2015 08:13:48 +0000
(
00:13
-0800)
21 files changed:
hwacha/insn_template_hwacha.cc
patch
|
blob
|
history
hwacha/insn_template_hwacha_ut.cc
patch
|
blob
|
history
riscv/decode.h
patch
|
blob
|
history
riscv/insn_template.cc
patch
|
blob
|
history
riscv/insns/add.h
patch
|
blob
|
history
riscv/insns/addi.h
patch
|
blob
|
history
riscv/insns/auipc.h
patch
|
blob
|
history
riscv/insns/csrrc.h
patch
|
blob
|
history
riscv/insns/csrrci.h
patch
|
blob
|
history
riscv/insns/csrrs.h
patch
|
blob
|
history
riscv/insns/csrrsi.h
patch
|
blob
|
history
riscv/insns/csrrw.h
patch
|
blob
|
history
riscv/insns/csrrwi.h
patch
|
blob
|
history
riscv/insns/div.h
patch
|
blob
|
history
riscv/insns/divu.h
patch
|
blob
|
history
riscv/insns/mul.h
patch
|
blob
|
history
riscv/insns/rem.h
patch
|
blob
|
history
riscv/insns/remu.h
patch
|
blob
|
history
riscv/insns/sll.h
patch
|
blob
|
history
riscv/insns/sra.h
patch
|
blob
|
history
riscv/insns/sub.h
patch
|
blob
|
history
diff --git
a/hwacha/insn_template_hwacha.cc
b/hwacha/insn_template_hwacha.cc
index cb44cac94e75044a13d36a767cbad8712a316c1d..d225949c993cf9377552bb0f4e2730ecccddf123 100644
(file)
--- 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)
{
reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc)
{
- int x
pr
len = 64;
- reg_t npc = sext_x
pr
len(pc + insn_length(OPCODE));
+ int xlen = 64;
+ reg_t npc = sext_xlen(pc + insn_length(OPCODE));
hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
rocc_insn_union_t u;
u.i = insn;
hwacha_t* h = static_cast<hwacha_t*>(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 d312e93c8000cfd16b6cf289ae88e72473a4cdf5..7f5dc0ebb515dd9fe6cd8bcd284bc8a74ae2f670 100644
(file)
--- 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)
{
reg_t hwacha_NAME(processor_t* p, insn_t insn, reg_t pc)
{
- int x
pr
len = 64;
- reg_t npc = sext_x
pr
len(pc + insn_length(OPCODE));
+ int xlen = 64;
+ reg_t npc = sext_xlen(pc + insn_length(OPCODE));
hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
do {
#include "insns_ut/NAME.h"
hwacha_t* h = static_cast<hwacha_t*>(p->get_extension());
do {
#include "insns_ut/NAME.h"
diff --git
a/riscv/decode.h
b/riscv/decode.h
index 274ab2ac30d04639f0bbfd22c896a9c8b5d7554c..6ac465a07c74ba6cf942ab963dc96d29cb108848 100644
(file)
--- a/
riscv/decode.h
+++ b/
riscv/decode.h
@@
-135,7
+135,7
@@
private:
if(rm > 4) throw trap_illegal_instruction(); \
rm; })
if(rm > 4) throw trap_illegal_instruction(); \
rm; })
-#define xpr64 (x
pr
len == 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()
#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()
#endif
#define require_accelerator if(unlikely(!(STATE.sr & SR_EA))) throw trap_accelerator_disabled()
-#define cmp_trunc(reg) (reg_t(reg) << (64-x
pr
len))
+#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 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_x
prlen(x) (((sreg_t)(x) << (64-xprlen)) >> (64-xpr
len))
-#define zext_x
prlen(x) (((reg_t)(x) << (64-xprlen)) >> (64-xpr
len))
+#define sext_x
len(x) (((sreg_t)(x) << (64-xlen)) >> (64-x
len))
+#define zext_x
len(x) (((reg_t)(x) << (64-xlen)) >> (64-x
len))
-#define set_pc(x) (npc = sext_x
pr
len(x))
+#define set_pc(x) (npc = sext_xlen(x))
#define validate_csr(which, write) ({ \
unsigned my_priv = (STATE.sr & SR_S) ? 1 : 0; \
#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 d2c0fce4322a1f1dbd1ad7d4d3416c369da153bb..35f67a0d3cb57798850789343f083ea53543487e 100644
(file)
--- 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)
{
reg_t rv32_NAME(processor_t* p, insn_t insn, reg_t pc)
{
- int x
pr
len = 32;
- reg_t npc = sext_x
pr
len(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)
{
#include "insns/NAME.h"
return npc;
}
reg_t rv64_NAME(processor_t* p, insn_t insn, reg_t pc)
{
- int x
pr
len = 64;
- reg_t npc = sext_x
pr
len(pc + insn_length(OPCODE));
+ int xlen = 64;
+ reg_t npc = sext_xlen(pc + insn_length(OPCODE));
#include "insns/NAME.h"
return npc;
}
#include "insns/NAME.h"
return npc;
}
diff --git
a/riscv/insns/add.h
b/riscv/insns/add.h
index d7a5c98d21867debe16657aad778d6b1be191c7e..895e2b1867dbf29aee59a86fc68fcbad5e2535f1 100644
(file)
--- a/
riscv/insns/add.h
+++ b/
riscv/insns/add.h
@@
-1
+1
@@
-WRITE_RD(sext_x
pr
len(RS1 + RS2));
+WRITE_RD(sext_xlen(RS1 + RS2));
diff --git
a/riscv/insns/addi.h
b/riscv/insns/addi.h
index c861a97c80ba3a81871f9ef3893d10bf7c387e85..1bb5dcedfa8e3c1269cd2f37697c090535e70d04 100644
(file)
--- a/
riscv/insns/addi.h
+++ b/
riscv/insns/addi.h
@@
-1
+1
@@
-WRITE_RD(sext_x
pr
len(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 d724d10b43352910fbf1cb8d8ebb6ddf5b9268d0..1a2b169b59a4b46ecb2976bb7ae427ae0fe49c48 100644
(file)
--- a/
riscv/insns/auipc.h
+++ b/
riscv/insns/auipc.h
@@
-1
+1
@@
-WRITE_RD(sext_x
pr
len(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 8719267da7b33870c8f27e5afec9442d765c964f..4667fc889fc2e39e8adf30c261a0c7cd060335fe 100644
(file)
--- 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);
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, old & ~RS1);
-WRITE_RD(sext_x
pr
len(old));
+WRITE_RD(sext_xlen(old));
diff --git
a/riscv/insns/csrrci.h
b/riscv/insns/csrrci.h
index 51a2cdeec6eac435c8c4a4cef1bb1c2669f746f7..172aea0a05bcd07def93d544349ddfe9d13f899d 100644
(file)
--- 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());
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_x
pr
len(old));
+WRITE_RD(sext_xlen(old));
diff --git
a/riscv/insns/csrrs.h
b/riscv/insns/csrrs.h
index 675cb86e7a8476b969189e5445113036048b81d6..661685536f72627659fce52e536a1dcfd6eb044a 100644
(file)
--- 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);
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_x
pr
len(old));
+WRITE_RD(sext_xlen(old));
diff --git
a/riscv/insns/csrrsi.h
b/riscv/insns/csrrsi.h
index 094e91a855869fafdf241a6aba6a1d7be525e91d..913c20a343ea317817eb32a220932e0c1029d1ea 100644
(file)
--- 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());
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, old | insn.rs1());
-WRITE_RD(sext_x
pr
len(old));
+WRITE_RD(sext_xlen(old));
diff --git
a/riscv/insns/csrrw.h
b/riscv/insns/csrrw.h
index 3d1ea32dd9ac67f5fe00d30b7b0ca0deb32e0b96..b98166584b68decc869a9f7ed4ffbc624324b29a 100644
(file)
--- 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);
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, RS1);
-WRITE_RD(sext_x
pr
len(old));
+WRITE_RD(sext_xlen(old));
diff --git
a/riscv/insns/csrrwi.h
b/riscv/insns/csrrwi.h
index 081b4e9573b4c139810b7ce9f7ad0c7d12be5521..cbee6b9de9e168d8d00602dc6d6b9aaf9377029b 100644
(file)
--- 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());
int csr = validate_csr(insn.csr(), true);
reg_t old = p->get_pcr(csr);
p->set_pcr(csr, insn.rs1());
-WRITE_RD(sext_x
pr
len(old));
+WRITE_RD(sext_xlen(old));
diff --git
a/riscv/insns/div.h
b/riscv/insns/div.h
index 261880fe3761b725fdf4d642c3cccfab2c46b3d4..3ad613a1113ff3c156720b7028aedea9a937e729 100644
(file)
--- a/
riscv/insns/div.h
+++ b/
riscv/insns/div.h
@@
-1,8
+1,8
@@
-sreg_t lhs = sext_x
pr
len(RS1);
-sreg_t rhs = sext_x
pr
len(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
if(rhs == 0)
WRITE_RD(UINT64_MAX);
else if(lhs == INT64_MIN && rhs == -1)
WRITE_RD(lhs);
else
- WRITE_RD(sext_x
pr
len(lhs / rhs));
+ WRITE_RD(sext_xlen(lhs / rhs));
diff --git
a/riscv/insns/divu.h
b/riscv/insns/divu.h
index fd878a2f3e8a50bef036289924d0f5ddc7ceea7f..4887ce0a6037cbc78e2b3833d57e21de21f34482 100644
(file)
--- a/
riscv/insns/divu.h
+++ b/
riscv/insns/divu.h
@@
-1,6
+1,6
@@
-reg_t lhs = zext_x
pr
len(RS1);
-reg_t rhs = zext_x
pr
len(RS2);
+reg_t lhs = zext_xlen(RS1);
+reg_t rhs = zext_xlen(RS2);
if(rhs == 0)
WRITE_RD(UINT64_MAX);
else
if(rhs == 0)
WRITE_RD(UINT64_MAX);
else
- WRITE_RD(sext_x
pr
len(lhs / rhs));
+ WRITE_RD(sext_xlen(lhs / rhs));
diff --git
a/riscv/insns/mul.h
b/riscv/insns/mul.h
index 9725bfd7a0fc89f926028297ab9fd4ae310330b3..c6b53311e6df7839bc545740a582bbfa71ef3367 100644
(file)
--- a/
riscv/insns/mul.h
+++ b/
riscv/insns/mul.h
@@
-1
+1
@@
-WRITE_RD(sext_x
pr
len(RS1 * RS2));
+WRITE_RD(sext_xlen(RS1 * RS2));
diff --git
a/riscv/insns/rem.h
b/riscv/insns/rem.h
index fa98ac6893f8a2919c3a974a916889cc8757427b..d074f26f6b5944486a2fd977f73ec999d03dcbce 100644
(file)
--- a/
riscv/insns/rem.h
+++ b/
riscv/insns/rem.h
@@
-1,8
+1,8
@@
-sreg_t lhs = sext_x
pr
len(RS1);
-sreg_t rhs = sext_x
pr
len(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
if(rhs == 0)
WRITE_RD(lhs);
else if(lhs == INT64_MIN && rhs == -1)
WRITE_RD(0);
else
- WRITE_RD(sext_x
pr
len(lhs % rhs));
+ WRITE_RD(sext_xlen(lhs % rhs));
diff --git
a/riscv/insns/remu.h
b/riscv/insns/remu.h
index 646bb3a65fa9ccd053b666eb070b81c45ac75139..c29194732f00d93415df95368052bbef2e3ec4cf 100644
(file)
--- a/
riscv/insns/remu.h
+++ b/
riscv/insns/remu.h
@@
-1,6
+1,6
@@
-reg_t lhs = zext_x
pr
len(RS1);
-reg_t rhs = zext_x
pr
len(RS2);
+reg_t lhs = zext_xlen(RS1);
+reg_t rhs = zext_xlen(RS2);
if(rhs == 0)
if(rhs == 0)
- WRITE_RD(sext_x
pr
len(RS1));
+ WRITE_RD(sext_xlen(RS1));
else
else
- WRITE_RD(sext_x
pr
len(lhs % rhs));
+ WRITE_RD(sext_xlen(lhs % rhs));
diff --git
a/riscv/insns/sll.h
b/riscv/insns/sll.h
index 48c0acfca7284b1e2db889feb6adc0e5853085f2..7db761318f576847e2421ce2fbf4fabbcd71e8a7 100644
(file)
--- a/
riscv/insns/sll.h
+++ b/
riscv/insns/sll.h
@@
-1
+1
@@
-WRITE_RD(sext_x
prlen(RS1 << (RS2 & (xpr
len-1))));
+WRITE_RD(sext_x
len(RS1 << (RS2 & (x
len-1))));
diff --git
a/riscv/insns/sra.h
b/riscv/insns/sra.h
index 45c96574f511b35c681c8a2a91597f6cd3c45b02..403b9b733a5e3cce36c7885e906a80f4dace1309 100644
(file)
--- a/
riscv/insns/sra.h
+++ b/
riscv/insns/sra.h
@@
-1
+1
@@
-WRITE_RD(sext_x
prlen(sext_xprlen(RS1) >> (RS2 & (xpr
len-1))));
+WRITE_RD(sext_x
len(sext_xlen(RS1) >> (RS2 & (x
len-1))));
diff --git
a/riscv/insns/sub.h
b/riscv/insns/sub.h
index 95fb83e3340f71beb2ca64115ed14bda85f29ec4..9ed48f7449061acd822a616d24fb8b16303cb13b 100644
(file)
--- a/
riscv/insns/sub.h
+++ b/
riscv/insns/sub.h
@@
-1
+1
@@
-WRITE_RD(sext_x
pr
len(RS1 - RS2));
+WRITE_RD(sext_xlen(RS1 - RS2));