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

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_2_x/] [or1ksim/] [peripheral/] [memory.c] - Diff between revs 1557 and 1586

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

Rev 1557 Rev 1586
Line 61... Line 61...
  return *(uint32_t *)(dat + addr);
  return *(uint32_t *)(dat + addr);
}
}
 
 
uint16_t simmem_read16(oraddr_t addr, void *dat)
uint16_t simmem_read16(oraddr_t addr, void *dat)
{
{
 
#ifdef WORDS_BIGENDIAN
 
  return *(uint16_t *)(dat + addr);
 
#else
  return *(uint16_t *)(dat + (addr ^ 2));
  return *(uint16_t *)(dat + (addr ^ 2));
 
#endif
}
}
 
 
uint8_t simmem_read8(oraddr_t addr, void *dat)
uint8_t simmem_read8(oraddr_t addr, void *dat)
{
{
 
#ifdef WORDS_BIGENDIAN
 
  return *(uint8_t *)(dat + addr);
 
#else
  return *(uint8_t *)(dat + ((addr & ~ADDR_C(3)) | (3 - (addr & 3))));
  return *(uint8_t *)(dat + ((addr & ~ADDR_C(3)) | (3 - (addr & 3))));
 
#endif
}
}
 
 
void simmem_write32(oraddr_t addr, uint32_t value, void *dat)
void simmem_write32(oraddr_t addr, uint32_t value, void *dat)
{
{
  *(uint32_t *)(dat + addr) = value;
  *(uint32_t *)(dat + addr) = value;
}
}
 
 
void simmem_write16(oraddr_t addr, uint16_t value, void *dat)
void simmem_write16(oraddr_t addr, uint16_t value, void *dat)
{
{
 
#ifdef WORDS_BIGENDIAN
 
  *(uint16_t *)(dat + addr) = value;
 
#else
  *(uint16_t *)(dat + (addr ^ 2)) = value;
  *(uint16_t *)(dat + (addr ^ 2)) = value;
 
#endif
}
}
 
 
void simmem_write8(oraddr_t addr, uint8_t value, void *dat)
void simmem_write8(oraddr_t addr, uint8_t value, void *dat)
{
{
 
#ifdef WORDS_BIGENDIAN
 
  *(uint8_t *)(dat + addr) = value;
 
#else
  *(uint8_t *)(dat + ((addr & ~ADDR_C(3)) | (3 - (addr & 3)))) = value;
  *(uint8_t *)(dat + ((addr & ~ADDR_C(3)) | (3 - (addr & 3)))) = value;
 
#endif
}
}
 
 
uint32_t simmem_read_zero32(oraddr_t addr, void *dat)
uint32_t simmem_read_zero32(oraddr_t addr, void *dat)
{
{
  if (config.sim.verbose)
  if (config.sim.verbose)

powered by: WebSVN 2.1.0

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