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 572 and 574

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

Rev 572 Rev 574
Line 84... Line 84...
 
 
/* Calls IMMU translation routines before simulating insn
/* Calls IMMU translation routines before simulating insn
cache for virtually indexed insn cache or after simulating insn cache
cache for virtually indexed insn cache or after simulating insn cache
for physically indexed insn cache. It returns physical address. */
for physically indexed insn cache. It returns physical address. */
 
 
unsigned long simulate_ic_mmu_fetch(unsigned long virtaddr)
static inline unsigned long simulate_ic_mmu_fetch(unsigned long virtaddr)
{
{
 
 
  unsigned long phyaddr;
  unsigned long phyaddr;
 
 
  if ((phyaddr = translate_vrt_to_phy_add(virtaddr, 0)) != -1) {
  if ((phyaddr = translate_vrt_to_phy_add(virtaddr, 0)) != -1) {
Line 104... Line 104...
 
 
/* Calls DMMU translation routines (load cycles) before simulating data
/* Calls DMMU translation routines (load cycles) before simulating data
   cache for virtually indexed data cache or after simulating data cache
   cache for virtually indexed data cache or after simulating data cache
   for physically indexed data cache. It returns physical address. */
   for physically indexed data cache. It returns physical address. */
 
 
unsigned long simulate_dc_mmu_load(unsigned long virtaddr)
static inline unsigned long simulate_dc_mmu_load(unsigned long virtaddr)
{
{
  if (config.dc.tagtype == CT_NONE)
  if (config.dc.tagtype == CT_NONE)
    return dmmu_translate(virtaddr, 0);
    return dmmu_translate(virtaddr, 0);
  else
  else
  if (config.dc.tagtype == CT_VIRTUAL) {
  if (config.dc.tagtype == CT_VIRTUAL) {
Line 130... Line 130...
 
 
/* Calls DMMU translation routines (store cycles) before simulating data
/* Calls DMMU translation routines (store cycles) before simulating data
cache for virtually indexed data cache or after simulating data cache
cache for virtually indexed data cache or after simulating data cache
for physically indexed data cache. It returns physical address. */
for physically indexed data cache. It returns physical address. */
 
 
unsigned long simulate_dc_mmu_store(unsigned long virtaddr)
static inline unsigned long simulate_dc_mmu_store(unsigned long virtaddr)
{
{
  if (config.dc.tagtype == CT_NONE)
  if (config.dc.tagtype == CT_NONE)
    return dmmu_translate(virtaddr, 0);
    return dmmu_translate(virtaddr, 0);
  else
  else
  if (config.dc.tagtype == CT_VIRTUAL) {
  if (config.dc.tagtype == CT_VIRTUAL) {
Line 368... Line 368...
  struct dev_memarea *dev;
  struct dev_memarea *dev;
 
 
  if (config.sim.mprofile)
  if (config.sim.mprofile)
    mprofile (memaddr, MPROF_32 | MPROF_READ);
    mprofile (memaddr, MPROF_32 | MPROF_READ);
 
 
  cur_vadd = memaddr;
 
  if (config.dmmu.enabled)
 
    memaddr = simulate_dc_mmu_load(memaddr);
 
  if (pending.valid)
 
    return 0;
 
 
 
  if (memaddr & 3) {
  if (memaddr & 3) {
    except_handle (EXCEPT_ALIGN, memaddr);
    except_handle (EXCEPT_ALIGN, memaddr);
    return 0;
    return 0;
  }
  }
 
 
 
  cur_vadd = memaddr;
 
  memaddr = simulate_dc_mmu_load(memaddr);
 
  if (pending.valid)
 
    return 0;
 
 
  if (config.debug.enabled)
  if (config.debug.enabled)
    *breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr); /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr); /* 28/05/01 CZ */
  temp = evalsim_mem32(memaddr);
  temp = evalsim_mem32(memaddr);
  if (config.debug.enabled)
  if (config.debug.enabled)
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
    *breakpoint += CheckDebugUnit(DebugLoadData,temp);  /* MM170901 */
Line 415... Line 414...
  unsigned short temp;
  unsigned short temp;
 
 
  if (config.sim.mprofile)
  if (config.sim.mprofile)
    mprofile (memaddr, MPROF_16 | MPROF_READ);
    mprofile (memaddr, MPROF_16 | MPROF_READ);
 
 
  cur_vadd = memaddr;
 
  if (config.dmmu.enabled)
 
    memaddr = simulate_dc_mmu_load(memaddr);
 
  if (pending.valid)
 
    return 0;
 
 
 
  if (memaddr & 1) {
  if (memaddr & 1) {
    except_handle (EXCEPT_ALIGN, memaddr);
    except_handle (EXCEPT_ALIGN, memaddr);
    return 0;
    return 0;
  }
  }
 
 
 
  cur_vadd = memaddr;
 
  memaddr = simulate_dc_mmu_load(memaddr);
 
  if (pending.valid)
 
    return 0;
 
 
  if (config.debug.enabled)
  if (config.debug.enabled)
    *breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr); /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr); /* 28/05/01 CZ */
 
 
  temp = evalsim_mem16(memaddr);
  temp = evalsim_mem16(memaddr);
  if (config.debug.enabled)
  if (config.debug.enabled)
Line 445... Line 443...
 
 
  if (config.sim.mprofile)
  if (config.sim.mprofile)
    mprofile (memaddr, MPROF_8 | MPROF_READ);
    mprofile (memaddr, MPROF_8 | MPROF_READ);
 
 
  cur_vadd = memaddr;
  cur_vadd = memaddr;
  if (config.dmmu.enabled)
 
      memaddr = simulate_dc_mmu_load(memaddr);
      memaddr = simulate_dc_mmu_load(memaddr);
  if (pending.valid)
  if (pending.valid)
    return 0;
    return 0;
 
 
  if (config.debug.enabled)
  if (config.debug.enabled)
    *breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr);  /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugLoadAddress,memaddr);  /* 28/05/01 CZ */
 
 
  temp = evalsim_mem8(memaddr);
  temp = evalsim_mem8(memaddr);
  if (config.debug.enabled)
  if (config.debug.enabled)
Line 465... Line 463...
void set_mem32(unsigned long memaddr, unsigned long value,int* breakpoint)
void set_mem32(unsigned long memaddr, unsigned long value,int* breakpoint)
{
{
  if (config.sim.mprofile)
  if (config.sim.mprofile)
    mprofile (memaddr, MPROF_32 | MPROF_WRITE);
    mprofile (memaddr, MPROF_32 | MPROF_WRITE);
 
 
 
  if (memaddr & 3) {
 
    except_handle (EXCEPT_ALIGN, memaddr);
 
    return;
 
  }
 
 
  cur_vadd = memaddr;
  cur_vadd = memaddr;
  if (config.dmmu.enabled)
 
    memaddr = simulate_dc_mmu_store(memaddr);
    memaddr = simulate_dc_mmu_store(memaddr);
 
 
  /* If we produced exception don't set anything */
  /* If we produced exception don't set anything */
  if (pending.valid)
  if (pending.valid)
    return;
    return;
 
 
  if (memaddr & 3) {
 
    except_handle (EXCEPT_ALIGN, memaddr);
 
    return;
 
  }
 
 
 
  if (config.debug.enabled) {
  if (config.debug.enabled) {
    *breakpoint += CheckDebugUnit(DebugStoreAddress,memaddr);  /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugStoreAddress,memaddr);  /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugStoreData,value);
    *breakpoint += CheckDebugUnit(DebugStoreData,value);
  }
  }
 
 
Line 524... Line 520...
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)
    mprofile (memaddr, MPROF_16 | MPROF_WRITE);
    mprofile (memaddr, MPROF_16 | MPROF_WRITE);
 
 
 
  if (memaddr & 1) {
 
    except_handle (EXCEPT_ALIGN, memaddr);
 
    return;
 
  }
 
 
  cur_vadd = memaddr;
  cur_vadd = memaddr;
  if (config.dmmu.enabled)
 
    memaddr = simulate_dc_mmu_store(memaddr);
    memaddr = simulate_dc_mmu_store(memaddr);
 
 
  /* If we produced exception don't set anything */
  /* If we produced exception don't set anything */
  if (pending.valid)
  if (pending.valid)
    return;
    return;
 
 
  if (memaddr & 1) {
 
    except_handle (EXCEPT_ALIGN, memaddr);
 
    return;
 
  }
 
 
 
  if (config.debug.enabled) {
  if (config.debug.enabled) {
    *breakpoint += CheckDebugUnit(DebugStoreAddress,memaddr);  /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugStoreAddress,memaddr);  /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugStoreData,value);
    *breakpoint += CheckDebugUnit(DebugStoreData,value);
  }
  }
 
 
Line 582... Line 576...
{
{
  if (config.sim.mprofile)
  if (config.sim.mprofile)
    mprofile (memaddr, MPROF_8 | MPROF_WRITE);
    mprofile (memaddr, MPROF_8 | MPROF_WRITE);
 
 
  cur_vadd = memaddr;
  cur_vadd = memaddr;
  if (config.dmmu.enabled)
 
    memaddr = simulate_dc_mmu_store(memaddr);
    memaddr = simulate_dc_mmu_store(memaddr);
 
 
  /* If we produced exception don't set anything */
  /* If we produced exception don't set anything */
  if (pending.valid) return;
  if (pending.valid) return;
 
 
  if (config.debug.enabled) {
  if (config.debug.enabled) {
    *breakpoint += CheckDebugUnit(DebugStoreAddress,memaddr);  /* 28/05/01 CZ */
    *breakpoint += CheckDebugUnit(DebugStoreAddress,memaddr);  /* 28/05/01 CZ */

powered by: WebSVN 2.1.0

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