From 514fb14ef375af151f575e5e9555792d0a81962a Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 20 Oct 2018 02:11:09 +0100 Subject: [PATCH] add sign-extension bitwidth macros --- riscv/sv_reg.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/riscv/sv_reg.h b/riscv/sv_reg.h index 6375a1a..f704f35 100644 --- a/riscv/sv_reg.h +++ b/riscv/sv_reg.h @@ -1,6 +1,9 @@ #ifndef SV_REG_H #define SV_REG_H +#define sext_bwid(x,wid) (((sreg_t)(x) << (64-wid)) >> (64-wid)) +#define zext_bwid(x,wid) (((reg_t)(x) << (64-wid)) >> (64-wid)) + class sv_sreg_t; class sv_regbase_t { @@ -29,7 +32,7 @@ public: 0x1, // 8-default/2: default/2 0x2, // 8-default*2: default*2 0x3 // 8-8: 8 - }; + }; return tb[elwidth|(r.elwidth<<2)]; } }; -- 2.30.2