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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [cpu/] [or1k/] [sprs.c] - Diff between revs 1486 and 1508

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 1486 Rev 1508
Line 48... Line 48...
int audio_cnt = 0;
int audio_cnt = 0;
 
 
static FILE *fo = 0;
static FILE *fo = 0;
/* Set a specific SPR with a value. */
/* Set a specific SPR with a value. */
void
void
mtspr(uint16_t regno, const sprword value)
mtspr(uint16_t regno, const uorreg_t value)
{
{
  sprword prev_val;
  uorreg_t prev_val;
 
 
  regno %= MAX_SPRS;
  regno %= MAX_SPRS;
  prev_val = cpu_state.sprs[regno];
  prev_val = cpu_state.sprs[regno];
  cpu_state.sprs[regno] = value;
  cpu_state.sprs[regno] = value;
 
 
Line 212... Line 212...
    }
    }
    break;
    break;
  }
  }
}
}
 
 
 
/* Get a specific SPR. */
 
uorreg_t mfspr(const uint16_t regno)
 
{
 
  extern oraddr_t pcprev;
 
 
 
  switch (regno) {
 
  case SPR_NPC:
 
    return cpu_state.pc;
 
  case SPR_PPC:
 
    return pcprev;
 
  case SPR_TTCR:
 
    return spr_read_ttcr();
 
  default:
 
    /* Links to GPRS */
 
    if(regno >= 0x0400 && regno < 0x0420)
 
      return cpu_state.reg[regno - 0x0400];
 
    else if (regno < MAX_SPRS)
 
      return cpu_state.sprs[regno];
 
  }
 
  if (config.sim.verbose)
 
    PRINTF ("WARNING: read out of SPR range %08X\n", regno);
 
  return 0;
 
}
 
 
/* Show status of important SPRs. */
/* Show status of important SPRs. */
void sprs_status()
void sprs_status(void)
{
{
  PRINTF("VR   : 0x%.8lx  UPR  : 0x%.8lx\n", mfspr(SPR_VR), mfspr(SPR_UPR));
  PRINTF("VR   : 0x%"PRIxREG"  UPR  : 0x%"PRIxREG"\n", cpu_state.sprs[SPR_VR],
  PRINTF("SR   : 0x%.8lx\n", mfspr(SPR_SR));
         cpu_state.sprs[SPR_UPR]);
  PRINTF("MACLO: 0x%.8lx  MACHI: 0x%.8lx\n", mfspr(SPR_MACLO), mfspr(SPR_MACHI));
  PRINTF("SR   : 0x%"PRIxREG"\n", cpu_state.sprs[SPR_SR]);
  PRINTF("EPCR0: 0x%.8lx  EPCR1: 0x%.8lx\n", mfspr(SPR_EPCR_BASE), mfspr(SPR_EPCR_BASE+1));
  PRINTF("MACLO: 0x%"PRIxREG"  MACHI: 0x%"PRIxREG"\n",
  PRINTF("EEAR0: 0x%.8lx  EEAR1: 0x%.8lx\n", mfspr(SPR_EEAR_BASE), mfspr(SPR_EEAR_BASE+1));
         cpu_state.sprs[SPR_MACLO], cpu_state.sprs[SPR_MACHI]);
  PRINTF("ESR0 : 0x%.8lx  ESR1 : 0x%.8lx\n", mfspr(SPR_ESR_BASE), mfspr(SPR_ESR_BASE+1));
  PRINTF("EPCR0: 0x%"PRIxADDR"  EPCR1: 0x%"PRIxADDR"\n",
  PRINTF("TTMR : 0x%.8lx  TTCR : 0x%.8lx\n", mfspr(SPR_TTMR), mfspr(SPR_TTCR));
         cpu_state.sprs[SPR_EPCR_BASE], cpu_state.sprs[SPR_EPCR_BASE+1]);
  PRINTF("PICMR: 0x%.8lx  PICSR: 0x%.8lx\n", mfspr(SPR_PICMR), mfspr(SPR_PICSR));
  PRINTF("EEAR0: 0x%"PRIxADDR"  EEAR1: 0x%"PRIxADDR"\n",
  PRINTF("PPC:   0x%.8lx  NPC   : 0x%.8lx\n", mfspr(SPR_PPC), mfspr(SPR_NPC));
         cpu_state.sprs[SPR_EEAR_BASE], cpu_state.sprs[SPR_EEAR_BASE+1]);
 
  PRINTF("ESR0 : 0x%"PRIxREG"  ESR1 : 0x%"PRIxREG"\n",
 
         cpu_state.sprs[SPR_ESR_BASE], cpu_state.sprs[SPR_ESR_BASE+1]);
 
  PRINTF("TTMR : 0x%"PRIxREG"  TTCR : 0x%"PRIxREG"\n",
 
         cpu_state.sprs[SPR_TTMR], cpu_state.sprs[SPR_TTCR]);
 
  PRINTF("PICMR: 0x%"PRIxREG"  PICSR: 0x%"PRIxREG"\n",
 
         cpu_state.sprs[SPR_PICMR], cpu_state.sprs[SPR_PICSR]);
 
  PRINTF("PPC:   0x%"PRIxADDR"  NPC   : 0x%"PRIxADDR"\n",
 
         cpu_state.sprs[SPR_PPC], cpu_state.sprs[SPR_NPC]);
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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