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

Subversion Repositories or1k

[/] [or1k/] [tags/] [tn_m001/] [or1ksim/] [toplevel.c] - Diff between revs 554 and 557

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

Rev 554 Rev 557
Line 49... Line 49...
#include "gdbcomm.h"
#include "gdbcomm.h"
#include "debug_unit.h"
#include "debug_unit.h"
#include "coff.h"
#include "coff.h"
 
 
/* CVS revision number. */
/* CVS revision number. */
const char rcsrev[] = "$Revision: 1.67 $";
const char rcsrev[] = "$Revision: 1.68 $";
 
 
/* Continuos run versus single step tracing switch. */
/* Continuos run versus single step tracing switch. */
int cont_run;
int cont_run;
 
 
/* History of execution */
/* History of execution */
Line 165... Line 165...
  tick_reset();
  tick_reset();
  pm_reset();
  pm_reset();
  pic_reset();
  pic_reset();
  mc_reset();
  mc_reset();
  du_reset ();
  du_reset ();
  reset();
  cpu_reset();
}
}
 
 
/* Initalizes all devices and sim */
/* Initalizes all devices and sim */
void sim_init ()
void sim_init ()
{
{
Line 580... Line 580...
        to = strtoul(item3, NULL, 0);
        to = strtoul(item3, NULL, 0);
      debugmem(from, to);
      debugmem(from, to);
      printf("\n");
      printf("\n");
    } else
    } else
    if (strcmp(item1, "reset") == 0) {  /* reset simulator */
    if (strcmp(item1, "reset") == 0) {  /* reset simulator */
      uart_reset();
      sim_reset();
      dma_reset();
 
      eth_reset();
 
      gpio_reset();
 
      tick_reset();
 
      pm_reset();
 
      pic_reset();
 
      reset(); /* Old or new mode */
 
    } else
    } else
#if !FAST_SIM
#if !FAST_SIM
    if (strcmp(item1, "debug") == 0) {  /* debug mode */
    if (strcmp(item1, "debug") == 0) {  /* debug mode */
      config.sim.debug ^= 1;
      config.sim.debug ^= 1;
    } else
    } else
Line 650... Line 643...
 
 
    /* MM: 'run -1' means endless execution.  */
    /* MM: 'run -1' means endless execution.  */
    while(cont_run != 0) {
    while(cont_run != 0) {
      extern int mem_cycles;
      extern int mem_cycles;
 
 
 
      IFF (config.debug.enabled) {
      if (cpu_stalled) {
      if (cpu_stalled) {
        printf ("!");
 
        if(config.debug.gdb_enabled) {
        if(config.debug.gdb_enabled) {
          BlockJTAG();
          BlockJTAG();
          HandleServerSocket(false);
          HandleServerSocket(false);
        } else
        } else
          fprintf (stderr, "WARNING: CPU stalled and gdb connection not enabled.");
          fprintf (stderr, "WARNING: CPU stalled and gdb connection not enabled.");
        continue;
        continue;
      }
      }
 
      }
 
 
      /* Each cycle has counter of mem_cycles; this value is joined with cycles
      /* Each cycle has counter of mem_cycles; this value is joined with cycles
         at the end of the cycle; no sim originated memory accesses should be
         at the end of the cycle; no sim originated memory accesses should be
         performed inbetween. */
         performed inbetween. */
      mem_cycles = 0;
      mem_cycles = 0;
      if (!testsprbits(SPR_PMR, SPR_PMR_DME | SPR_PMR_SME)) {
      if (!config.pm.enabled || !testsprbits(SPR_PMR, SPR_PMR_DME | SPR_PMR_SME)) {
        pic_clock();
 
        if (cont_run > 0) cont_run--;
        if (cont_run > 0) cont_run--;
        if(fetch()) {
        pic_clock ();
          printf ("Breakpoint hit.\n");
        if (cpu_clock ()) break;
          cont_run = 0; /* memory breakpoint encountered */
        if (config.dc.enabled) dc_clock();
          break;
        if (config.ic.enabled) ic_clock();
        }
        if (config.pm.enabled) {
        decode_execute(&iqueue[0]);
          if (!testsprbits(SPR_PMR, SPR_PMR_SME))
        update_pc();
            IFF (config.tick.enabled) tick_clock();
        analysis();
        } else
        dc_clock();
          IFF (config.tick.enabled) tick_clock();
        ic_clock();
 
        if (!testsprbits(SPR_PMR, SPR_PMR_SME)) tick_clock();
 
      }
      }
 
 
      pm_clock();
      if (config.pm.enabled) pm_clock();
      if (config.uarts) uart_clock();
      if (config.uarts) uart_clock();
      if (config.dmas) dma_clock();
      if (config.dmas) dma_clock();
      if (config.ethernets) eth_clock();
      if (config.ethernets) eth_clock();
      if (config.ngpios) gpio_clock();
      if (config.ngpios) gpio_clock();
      if (config.vapi.enabled && runtime.vapi.enabled) vapi_check();
      if (config.vapi.enabled && runtime.vapi.enabled) vapi_check();
      if (config.debug.gdb_enabled) {
      if (config.debug.gdb_enabled) HandleServerSocket(false); /* block & check_stdin = false */
        HandleServerSocket(false); /* block & check_stdin = false */
      IFF(config.debug.enabled)
        debug (1, ".");
 
      }
 
      if (config.debug.enabled)
 
        if (testsprbits(SPR_DMR1, SPR_DMR1_ST)) set_stall_state (1);
        if (testsprbits(SPR_DMR1, SPR_DMR1_ST)) set_stall_state (1);
 
 
      cycles += mem_cycles;
      cycles += mem_cycles;
      if (!hush) dumpreg();
      if (!hush) dumpreg();
      if (config.sim.exe_log) dump_exe_log();
 
    }
    }
    hush = 0;
    hush = 0;
    fflush(stdout);
    fflush(stdout);
    freopen("/dev/fd/0", "w+", stdout);
    freopen("/dev/fd/0", "w+", stdout);
 
 

powered by: WebSVN 2.1.0

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