/* debug_unit.h -- Simulation of Or1k debug unit
|
/* debug_unit.h -- Simulation of Or1k debug unit
|
Copyright (C) 2001 Chris Ziomkowski, chris@asics.ws
|
Copyright (C) 2001 Chris Ziomkowski, chris@asics.ws
|
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
|
|
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
(at your option) any later version.
|
(at your option) any later version.
|
|
|
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU General Public License for more details.
|
GNU General Public License for more details.
|
|
|
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|
|
typedef enum {
|
typedef enum {
|
JTAG_CHAIN_GLOBAL = 0,
|
JTAG_CHAIN_GLOBAL = 0,
|
JTAG_CHAIN_DEBUG_UNIT = 1,
|
JTAG_CHAIN_DEBUG_UNIT = 1,
|
JTAG_CHAIN_TEST = 2,
|
JTAG_CHAIN_TEST = 2,
|
JTAG_CHAIN_TRACE = 3,
|
JTAG_CHAIN_TRACE = 3,
|
JTAG_CHAIN_DEVELOPMENT = 4,
|
JTAG_CHAIN_DEVELOPMENT = 4,
|
JTAG_CHAIN_WISHBONE = 5,
|
JTAG_CHAIN_WISHBONE = 5,
|
JTAG_CHAIN_BLOCK1 = 6,
|
JTAG_CHAIN_BLOCK1 = 6,
|
JTAG_CHAIN_BLOCK2 = 7,
|
JTAG_CHAIN_BLOCK2 = 7,
|
JTAG_CHAIN_OPTIONAL0 = 8,
|
JTAG_CHAIN_OPTIONAL0 = 8,
|
JTAG_CHAIN_OPTIONAL1 = 9,
|
JTAG_CHAIN_OPTIONAL1 = 9,
|
JTAG_CHAIN_OPTIONAL2 = 10,
|
JTAG_CHAIN_OPTIONAL2 = 10,
|
JTAG_CHAIN_OPTIONAL3 = 11,
|
JTAG_CHAIN_OPTIONAL3 = 11,
|
JTAG_CHAIN_OPTIONAL4 = 12,
|
JTAG_CHAIN_OPTIONAL4 = 12,
|
JTAG_CHAIN_OPTIONAL5 = 13,
|
JTAG_CHAIN_OPTIONAL5 = 13,
|
JTAG_CHAIN_OPTIONAL6 = 14,
|
JTAG_CHAIN_OPTIONAL6 = 14,
|
JTAG_CHAIN_OPTIONAL7 = 15,
|
JTAG_CHAIN_OPTIONAL7 = 15,
|
} DebugScanChainIDs;
|
} DebugScanChainIDs;
|
|
|
|
|
typedef struct {
|
typedef struct {
|
unsigned int DCR_hit;
|
unsigned int DCR_hit;
|
unsigned int watchpoint;
|
unsigned int watchpoint;
|
} DebugUnit;
|
} DebugUnit;
|
|
|
typedef enum {
|
typedef enum {
|
DebugInstructionFetch = 1,
|
DebugInstructionFetch = 1,
|
DebugLoadAddress = 2,
|
DebugLoadAddress = 2,
|
DebugStoreAddress = 3,
|
DebugStoreAddress = 3,
|
DebugLoadData = 4,
|
DebugLoadData = 4,
|
DebugStoreData = 5,
|
DebugStoreData = 5,
|
} DebugUnitAction;
|
} DebugUnitAction;
|
|
|
|
|
/* Debug registers and their bits */
|
/* Debug registers and their bits */
|
typedef struct {
|
typedef struct {
|
unsigned long moder;
|
unsigned long moder;
|
unsigned long tsel;
|
unsigned long tsel;
|
unsigned long qsel;
|
unsigned long qsel;
|
unsigned long ssel;
|
unsigned long ssel;
|
unsigned long riscop;
|
unsigned long riscop;
|
unsigned long recwp[11];
|
unsigned long recwp[11];
|
unsigned long recbp;
|
unsigned long recbp;
|
} DevelopmentInterface;
|
} DevelopmentInterface;
|
|
|
typedef enum {
|
typedef enum {
|
DEVELOPINT_MODER = 0,
|
DEVELOPINT_MODER = 0,
|
DEVELOPINT_TSEL = 1,
|
DEVELOPINT_TSEL = 1,
|
DEVELOPINT_QSEL = 2,
|
DEVELOPINT_QSEL = 2,
|
DEVELOPINT_SSEL = 3,
|
DEVELOPINT_SSEL = 3,
|
DEVELOPINT_RISCOP = 4,
|
DEVELOPINT_RISCOP = 4,
|
DEVELOPINT_RECWP0 = 16,
|
DEVELOPINT_RECWP0 = 16,
|
DEVELOPINT_RECWP1 = 17,
|
DEVELOPINT_RECWP1 = 17,
|
DEVELOPINT_RECWP2 = 18,
|
DEVELOPINT_RECWP2 = 18,
|
DEVELOPINT_RECWP3 = 19,
|
DEVELOPINT_RECWP3 = 19,
|
DEVELOPINT_RECWP4 = 20,
|
DEVELOPINT_RECWP4 = 20,
|
DEVELOPINT_RECWP5 = 21,
|
DEVELOPINT_RECWP5 = 21,
|
DEVELOPINT_RECWP6 = 22,
|
DEVELOPINT_RECWP6 = 22,
|
DEVELOPINT_RECWP7 = 23,
|
DEVELOPINT_RECWP7 = 23,
|
DEVELOPINT_RECWP8 = 24,
|
DEVELOPINT_RECWP8 = 24,
|
DEVELOPINT_RECWP9 = 25,
|
DEVELOPINT_RECWP9 = 25,
|
DEVELOPINT_RECWP10 = 26,
|
DEVELOPINT_RECWP10 = 26,
|
DEVELOPINT_RECBP0 = 27,
|
DEVELOPINT_RECBP0 = 27,
|
} DevelopmentInterfaceAddressSpace;
|
} DevelopmentInterfaceAddressSpace;
|
|
|
#define RISCOP_STALL 0x00000001
|
#define RISCOP_STALL 0x00000001
|
#define RISCOP_RESET 0x00000002
|
#define RISCOP_RESET 0x00000002
|
|
|
/* Resets the debug unit */
|
/* Resets the debug unit */
|
void du_reset(void);
|
void du_reset(void);
|
|
|
/* do cycle-related initialisation (watchpoints etc.) */
|
/* do cycle-related initialisation (watchpoints etc.) */
|
void du_clock();
|
void du_clock();
|
|
|
/* set cpu_stalled flag */
|
/* set cpu_stalled flag */
|
void set_stall_state (int state);
|
void set_stall_state (int state);
|
|
|
/* Whether debug unit should ignore exception */
|
/* Whether debug unit should ignore exception */
|
int debug_ignore_exception (unsigned long except);
|
int debug_ignore_exception (unsigned long except);
|
|
|
/* Gets development interface register */
|
/* Gets development interface register */
|
int get_devint_reg(unsigned int addr, unsigned long *data);
|
int get_devint_reg(unsigned int addr, unsigned long *data);
|
|
|
/* Sets development interface register */
|
/* Sets development interface register */
|
int set_devint_reg(unsigned int addr, unsigned long data);
|
int set_devint_reg(unsigned int addr, unsigned long data);
|
|
|
/* Reads from bus address */
|
/* Reads from bus address */
|
int debug_get_mem(unsigned int address, unsigned long *data);
|
int debug_get_mem(unsigned int address, unsigned long *data);
|
|
|
/* Writes to bus address */
|
/* Writes to bus address */
|
int debug_set_mem(unsigned int address, unsigned long data);
|
int debug_set_mem(unsigned int address, unsigned long data);
|
|
|
int DebugGetRegister(unsigned int address, unsigned long *data);
|
int DebugGetRegister(unsigned int address, unsigned long *data);
|
|
|
int DebugSetRegister(unsigned int address, unsigned long data);
|
int DebugSetRegister(unsigned int address, unsigned long data);
|
|
|
int DebugSetChain(int chain);
|
int DebugSetChain(int chain);
|
|
|
#ifdef DEBUGMOD_OFF
|
#ifdef DEBUGMOD_OFF
|
#define CheckDebugUnit(x,y) 0
|
#define CheckDebugUnit(x,y) 0
|
#else
|
#else
|
int CheckDebugUnit(DebugUnitAction, unsigned long);
|
int CheckDebugUnit(DebugUnitAction, unsigned long);
|
#endif
|
#endif
|
|
|