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

Subversion Repositories or1k

[/] [or1k/] [tags/] [tn_m001/] [or1ksim/] [toplevel.c] - Diff between revs 714 and 728

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

Rev 714 Rev 728
Line 28... Line 28...
#include <stdlib.h>
#include <stdlib.h>
#include <unistd.h>
#include <unistd.h>
#include <signal.h>
#include <signal.h>
#include <stdarg.h>
#include <stdarg.h>
#include <fcntl.h>
#include <fcntl.h>
 
#include <limits.h>
 
 
#ifdef HAVE_LIBREADLINE
#ifdef HAVE_LIBREADLINE
#include <readline/readline.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <readline/history.h>
#endif /* HAVE_LIBREADLINE */
#endif /* HAVE_LIBREADLINE */
Line 50... Line 51...
#include "ps2kbd.h"
#include "ps2kbd.h"
#include "vapi.h"
#include "vapi.h"
#include "gdbcomm.h"
#include "gdbcomm.h"
#include "debug_unit.h"
#include "debug_unit.h"
#include "coff.h"
#include "coff.h"
 
#include "sched.h"
#include "profiler.h"
#include "profiler.h"
#include "mprofiler.h"
#include "mprofiler.h"
 
 
/* CVS revision number. */
/* CVS revision number. */
const char rcsrev[] = "$Revision: 1.78 $";
const char rcsrev[] = "$Revision: 1.79 $";
 
 
/* Continuos run versus single step tracing switch. */
/* Continuos run versus single step tracing switch. */
int cont_run;
int cont_run;
 
 
/* History of execution */
/* History of execution */
Line 162... Line 163...
void debugmem (unsigned long from, unsigned long to );
void debugmem (unsigned long from, unsigned long to );
 
 
/* Resets all subunits */
/* Resets all subunits */
void sim_reset ()
void sim_reset ()
{
{
 
  SCHED_INIT();
  uart_reset();
  uart_reset();
  dma_reset();
  dma_reset();
  eth_reset();
  eth_reset();
  gpio_reset();
  gpio_reset();
  vga_reset ();
  vga_reset ();
Line 366... Line 368...
  if (runtime.vapi.enabled)  vapi_done ();
  if (runtime.vapi.enabled)  vapi_done ();
  done_memory_table ();
  done_memory_table ();
  exit(0);
  exit(0);
}
}
 
 
 
/* Executes jobs in time queue */
 
static inline void do_scheduler ()
 
{
 
  void (*func)(int);
 
  int param;
 
 
 
  /* Execute all jobs till now */
 
  do {
 
    func = SCHED_PEEK().func;
 
    param = SCHED_PEEK().param;
 
    SCHED_REMOVE();
 
    func (param);
 
  } while (cycles >= SCHED_PEEK().time);
 
}
 
 
/*###############################################
/* Main function */
| MAIN
 
###############################################*/
 
int main(argc, argv)
int main(argc, argv)
     int argc;
     int argc;
     char *argv[];
     char *argv[];
{
{
  char *linestr;
  char *linestr;
Line 699... Line 712...
         at the end of the cycle; no sim originated memory accesses should be
         at the end of the cycle; no sim originated memory accesses should be
         performed inbetween. */
         performed inbetween. */
      mem_cycles = 0;
      mem_cycles = 0;
      if (!config.pm.enabled || !testsprbits(SPR_PMR, SPR_PMR_DME | SPR_PMR_SME)) {
      if (!config.pm.enabled || !testsprbits(SPR_PMR, SPR_PMR_DME | SPR_PMR_SME)) {
        if (cont_run > 0) cont_run--;
        if (cont_run > 0) cont_run--;
        if (config.pm.enabled) {
 
          if (!testsprbits(SPR_PMR, SPR_PMR_SME))
 
            IFF (config.tick.enabled) tick_clock();
 
        } else
 
          IFF (config.tick.enabled) tick_clock();
 
        pic_clock ();
        pic_clock ();
        if (cpu_clock ()) break;
        if (cpu_clock ()) break;
        if (config.dc.enabled) dc_clock();
        if (config.dc.enabled) dc_clock();
        if (config.ic.enabled) ic_clock();
        if (config.ic.enabled) ic_clock();
      }
      }
Line 724... Line 732...
      if (config.debug.gdb_enabled) HandleServerSocket(false); /* block & check_stdin = false */
      if (config.debug.gdb_enabled) HandleServerSocket(false); /* block & check_stdin = false */
      IFF(config.debug.enabled)
      IFF(config.debug.enabled)
        if (testsprbits(SPR_DMR1, SPR_DMR1_ST)) set_stall_state (1);
        if (testsprbits(SPR_DMR1, SPR_DMR1_ST)) set_stall_state (1);
 
 
      cycles += mem_cycles;
      cycles += mem_cycles;
 
      if (cycles >= SCHED_PEEK().time) do_scheduler ();
      if (!hush) dumpreg();
      if (!hush) dumpreg();
    }
    }
    hush = 0;
    hush = 0;
    fflush(stdout);
    fflush(stdout);
    freopen("/dev/fd/0", "w+", stdout);
    freopen("/dev/fd/0", "w+", stdout);

powered by: WebSVN 2.1.0

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