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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [toplevel.c] - Diff between revs 1446 and 1452

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

Rev 1446 Rev 1452
Line 66... Line 66...
#include "dumpverilog.h"
#include "dumpverilog.h"
#include "trace.h"
#include "trace.h"
#include "cuc.h"
#include "cuc.h"
 
 
/* CVS revision number. */
/* CVS revision number. */
const char rcsrev[] = "$Revision: 1.122 $";
const char rcsrev[] = "$Revision: 1.123 $";
 
 
inline void debug(int level, const char *format, ...)
inline void debug(int level, const char *format, ...)
{
{
  char *p;
  char *p;
  va_list ap;
  va_list ap;
Line 167... Line 167...
 
 
  tick_reset();
  tick_reset();
  pm_reset();
  pm_reset();
  pic_reset();
  pic_reset();
  du_reset ();
  du_reset ();
 
 
 
  lock_memory_table ();
 
 
 
  /* FIXME: Lame-ass way to get runtime.sim.mem_cycles not going into overly
 
   * negative numbers.  This happens because parse.c uses setsim_mem32 to load
 
   * the program but set_mem32 calls dc_simulate_write, which inturn calls
 
   * setsim_mem32.  This mess of memory statistics needs to be sorted out for
 
   * good one day */
 
  runtime.sim.mem_cycles = 0;
  cpu_reset();
  cpu_reset();
}
}
 
 
/* Initalizes all devices and sim */
/* Initalizes all devices and sim */
void sim_init ()
void sim_init ()
Line 179... Line 188...
  init_labels();
  init_labels();
  init_breakpoints();
  init_breakpoints();
  initstats();
  initstats();
  build_automata();
  build_automata();
 
 
 
#if DYNAMIC_EXECUTION
 
  /* Note: This must be called before the scheduler is used */
 
  init_dyn_recomp();
 
#endif
 
 
  sched_init();
  sched_init();
 
 
  if (config.sim.profile) {
  if (config.sim.profile) {
    runtime.sim.fprof = fopen(config.sim.prof_fn, "wt+");
    runtime.sim.fprof = fopen(config.sim.prof_fn, "wt+");
    if(!runtime.sim.fprof) {
    if(!runtime.sim.fprof) {
Line 288... Line 302...
      PRINTF ("VAPI started, waiting for clients.\n");
      PRINTF ("VAPI started, waiting for clients.\n");
  }
  }
 
 
  sim_reset ();
  sim_reset ();
 
 
  lock_memory_table ();
 
 
 
  /* Wait till all test are connected.  */
  /* Wait till all test are connected.  */
  if (runtime.vapi.enabled) {
  if (runtime.vapi.enabled) {
    int numu = vapi_num_unconnected (0);
    int numu = vapi_num_unconnected (0);
    if (numu) {
    if (numu) {
      PRINTF ("\nWaiting for VAPI tests with ids:\n");
      PRINTF ("\nWaiting for VAPI tests with ids:\n");
Line 326... Line 338...
  done_memory_table ();
  done_memory_table ();
  exit(0);
  exit(0);
}
}
 
 
/* Executes jobs in time queue */
/* Executes jobs in time queue */
static inline void do_scheduler (void)
#if !(DYNAMIC_EXECUTION)
 
static inline
 
#endif
 
void do_scheduler (void)
{
{
  struct sched_entry *tmp;
  struct sched_entry *tmp;
 
 
  /* Execute all jobs till now */
  /* Execute all jobs till now */
  do {
  do {
    tmp = scheduler.job_queue;
    tmp = scheduler.job_queue;
    scheduler.job_queue = tmp->next;
    scheduler.job_queue = tmp->next;
    tmp->next = scheduler.free_job_queue;
    tmp->next = scheduler.free_job_queue;
    scheduler.free_job_queue = tmp;
    scheduler.free_job_queue = tmp;
 
 
 
#if DYNAMIC_EXECUTION
 
    /* This is done here and not after the loop has run because the job function
 
     * may raise an exception in which case set_sched_cycle would never be
 
     * called. */
 
    set_sched_cycle(scheduler.job_queue->time);
 
#endif
 
    TRACE_(sched)("Setting to-go cycles to %"PRIi32" at %lli\n",
 
                  scheduler.job_queue->time, runtime.sim.cycles);
 
 
    tmp->func (tmp->param);
    tmp->func (tmp->param);
  } while (scheduler.job_queue->time <= 0);
  } while (scheduler.job_queue->time <= 0);
}
}
 
 
/* Main function */
/* Main function */

powered by: WebSVN 2.1.0

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