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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [cpu/] [common/] [abstract.c] - Diff between revs 19 and 98

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

Rev 19 Rev 98
Line 165... Line 165...
{
{
  unsigned int size_mask = bit_mask (size);
  unsigned int size_mask = bit_mask (size);
  unsigned int addr_mask = ~size_mask;
  unsigned int addr_mask = ~size_mask;
  struct dev_memarea *mem;
  struct dev_memarea *mem;
 
 
 
  printf ("Reg mem area, addr = 0x%08lx, size_mask = 0x%08lx, "
 
          "addr_mask = 0x%08lx\n", (unsigned long int) addr,
 
          (unsigned long int) size_mask, (unsigned long int) addr_mask);
 
 
  mem = register_memoryarea_mask (addr_mask, addr & addr_mask, size_mask + 1,
  mem = register_memoryarea_mask (addr_mask, addr & addr_mask, size_mask + 1,
                                  mc_dev);
                                  mc_dev);
 
 
  memcpy (&mem->ops, ops, sizeof (struct mem_ops));
  memcpy (&mem->ops, ops, sizeof (struct mem_ops));
  memcpy (&mem->direct_ops, ops, sizeof (struct mem_ops));
  memcpy (&mem->direct_ops, ops, sizeof (struct mem_ops));
Line 241... Line 245...
 
 
  /* Check memory controller space first */
  /* Check memory controller space first */
  if (mc_area
  if (mc_area
      && (addr & mc_area->addr_mask) ==
      && (addr & mc_area->addr_mask) ==
      (mc_area->addr_compare & mc_area->addr_mask))
      (mc_area->addr_compare & mc_area->addr_mask))
 
    {
    return cur_area = mc_area;
    return cur_area = mc_area;
 
    }
 
 
  /* Check cached value */
  /* Check cached value */
  if (cur_area
  if (cur_area
      && (addr & cur_area->addr_mask) ==
      && (addr & cur_area->addr_mask) ==
      (cur_area->addr_compare & cur_area->addr_mask))
      (cur_area->addr_compare & cur_area->addr_mask))
 
    {
    return cur_area;
    return cur_area;
 
    }
 
 
  /* When mc is enabled, we must check valid also, otherwise we assume it is
  /* When mc is enabled, we must check valid also, otherwise we assume it is
     nonzero */
     nonzero */
  /* Check list of registered devices. */
  /* Check list of registered devices. */
  for (ptmp = dev_list; ptmp; ptmp = ptmp->next)
  for (ptmp = dev_list; ptmp; ptmp = ptmp->next)
 
    {
    if ((addr & ptmp->addr_mask) == (ptmp->addr_compare & ptmp->addr_mask)
    if ((addr & ptmp->addr_mask) == (ptmp->addr_compare & ptmp->addr_mask)
        && ptmp->valid)
        && ptmp->valid)
 
        {
      return cur_area = ptmp;
      return cur_area = ptmp;
 
        }
 
    }
 
 
  return cur_area = NULL;
  return cur_area = NULL;
}
}
 
 
/* Sets the valid bit (Used only by memory controllers) */
/* Sets the valid bit (Used only by memory controllers) */
void
void

powered by: WebSVN 2.1.0

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