Line 88... |
Line 88... |
config.sim.clkcycle_ps = 4000; /* 4000 for 4ns (250MHz) */
|
config.sim.clkcycle_ps = 4000; /* 4000 for 4ns (250MHz) */
|
if (config.sim.clkcycle_ps) config.sim.system_kfreq = (long)((1000000000.0 / (double)config.sim.clkcycle_ps));
|
if (config.sim.clkcycle_ps) config.sim.system_kfreq = (long)((1000000000.0 / (double)config.sim.clkcycle_ps));
|
else config.sim.system_kfreq = INT_MAX;
|
else config.sim.system_kfreq = INT_MAX;
|
if (config.sim.system_kfreq <= 0) config.sim.system_kfreq = 1;
|
if (config.sim.system_kfreq <= 0) config.sim.system_kfreq = 1;
|
|
|
/* Memory */
|
|
config.memory.type = MT_UNKNOWN;
|
|
config.memory.pattern = 0;
|
|
config.memory.random_seed = -1; /* Generate new seed */
|
|
for (i = 0; i < MAX_MEMORIES; i++)
|
|
config.memory.table[i].ce = -1; /* memory is disabled by default */
|
|
|
|
/* IMMU & DMMU*/
|
/* IMMU & DMMU*/
|
config.immu.enabled = 0;
|
config.immu.enabled = 0;
|
config.immu.hitdelay = 1;
|
config.immu.hitdelay = 1;
|
config.immu.missdelay = 1;
|
config.immu.missdelay = 1;
|
config.dmmu.enabled = 0;
|
config.dmmu.enabled = 0;
|
Line 418... |
Line 411... |
reg_config_param(sec, "spr_log_fn", paramt_str, sim_spr_log_fn);
|
reg_config_param(sec, "spr_log_fn", paramt_str, sim_spr_log_fn);
|
reg_config_param(sec, "clkcycle", paramt_word, sim_clkcycle);
|
reg_config_param(sec, "clkcycle", paramt_word, sim_clkcycle);
|
reg_config_param(sec, "stdout", paramt_str, sim_stdout);
|
reg_config_param(sec, "stdout", paramt_str, sim_stdout);
|
}
|
}
|
|
|
/*-------------------------------------------------[ Memory configuration ]---*/
|
|
void memory_random_seed(union param_val val, void *dat) {
|
|
config.memory.random_seed = val.int_val;
|
|
}
|
|
|
|
void memory_pattern(union param_val val, void *dat) {
|
|
config.memory.pattern = val.int_val;
|
|
}
|
|
|
|
void memory_nmemories (union param_val val, void *dat) {
|
|
if (val.int_val >= 0 && val.int_val < MAX_MEMORIES)
|
|
config.memory.nmemories = val.int_val;
|
|
else
|
|
CONFIG_ERROR("invalid number of devices.");
|
|
}
|
|
|
|
void memory_type (union param_val val, void *dat) {
|
|
if (strcmp (val.str_val, "unknown") == 0)
|
|
config.memory.type = MT_UNKNOWN;
|
|
else if (strcmp (val.str_val, "random") == 0)
|
|
config.memory.type = MT_RANDOM;
|
|
else if (strcmp (val.str_val, "pattern") == 0)
|
|
config.memory.type = MT_PATTERN;
|
|
else if (strcmp (val.str_val, "zero") == 0) {
|
|
config.memory.type = MT_PATTERN;
|
|
config.memory.pattern = 0;
|
|
} else {
|
|
char tmp[200];
|
|
sprintf (tmp, "invalid memory type '%s'.\n", val.str_val);
|
|
CONFIG_ERROR(tmp);
|
|
}
|
|
}
|
|
|
|
void memory_ce (union param_val val, void *dat) {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].ce = val.int_val;
|
|
else
|
|
CONFIG_ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_baseaddr (union param_val val, void *dat) {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].baseaddr = val.addr_val;
|
|
else
|
|
CONFIG_ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_size (union param_val val, void *dat) {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].size = val.int_val;
|
|
else
|
|
CONFIG_ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_name (union param_val val, void *dat) {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
strcpy (config.memory.table[current_device].name, val.str_val);
|
|
else
|
|
CONFIG_ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_log (union param_val val, void *dat) {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
strcpy (config.memory.table[current_device].log, val.str_val);
|
|
else
|
|
CONFIG_ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_delayr (union param_val val, void *dat) {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].delayr = val.int_val;
|
|
else
|
|
CONFIG_ERROR("invalid device number.");
|
|
}
|
|
|
|
void memory_delayw (union param_val val, void *dat) {
|
|
if (current_device >= 0 && current_device < config.memory.nmemories)
|
|
config.memory.table[current_device].delayw = val.int_val;
|
|
else
|
|
CONFIG_ERROR("invalid device number.");
|
|
}
|
|
|
|
void reg_memory_sec(void) {
|
|
struct config_section *sec = reg_config_sec("memory", NULL, NULL);
|
|
|
|
reg_config_param(sec, "random_seed", paramt_int, memory_random_seed);
|
|
reg_config_param(sec, "pattern", paramt_int, memory_pattern);
|
|
reg_config_param(sec, "type", paramt_word, memory_type);
|
|
reg_config_param(sec, "nmemories", paramt_int, memory_nmemories);
|
|
reg_config_param(sec, "device", paramt_int, change_device);
|
|
reg_config_param(sec, "enddevice", paramt_none, end_device);
|
|
reg_config_param(sec, "ce", paramt_int, memory_ce);
|
|
reg_config_param(sec, "baseaddr", paramt_addr, memory_baseaddr);
|
|
reg_config_param(sec, "size", paramt_int, memory_size);
|
|
reg_config_param(sec, "name", paramt_str, memory_name);
|
|
reg_config_param(sec, "log", paramt_str, memory_log);
|
|
reg_config_param(sec, "delayr", paramt_int, memory_delayr);
|
|
reg_config_param(sec, "delayw", paramt_int, memory_delayw);
|
|
}
|
|
|
|
/*----------------------------------------------------[ CPU configuration ]---*/
|
/*----------------------------------------------------[ CPU configuration ]---*/
|
void cpu_ver (union param_val val, void *dat) {
|
void cpu_ver (union param_val val, void *dat) {
|
config.cpu.ver = val.int_val;
|
config.cpu.ver = val.int_val;
|
}
|
}
|
|
|