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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_61/] [or1ksim/] [sim-config.c] - Diff between revs 424 and 425

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

Rev 424 Rev 425
Line 283... Line 283...
void eth_rx_channel ();
void eth_rx_channel ();
void eth_tx_channel ();
void eth_tx_channel ();
void eth_rxfile ();
void eth_rxfile ();
void eth_txfile ();
void eth_txfile ();
void eth_vapi_id ();
void eth_vapi_id ();
 
void immu_enabled ();
 
void immu_nsets ();
 
void immu_nways ();
 
void immu_pagesize ();
 
void immu_entrysize ();
 
void immu_ustates ();
 
void dmmu_enabled ();
 
void dmmu_nsets ();
 
void dmmu_nways ();
 
void dmmu_pagesize ();
 
void dmmu_entrysize ();
 
void dmmu_ustates ();
 
 
unsigned long tempL;
unsigned long tempL;
unsigned long tempUL;
unsigned long tempUL;
char tempS[STR_SIZE];
char tempS[STR_SIZE];
 
 
Line 302... Line 314...
  {"cpu",    0},
  {"cpu",    0},
  {"sim",    0},
  {"sim",    0},
  {"debug",  0},
  {"debug",  0},
  {"VAPI",   0},
  {"VAPI",   0},
  {"ethernet",0},
  {"ethernet",0},
  {"tick",   0}   /* 10 */
  {"tick",   0},   /* 10 */
 
  {"immu",   0},
 
  {"dmmu",   0}
};
};
 
 
/* *INDENT-OFF* */
/* *INDENT-OFF* */
 
 
/* Parameter definitions */
/* Parameter definitions */
Line 397... Line 411...
{9, 0, "txfile",             "=\"%s\"",     eth_txfile,    (void *)(&tempS[0])},
{9, 0, "txfile",             "=\"%s\"",     eth_txfile,    (void *)(&tempS[0])},
{9, 0, "vapi_id",            "=0x%x",       eth_vapi_id,   (void *)(&tempUL)},
{9, 0, "vapi_id",            "=0x%x",       eth_vapi_id,   (void *)(&tempUL)},
 
 
{10,0, "enabled",            "=%i",         NULL,          (void *)(&config.tick.enabled)},
{10,0, "enabled",            "=%i",         NULL,          (void *)(&config.tick.enabled)},
{10,0, "irq",                "=%i",         NULL,          (void *)(&config.tick.irq)},
{10,0, "irq",                "=%i",         NULL,          (void *)(&config.tick.irq)},
 
 
 
{11,0, "enabled",            "=%i",         immu_enabled,  (void *)(&tempL)},
 
{11,0, "nsets",              "=%i",         immu_nsets,    (void *)(&tempL)},
 
{11,0, "nways",              "=%i",         immu_nways,    (void *)(&tempL)},
 
{11,0, "pagesize",           "=%i",         immu_pagesize, (void *)(&tempL)},
 
{11,0, "entrysize",          "=%i",         immu_entrysize,(void *)(&tempL)},
 
{11,0, "ustates",            "=%i",         immu_ustates,  (void *)(&tempL)},
 
 
 
{12,0, "enabled",            "=%i",         dmmu_enabled,  (void *)(&tempL)},
 
{12,0, "nsets",              "=%i",         dmmu_nsets,    (void *)(&tempL)},
 
{12,0, "nways",              "=%i",         dmmu_nways,    (void *)(&tempL)},
 
{12,0, "pagesize",           "=%i",         dmmu_pagesize, (void *)(&tempL)},
 
{12,0, "entrysize",          "=%i",         dmmu_entrysize,(void *)(&tempL)},
 
{12,0, "ustates",            "=%i",         dmmu_ustates,  (void *)(&tempL)}
};
};
 
 
/* *INDENT-ON* */
/* *INDENT-ON* */
 
 
int current_device = -1;
int current_device = -1;
Line 620... Line 648...
 
 
void eth_vapi_id () {
void eth_vapi_id () {
  if (current_device >= 0 && current_device < config.nethernets)
  if (current_device >= 0 && current_device < config.nethernets)
    config.ethernets[current_device].vapi_id = tempUL;
    config.ethernets[current_device].vapi_id = tempUL;
  else
  else
    ERROR("nvalid device number.");
    ERROR("invalid device number.");
 
}
 
 
 
int is_power2 (int x) {
 
  while (!(x & 1))
 
    x >>= 1;
 
  return x == 1;
 
}
 
 
 
void immu_enabled () {
 
  setsprbits (SPR_UPR, SPR_UPR_IMP, tempL & 1);
 
}
 
 
 
void dmmu_enabled () {
 
  setsprbits (SPR_UPR, SPR_UPR_DMP, tempL & 1);
 
}
 
 
 
void immu_nsets () {
 
  if (is_power2(tempL) && tempL <= 256)
 
    config.immu.nsets = tempL;
 
  else
 
    ERROR("value of power two and lower or equal than 256 expected.");
 
}
 
 
 
void dmmu_nsets () {
 
  if (is_power2(tempL) && tempL <= 256)
 
    config.dmmu.nsets = tempL;
 
  else
 
    ERROR("value of power two and lower or equal than 256 expected.");
 
}
 
 
 
void immu_nways () {
 
  if (tempL >= 1 && tempL <= 4)
 
    config.immu.nways = tempL;
 
  else
 
    ERROR("value 1, 2, 3 or 4 expected.");
 
}
 
 
 
void dmmu_nways () {
 
  if (tempL >= 1 && tempL <= 4)
 
    config.dmmu.nways = tempL;
 
  else
 
    ERROR("value 1, 2, 3 or 4 expected.");
 
}
 
 
 
void immu_pagesize () {
 
  if (is_power2(tempL))
 
    config.immu.pagesize = tempL;
 
  else
 
    ERROR("value of power two expected.");
 
}
 
 
 
void dmmu_pagesize () {
 
  if (is_power2(tempL))
 
    config.dmmu.pagesize = tempL;
 
  else
 
    ERROR("value of power two expected.");
 
}
 
 
 
void immu_entrysize () {
 
  if (is_power2(tempL))
 
    config.immu.entrysize = tempL;
 
  else
 
    ERROR("value of power two expected.");
}
}
 
 
 
void dmmu_entrysize () {
 
  if (is_power2(tempL))
 
    config.dmmu.entrysize = tempL;
 
  else
 
    ERROR("value of power two expected.");
 
}
 
 
 
void immu_ustates () {
 
  if (tempL >= 2 && tempL <= 4)
 
    config.immu.ustates = tempL;
 
  else
 
    ERROR("invalid USTATE.");
 
}
 
 
 
void dmmu_ustates () {
 
  if (tempL >= 2 && tempL <= 4)
 
    config.dmmu.ustates = tempL;
 
  else
 
    ERROR("invalid USTATE.");
 
}
 
 
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead.
/* Read environment from a script file. Does not fail - assumes defaukt configuration instead.
   The syntax of script file is:
   The syntax of script file is:
   param = value
   param = value
   section x
   section x

powered by: WebSVN 2.1.0

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