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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_40/] [or1ksim/] [sim-config.c] - Diff between revs 1374 and 1375

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

Rev 1374 Rev 1375
Line 49... Line 49...
#include "debug.h"
#include "debug.h"
 
 
#define WARNING(s) fprintf (stderr, "WARNING: config.%s: %s\n", cur_section->name, (s))
#define WARNING(s) fprintf (stderr, "WARNING: config.%s: %s\n", cur_section->name, (s))
#define MERROR(s) {fprintf (stderr, "ERROR: %s\n", s); if (runtime.sim.init) exit (1);}
#define MERROR(s) {fprintf (stderr, "ERROR: %s\n", s); if (runtime.sim.init) exit (1);}
 
 
#if !FAST_SIM
 
struct config config;
struct config config;
#endif
 
struct runtime runtime;
struct runtime runtime;
 
 
struct config_section *cur_section;
struct config_section *cur_section;
 
 
struct config_section *sections = NULL;
struct config_section *sections = NULL;
 
 
void init_defconfig()
void init_defconfig()
{
{
  int i;
  int i;
 
 
#if !FAST_SIM
 
  memset(&config, 0, sizeof(config));
  memset(&config, 0, sizeof(config));
  /* Sim */
  /* Sim */
  config.sim.exe_log = 0;
  config.sim.exe_log = 0;
  config.sim.exe_log_type = EXE_LOG_HARDWARE;
  config.sim.exe_log_type = EXE_LOG_HARDWARE;
  config.sim.exe_log_start = 0;
  config.sim.exe_log_start = 0;
Line 149... Line 146...
  config.cuc.memory_order = MO_STRONG;
  config.cuc.memory_order = MO_STRONG;
  config.cuc.calling_convention = 1;
  config.cuc.calling_convention = 1;
  config.cuc.enable_bursts = 1;
  config.cuc.enable_bursts = 1;
  config.cuc.no_multicycle = 1;
  config.cuc.no_multicycle = 1;
 
 
#endif
 
 
 
  /* Configure runtime */
  /* Configure runtime */
  memset(&runtime, 0, sizeof(runtime));
  memset(&runtime, 0, sizeof(runtime));
 
 
  /* Sim */
  /* Sim */
  runtime.sim.fexe_log = NULL;
  runtime.sim.fexe_log = NULL;
Line 186... Line 181...
    if (*argv[0] != '-') {
    if (*argv[0] != '-') {
      runtime.sim.filename = argv[0];
      runtime.sim.filename = argv[0];
      argc--;
      argc--;
      argv++;
      argv++;
    } else
    } else
#if !FAST_SIM /* Constant cfg */
 
    if (strcmp(*argv, "-f") == 0 || strcmp(*argv, "--file") == 0) {
    if (strcmp(*argv, "-f") == 0 || strcmp(*argv, "--file") == 0) {
      argv++; argc--;
      argv++; argc--;
      if (argv[0]) {
      if (argv[0]) {
        read_script_file(argv[0]);
        read_script_file(argv[0]);
        argv++; argc--;
        argv++; argc--;
      } else {
      } else {
        fprintf(stderr, "Configure filename not specified!\n");
        fprintf(stderr, "Configure filename not specified!\n");
        return 1;
        return 1;
      }
      }
    } else
    } else
#endif
 
    if (strcmp(*argv, "--nosrv") == 0) {  /* (CZ) */
    if (strcmp(*argv, "--nosrv") == 0) {  /* (CZ) */
      config.debug.gdb_enabled = 0;
      config.debug.gdb_enabled = 0;
      argv++; argc--;
      argv++; argc--;
    } else
    } else
    if (strcmp(*argv, "--srv") == 0) {  /* (CZ) */
    if (strcmp(*argv, "--srv") == 0) {  /* (CZ) */
Line 221... Line 214...
    } else
    } else
    if (strcmp(*argv, "-v") == 0) {
    if (strcmp(*argv, "-v") == 0) {
      version();
      version();
      exit(0);
      exit(0);
    } else
    } else
#if !FAST_SIM
 
    if (strcmp(*argv, "--enable-profile") == 0) {
    if (strcmp(*argv, "--enable-profile") == 0) {
      runtime.simcmd.profile = 1;
      runtime.simcmd.profile = 1;
      argv++; argc--;
      argv++; argc--;
    } else
    } else
    if (strcmp(*argv, "--enable-mprofile") == 0) {
    if (strcmp(*argv, "--enable-mprofile") == 0) {
      runtime.simcmd.mprofile = 1;
      runtime.simcmd.mprofile = 1;
      argv++; argc--;
      argv++; argc--;
    } else
    } else
#endif
 
    if (strcmp(*argv, "--output-cfg") == 0) {
    if (strcmp(*argv, "--output-cfg") == 0) {
      runtime.sim.output_cfg = 1;
      runtime.sim.output_cfg = 1;
      argv++; argc--;
      argv++; argc--;
    } else {
    } else {
      fprintf(stderr, "Unknown option: %s\n", *argv);
      fprintf(stderr, "Unknown option: %s\n", *argv);
Line 282... Line 273...
    else
    else
      PRINTF("BTIC simulation off.\n");
      PRINTF("BTIC simulation off.\n");
  }
  }
}
}
 
 
#if !FAST_SIM
 
struct config_param {
struct config_param {
  char *name;
  char *name;
  enum param_t type;
  enum param_t type;
  void (*func)(union param_val, void *dat);
  void (*func)(union param_val, void *dat);
  struct config_param *next;
  struct config_param *next;
Line 872... Line 862...
    case 3:
    case 3:
      PRINTF ("Invalid parameters specified.\n");
      PRINTF ("Invalid parameters specified.\n");
      break;
      break;
  }
  }
}
}
#endif /* !FAST_SIM */
 
 
 
/* Outputs C structure of current config to file */
/* Outputs C structure of current config to file */
void output_cfg (FILE *f)
void output_cfg (FILE *f)
{
{
  int i, comma;
  int i, comma;

powered by: WebSVN 2.1.0

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