Esempio n. 1
0
static void
engine_run_n (SIM_DESC sd, int next_cpu_nr, int nr_cpus, int max_insns, int fast_p)
{
  int i;
  ENGINE_FN *engine_fns[MAX_NR_PROCESSORS];

  for (i = 0; i < nr_cpus; ++i)
    {
      SIM_CPU *cpu = STATE_CPU (sd, i);

      engine_fns[i] = fast_p ? CPU_FAST_ENGINE_FN (cpu) : CPU_FULL_ENGINE_FN (cpu);
      prime_cpu (cpu, max_insns);
    }

  while (1)
    {
      SIM_ENGINE_PREFIX_HOOK (sd);

      /* FIXME: proper cycling of all of them, blah blah blah.  */
      while (next_cpu_nr != nr_cpus)
	{
	  SIM_CPU *cpu = STATE_CPU (sd, next_cpu_nr);

	  (* engine_fns[next_cpu_nr]) (cpu);
	  ++next_cpu_nr;
	}

      SIM_ENGINE_POSTFIX_HOOK (sd);

      /* process any events */
      if (sim_events_tick (sd))
	sim_events_process (sd);
    }
}
Esempio n. 2
0
static void
lm32_init_cpu (SIM_CPU *cpu)
{
  CPU_REG_FETCH (cpu) = lm32bf_fetch_register;
  CPU_REG_STORE (cpu) = lm32bf_store_register;
  CPU_PC_FETCH (cpu) = lm32bf_h_pc_get;
  CPU_PC_STORE (cpu) = lm32bf_h_pc_set;
  CPU_GET_IDATA (cpu) = lm32bf_get_idata;
  CPU_MAX_INSNS (cpu) = LM32BF_INSN__MAX;
  CPU_INSN_NAME (cpu) = cgen_insn_name;
  CPU_FULL_ENGINE_FN (cpu) = lm32bf_engine_run_full;
#if WITH_FAST
  CPU_FAST_ENGINE_FN (cpu) = lm32bf_engine_run_fast;
#else
  CPU_FAST_ENGINE_FN (cpu) = lm32bf_engine_run_full;
#endif
}
Esempio n. 3
0
static void
engine_run_1 (SIM_DESC sd, int max_insns, int fast_p)
{
  sim_cpu *cpu = STATE_CPU (sd, 0);
  ENGINE_FN *fn = fast_p ? CPU_FAST_ENGINE_FN (cpu) : CPU_FULL_ENGINE_FN (cpu);

  prime_cpu (cpu, max_insns);

  while (1)
    {
      SIM_ENGINE_PREFIX_HOOK (sd);

      (*fn) (cpu);

      SIM_ENGINE_POSTFIX_HOOK (sd);

      /* process any events */
      if (sim_events_tick (sd))
	sim_events_process (sd);
    }
}