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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [tick/] [tick.c] - Diff between revs 19 and 538

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

Rev 19 Rev 538
Line 90... Line 90...
static void
static void
tick_restart (void *dat)
tick_restart (void *dat)
{
{
  cpu_state.sprs[SPR_TTCR] = 0;
  cpu_state.sprs[SPR_TTCR] = 0;
  cycles_start = runtime.sim.cycles;
  cycles_start = runtime.sim.cycles;
  SCHED_ADD (tick_restart, NULL, cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD);
  SCHED_ADD (tick_restart, NULL, cpu_state.sprs[SPR_TTMR] & SPR_TTMR_TP);
}
}
 
 
/*! Stops the timer */
/*! Stops the timer */
static void
static void
tick_one_shot (void *dat)
tick_one_shot (void *dat)
{
{
  cpu_state.sprs[SPR_TTCR] = cpu_state.sprs[SPR_TTMR] & SPR_TTMR_PERIOD;
  cpu_state.sprs[SPR_TTCR] = cpu_state.sprs[SPR_TTMR] & SPR_TTMR_TP;
  tick_count = 0;
  tick_count = 0;
}
}
 
 
/*! Schedules the timer jobs */
/*! Schedules the timer jobs */
static void
static void
sched_timer_job (uorreg_t prev_ttmr)
sched_timer_job (uorreg_t prev_ttmr)
{
{
  uorreg_t ttmr = cpu_state.sprs[SPR_TTMR];
  uorreg_t ttmr = cpu_state.sprs[SPR_TTMR];
  uint32_t match_time = ttmr & SPR_TTMR_PERIOD;
  uint32_t match_time = ttmr & SPR_TTMR_TP;
  uint32_t ttcr_period = spr_read_ttcr () & SPR_TTCR_PERIOD;
  uint32_t ttcr_period = spr_read_ttcr () & SPR_TTCR_CNT;
 
 
  /* Remove previous jobs if they exists */
  /* Remove previous jobs if they exists */
  if ((prev_ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP))
  if ((prev_ttmr & SPR_TTMR_IE) && !(ttmr & SPR_TTMR_IP))
    {
    {
      SCHED_FIND_REMOVE (tick_raise_except, NULL);
      SCHED_FIND_REMOVE (tick_raise_except, NULL);
Line 194... Line 194...
  cycles_start = runtime.sim.cycles - cpu_state.sprs[SPR_TTCR];
  cycles_start = runtime.sim.cycles - cpu_state.sprs[SPR_TTCR];
 
 
  tick_count = value & SPR_TTMR_M;
  tick_count = value & SPR_TTMR_M;
 
 
  if ((tick_count == 0xc0000000) &&
  if ((tick_count == 0xc0000000) &&
      (cpu_state.sprs[SPR_TTCR] == (value & SPR_TTMR_PERIOD)))
      (cpu_state.sprs[SPR_TTCR] == (value & SPR_TTMR_TP)))
    {
    {
      tick_count = 0;
      tick_count = 0;
    }
    }
 
 
  sched_timer_job (prev_val);
  sched_timer_job (prev_val);

powered by: WebSVN 2.1.0

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