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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [or1ksim/] [cpu/] [or1k/] [sprs.c] - Diff between revs 1751 and 1756

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

Rev 1751 Rev 1756
Line 126... Line 126...
  case SPR_NPC:
  case SPR_NPC:
    {
    {
      /* The debugger has redirected us to a new address */
      /* The debugger has redirected us to a new address */
      /* This is usually done to reissue an instruction
      /* This is usually done to reissue an instruction
         which just caused a breakpoint exception. */
         which just caused a breakpoint exception. */
 
 
 
      /* JPB patch. When GDB stepi, this may be used to set the PC to the
 
         value it is already at. If this is the case, then we do nothing (in
 
         particular we do not trash a delayed branch) */
 
 
 
      if (value != cpu_state.pc)
 
        {
      cpu_state.pc = value;
      cpu_state.pc = value;
 
 
      if(!value && config.sim.verbose)
      if(!value && config.sim.verbose)
        PRINTF("WARNING: PC just set to 0!\n");
        PRINTF("WARNING: PC just set to 0!\n");
 
 
      /* Clear any pending delay slot jumps also */
      /* Clear any pending delay slot jumps also */
      cpu_state.delay_insn = 0;
      cpu_state.delay_insn = 0;
      pcnext = value + 4;
      pcnext = value + 4;
 
 
 
          /* Further JPB patch. If the processor is stalled, then subsequent
 
             reads of the NPC should return 0 until the processor is
 
             unstalled. If the processor is stalled, note that the NPC has
 
             been updated while the processor was stalled. */
 
 
 
          if (runtime.cpu.stalled)
 
            {
 
              cpu_state.npc_not_valid = 1;
 
            }
 
        }
    }
    }
    break;
    break;
  case SPR_PICSR:
  case SPR_PICSR:
    if(!config.pic.edge_trigger)
    if(!config.pic.edge_trigger)
      cpu_state.sprs[SPR_PICSR] = prev_val;
      cpu_state.sprs[SPR_PICSR] = prev_val;
Line 219... Line 237...
 
 
  ret = cpu_state.sprs[regno];
  ret = cpu_state.sprs[regno];
 
 
  switch (regno) {
  switch (regno) {
  case SPR_NPC:
  case SPR_NPC:
 
 
 
    /* The NPC is the program counter UNLESS the NPC has been changed and we
 
       are stalled, which will have flushed the pipeline, so the value is
 
       zero. Currently this is optional behavior, since it breaks GDB.
 
    */
 
 
 
    if (config.sim.strict_npc && cpu_state.npc_not_valid)
 
      {
 
        ret = 0;
 
      }
 
    else
 
      {
    ret = cpu_state.pc;
    ret = cpu_state.pc;
 
      }
    break;
    break;
 
 
  case SPR_TTCR:
  case SPR_TTCR:
    ret = spr_read_ttcr();
    ret = spr_read_ttcr();
    break;
    break;
  default:
  default:
    /* Links to GPRS */
    /* Links to GPRS */

powered by: WebSVN 2.1.0

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