Line 58... |
Line 58... |
if (config.sim.verbose)
|
if (config.sim.verbose)
|
PRINTF ("WARNING: read out of SPR range %08X\n", regno);
|
PRINTF ("WARNING: read out of SPR range %08X\n", regno);
|
return 0;
|
return 0;
|
}
|
}
|
|
|
/* Set specific SPR bit(s) identified by mask. */
|
|
static inline void
|
|
setsprbits(const int regno, const unsigned long mask, const unsigned long value)
|
|
{
|
|
sprword regvalue = cpu_state.sprs[regno];
|
|
sprword shifted = 0x0;
|
|
int m, v = 0;
|
|
|
|
/* m counts bits in valuemask */
|
|
/* v counts bits in value */
|
|
for (m = 0; m < 32; m++)
|
|
if ((mask >> m) & 0x1) {
|
|
shifted |= ((value >> v) & 0x1) << m;
|
|
v++;
|
|
}
|
|
|
|
/* PRINTF("oldvalue %x setsprbits(%x, %x, %x) shifted %x", regvalue, regno, mask, value, shifted); */
|
|
cpu_state.sprs[regno] = (regvalue & ~mask) | shifted;
|
|
}
|
|
|
|
/* Get specific SPR bit(s) identified by mask. */
|
/* Get specific SPR bit(s) identified by mask. */
|
static inline unsigned long
|
static inline unsigned long
|
getsprbits(const int regno, const unsigned long mask)
|
getsprbits(const int regno, const unsigned long mask)
|
{
|
{
|
sprword regvalue = cpu_state.sprs[regno];
|
sprword regvalue = cpu_state.sprs[regno];
|
Line 97... |
Line 77... |
}
|
}
|
|
|
return shifted;
|
return shifted;
|
}
|
}
|
|
|
/* Set a specific bit from SPR. LSB in a word is numbered zero. */
|
|
static inline void
|
|
setsprbit(const int regno, const int bitnum, const unsigned long bitvalue)
|
|
{
|
|
sprword mask;
|
|
sprword regvalue = cpu_state.sprs[regno];
|
|
|
|
mask = ~(1 << bitnum);
|
|
|
|
cpu_state.sprs[regno] = (regvalue & mask) | ((bitvalue & 0x1) << bitnum);
|
|
|
|
return;
|
|
}
|
|
|
|
/* Get a specific bit from SPR. */
|
|
static inline int
|
|
getsprbit(const int regno, const int bitnum)
|
|
{
|
|
sprword regvalue = cpu_state.sprs[regno];
|
|
|
|
return (regvalue >> bitnum) & 0x1;
|
|
}
|
|
|
|
/* Get specific SPR bit(s) identified by mask. */
|
|
static inline unsigned long
|
|
testsprbits(const int regno, const unsigned long mask)
|
|
{
|
|
sprword regvalue = cpu_state.sprs[regno];
|
|
return regvalue & mask;
|
|
}
|
|
|
|
|
|
No newline at end of file
|
No newline at end of file
|