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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cpu/] [or1k/] [sprs.h] - Diff between revs 479 and 517

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

Rev 479 Rev 517
Line 38... Line 38...
 
 
inline void setsprbit(const int regno, const int bitnum, const unsigned long bitvalue);
inline void setsprbit(const int regno, const int bitnum, const unsigned long bitvalue);
inline int getsprbit(const int regno, const int bitnum);
inline int getsprbit(const int regno, const int bitnum);
void sprs_status();
void sprs_status();
 
 
 No newline at end of file
 No newline at end of file
 
#include "sim-config.h"
 
 
 
/* Ugly, but fast */
 
/* Get a specific SPR. */
 
static inline sprword
 
mfspr_(const int regno)
 
{
 
  extern unsigned long reg[32];
 
  extern unsigned long pc;
 
  extern unsigned long pcprev;
 
  extern sprword sprs[MAX_SPRS];
 
 
 
  switch (regno) {
 
  case SPR_SR:
 
    /* Exceptions are always enabled */
 
    return sprs[regno] | SPR_SR_EXR;
 
  case SPR_NPC:
 
    return pc;
 
  case SPR_PPC:
 
    return pcprev;
 
  default:
 
    /* Links to GPRS */
 
    if(regno >= 0x0400 && regno < 0x0420)
 
      return reg[regno - 0x0400];
 
    else if (regno < MAX_SPRS)
 
      return sprs[regno];
 
  }
 
  if (config.sim.verbose)
 
    printf ("WARNING: read out of SPR range %08X\n", regno);
 
  return 0;
 
}
 
 
 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.