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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [cpu/] [or1k/] [sprs.c] - Diff between revs 1529 and 1531

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

Rev 1529 Rev 1531
Line 52... Line 52...
void
void
mtspr(uint16_t regno, const uorreg_t value)
mtspr(uint16_t regno, const uorreg_t value)
{
{
  uorreg_t prev_val;
  uorreg_t prev_val;
 
 
  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;
 
 
  /* MM: Register hooks.  */
  /* MM: Register hooks.  */
  switch (regno) {
  switch (regno) {
Line 202... Line 201...
 
 
/* Get a specific SPR. */
/* Get a specific SPR. */
uorreg_t mfspr(const uint16_t regno)
uorreg_t mfspr(const uint16_t regno)
{
{
  extern oraddr_t pcprev;
  extern oraddr_t pcprev;
 
  uorreg_t ret;
 
 
 
  ret = cpu_state.sprs[regno];
 
 
  switch (regno) {
  switch (regno) {
  case SPR_NPC:
  case SPR_NPC:
    return cpu_state.pc;
    ret = cpu_state.pc;
  case SPR_PPC:
  case SPR_PPC:
    return pcprev;
    ret = pcprev;
  case SPR_TTCR:
  case SPR_TTCR:
    return spr_read_ttcr();
    ret = spr_read_ttcr();
  default:
  default:
    /* Links to GPRS */
    /* Links to GPRS */
    if(regno >= 0x0400 && regno < 0x0420)
    if(regno >= 0x0400 && regno < 0x0420)
      return cpu_state.reg[regno - 0x0400];
      ret = cpu_state.reg[regno - 0x0400];
    else if (regno < MAX_SPRS)
  }
      return cpu_state.sprs[regno];
 
  }
  return ret;
  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)
void sprs_status(void)
{
{

powered by: WebSVN 2.1.0

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