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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_69/] [or1ksim/] [toplevel.c] - Diff between revs 1374 and 1375

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

Rev 1374 Rev 1375
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.115 $";
const char rcsrev[] = "$Revision: 1.116 $";
 
 
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 252... Line 252...
      fprintf(stderr, "Problems loading boot code.\n");
      fprintf(stderr, "Problems loading boot code.\n");
      exit(1);
      exit(1);
    }
    }
  }
  }
 
 
#if !FAST_SIM /* We assume we have valid configuration with fsim*/
 
  /* Disable gdb debugging, if debug module is not available.  */
  /* Disable gdb debugging, if debug module is not available.  */
  if (config.debug.gdb_enabled && !config.debug.enabled) {
  if (config.debug.gdb_enabled && !config.debug.enabled) {
    config.debug.gdb_enabled = 0;
    config.debug.gdb_enabled = 0;
    if (config.sim.verbose)
    if (config.sim.verbose)
      fprintf (stderr, "WARNING: Debug module not enabled, cannot start gdb.\n");
      fprintf (stderr, "WARNING: Debug module not enabled, cannot start gdb.\n");
  }
  }
#endif
 
 
 
  if (config.debug.gdb_enabled)
  if (config.debug.gdb_enabled)
    gdbcomm_init ();
    gdbcomm_init ();
 
 
#if !FAST_SIM /* We assume we have valid configuration with fsim*/
 
  /* Enable dependency stats, if we want to do history analisis */
  /* Enable dependency stats, if we want to do history analisis */
  if (config.sim.history && !config.cpu.dependstats) {
  if (config.sim.history && !config.cpu.dependstats) {
    config.cpu.dependstats = 1;
    config.cpu.dependstats = 1;
    if (config.sim.verbose)
    if (config.sim.verbose)
      fprintf (stderr, "WARNING: dependstats stats must be enabled to do history analisis.\n");
      fprintf (stderr, "WARNING: dependstats stats must be enabled to do history analisis.\n");
  }
  }
#endif
 
 
 
#if !FAST_SIM /* We assume we have valid configuration with fsim*/  
 
  /* Debug forces verbose */
  /* Debug forces verbose */
  if (config.sim.debug && !config.sim.verbose) {
  if (config.sim.debug && !config.sim.verbose) {
    config.sim.verbose = 1;
    config.sim.verbose = 1;
    fprintf (stderr, "WARNING: verbose turned on.\n");
    fprintf (stderr, "WARNING: verbose turned on.\n");
  }
  }
#endif
 
 
 
  /* Start VAPI before device initialization.  */
  /* Start VAPI before device initialization.  */
  if (config.vapi.enabled) {
  if (config.vapi.enabled) {
    runtime.vapi.enabled = 1;
    runtime.vapi.enabled = 1;
    vapi_init ();
    vapi_init ();
Line 358... Line 352...
    PRINTF("Options:\n");
    PRINTF("Options:\n");
    PRINTF(" -v                   version and copyright note\n");
    PRINTF(" -v                   version and copyright note\n");
    PRINTF(" -i                   enable interactive command prompt\n");
    PRINTF(" -i                   enable interactive command prompt\n");
    PRINTF(" --nosrv              do not launch JTAG proxy server\n"); /* (CZ) */
    PRINTF(" --nosrv              do not launch JTAG proxy server\n"); /* (CZ) */
    PRINTF(" --srv <n>            launch JTAG proxy server on port <n>; [random]\n"); /* (CZ) */
    PRINTF(" --srv <n>            launch JTAG proxy server on port <n>; [random]\n"); /* (CZ) */
#if !FAST_SIM
 
    PRINTF(" -f or --file         load script file [sim.cfg]\n");
    PRINTF(" -f or --file         load script file [sim.cfg]\n");
    PRINTF(" --enable-profile     enable profiling.\n");
    PRINTF(" --enable-profile     enable profiling.\n");
    PRINTF(" --enable-mprofile    enable memory profiling.\n");
    PRINTF(" --enable-mprofile    enable memory profiling.\n");
#endif
 
    PRINTF(" --output-cfg         prints C structure of current\n");
    PRINTF(" --output-cfg         prints C structure of current\n");
    PRINTF("                      configuration to standard output\n");
    PRINTF("                      configuration to standard output\n");
    PRINTF("\nor   : %s ", argv[0]);
    PRINTF("\nor   : %s ", argv[0]);
    mp_help ();
    mp_help ();
    PRINTF("\nor   : %s ", argv[0]);
    PRINTF("\nor   : %s ", argv[0]);
    prof_help ();
    prof_help ();
    exit(-1);
    exit(-1);
  }
  }
 
 
#if !FAST_SIM
 
  /* Read configuration file.  */
  /* Read configuration file.  */
  if (!runtime.sim.script_file_specified)
  if (!runtime.sim.script_file_specified)
    read_script_file ("sim.cfg");
    read_script_file ("sim.cfg");
 
 
  /* Overide parameters with command line ones */
  /* Overide parameters with command line ones */
  if (runtime.simcmd.profile) config.sim.profile = 1;
  if (runtime.simcmd.profile) config.sim.profile = 1;
  if (runtime.simcmd.mprofile) config.sim.mprofile = 1;
  if (runtime.simcmd.mprofile) config.sim.mprofile = 1;
 
 
  if (!runtime.sim.script_file_specified && config.sim.verbose)
  if (!runtime.sim.script_file_specified && config.sim.verbose)
    fprintf (stderr, "WARNING: No config file read, assuming default configuration.\n");
    fprintf (stderr, "WARNING: No config file read, assuming default configuration.\n");
#else
 
  PRINTF ("\n\tNOTE: running fast sim with fixed configuration!\n\n");
 
#endif
 
  if (runtime.sim.output_cfg) {
  if (runtime.sim.output_cfg) {
    output_cfg (stdout);
    output_cfg (stdout);
    exit (0);
    exit (0);
  }
  }
  print_config();
  print_config();
Line 409... Line 397...
              || config.sim.history || config.sim.exe_log;
              || config.sim.history || config.sim.exe_log;
    }
    }
 
 
    /* MM: 'run -1' means endless execution.  */
    /* MM: 'run -1' means endless execution.  */
    while(runtime.sim.cont_run) {
    while(runtime.sim.cont_run) {
      IFF (config.debug.enabled) {
      if (config.debug.enabled) {
        du_clock(); // reset watchpoints
        du_clock(); // reset watchpoints
        if (runtime.cpu.stalled) {
        if (runtime.cpu.stalled) {
          if(config.debug.gdb_enabled) {
          if(config.debug.gdb_enabled) {
            BlockJTAG();
            BlockJTAG();
            HandleServerSocket(false);
            HandleServerSocket(false);
Line 437... Line 425...
        if (config.ic.enabled) ic_clock();
        if (config.ic.enabled) ic_clock();
      }
      }
 
 
      if (config.vapi.enabled && runtime.vapi.enabled) vapi_check();
      if (config.vapi.enabled && runtime.vapi.enabled) vapi_check();
      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)
      if(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);
 
 
      runtime.sim.cycles += runtime.sim.mem_cycles;
      runtime.sim.cycles += runtime.sim.mem_cycles;
      if (runtime.sim.cycles >= SCHED_PEEK().time) do_scheduler ();
      if (runtime.sim.cycles >= SCHED_PEEK().time) do_scheduler ();
      if (!runtime.sim.hush) dumpreg();
      if (!runtime.sim.hush) dumpreg();

powered by: WebSVN 2.1.0

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