#define sext32(x) ((sreg_t)(int32_t)(x))
#define zext32(x) ((reg_t)(uint32_t)(x))
+
+#define _sext_xlen(x) (((sreg_t)(x) << (64-xlen)) >> (64-xlen))
#define sext_xlen(x) (((sreg_t)(x) << (64-xlen)) >> (64-xlen))
+
+#define _zext_xlen(x) (((reg_t)(x) << (64-xlen)) >> (64-xlen))
#define zext_xlen(x) (((reg_t)(x) << (64-xlen)) >> (64-xlen))
#define _set_pc(x) \
do { p->check_pc_alignment(x); \
- npc = sext_xlen(x); \
+ npc = _sext_xlen(x); \
} while(0)
#ifndef SPIKE_SIMPLEV
void processor_t::set_csr(int which, reg_t val)
{
- val = zext_xlen(val);
+ val = _zext_xlen(val);
reg_t delegable_ints = MIP_SSIP | MIP_STIP | MIP_SEIP
| ((ext != NULL) << IRQ_COP);
reg_t all_ints = delegable_ints | MIP_MSIP | MIP_MTIP;