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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_47/] [or1ksim/] [cpu/] [common/] [abstract.c] - Diff between revs 1218 and 1240

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

Rev 1218 Rev 1240
Line 320... Line 320...
  if (config.debug.enabled)
  if (config.debug.enabled)
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
  return temp;
  return temp;
}
}
 
 
 
unsigned long eval_direct32(unsigned long memaddr, int *breakpoint,
 
                            int through_mmu, int through_dc)
 
{
 
  unsigned long temp;
 
 
 
  if (memaddr & 3) {
 
    PRINTF("%s:%d %s(): ERR unaligned access\n", __FILE__, __LINE__, __FUNCTION__);
 
      return 0;
 
  }
 
 
 
  cur_vadd = memaddr;
 
 
 
  if (through_mmu)
 
    memaddr = peek_into_dtlb(memaddr, 0, through_dc);
 
 
 
  if (through_dc)
 
    temp = dc_simulate_read(memaddr, 4);
 
  else {
 
    temp = evalsim_mem32(memaddr);
 
    if (!cur_area) {
 
      PRINTF("EXCEPTION: read out of memory (32-bit access to %.8lx) in eval_direct32()\n", memaddr);
 
      except_handle(EXCEPT_BUSERR, cur_vadd);
 
      temp = 0;
 
    }
 
  }
 
 
 
  return temp;
 
}
 
 
 
 
/* Returns 32-bit values from mem array. Big endian version. */
/* Returns 32-bit values from mem array. Big endian version. */
unsigned long eval_insn(unsigned long memaddr,int* breakpoint)
unsigned long eval_insn(unsigned long memaddr,int* breakpoint)
{
{
  unsigned long temp;
  unsigned long temp;
  struct dev_memarea *dev;
  struct dev_memarea *dev;
Line 387... Line 417...
  if (config.debug.enabled)
  if (config.debug.enabled)
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
  return temp;
  return temp;
}
}
 
 
 
unsigned short eval_direct16(unsigned long memaddr, int *breakpoint,
 
                             int through_mmu, int through_dc)
 
{
 
  unsigned long temp;
 
 
 
  if (memaddr & 3) {
 
    PRINTF("%s:%d %s(): ERR unaligned access\n", __FILE__, __LINE__, __FUNCTION__);
 
      return 0;
 
  }
 
 
 
  cur_vadd = memaddr;
 
 
 
  if (through_mmu)
 
    memaddr = peek_into_dtlb(memaddr, 0, through_dc);
 
 
 
  if (through_dc)
 
    temp = dc_simulate_read(memaddr, 2);
 
  else {
 
    temp = evalsim_mem16(memaddr);
 
    if (!cur_area) {
 
      PRINTF("EXCEPTION: read out of memory (16-bit access to %.8lx) in eval_direct16()\n", memaddr);
 
      except_handle(EXCEPT_BUSERR, cur_vadd);
 
      temp = 0;
 
    }
 
  }
 
 
 
  return temp;
 
}
 
 
 
 
/* Returns 8-bit values from mem array. */
/* Returns 8-bit values from mem array. */
 
 
unsigned char eval_mem8(unsigned long memaddr,int* breakpoint)
unsigned char eval_mem8(unsigned long memaddr,int* breakpoint)
{
{
  unsigned char temp;
  unsigned char temp;
Line 421... Line 481...
  if (config.debug.enabled)
  if (config.debug.enabled)
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
  return temp;
  return temp;
}
}
 
 
 
unsigned char eval_direct8(unsigned long memaddr, int *breakpoint,
 
                           int through_mmu, int through_dc)
 
{
 
  unsigned char temp;
 
 
 
  if (memaddr & 3) {
 
    PRINTF("%s:%d %s(): ERR unaligned access\n", __FILE__, __LINE__, __FUNCTION__);
 
    return 0;
 
  }
 
 
 
  cur_vadd = memaddr;
 
 
 
  if (through_mmu)
 
    memaddr = peek_into_dtlb(memaddr, 0, through_dc);
 
 
 
  if (through_dc)
 
    temp = (unsigned char)dc_simulate_read(memaddr, 1);
 
  else {
 
    temp = evalsim_mem8(memaddr);
 
    if (!cur_area) {
 
      PRINTF("EXCEPTION: read out of memory (8-bit access to %.8lx) in eval_direct8()\n", memaddr);
 
      except_handle(EXCEPT_BUSERR, cur_vadd);
 
      temp = 0;
 
    }
 
  }
 
}
 
 
 
 
void setsim_mem32(unsigned long memaddr, unsigned long value)
void setsim_mem32(unsigned long memaddr, unsigned long value)
{
{
  struct dev_memarea *dev;
  struct dev_memarea *dev;
 
 
  if (verify_memoryarea(memaddr)) {
  if (verify_memoryarea(memaddr)) {
Line 534... Line 622...
 
 
  if (cur_area && cur_area->log)
  if (cur_area && cur_area->log)
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
}
}
 
 
 
void set_direct32(unsigned long memaddr, unsigned long value,int* breakpoint,
 
                  int through_mmu, int through_dc)
 
{
 
 
 
  if (memaddr & 3) {
 
    PRINTF("%s:%d %s(): ERR unaligned access\n", __FILE__, __LINE__, __FUNCTION__);
 
    return;
 
  }
 
 
 
  cur_vadd = memaddr;
 
 
 
  if (through_mmu) {
 
    /* 0 - no write access, we do not want a DPF exception do we ;)
 
     */
 
    memaddr = peek_into_dtlb(memaddr, 1, through_dc);
 
  }
 
 
 
 
 
  /* __PHX__ fixme: in principle we should write around the cache if
 
   *                through_dc is set, but i believe we this will work
 
   *                just fine anyway
 
   */
 
  dc_simulate_write(memaddr, value, 4);
 
 
 
  if (cur_area && cur_area->log)
 
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
 
}
 
 
 
 
/* Set mem, 16-bit. Big endian version. */
/* Set mem, 16-bit. Big endian version. */
 
 
void set_mem16(unsigned long memaddr, unsigned short value,int* breakpoint)
void set_mem16(unsigned long memaddr, unsigned short value,int* breakpoint)
{
{
  if (config.sim.mprofile)
  if (config.sim.mprofile)
Line 563... Line 680...
 
 
  if (cur_area && cur_area->log)
  if (cur_area && cur_area->log)
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
}
}
 
 
 
void set_direct16(unsigned long memaddr, unsigned short value, int* breakpoint,
 
                  int through_mmu, int through_dc)
 
{
 
 
 
  if (memaddr & 3) {
 
    PRINTF("%s:%d %s(): ERR unaligned access\n", __FILE__, __LINE__, __FUNCTION__);
 
    return;
 
  }
 
 
 
  cur_vadd = memaddr;
 
 
 
  if (through_mmu) {
 
    /* 0 - no write access, we do not want a DPF exception do we ;)
 
     */
 
    memaddr = peek_into_dtlb(memaddr, 0, through_dc);
 
  }
 
 
 
  /* __PHX__ fixme: in principle we should write around the cache if
 
   *                through_dc is set, but i believe we this will work
 
   *                just fine anyway
 
   */
 
  dc_simulate_write(memaddr, value, 2);
 
 
 
  if (cur_area && cur_area->log)
 
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
 
}
 
 
/* Set mem, 8-bit. */
/* Set mem, 8-bit. */
 
 
void set_mem8(unsigned long memaddr, unsigned char value,int* breakpoint)
void set_mem8(unsigned long memaddr, unsigned char value,int* breakpoint)
{
{
  if (config.sim.mprofile)
  if (config.sim.mprofile)
Line 586... Line 730...
 
 
  if (cur_area && cur_area->log)
  if (cur_area && cur_area->log)
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
}
}
 
 
 
void set_direct8(unsigned long memaddr, unsigned char value, int* breakpoint,
 
                 int through_mmu, int through_dc)
 
{
 
 
 
  if (memaddr & 3) {
 
    PRINTF("%s:%d %s(): ERR unaligned access\n", __FILE__, __LINE__, __FUNCTION__);
 
    return;
 
  }
 
 
 
  cur_vadd = memaddr;
 
 
 
  if (through_mmu) {
 
    /* 0 - no write access, we do not want a DPF exception do we ;)
 
     */
 
    memaddr = peek_into_dtlb(memaddr, 0, through_dc);
 
  }
 
 
 
  /* __PHX__ fixme: in principle we should write around the cache if
 
   *                through_dc is set, but i believe we this will work
 
   *                just fine anyway
 
   */
 
  dc_simulate_write(memaddr, value, 1);
 
 
 
  if (cur_area && cur_area->log)
 
    fprintf (cur_area->log, "[%08x] -> write %08x\n", memaddr, value);
 
}
 
 
 
 
 
 
void dumpmemory(unsigned int from, unsigned int to, int disasm, int nl)
void dumpmemory(unsigned int from, unsigned int to, int disasm, int nl)
{
{
  unsigned int i, j;
  unsigned int i, j;
  struct label_entry *tmp;
  struct label_entry *tmp;
  int breakpoint = 0;
  int breakpoint = 0;

powered by: WebSVN 2.1.0

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