OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 62 to Rev 63
    Reverse comparison

Rev 62 → Rev 63

/trunk/or1ksim/cpu/or1k/sprs.c
36,7 → 36,8
regno /= MAX_SPRS_PER_GRP;
regno += ofs;
if (regno < MAX_SPRS)
/* printf("mtspr(%x, %x)\n", regno, value);
*/ if (regno < MAX_SPRS)
sprs[regno] = value;
else {
printf("\nABORT: write out of SPR range\n");
54,7 → 55,8
regno /= MAX_SPRS_PER_GRP;
regno += ofs;
 
if (regno < MAX_SPRS)
/* printf("mfspr(%x)%x\n", regno, sprs[regno]);
*/ if (regno < MAX_SPRS)
return sprs[regno];
else {
printf("\nABORT: read out of SPR range\n");
85,6 → 87,45
return (regvalue >> bitnum) & 0x1;
}
 
/* Set specific SPR bit(s) identified by mask. */
void setsprbits(int regno, unsigned long mask, unsigned long value)
{
sprword regvalue = mfspr(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); */
mtspr(regno, (regvalue & ~mask) | shifted);
 
return;
}
 
/* Get specific SPR bit(s) identified by mask. */
unsigned long getsprbits(int regno, unsigned long mask)
{
sprword regvalue = mfspr(regno);
sprword shifted = 0x0;
int m, v = 0;
 
/* m counts bits in valuemask */
/* v counts bits in regvalue */
for (m = 0; m < 32; m++)
if ((mask >> m) & 0x1) {
shifted |= ((regvalue >> m) & 0x1) << v;
v++;
}
 
return shifted;
}
 
/* Show status of important SPRs. */
void sprs_status()
{
93,4 → 134,5
printf("MACLO: 0x%.8x MACHI: 0x%.8x\n", mfspr(SPR_MACLO), mfspr(SPR_MACHI));
printf("EPCR0: 0x%.8x EPCR1: 0x%.8x\n", mfspr(SPR_EPCR_BASE), mfspr(SPR_EPCR_BASE+1));
printf("EEAR0: 0x%.8x EEAR1: 0x%.8x\n", mfspr(SPR_EEAR_BASE), mfspr(SPR_EEAR_BASE+1));
printf("ESR0 : 0x%.8x ESR1 : 0x%.8x\n", mfspr(SPR_ESR_BASE), mfspr(SPR_ESR_BASE+1));
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.