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

Subversion Repositories or1k

[/] [or1k/] [tags/] [rel-0-3-0-rc3/] [or1ksim/] [pic/] [pic.c] - Diff between revs 1545 and 1608

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

Rev 1545 Rev 1608
Line 60... Line 60...
{
{
  /* Don't do anything if interrupts not currently enabled */
  /* Don't do anything if interrupts not currently enabled */
  if(cpu_state.sprs[SPR_SR] & SPR_SR_IEE) {
  if(cpu_state.sprs[SPR_SR] & SPR_SR_IEE) {
    TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
    TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
    except_handle(EXCEPT_INT, cpu_state.sprs[SPR_EEAR_BASE]);
    except_handle(EXCEPT_INT, cpu_state.sprs[SPR_EEAR_BASE]);
  } else if(cpu_state.sprs[SPR_PICSR] & (1 << (int)dat))
  } else if(cpu_state.sprs[SPR_PICSR] & cpu_state.sprs[SPR_PICMR])
    /* Reschedule only if the interrupt hasn't been cleared */
    /* Reschedule only if the interrupt hasn't been cleared */
    sched_next_insn(pic_clock, dat);
    sched_next_insn(pic_clock, NULL);
}
}
 
 
/* WARNING: Don't eaven try and call this function *during* a simulated
/* WARNING: Don't eaven try and call this function *during* a simulated
 * instruction!! (as in during a read_mem or write_mem callback).  except_handle
 * instruction!! (as in during a read_mem or write_mem callback).  except_handle
 * assumes that this is the case, it breaks otherwise. */
 * assumes that this is the case, it breaks otherwise. */
Line 79... Line 79...
  cpu_state.sprs[SPR_PMR] &= ~(SPR_PMR_DME | SPR_PMR_SME);
  cpu_state.sprs[SPR_PMR] &= ~(SPR_PMR_DME | SPR_PMR_SME);
 
 
  TRACE("Asserting interrupt %d (%s).\n", line,
  TRACE("Asserting interrupt %d (%s).\n", line,
        (cpu_state.sprs[SPR_PICMR] & (1 << line)) ? "Unmasked" : "Masked");
        (cpu_state.sprs[SPR_PICMR] & (1 << line)) ? "Unmasked" : "Masked");
 
 
 
  SCHED_FIND_REMOVE(pic_clock, NULL);
 
 
  if ((cpu_state.sprs[SPR_PICMR] & (1 << line)) || line < 2) {
  if ((cpu_state.sprs[SPR_PICMR] & (1 << line)) || line < 2) {
    cpu_state.sprs[SPR_PICSR] |= 1 << line;
    cpu_state.sprs[SPR_PICSR] |= 1 << line;
    /* Don't do anything if interrupts not currently enabled */
    /* Don't do anything if interrupts not currently enabled */
    if (cpu_state.sprs[SPR_SR] & SPR_SR_IEE) {
    if (cpu_state.sprs[SPR_SR] & SPR_SR_IEE) {
      TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
      TRACE("Delivering interrupt on cycle %lli\n", runtime.sim.cycles);
      except_handle(EXCEPT_INT, cpu_state.sprs[SPR_EEAR_BASE]);
      except_handle(EXCEPT_INT, cpu_state.sprs[SPR_EEAR_BASE]);
    } else
      return;
      /* Interrupts not currently enabled, retry next clock cycle */
    }
      sched_next_insn(pic_clock, (void *)line);
 
  }
  }
 
 
 
  if(cpu_state.sprs[SPR_PICMR] & cpu_state.sprs[SPR_PICSR])
 
    /* Interrupts not currently enabled, retry next clock cycle */
 
    sched_next_insn(pic_clock, NULL);
}
}
 
 
 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.