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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [sim-config.c] - Diff between revs 547 and 549

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

Rev 547 Rev 549
Line 62... Line 62...
  strcpy (config.sim.prof_fn, "sim.profile");
  strcpy (config.sim.prof_fn, "sim.profile");
  runtime.sim.fmprof = NULL;
  runtime.sim.fmprof = NULL;
  strcpy (config.sim.mprof_fn, "sim.mprofile");
  strcpy (config.sim.mprof_fn, "sim.mprofile");
  runtime.sim.init = 1;
  runtime.sim.init = 1;
  runtime.sim.script_file_specified = 0;
  runtime.sim.script_file_specified = 0;
 
  strcpy (runtime.sim.script_fn, "(default)");
  config.sim.clkcycle_ps = 4000; /* 4000 for 4ns (250MHz) */
  config.sim.clkcycle_ps = 4000; /* 4000 for 4ns (250MHz) */
 
 
  /* Memory */
  /* Memory */
  config.memory.type = MT_PATTERN;
  config.memory.type = MT_PATTERN;
  config.memory.pattern = 0;
  config.memory.pattern = 0;
Line 97... Line 98...
  /* Memory Controller */
  /* Memory Controller */
  config.mc.enabled = 0;
  config.mc.enabled = 0;
 
 
  /* Uarts */
  /* Uarts */
  config.nuarts = 0;
  config.nuarts = 0;
  config.uarts_enabled = 0;
 
 
 
  /* DMAs */
  /* DMAs */
  config.ndmas = 0;
  config.ndmas = 0;
  config.dmas_enabled = 0;
 
 
 
  /* CPU */
  /* CPU */
  config.cpu.superscalar = 0;
  config.cpu.superscalar = 0;
  config.sim.history = 0;
  config.sim.history = 0;
  config.cpu.hazards = 0;
  config.cpu.hazards = 0;
Line 123... Line 122...
  config.vapi.enabled = 0;
  config.vapi.enabled = 0;
  strcpy (config.vapi.vapi_fn, "vapi.log");
  strcpy (config.vapi.vapi_fn, "vapi.log");
  runtime.vapi.vapi_file = NULL;
  runtime.vapi.vapi_file = NULL;
 
 
  /* Ethernet */
  /* Ethernet */
  config.ethernets_enabled = 0;
  config.nethernets = 0;
 
 
  /* GPIO */
  /* GPIO */
  config.gpios_enabled = 0;
  config.ngpios = 0;
 
 
  /* Tick timer */
  /* Tick timer */
  config.tick.enabled = 0;
  config.tick.enabled = 0;
}
}
 
 
Line 183... Line 182...
      argv++; argc--;
      argv++; argc--;
    } else
    } else
    if (strcmp(*argv, "--mprofile") == 0) {
    if (strcmp(*argv, "--mprofile") == 0) {
      config.sim.mprofile = 1;
      config.sim.mprofile = 1;
      argv++; argc--;
      argv++; argc--;
 
    } else
 
    if (strcmp(*argv, "--output-cfg") == 0) {
 
      runtime.sim.output_cfg = 1;
 
      argv++; argc--;
    } else {
    } else {
      fprintf(stderr, "Unknown option: %s\n", *argv);
      fprintf(stderr, "Unknown option: %s\n", *argv);
      return 1;
      return 1;
    }
    }
  }
  }
Line 198... Line 201...
}
}
 
 
#define CNV(x) ((isspace(x) || (x) == 0) ? ' ' : (x))
#define CNV(x) ((isspace(x) || (x) == 0) ? ' ' : (x))
 
 
/* Substitute for less powerful fscanf */
/* Substitute for less powerful fscanf */
int fscanf_ex (FILE *f, char *fmt, void *buf, char *str) {
int fscanf_ex (FILE *f, char *fmt, void *buf, char *str)
 
{
  char tmp[STR_SIZE];
  char tmp[STR_SIZE];
  char ch;
  char ch;
  int i = 0;
  int i = 0;
  while (*fmt) {
  while (*fmt) {
    switch (*fmt) {
    switch (*fmt) {
Line 356... Line 360...
unsigned long tempUL;
unsigned long tempUL;
char tempS[STR_SIZE];
char tempS[STR_SIZE];
 
 
#define CPF_SUBSECTION 1
#define CPF_SUBSECTION 1
#define CPF_SUBFIELD   2
#define CPF_SUBFIELD   2
 
#define CPF_GLOBAL     4   /* Not part of the substructure (group) in config */
 
 
struct section sections[] = {
struct section sections[] = {
  {"?",      0},   /* 0  */
  {"?",      0},   /* 0  */
  {"mc",     0},
  {"mc",     0},
  {"uart",   0},
  {"uart",   0},
Line 382... Line 387...
/* *INDENT-OFF* */
/* *INDENT-OFF* */
 
 
/* Parameter definitions */
/* Parameter definitions */
struct config_params {
struct config_params {
  int section;
  int section;
  int attr;
 
  char *name;
  char *name;
  char *type;
  char *type;
  void (*func)();
  void (*func)();
  void *addr;
  void *addr;
 
  int attr;
} config_params[] = {
} config_params[] = {
{1, 0, "enabled",            "=%i",         NULL,          (void *)(&config.mc.enabled)},
{1, "enabled",            "=%i",         NULL,          (void *)(&config.mc.enabled), 0},
{1, 0, "baseaddr",           "=0x%x",       NULL,          (void *)(&config.mc.baseaddr)},
{1, "baseaddr",           "=0x%x",       NULL,          (void *)(&config.mc.baseaddr), 0},
{1, 0, "POC",                "=0x%x",       NULL,          (void *)(&config.mc.POC)},
{1, "POC",                "=0x%x",       NULL,          (void *)(&config.mc.POC), 0},
 
 
{2, 0, "enabled",            "=%i",         NULL,          (void *)(&config.uarts_enabled)},
{2, "nuarts",             "=%i",         uart_nuarts,   (void *)(&tempL), CPF_GLOBAL},
{2, 0, "nuarts",             "=%i",         uart_nuarts,   (void *)(&tempL)},
{2, "device",             "%i",          change_device, (void *)(&tempL), 0},
{2, 0, "device",             "%i",          change_device, (void *)(&tempL)},
{2, "enddevice",          "",            end_device,    NULL, 0},
{2, 0, "enddevice",          "",            end_device,    NULL},
{2, "baseaddr",           "=0x%x",       uart_baseaddr, (void *)(&tempUL), 0},
{2, 0, "baseaddr",           "=0x%x",       uart_baseaddr, (void *)(&tempUL)},
{2, "irq",                "=%i",         uart_irq,      (void *)(&tempL), 0},
{2, 0, "irq",                "=%i",         uart_irq,      (void *)(&tempL)},
{2, "16550",              "=%i",         uart_16550,    (void *)(&tempL), 0},
{2, 0, "16550",              "=%i",         uart_16550,    (void *)(&tempL)},
{2, "jitter",             "=%i",         uart_jitter,   (void *)(&tempL), 0},
{2, 0, "jitter",             "=%i",         uart_jitter,   (void *)(&tempL)},
{2, "rxfile",             "=\"%s\"",     uart_rxfile,   (void *)(&tempS[0]), 0},
{2, 0, "rxfile",             "=\"%s\"",     uart_rxfile,   (void *)(&tempS[0])},
{2, "txfile",             "=\"%s\"",     uart_txfile,   (void *)(&tempS[0]), 0},
{2, 0, "txfile",             "=\"%s\"",     uart_txfile,   (void *)(&tempS[0])},
{2, "vapi_id",            "=0x%x",       uart_vapi_id,  (void *)(&tempUL), 0},
{2, 0, "vapi_id",            "=0x%x",       uart_vapi_id,  (void *)(&tempUL)},
 
 
{3, "ndmas",              "=%i",         dma_ndmas,     (void *)(&tempL), CPF_GLOBAL},
{3, 0, "enabled",            "=%i",         NULL,          (void *)(&config.dmas_enabled)},
{3, "device",             "%i",          change_device, (void *)(&tempL), 0},
{3, 0, "ndmas",              "=%i",         dma_ndmas,     (void *)(&tempL)},
{3, "enddevice",          "",            end_device,    NULL, 0},
{3, 0, "device",             "%i",          change_device, (void *)(&tempL)},
{3, "baseaddr",           "=0x%x",       dma_baseaddr,  (void *)(&tempUL), 0},
{3, 0, "enddevice",          "",            end_device,    NULL},
{3, "irq",                "=%i",         dma_irq,       (void *)(&tempL), 0},
{3, 0, "baseaddr",           "=0x%x",       dma_baseaddr,  (void *)(&tempUL)},
{3, "vapi_id",            "=0x%x",       dma_vapi_id,   (void *)(&tempUL), 0},
{3, 0, "irq",                "=%i",         dma_irq,       (void *)(&tempL)},
 
{3, 0, "vapi_id",            "=0x%x",       dma_vapi_id,   (void *)(&tempUL)},
{4, "random_seed",        "=%i",         NULL,          (void *)(&config.memory.random_seed), 0},
 
{4, "pattern",            "=%i",         NULL,          (void *)(&config.memory.pattern), 0},
{4, 0, "random_seed",        "=%i",         NULL,          (void *)(&config.memory.random_seed)},
{4, "type",               "=%s ",        memory_type,   (void *)(&tempS[0]), 0},
{4, 0, "pattern",            "=%i",         NULL,          (void *)(&config.memory.pattern)},
{4, "nmemories",          "=%i",         memory_nmemories,(void *)(&tempL), CPF_GLOBAL},
{4, 0, "type",               "=%s ",        memory_type,   (void *)(&tempS[0])},
{4, "device",             "%i",          change_device, (void *)(&tempL), 0},
{4, 0, "nmemories",          "=%i",         memory_nmemories,(void *)(&tempL)},
{4, "enddevice",          "",            end_device,    NULL, 0},
{4, 0, "device",             "%i",          change_device, (void *)(&tempL)},
{4, "ce",                 "=%i",         memory_ce,     (void *)(&tempL), 0},
{4, 0, "enddevice",          "",            end_device,    NULL},
{4, "baseaddr",           "=0x%x",       memory_baseaddr,(void *)(&tempUL), 0},
{4, 0, "ce",                 "=%i",         memory_ce,     (void *)(&tempL)},
{4, "size",               "=0x%x",       memory_size,   (void *)(&tempUL), 0},
{4, 0, "baseaddr",           "=0x%x",       memory_baseaddr,(void *)(&tempUL)},
{4, "name",               "=\"%s\"",     memory_name,   (void *)(&tempS[0]), 0},
{4, 0, "size",               "=0x%x",       memory_size,   (void *)(&tempUL)},
{4, "log",                "=\"%s\"",     memory_log,    (void *)(&tempS[0]), 0},
{4, 0, "name",               "=\"%s\"",     memory_name,   (void *)(&tempS[0])},
{4, "delayr",             "=%i",         memory_delayr, (void *)(&tempL), 0},
{4, 0, "log",                "=\"%s\"",     memory_log,    (void *)(&tempS[0])},
{4, "delayw",             "=%i",         memory_delayw, (void *)(&tempL), 0},
{4, 0, "delayr",             "=%i",         memory_delayr, (void *)(&tempL)},
 
{4, 0, "delayw",             "=%i",         memory_delayw, (void *)(&tempL)},
{5, "ver",                "=0x%x",       NULL,          (void *)(&config.cpu.ver), 0},
 
{5, "rev",                "=0x%x",       NULL,          (void *)(&config.cpu.rev), 0},
{5, 0, "ver",                "=0x%x",       NULL,          (void *)(&config.cpu.ver)},
{5, "upr",                "=0x%x",       NULL,          (void *)(&config.cpu.upr), 0},
{5, 0, "rev",                "=0x%x",       NULL,          (void *)(&config.cpu.rev)},
{5, "hazards",            "=%i",         NULL,          (void *)(&config.cpu.hazards), 0},
{5, 0, "upr",                "=0x%x",       NULL,          (void *)(&config.cpu.upr)},
{5, "superscalar",        "=%i",         NULL,          (void *)(&config.cpu.superscalar), 0},
{5, 0, "hazards",            "=%i",         NULL,          (void *)(&config.cpu.hazards)},
{5, "dependstats",        "=%i",         NULL,          (void *)(&config.cpu.dependstats), 0},
{5, 0, "superscalar",        "=%i",         NULL,          (void *)(&config.cpu.superscalar)},
{5, "raw_range",          "=%i",         cpu_raw_range, (void *)(&config.cpu.raw_range), 0},
{5, 0, "dependstats",        "=%i",         NULL,          (void *)(&config.cpu.dependstats)},
 
{5, 0, "raw_range",          "=%i",         cpu_raw_range, (void *)(&config.cpu.raw_range)},
{6, "debug",              "=%i",         NULL,          (void *)(&config.sim.debug), 0},
 
{6, "iprompt",            "=%i",         NULL,          (void *)(&config.sim.iprompt), 0},
{6, 0, "debug",              "=%i",         NULL,          (void *)(&config.sim.debug)},
{6, "verbose",            "=%i",         NULL,          (void *)(&config.sim.verbose), 0},
{6, 0, "iprompt",            "=%i",         NULL,          (void *)(&config.sim.iprompt)},
{6, "profile",            "=%i",         NULL,          (void *)(&config.sim.profile), 0},
{6, 0, "verbose",            "=%i",         NULL,          (void *)(&config.sim.verbose)},
{6, "prof_fn",            "=\"%s\"",     NULL,          (void *)(&config.sim.prof_fn[0]), 0},
{6, 0, "profile",            "=%i",         NULL,          (void *)(&config.sim.profile)},
{6, "mprofile",           "=%i",         NULL,          (void *)(&config.sim.mprofile), 0},
{6, 0, "prof_fn",            "=\"%s\"",     NULL,          (void *)(&config.sim.prof_fn[0])},
{6, "mprof_fn",           "=\"%s\"",     NULL,          (void *)(&config.sim.mprof_fn[0]), 0},
{6, 0, "mprofile",           "=%i",         NULL,          (void *)(&config.sim.mprofile)},
{6, "history",            "=%i",         NULL,          (void *)(&config.sim.history), 0},
{6, 0, "mprof_fn",           "=\"%s\"",     NULL,          (void *)(&config.sim.mprof_fn[0])},
{6, "exe_log",            "=%i",         NULL,          (void *)(&config.sim.exe_log), 0},
{6, 0, "history",            "=%i",         NULL,          (void *)(&config.sim.history)},
{6, "exe_log_fn",         "=\"%s\"",     NULL,          (void *)(&config.sim.exe_log_fn[0]), 0},
{6, 0, "exe_log",            "=%i",         NULL,          (void *)(&config.sim.exe_log)},
{6, "clkcycle",           "=%s ",        sim_clkcycle,  (void *)(&tempS[0]), 0},
{6, 0, "exe_log_fn",         "=\"%s\"",     NULL,          (void *)(&config.sim.exe_log_fn[0])},
 
{6, 0, "clkcycle",           "=%s ",        sim_clkcycle,  (void *)(&tempS[0])},
{7, "enabled",            "=%i",         NULL,          (void *)(&config.debug.enabled), 0},
 
{7, "gdb_enabled",        "=%i",         NULL,          (void *)(&config.debug.gdb_enabled), 0},
{7, 0, "enabled",            "=%i",         NULL,          (void *)(&config.debug.enabled)},
{7, "server_port",        "=%i",         NULL,          (void *)(&config.debug.server_port), 0},
{7, 0, "gdb_enabled",        "=%i",         NULL,          (void *)(&config.debug.gdb_enabled)},
{7, "vapi_id",            "=0x%x",       NULL,          (void *)(&config.debug.vapi_id), 0},
{7, 0, "server_port",        "=%i",         NULL,          (void *)(&config.debug.server_port)},
 
{7, 0, "vapi_id",            "=0x%x",       NULL,          (void *)(&config.debug.vapi_id)},
{8, "enabled",            "=%i",         NULL,          (void *)(&config.vapi.enabled), 0},
 
{8, "server_port",        "=%i",         NULL,          (void *)(&config.vapi.server_port), 0},
{8, 0, "enabled",            "=%i",         NULL,          (void *)(&config.vapi.enabled)},
{8, "log_enabled",        "=%i",         NULL,          (void *)(&config.vapi.log_enabled), 0},
{8, 0, "server_port",        "=%i",         NULL,          (void *)(&config.vapi.server_port)},
{8, "hide_device_id",     "=%i",         NULL,          (void *)(&config.vapi.hide_device_id), 0},
{8, 0, "log_enabled",        "=%i",         NULL,          (void *)(&config.vapi.log_enabled)},
{8, "vapi_log_fn",        "=\"%s\"",     NULL,          (void *)(&config.vapi.vapi_fn[0]), 0},
{8, 0, "hide_device_id",     "=%i",         NULL,          (void *)(&config.vapi.hide_device_id)},
 
{8, 0, "vapi_log_fn",        "=\"%s\"",     NULL,          (void *)(&config.vapi.vapi_fn[0])},
{9, "nethernets",         "=%i",         eth_nethernets,(void *)(&tempL), CPF_GLOBAL},
 
{9, "device",             "%i",          change_device, (void *)(&tempL), 0},
{9, 0, "enabled",            "=%i",         NULL,          (void *)(&config.ethernets_enabled)},
{9, "enddevice",          "",            end_device,    NULL, 0},
{9, 0, "nethernets",         "=%i",         eth_nethernets,(void *)(&tempL)},
{9, "baseaddr",           "=0x%x",       eth_baseaddr,  (void *)(&tempUL), 0},
{9, 0, "device",             "%i",          change_device, (void *)(&tempL)},
{9, "dma",                "=%i",         eth_dma,       (void *)(&tempL), 0},
{9, 0, "enddevice",          "",            end_device,    NULL},
{9, "rx_channel",         "=%i",         eth_rx_channel,(void *)(&tempL), 0},
{9, 0, "baseaddr",           "=0x%x",       eth_baseaddr,  (void *)(&tempUL)},
{9, "tx_channel",         "=%i",         eth_tx_channel,(void *)(&tempL), 0},
{9, 0, "dma",                "=%i",         eth_dma,       (void *)(&tempL)},
{9, "rxfile",             "=\"%s\"",     eth_rxfile,    (void *)(&tempS[0]), 0},
{9, 0, "rx_channel",         "=%i",         eth_rx_channel,(void *)(&tempL)},
{9, "txfile",             "=\"%s\"",     eth_txfile,    (void *)(&tempS[0]), 0},
{9, 0, "tx_channel",         "=%i",         eth_tx_channel,(void *)(&tempL)},
{9, "vapi_id",            "=0x%x",       eth_vapi_id,   (void *)(&tempUL), 0},
{9, 0, "rxfile",             "=\"%s\"",     eth_rxfile,    (void *)(&tempS[0])},
 
{9, 0, "txfile",             "=\"%s\"",     eth_txfile,    (void *)(&tempS[0])},
{10, "enabled",           "=%i",         NULL,          (void *)(&config.tick.enabled), 0},
{9, 0, "vapi_id",            "=0x%x",       eth_vapi_id,   (void *)(&tempUL)},
{10, "irq",               "=%i",         NULL,          (void *)(&config.tick.irq), 0},
 
 
{10,0, "enabled",            "=%i",         NULL,          (void *)(&config.tick.enabled)},
{11, "enabled",           "=%i",         immu_enabled,  (void *)(&tempL), 0},
{10,0, "irq",                "=%i",         NULL,          (void *)(&config.tick.irq)},
{11, "nsets",             "=%i",         immu_nsets,    (void *)(&tempL), 0},
 
{11, "nways",             "=%i",         immu_nways,    (void *)(&tempL), 0},
{11,0, "enabled",            "=%i",         immu_enabled,  (void *)(&tempL)},
{11, "pagesize",          "=%i",         immu_pagesize, (void *)(&tempL), 0},
{11,0, "nsets",              "=%i",         immu_nsets,    (void *)(&tempL)},
{11, "entrysize",         "=%i",         immu_entrysize,(void *)(&tempL), 0},
{11,0, "nways",              "=%i",         immu_nways,    (void *)(&tempL)},
{11, "ustates",           "=%i",         immu_ustates,  (void *)(&tempL), 0},
{11,0, "pagesize",           "=%i",         immu_pagesize, (void *)(&tempL)},
{11, "missdelay",         "=%i",         NULL,          (void *)(&config.immu.missdelay), 0},
{11,0, "entrysize",          "=%i",         immu_entrysize,(void *)(&tempL)},
{11, "hitdelay",          "=%i",         NULL,          (void *)(&config.immu.hitdelay), 0},
{11,0, "ustates",            "=%i",         immu_ustates,  (void *)(&tempL)},
 
{11,0, "missdelay",          "=%i",         NULL,          (void *)(&config.immu.missdelay)},
{12, "enabled",           "=%i",         dmmu_enabled,  (void *)(&tempL), 0},
{11,0, "hitdelay",           "=%i",         NULL,          (void *)(&config.immu.hitdelay)},
{12, "nsets",             "=%i",         dmmu_nsets,    (void *)(&tempL), 0},
 
{12, "nways",             "=%i",         dmmu_nways,    (void *)(&tempL), 0},
{12,0, "enabled",            "=%i",         dmmu_enabled,  (void *)(&tempL)},
{12, "pagesize",          "=%i",         dmmu_pagesize, (void *)(&tempL), 0},
{12,0, "nsets",              "=%i",         dmmu_nsets,    (void *)(&tempL)},
{12, "entrysize",         "=%i",         dmmu_entrysize,(void *)(&tempL), 0},
{12,0, "nways",              "=%i",         dmmu_nways,    (void *)(&tempL)},
{12, "ustates",           "=%i",         dmmu_ustates,  (void *)(&tempL), 0},
{12,0, "pagesize",           "=%i",         dmmu_pagesize, (void *)(&tempL)},
{12, "missdelay",         "=%i",         NULL,          (void *)(&config.dmmu.missdelay), 0},
{12,0, "entrysize",          "=%i",         dmmu_entrysize,(void *)(&tempL)},
{12, "hitdelay",          "=%i",         NULL,          (void *)(&config.dmmu.hitdelay), 0},
{12,0, "ustates",            "=%i",         dmmu_ustates,  (void *)(&tempL)},
 
{12,0, "missdelay",          "=%i",         NULL,          (void *)(&config.dmmu.missdelay)},
{13, "enabled",           "=%i",         ic_enabled,    (void *)(&tempL), 0},
{12,0, "hitdelay",           "=%i",         NULL,          (void *)(&config.dmmu.hitdelay)},
{13, "nsets",             "=%i",         ic_nsets,      (void *)(&tempL), 0},
 
{13, "nways",             "=%i",         ic_nways,      (void *)(&tempL), 0},
{13,0, "enabled",            "=%i",         ic_enabled,    (void *)(&tempL)},
{13, "blocksize",         "=%i",         ic_blocksize,  (void *)(&tempL), 0},
{13,0, "nsets",              "=%i",         ic_nsets,      (void *)(&tempL)},
{13, "ustates",           "=%i",         ic_ustates,    (void *)(&tempL), 0},
{13,0, "nways",              "=%i",         ic_nways,      (void *)(&tempL)},
{13, "tagtype",           "=%s ",        ic_tagtype,    (void *)(&tempS), 0},
{13,0, "blocksize",          "=%i",         ic_blocksize,  (void *)(&tempL)},
{13, "missdelay",         "=%i",         NULL,          (void *)(&config.ic.missdelay), 0},
{13,0, "ustates",            "=%i",         ic_ustates,    (void *)(&tempL)},
{13, "hitdelay",          "=%i",         NULL,          (void *)(&config.ic.hitdelay), 0},
{13,0, "tagtype",            "=%s ",        ic_tagtype,    (void *)(&tempS)},
 
{13,0, "missdelay",          "=%i",         NULL,          (void *)(&config.ic.missdelay)},
{14, "enabled",           "=%i",         dc_enabled,    (void *)(&tempL), 0},
{13,0, "hitdelay",           "=%i",         NULL,          (void *)(&config.ic.hitdelay)},
{14, "nsets",             "=%i",         dc_nsets,      (void *)(&tempL), 0},
 
{14, "nways",             "=%i",         dc_nways,      (void *)(&tempL), 0},
{14,0, "enabled",            "=%i",         dc_enabled,    (void *)(&tempL)},
{14, "blocksize",         "=%i",         dc_blocksize,  (void *)(&tempL), 0},
{14,0, "nsets",              "=%i",         dc_nsets,      (void *)(&tempL)},
{14, "ustates",           "=%i",         dc_ustates,    (void *)(&tempL), 0},
{14,0, "nways",              "=%i",         dc_nways,      (void *)(&tempL)},
{14, "tagtype",           "=%s ",        dc_tagtype,    (void *)(&tempS), 0},
{14,0, "blocksize",          "=%i",         dc_blocksize,  (void *)(&tempL)},
{14, "load_missdelay",    "=%i",         NULL,          (void *)(&config.dc.load_missdelay), 0},
{14,0, "ustates",            "=%i",         dc_ustates,    (void *)(&tempL)},
{14, "load_hitdelay",     "=%i",         NULL,          (void *)(&config.dc.load_hitdelay), 0},
{14,0, "tagtype",            "=%s ",        dc_tagtype,    (void *)(&tempS)},
{14, "store_missdelay",   "=%i",         NULL,          (void *)(&config.dc.store_missdelay), 0},
{14,0, "load_missdelay",     "=%i",         NULL,          (void *)(&config.dc.load_missdelay)},
{14, "store_hitdelay",    "=%i",         NULL,          (void *)(&config.dc.store_hitdelay), 0},
{14,0, "load_hitdelay",      "=%i",         NULL,          (void *)(&config.dc.load_hitdelay)},
 
{14,0, "store_missdelay",    "=%i",         NULL,          (void *)(&config.dc.store_missdelay)},
{15, "ngpios",            "=%i",         gpio_ngpios,   (void *)(&tempL), CPF_GLOBAL},
{14,0, "store_hitdelay",     "=%i",         NULL,          (void *)(&config.dc.store_hitdelay)},
{15, "device",            "%i",          change_device, (void *)(&tempL), 0},
 
{15, "baseaddr",          "=0x%x",       gpio_baseaddr, (void *)(&tempUL), 0},
{15,0, "enabled",            "=%i",         NULL,          (void *)(&config.gpios_enabled)},
{15, "irq",               "=%i",         gpio_irq,      (void *)(&tempL), 0},
{15,0, "ngpios",             "=%i",         gpio_ngpios,    (void *)(&tempL)},
{15, "base_vapi_id",      "=0x%x",       gpio_base_vapi_id,   (void *)(&tempUL), 0},
{15,0, "device",             "%i",          change_device, (void *)(&tempL)},
{15, "enddevice",         "",            end_device,    NULL, 0},
{15,0, "baseaddr",           "=0x%x",       gpio_baseaddr, (void *)(&tempUL)},
 
{15,0, "irq",                "=%i",         gpio_irq,      (void *)(&tempL)},
{16, "enabled",           "=%i",         NULL,          (void *)(&config.bpb.enabled), 0},
{15,0, "base_vapi_id",       "=0x%x",       gpio_base_vapi_id,   (void *)(&tempUL)},
{16, "btic",              "=%i",         NULL,          (void *)(&config.bpb.btic), 0},
{15, 0, "enddevice",         "",            end_device,    NULL},
{16, "sbp_bnf_fwd",       "=%i",         NULL,          (void *)(&config.bpb.sbp_bnf_fwd), 0},
 
{16, "sbp_bf_fwd",        "=%i",         NULL,          (void *)(&config.bpb.sbp_bf_fwd), 0},
{16, 0, "enabled",            "=%i",         NULL,          (void *)(&config.bpb.enabled)},
{16, "missdelay",         "=%i",         NULL,          (void *)(&config.bpb.missdelay), 0},
{16, 0, "btic",               "=%i",         NULL,          (void *)(&config.bpb.btic)},
{16, "hitdelay",          "=%i",         NULL,          (void *)(&config.bpb.hitdelay), 0}
{16, 0, "sbp_bnf_fwd",        "=%i",         NULL,          (void *)(&config.bpb.sbp_bnf_fwd)},
 
{16, 0, "sbp_bf_fwd",         "=%i",         NULL,          (void *)(&config.bpb.sbp_bf_fwd)},
 
{16, 0, "missdelay",          "=%i",         NULL,          (void *)(&config.bpb.missdelay)},
 
{16, 0, "hitdelay",           "=%i",         NULL,          (void *)(&config.bpb.hitdelay)}
 
};
};
 
 
/* *INDENT-ON* */
/* *INDENT-ON* */
 
 
int current_device = -1;
int current_device = -1;
Line 1024... Line 1025...
      || home != NULL && !(local = 0) && (f = fopen (ctmp, "rt")) != NULL) {
      || home != NULL && !(local = 0) && (f = fopen (ctmp, "rt")) != NULL) {
    unsigned long start, length;
    unsigned long start, length;
    char type[STR_SIZE];
    char type[STR_SIZE];
    int nparam;
    int nparam;
    int rd, wd;
    int rd, wd;
    if (config.sim.verbose)
    if (config.sim.verbose && !runtime.sim.output_cfg)
      printf ("Reading script file from '%s'...\n", local ? filename : ctmp);
      printf ("Reading script file from '%s'...\n", local ? filename : ctmp);
 
    strcpy (runtime.sim.script_fn, local ? filename : ctmp);
 
 
    while (!feof(f)) {
    while (!feof(f)) {
      char param[STR_SIZE];
      char param[STR_SIZE];
      if (fscanf(f, "%s ", &param) != 1) break;
      if (fscanf(f, "%s ", &param) != 1) break;
      /* Is this a sections? */
      /* Is this a sections? */
      if (strcmp (param, "section") == 0) {
      if (strcmp (param, "section") == 0) {
Line 1169... Line 1172...
      printf ("Invalid parameters specified.\n");
      printf ("Invalid parameters specified.\n");
      break;
      break;
  }
  }
}
}
 
 
 No newline at end of file
 No newline at end of file
 
/* Outputs C structure of current config to file */
 
void output_cfg (FILE *f)
 
{
 
  int i, comma;
 
  fprintf (f, "/* This file was automatically generated by or1ksim,\n"
 
              "   using --output-cfg switch (cfg file '%s'). */\n"
 
  "const static struct config config = {\n", runtime.sim.script_fn);
 
 
 
  fprintf (f, "  tick:{enabled:%i, irq:%i},\n", config.tick.enabled, config.tick.irq);
 
  fprintf (f, "  nuarts:%i, uarts:{", config.nuarts);
 
  comma = 0;
 
  for (i = 0; i < config.nuarts; i++) {
 
    fprintf (f, "%s\n    {rxfile:\"%s\", txfile:\"%s\", jitter:%i, baseaddr:0x%08x, irq:%i, vapi_id:0x%08x, uart16550:%i}",
 
      comma ? "," :"", config.uarts[i].rxfile, config.uarts[i].txfile, config.uarts[i].jitter, config.uarts[i].baseaddr, config.uarts[i].irq,
 
      config.uarts[i].vapi_id, config.uarts[i].uart16550);
 
    comma = 1;
 
  }
 
  fprintf (f, "},\n");
 
 
 
  fprintf (f, "  ndmas:%i, dmas:{", config.ndmas);
 
  comma = 0;
 
  for (i = 0; i < config.ndmas; i++) {
 
    fprintf (f, "%s\n    {baseaddr:0x%08x, irq:%i, vapi_id:0x%08x}",
 
      comma ? "," :"", config.dmas[i].baseaddr, config.dmas[i].irq, config.dmas[i].vapi_id);
 
    comma = 1;
 
  }
 
  fprintf (f, "},\n");
 
 
 
  fprintf (f, "  nethernets:%i, ethernets:{", config.nethernets);
 
  comma = 0;
 
  for (i = 0; i < config.nethernets; i++) {
 
    fprintf (f, "%s\n    {baseaddr:0x%08x, dma:%i, tx_channel:0x%08x, rx_channel:0x%08x, rxfile:\"%s\", txfile:\"%s\", vapi_id:0x%08x}",
 
      comma ? "," :"", config.ethernets[i].baseaddr, config.ethernets[i].dma, config.ethernets[i].tx_channel, config.ethernets[i].rx_channel,
 
      config.ethernets[i].rxfile, config.ethernets[i].txfile, config.ethernets[i].vapi_id);
 
    comma = 1;
 
  }
 
  fprintf (f, "},\n");
 
 
 
  fprintf (f, "  ngpios:%i, gpios:{", config.ngpios);
 
  comma = 0;
 
  for (i = 0; i < config.ngpios; i++) {
 
    fprintf (f, "%s\n    {baseaddr:0x%08x, irq:%i, base_vapi_id:0x%08x}",
 
      comma ? "," :"", config.gpios[i].baseaddr, config.gpios[i].irq, config.gpios[i].base_vapi_id);
 
    comma = 1;
 
  }
 
  fprintf (f, "},\n");
 
 
 
  fprintf (f, "  mc:{enabled:%i, baseaddr:%i, POC:%i},\n", config.mc.enabled, config.mc.baseaddr, config.mc.POC);
 
  fprintf (f, "  memory:{pattern:%i, random_seed:%i, type:%s, nmemories:%i, table:{", config.memory.pattern, config.memory.random_seed,
 
    config.memory.type == MT_UNKNOWN ? "MT_UNKNOWN" : config.memory.type == MT_PATTERN ? "MT_PATTERN" : "MT_RANDOM", config.memory.nmemories);
 
  comma = 0;
 
  for (i = 0; i < config.memory.nmemories; i++) {
 
    fprintf (f, "%s\n    {ce:%i, baseaddr:0x%08x, size:0x%08x, name:\"%s\", log:\"%s\", delayr:%i, delayw:%i}",
 
      comma ? "," :"", config.memory.table[i].ce, config.memory.table[i].baseaddr, config.memory.table[i].size, config.memory.table[i].name,
 
      config.memory.table[i].log, config.memory.table[i].delayr, config.memory.table[i].delayw);
 
    comma = 1;
 
  }
 
  fprintf (f, "}},\n");
 
 
 
  fprintf (f, "  immu:{enabled:%i, nways:%i, nsets:%i, pagesize:%i, entrysize:%i, ustates:%i, missdelay:%i, hitdelay:%i},\n",
 
    config.immu.enabled, config.immu.nways, config.immu.nsets, config.immu.pagesize, config.immu.entrysize, config.immu.ustates,
 
    config.immu.missdelay, config.immu.hitdelay);
 
 
 
  fprintf (f, "  dmmu:{enabled:%i, nways:%i, nsets:%i, pagesize:%i, entrysize:%i, ustates:%i, missdelay:%i, hitdelay:%i},\n",
 
    config.dmmu.enabled, config.dmmu.nways, config.dmmu.nsets, config.dmmu.pagesize, config.dmmu.entrysize, config.dmmu.ustates,
 
    config.dmmu.missdelay, config.dmmu.hitdelay);
 
 
 
  fprintf (f, "  ic:{enabled:%i, tagtype:%i, nways:%i, nsets:%i, blocksize:%i, ustates:%i, missdelay:%i, hitdelay:%i},\n",
 
    config.ic.enabled, config.ic.tagtype, config.ic.nways, config.ic.nsets, config.ic.blocksize, config.ic.ustates,
 
    config.ic.missdelay, config.ic.hitdelay);
 
 
 
  fprintf (f, "  dc:{enabled:%i, tagtype:%i, nways:%i, nsets:%i, blocksize:%i, ustates:%i, "
 
    "load_missdelay:%i, load_hitdelay:%i, store_missdelay:%i, store_hitdelay:%i},\n",
 
    config.dc.enabled, config.dc.tagtype, config.dc.nways, config.dc.nsets, config.dc.blocksize, config.dc.ustates,
 
    config.dc.load_missdelay, config.dc.load_hitdelay, config.dc.store_missdelay, config.dc.store_hitdelay);
 
 
 
  fprintf (f, "  bpb:{enabled:%i, sbp_bnf_fwd:%i, sbp_bf_fwd:%i, btic:%i, missdelay:%i, hitdelay:%i},\n",
 
    config.bpb.enabled, config.bpb.sbp_bnf_fwd, config.bpb.sbp_bf_fwd, config.bpb.btic, config.bpb.missdelay, config.bpb.hitdelay);
 
 
 
  fprintf (f, "  cpu:{upr:0x%08x, ver:0x%04x, rev:0x%04x, superscalar:%i, hazards:%i, dependstats:%i, raw_range:%i},\n",
 
    config.cpu.upr, config.cpu.ver, config.cpu.rev, config.cpu.superscalar, config.cpu.dependstats, config.cpu.raw_range);
 
 
 
  fprintf (f, "  sim:{debug:%i, verbose:%i, iprompt:%i, profile:%i, prof_fn:\"%s\", mprofile:%i, mprof_fn:\"%s\",\n",
 
    config.sim.debug, config.sim.verbose, config.sim.iprompt, config.sim.profile, config.sim.prof_fn, config.sim.mprofile, config.sim.mprof_fn);
 
 
 
  fprintf (f, "    history:%i, exe_log:%i, exe_log_fn:\"%s\", clkcycle_ps:%i},\n",
 
    config.sim.history, config.sim.exe_log, config.sim.exe_log_fn, config.sim.clkcycle_ps);
 
 
 
  fprintf (f, "  debug:{enabled:%i, gdb_enabled:%i, server_port:%i, vapi_id:0x%08x},\n",
 
    config.debug.enabled, config.debug.gdb_enabled, config.debug.server_port, config.debug.vapi_id);
 
 
 
  fprintf (f, "  vapi:{enabled:%i, server_port:%i, log_enabled:%i, hide_device_id:%i, vapi_fn:\"%s\"}\n",
 
    config.vapi.enabled, config.vapi.server_port, config.vapi.log_enabled, config.vapi.hide_device_id, config.vapi.vapi_fn);
 
 
 
  fprintf (f, "};\n");
 
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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