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

Subversion Repositories or1k

[/] [or1k/] [tags/] [nog_patch_61/] [or1ksim/] [debug/] [debug_unit.c] - Diff between revs 1244 and 1308

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

Rev 1244 Rev 1308
Line 39... Line 39...
#include "arch.h"
#include "arch.h"
#include "abstract.h"
#include "abstract.h"
#include "parse.h"
#include "parse.h"
#include "sprs.h"
#include "sprs.h"
#include "gdb.h"
#include "gdb.h"
#include "../cpu/or1k/except.h"
#include "except.h"
#include "opcode/or32.h"
#include "opcode/or32.h"
 
#include "debug.h"
 
 
DevelopmentInterface development;
DevelopmentInterface development;
 
 
/* External STALL signal to debug interface */
/* External STALL signal to debug interface */
int in_reset = 0;
int in_reset = 0;
Line 72... Line 73...
void du_clock()
void du_clock()
{
{
        watchpoints=0;
        watchpoints=0;
};
};
 
 
inline int CheckDebugUnit(DebugUnitAction action, unsigned long udata)
int CheckDebugUnit(DebugUnitAction action, unsigned long udata)
{
{
  /* Do not stop, if we have debug module disabled or during reset */
  /* Do not stop, if we have debug module disabled or during reset */
  if(!config.debug.enabled || in_reset)
  if(!config.debug.enabled || in_reset)
    return 0;
    return 0;
 
 
  /* If we're single stepping, always stop */
  /* If we're single stepping, always stop */
  if(action == DebugInstructionFetch && testsprbits (SPR_DMR1, SPR_DMR1_ST))
  if(action == DebugInstructionFetch && testsprbits (SPR_DMR1, SPR_DMR1_ST))
    return 1;
    return 1;
 
 
  // is any watchpoint enabled to generate a break or count? If not, ignore
  /* is any watchpoint enabled to generate a break or count? If not, ignore */
  if(mfspr(SPR_DMR2) & (SPR_DMR2_WGB|SPR_DMR2_AWTC))
  if(mfspr(SPR_DMR2) & (SPR_DMR2_WGB|SPR_DMR2_AWTC))
          return calculate_watchpoints(action, udata);
          return calculate_watchpoints(action, udata);
 
 
  return 0;
  return 0;
}
}
Line 212... Line 213...
    {
    {
    case JTAG_CHAIN_DEBUG_UNIT:
    case JTAG_CHAIN_DEBUG_UNIT:
      *data = mfspr (address);
      *data = mfspr (address);
      debug (2, "READ  (%08x) = %08x\n", address, *data);
      debug (2, "READ  (%08x) = %08x\n", address, *data);
      if (runtime.sim.fspr_log) {
      if (runtime.sim.fspr_log) {
        fprintf(runtime.sim.fspr_log, "Read from SPR : [%08lX] -> [%08lX]\n", address, *data);
        fprintf(runtime.sim.fspr_log, "Read from SPR : [%08X] -> [%08lX]\n",
 
                address, *data);
      }
      }
      break;
      break;
    case JTAG_CHAIN_TRACE:
    case JTAG_CHAIN_TRACE:
      *data = 0;  /* Scan chain not yet implemented */
      *data = 0;  /* Scan chain not yet implemented */
      break;
      break;
Line 244... Line 246...
  switch(current_scan_chain)
  switch(current_scan_chain)
    {
    {
    case JTAG_CHAIN_DEBUG_UNIT:
    case JTAG_CHAIN_DEBUG_UNIT:
      debug (2, "WRITE (%08x) = %08x\n", address, data);
      debug (2, "WRITE (%08x) = %08x\n", address, data);
      if (runtime.sim.fspr_log) {
      if (runtime.sim.fspr_log) {
        fprintf(runtime.sim.fspr_log, "Write to SPR  : [%08lX] <- [%08lX]\n", address, data);
        fprintf(runtime.sim.fspr_log, "Write to SPR  : [%08X] <- [%08lX]\n",
 
                address, data);
      }
      }
      mtspr(address, data);
      mtspr(address, data);
      break;
      break;
    case JTAG_CHAIN_TRACE:
    case JTAG_CHAIN_TRACE:
      err = JTAG_PROXY_ACCESS_EXCEPTION;
      err = JTAG_PROXY_ACCESS_EXCEPTION;
Line 336... Line 339...
  fflush(stdout);
  fflush(stdout);
#endif
#endif
  return err;
  return err;
}
}
 
 
 
/* Gets development interface register */
int get_devint_reg(unsigned int address,unsigned long *data)
int get_devint_reg(unsigned int address,unsigned long *data)
{
{
  int err = 0;
  int err = 0;
  unsigned long value = 0;
  unsigned long value = 0;
 
 
Line 387... Line 391...
          simmem_write_word(address, data);
          simmem_write_word(address, data);
  }
  }
  return err;
  return err;
}
}
 
 
 
/* Reads from bus address */
int debug_get_mem(unsigned int address,unsigned long *data)
int debug_get_mem(unsigned int address,unsigned long *data)
{
{
  int err = 0;
  int err = 0;
  if(!verify_memoryarea(address))
  if(!verify_memoryarea(address))
    err = JTAG_PROXY_INVALID_ADDRESS;
    err = JTAG_PROXY_INVALID_ADDRESS;
Line 407... Line 412...
{
{
  int result = 0;
  int result = 0;
  unsigned long dsr = mfspr (SPR_DSR);
  unsigned long dsr = mfspr (SPR_DSR);
  unsigned long drr = mfspr (SPR_DRR);
  unsigned long drr = mfspr (SPR_DRR);
 
 
  &debug_ignore_exception;
 
 
 
#if DEBUG_JTAG
#if DEBUG_JTAG
  PRINTF ("dsr 0x%08x drr 0x%08x \n", dsr, drr);
  PRINTF ("dsr 0x%08x drr 0x%08x \n", dsr, drr);
#endif
#endif
 
 
  switch(except) {
  switch(except) {

powered by: WebSVN 2.1.0

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