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 1748 and 1751

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

Rev 1748 Rev 1751
Line 41... Line 41...
#include "execute.h"
#include "execute.h"
#include "except.h"
#include "except.h"
#include "sprs.h"
#include "sprs.h"
#include "sim-config.h"
#include "sim-config.h"
#include "sched.h"
#include "sched.h"
#include "debug.h"
 
 
 
DEFAULT_DEBUG_CHANNEL (pic);
 
 
 
/* FIXME: This ugly hack will be removed once the bus architecture gets written
/* FIXME: This ugly hack will be removed once the bus architecture gets written
 */
 */
struct pic pic_state_int = { 1, 1 };
struct pic pic_state_int = { 1, 1 };
 
 
Line 67... Line 65...
static void
static void
pic_rep_int (void *dat)
pic_rep_int (void *dat)
{
{
  if (cpu_state.sprs[SPR_PICSR])
  if (cpu_state.sprs[SPR_PICSR])
    {
    {
      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]);
    }
    }
}
}
 
 
/* Called whenever interrupts get enabled */
/* Called whenever interrupts get enabled */
Line 92... Line 89...
  uint32_t lmask = 1 << line;
  uint32_t lmask = 1 << line;
 
 
  /* Disable doze and sleep mode */
  /* Disable doze and sleep mode */
  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,
 
         (cpu_state.sprs[SPR_PICMR] & lmask) ? "Unmasked" : "Masked");
 
 
 
  /* If PIC is disabled, don't set any register, just raise EXCEPT_INT */
  /* If PIC is disabled, don't set any register, just raise EXCEPT_INT */
  if (!config.pic.enabled)
  if (!config.pic.enabled)
    {
    {
      if (cpu_state.sprs[SPR_SR] & SPR_SR_IEE)
      if (cpu_state.sprs[SPR_SR] & SPR_SR_IEE)
        except_handle (EXCEPT_INT, cpu_state.sprs[SPR_EEAR_BASE]);
        except_handle (EXCEPT_INT, cpu_state.sprs[SPR_EEAR_BASE]);
Line 106... Line 100...
    }
    }
 
 
  if (cpu_state.pic_lines & lmask)
  if (cpu_state.pic_lines & lmask)
    {
    {
      /* No edge occured, warn about performance penalty and exit */
      /* No edge occured, warn about performance penalty and exit */
      WARN ("Int line %d did not change state\n", line);
      fprintf (stderr, "Warning: Int line %d did not change state\n", line);
      return;
      return;
    }
    }
 
 
  cpu_state.pic_lines |= lmask;
  cpu_state.pic_lines |= lmask;
  cpu_state.sprs[SPR_PICSR] |= lmask;
  cpu_state.sprs[SPR_PICSR] |= lmask;
Line 122... Line 116...
 
 
/* Clears an int on a pic line */
/* Clears an int on a pic line */
void
void
clear_interrupt (int line)
clear_interrupt (int line)
{
{
  TRACE ("Clearing interrupt %d\n", line);
 
  cpu_state.pic_lines &= ~(1 << line);
  cpu_state.pic_lines &= ~(1 << line);
 
 
  if (!config.pic.edge_trigger)
  if (!config.pic.edge_trigger)
    cpu_state.sprs[SPR_PICSR] &= ~(1 << line);
    cpu_state.sprs[SPR_PICSR] &= ~(1 << line);
}
}

powered by: WebSVN 2.1.0

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