#ifndef __CP0DEFS__H__
#define __CP0DEFS__H__
/*
 * Contains register definitions for the CP0 registers and bits and macros
 * to access the CP0 registers.  This file is included in p32xxxx.h and
 * depends on macro definitions found in that file.  To use this file
 * include p32xxxx.h
 */

#ifdef __LANGUAGE_ASSEMBLY__
/* CP0 Register Defines
 * #define _CP0_<register_name> <register_number>, <select_number>
 */
#define _CP0_HWRENA                            $7, 0
#define _CP0_BADVADDR                          $8, 0
#define _CP0_COUNT                             $9, 0
#define _CP0_COMPARE                           $11, 0
#define _CP0_STATUS                            $12, 0
#define _CP0_INTCTL                            $12, 1
#define _CP0_SRSCTL                            $12, 2
#define _CP0_SRSMAP                            $12, 3
#define _CP0_CAUSE                             $13, 0
#define _CP0_EPC                               $14, 0
#define _CP0_PRID                              $15, 0
#define _CP0_EBASE                             $15, 1
#define _CP0_CONFIG                            $16, 0
#define _CP0_CONFIG1                           $16, 1
#define _CP0_CONFIG2                           $16, 2
#define _CP0_CONFIG3                           $16, 3
#define _CP0_DEBUG                             $23, 0
#define _CP0_TRACECONTROL                      $23, 1
#define _CP0_TRACECONTROL2                     $23, 2
#define _CP0_USERTRACEDATA                     $23, 3
#define _CP0_TRACEBPC                          $23, 4
#define _CP0_DEBUG2                            $23, 5
#define _CP0_DEPC                              $24, 0
#define _CP0_ERROREPC                          $30, 0
#define _CP0_DESAVE                            $31, 0
#else
#define _CP0_HWRENA                            7
#define _CP0_HWRENA_SELECT                     0
#define _CP0_BADVADDR                          8
#define _CP0_BADVADDR_SELECT                   0
#define _CP0_COUNT                             9
#define _CP0_COUNT_SELECT                      0
#define _CP0_COMPARE                           11
#define _CP0_COMPARE_SELECT                    0
#define _CP0_STATUS                            12
#define _CP0_STATUS_SELECT                     0
#define _CP0_INTCTL                            12
#define _CP0_INTCTL_SELECT                     1
#define _CP0_SRSCTL                            12
#define _CP0_SRSCTL_SELECT                     2
#define _CP0_SRSMAP                            12
#define _CP0_SRSMAP_SELECT                     3
#define _CP0_CAUSE                             13
#define _CP0_CAUSE_SELECT                      0
#define _CP0_EPC                               14
#define _CP0_EPC_SELECT                        0
#define _CP0_PRID                              15
#define _CP0_PRID_SELECT                       0
#define _CP0_EBASE                             15
#define _CP0_EBASE_SELECT                      1
#define _CP0_CONFIG                            16
#define _CP0_CONFIG_SELECT                     0
#define _CP0_CONFIG1                           16
#define _CP0_CONFIG1_SELECT                    1
#define _CP0_CONFIG2                           16
#define _CP0_CONFIG2_SELECT                    2
#define _CP0_CONFIG3                           16
#define _CP0_CONFIG3_SELECT                    3
#define _CP0_DEBUG                             23
#define _CP0_DEBUG_SELECT                      0
#define _CP0_TRACECONTROL                      23
#define _CP0_TRACECONTROL_SELECT               1
#define _CP0_TRACECONTROL2                     23
#define _CP0_TRACECONTROL2_SELECT              2
#define _CP0_USERTRACEDATA                     23
#define _CP0_USERTRACEDATA_SELECT              3
#define _CP0_TRACEBPC                          23
#define _CP0_TRACEBPC_SELECT                   4
#define _CP0_DEBUG2                            23
#define _CP0_DEBUG2_SELEECT                    5
#define _CP0_DEPC                              24
#define _CP0_DEPC_SELECT                       0
#define _CP0_ERROREPC                          30
#define _CP0_ERROREPC_SELECT                   0
#define _CP0_DESAVE                            31
#define _CP0_DESAVE_SELECT                     0

#define _CP0_GET_HWRENA()      _mfc0 (_CP0_HWRENA, _CP0_HWRENA_SELECT)
#define _CP0_SET_HWRENA(val)   _mtc0 (_CP0_HWRENA, _CP0_HWRENA_SELECT, val)
#define _CP0_XCH_HWRENA(val)   _mxc0 (_CP0_HWRENA, _CP0_HWRENA_SELECT, val)
#define _CP0_BIC_HWRENA(clr)   _bcc0 (_CP0_HWRENA, _CP0_HWRENA_SELECT, clr)
#define _CP0_BIS_HWRENA(set)   _bsc0 (_CP0_HWRENA, _CP0_HWRENA_SELECT, set)
#define _CP0_BCS_HWRENA(c,s)   _bcsc0(_CP0_HWRENA, _CP0_HWRENA_SELECT, c, s)

#define _CP0_GET_BADVADDR()    _mfc0 (_CP0_BADVADDR, _CP0_BADVADDR_SELECT)

#define _CP0_GET_COUNT()       _mfc0 (_CP0_COUNT, _CP0_COUNT_SELECT)
#define _CP0_SET_COUNT(val)    _mtc0 (_CP0_COUNT, _CP0_COUNT_SELECT, val)

#define _CP0_GET_COMPARE()     _mfc0 (_CP0_COMPARE, _CP0_COMPARE_SELECT)
#define _CP0_SET_COMPARE(val)  _mtc0 (_CP0_COMPARE, _CP0_COMPARE_SELECT, val)

#define _CP0_GET_STATUS()      _mfc0 (_CP0_STATUS, _CP0_STATUS_SELECT)
#define _CP0_SET_STATUS(val)   _mtc0 (_CP0_STATUS, _CP0_STATUS_SELECT, val)
#define _CP0_XCH_STATUS(val)   _mxc0 (_CP0_STATUS, _CP0_STATUS_SELECT, val)
#define _CP0_BIC_STATUS(clr)   _bcc0 (_CP0_STATUS, _CP0_STATUS_SELECT, clr)
#define _CP0_BIS_STATUS(set)   _bsc0 (_CP0_STATUS, _CP0_STATUS_SELECT, set)
#define _CP0_BCS_STATUS(c,s)   _bcsc0(_CP0_STATUS, _CP0_STATUS_SELECT, c, s)

#define _CP0_GET_INTCTL()      _mfc0 (_CP0_INTCTL, _CP0_INTCTL_SELECT)
#define _CP0_SET_INTCTL(val)   _mtc0 (_CP0_INTCTL, _CP0_INTCTL_SELECT, val)
#define _CP0_XCH_INTCTL(val)   _mxc0 (_CP0_INTCTL, _CP0_INTCTL_SELECT, val)

#define _CP0_GET_SRSCTL()      _mfc0 (_CP0_SRSCTL, _CP0_SRSCTL_SELECT)
#define _CP0_SET_SRSCTL(val)   _mtc0 (_CP0_SRSCTL, _CP0_SRSCTL_SELECT, val)
#define _CP0_XCH_SRSCTL(val)   _mxc0 (_CP0_SRSCTL, _CP0_SRSCTL_SELECT, val)

#define _CP0_GET_SRSMAP()      _mfc0 (_CP0_SRSMAP, _CP0_SRSMAP_SELECT)
#define _CP0_SET_SRSMAP(val)   _mtc0 (_CP0_SRSMAP, _CP0_SRSMAP_SELECT, val)
#define _CP0_XCH_SRSMAP(val)   _mxc0 (_CP0_SRSMAP, _CP0_SRSMAP_SELECT, val)

#define _CP0_GET_CAUSE()       _mfc0 (_CP0_CAUSE, _CP0_CAUSE_SELECT)
#define _CP0_SET_CAUSE(val)    _mtc0 (_CP0_CAUSE, _CP0_CAUSE_SELECT, val)
#define _CP0_XCH_CAUSE(val)    _mxc0 (_CP0_CAUSE, _CP0_CAUSE_SELECT, val)
#define _CP0_BIC_CAUSE(clr)    _bcc0 (_CP0_CAUSE, _CP0_CAUSE_SELECT, clr)
#define _CP0_BIS_CAUSE(set)    _bsc0 (_CP0_CAUSE, _CP0_CAUSE_SELECT, set)
#define _CP0_BCS_CAUSE(c,s)    _bcsc0(_CP0_CAUSE, _CP0_CAUSE_SELECT, c, s)

#define _CP0_GET_EPC()         _mfc0 (_CP0_EPC, _CP0_EPC_SELECT)
#define _CP0_SET_EPC(val)      _mtc0 (_CP0_EPC, _CP0_EPC_SELECT, val)

#define _CP0_GET_PRID()        _mfc0 (_CP0_PRID, _CP0_PRID_SELECT)

#define _CP0_GET_EBASE()       _mfc0 (_CP0_EBASE, _CP0_EBASE_SELECT)
#define _CP0_SET_EBASE(val)    _mtc0 (_CP0_EBASE, _CP0_EBASE_SELECT, val)
#define _CP0_XCH_EBASE(val)    _mxc0 (_CP0_EBASE, _CP0_EBASE_SELECT, val)

#define _CP0_GET_CONFIG()      _mfc0 (_CP0_CONFIG, _CP0_CONFIG_SELECT)
#define _CP0_GET_CONFIG1()     _mfc0 (_CP0_CONFIG1, _CP0_CONFIG1_SELECT)
#define _CP0_GET_CONFIG2()     _mfc0 (_CP0_CONFIG2, _CP0_CONFIG2_SELECT)
#define _CP0_GET_CONFIG3()     _mfc0 (_CP0_CONFIG3, _CP0_CONFIG3_SELECT)

#define _CP0_GET_DEBUG()       _mfc0 (_CP0_DEBUG, _CP0_DEBUG_SELECT)
#define _CP0_SET_DEBUG(val)    _mtc0 (_CP0_DEBUG, _CP0_DEBUG_SELECT, val)
#define _CP0_XCH_DEBUG(val)    _mxc0 (_CP0_DEBUG, _CP0_DEBUG_SELECT, val)
#define _CP0_BIC_DEBUG(clr)    _bcc0 (_CP0_DEBUG, _CP0_DEBUG_SELECT, clr)
#define _CP0_BIS_DEBUG(set)    _bsc0 (_CP0_DEBUG, _CP0_DEBUG_SELECT, set)
#define _CP0_BCS_DEBUG(c,s)    _bcsc0(_CP0_DEBUG, _CP0_DEBUG_SELECT, c, s)

#define _CP0_GET_TRACECONTROL() \
        _mfc0 (_CP0_TRACECONTROL, _CP0_TRACECONTROL_SELECT)
#define _CP0_SET_TRACECONTROL(val) \
        _mtc0 (_CP0_TRACECONTROL, _CP0_TRACECONTROL_SELECT, val)
#define _CP0_XCH_TRACECONTROL(val) \
        _mxc0 (_CP0_TRACECONTROL, _CP0_TRACECONTROL_SELECT, val)
#define _CP0_BIC_TRACECONTROL(clr) \
        _bcc0 (_CP0_TRACECONTROL, _CP0_TRACECONTROL_SELECT, clr)
#define _CP0_BIS_TRACECONTROL(set) \
        _bsc0 (_CP0_TRACECONTROL, _CP0_TRACECONTROL_SELECT, set)
#define _CP0_BCS_TRACECONTROL(c,s) \
        _bcsc0(_CP0_TRACECONTROL, _CP0_TRACECONTROL_SELECT, c, s)

#define _CP0_GET_TRACECONTROL2() \
        _mfc0 (_CP0_TRACECONTROL2, _CP0_TRACECONTROL2_SELECT)

#define _CP0_GET_USERTRACEDATA() \
        _mfc0 (_CP0_USERTRACEDATA, _CP0_USERTRACEDATA_SELECT)
#define _CP0_SET_USERTRACEDATA(val) \
        _mtc0 (_CP0_USERTRACEDATA, _CP0_USERTRACEDATA_SELECT, val)
#define _CP0_XCH_USERTRACEDATA(val) \
        _mxc0 (_CP0_USERTRACEDATA, _CP0_USERTRACEDATA_SELECT, val)

#define _CP0_GET_TRACEBPC()    _mfc0 (_CP0_TRACEBPC, _CP0_TRACEBPC_SELECT)
#define _CP0_SET_TRACEBPC(val) _mtc0 (_CP0_TRACEBPC, _CP0_TRACEBPC_SELECT, val)
#define _CP0_XCH_TRACEBPC(val) _mxc0 (_CP0_TRACEBPC, _CP0_TRACEBPC_SELECT, val)
#define _CP0_BIC_TRACEBPC(clr) _bcc0 (_CP0_TRACEBPC, _CP0_TRACEBPC_SELECT, clr)
#define _CP0_BIS_TRACEBPC(set) _bsc0 (_CP0_TRACEBPC, _CP0_TRACEBPC_SELECT, set)
#define _CP0_BCS_TRACEBPC(c,s) _bcsc0(_CP0_TRACEBPC, _CP0_TRACEBPC_SELECT, c, s)

#define _CP0_GET_DEBUG2()      _mfc0 (_CP0_DEBUG2, _CP0_DEBUG2_SELECT)

#define _CP0_GET_DEPC()        _mfc0 (_CP0_DEPC, _CP0_DEPC_SELECT)
#define _CP0_SET_DEPC(val)     _mtc0 (_CP0_DEPC, _CP0_DEPC_SELECT, val)
#define _CP0_XCH_DEPC(val)     _mxc0 (_CP0_DEPC, _CP0_DEPC_SELECT, val)

#define _CP0_GET_ERROREPC()    _mfc0 (_CP0_ERROREPC, _CP0_ERROREPC_SELECT)
#define _CP0_SET_ERROREPC(val) _mtc0 (_CP0_ERROREPC, _CP0_ERROREPC_SELECT, val)
#define _CP0_XCH_ERROREPC(val) _mxc0 (_CP0_ERROREPC, _CP0_ERROREPC_SELECT, val)

#define _CP0_GET_DESAVE()      _mfc0 (_CP0_DESAVE, _CP0_DESAVE_SELECT)
#define _CP0_SET_DESAVE(val)   _mtc0 (_CP0_DESAVE, _CP0_DESAVE_SELECT, val)
#define _CP0_XCH_DESAVE(val)   _mxc0 (_CP0_DESAVE, _CP0_DESAVE_SELECT, val)
#endif

#define _CP0_HWRENA_MASK_POSITION              0x00000000
#define _CP0_HWRENA_MASK_MASK                  0x0000000F
#define _CP0_HWRENA_MASK_LENGTH                0x00000004

#define _CP0_BADVADDR_ALL_POSITION             0x00000000
#define _CP0_BADVADDR_ALL_MASK                 0xFFFFFFFF
#define _CP0_BADVADDR_ALL_LENGTH               0x00000020

#define _CP0_COUNT_ALL_POSITION                0x00000000
#define _CP0_COUNT_ALL_MASK                    0xFFFFFFFF
#define _CP0_COUNT_ALL_LENGTH                  0x00000020

#define _CP0_COMPARE_ALL_POSITION              0x00000000
#define _CP0_COMPARE_ALL_MASK                  0xFFFFFFFF
#define _CP0_COMPARE_ALL_LENGTH                0x00000020

#define _CP0_STATUS_IE_POSITION                0x00000000
#define _CP0_STATUS_IE_MASK                    0x00000001
#define _CP0_STATUS_IE_LENGTH                  0x00000001

#define _CP0_STATUS_EXL_POSITION               0x00000001
#define _CP0_STATUS_EXL_MASK                   0x00000002
#define _CP0_STATUS_EXL_LENGTH                 0x00000001

#define _CP0_STATUS_ERL_POSITION               0x00000002
#define _CP0_STATUS_ERL_MASK                   0x00000004
#define _CP0_STATUS_ERL_LENGTH                 0x00000001

#define _CP0_STATUS_UM_POSITION                0x00000004
#define _CP0_STATUS_UM_MASK                    0x00000010
#define _CP0_STATUS_UM_LENGTH                  0x00000001

#define _CP0_STATUS_IM0_POSITION               0x00000008
#define _CP0_STATUS_IM0_MASK                   0x00000100
#define _CP0_STATUS_IM0_LENGTH                 0x00000001

#define _CP0_STATUS_IM1_POSITION               0x00000009
#define _CP0_STATUS_IM1_MASK                   0x00000200
#define _CP0_STATUS_IM1_LENGTH                 0x00000001

#define _CP0_STATUS_IPL_POSITION               0x0000000A
#define _CP0_STATUS_IPL_MASK                   0x0000FC00
#define _CP0_STATUS_IPL_LENGTH                 0x00000006

#define _CP0_STATUS_IM2_POSITION               0x0000000A
#define _CP0_STATUS_IM2_MASK                   0x00000400
#define _CP0_STATUS_IM2_LENGTH                 0x00000001

#define _CP0_STATUS_IM3_POSITION               0x0000000B
#define _CP0_STATUS_IM3_MASK                   0x00000800
#define _CP0_STATUS_IM3_LENGTH                 0x00000001

#define _CP0_STATUS_IM4_POSITION               0x0000000C
#define _CP0_STATUS_IM4_MASK                   0x00001000
#define _CP0_STATUS_IM4_LENGTH                 0x00000001

#define _CP0_STATUS_IM5_POSITION               0x0000000D
#define _CP0_STATUS_IM5_MASK                   0x00002000
#define _CP0_STATUS_IM5_LENGTH                 0x00000001

#define _CP0_STATUS_IM6_POSITION               0x0000000E
#define _CP0_STATUS_IM6_MASK                   0x00004000
#define _CP0_STATUS_IM6_LENGTH                 0x00000001

#define _CP0_STATUS_IM7_POSITION               0x0000000F
#define _CP0_STATUS_IM7_MASK                   0x00008000
#define _CP0_STATUS_IM7_LENGTH                 0x00000001

#define _CP0_STATUS_CEE_POSITION               0x00000011
#define _CP0_STATUS_CEE_MASK                   0x00020000
#define _CP0_STATUS_CEE_LENGTH                 0x00000001

#define _CP0_STATUS_NMI_POSITION               0x00000013
#define _CP0_STATUS_NMI_MASK                   0x00080000
#define _CP0_STATUS_NMI_LENGTH                 0x00000001

#define _CPO_STATUS_SR_POSITION                0x00000014
#define _CP0_STATUS_SR_MASK                    0x00100000
#define _CP0_STATUS_SR_LENGTH                  0x00000001

#define _CP0_STATUS_TS_POSITION                0x00000015
#define _CP0_STATUS_TS_MASK                    0x00200000
#define _CP0_STATUS_TS_LENGTH                  0x00000001

#define _CP0_STATUS_BEV_POSITION               0x00000016
#define _CP0_STATUS_BEV_MASK                   0x00400000
#define _CP0_STATUS_BEV_LENGTH                 0x00000001

#define _CP0_STATUS_RE_POSITION                0x00000019
#define _CP0_STATUS_RE_MASK                    0x02000000
#define _CP0_STATUS_RE_LENGTH                  0x00000001

#define _CP0_STATUS_FR_POSITION                0x0000001A
#define _CP0_STATUS_FR_MASK                    0x04000000
#define _CP0_STATUS_FR_LENGTH                  0x00000001

#define _CP0_STATUS_RP_POSITION                0x0000001B
#define _CP0_STATUS_RP_MASK                    0x08000000
#define _CP0_STATUS_RP_LENGTH                  0x00000001

#define _CP0_STATUS_CU0_POSITION               0x0000001C
#define _CP0_STATUS_CU0_MASK                   0x10000000
#define _CP0_STATUS_CU0_LENGTH                 0x00000001

#define _CP0_STATUS_CU1_POSITION               0x0000001D
#define _CP0_STATUS_CU1_MASK                   0x20000000
#define _CP0_STATUS_CU1_LENGTH                 0x00000001

#define _CP0_STATUS_CU2_POSITION               0x0000001E
#define _CP0_STATUS_CU2_MASK                   0x40000000
#define _CP0_STATUS_CU2_LENGTH                 0x00000001

#define _CP0_STATUS_CU3_POSITION               0x0000001F
#define _CP0_STATUS_CU3_MASK                   0x80000000
#define _CP0_STATUS_CU3_LENGTH                 0x00000001

#define _CP0_INTCTL_VS_POSITION                0x00000005
#define _CP0_INTCTL_VS_MASK                    0x000003E0
#define _CP0_INTCTL_VS_LENGTH                  0x00000005

#define _CP0_INTCTL_IPPCI_POSITION             0x0000001A
#define _CP0_INTCTL_IPPCI_MASK                 0x1C000000
#define _CP0_INTCTL_IPPCI_LENGTH               0x00000003

#define _CP0_INTCTL_IPTI_POSITION              0x0000001D
#define _CP0_INTCTL_IPTI_MASK                  0xE0000000
#define _CP0_INTCTL_IPTI_LENGTH                0x00000003

#define _CP0_SRSCTL_CSS_POSITION               0x00000000
#define _CP0_SRSCTL_CSS_MASK                   0x0000000F
#define _CP0_SRSCTL_CSS_LENGTH                 0x00000004

#define _CP0_SRSCTL_PSS_POSITION               0x00000006
#define _CP0_SRSCTL_PSS_MASK                   0x000003C0
#define _CP0_SRSCTL_PSS_LENGTH                 0x00000004

#define _CP0_SRSCTL_ESS_POSITION               0x0000000C
#define _CP0_SRSCTL_ESS_MASK                   0x0000F000
#define _CP0_SRSCTL_ESS_LENGTH                 0x00000004

#define _CP0_SRSCTL_EICSS_POSITION             0x00000012
#define _CP0_SRSCTL_EICSS_MASK                 0x003C0000
#define _CP0_SRSCTL_EICSS_LENGTH               0x00000004

#define _CP0_SRSCTL_HSS_POSITION               0x0000001A
#define _CP0_SRSCTL_HSS_MASK                   0x3C000000
#define _CP0_SRSCTL_HSS_LENGTH                 0x00000004

#define _CP0_SRSMAP_SSV0_POSITION              0x00000000
#define _CP0_SRSMAP_SSV0_MASK                  0x0000000F
#define _CP0_SRSMAP_SSV0_LENGTH                0x00000004

#define _CP0_SRSMAP_SSV1_POSITION              0x00000004
#define _CP0_SRSMAP_SSV1_MASK                  0x000000F0
#define _CP0_SRSMAP_SSV1_LENGTH                0x00000004

#define _CP0_SRSMAP_SSV2_POSITION              0x00000008
#define _CP0_SRSMAP_SSV2_MASK                  0x00000F00
#define _CP0_SRSMAP_SSV2_LENGTH                0x00000004

#define _CP0_SRSMAP_SSV3_POSITION              0x0000000C
#define _CP0_SRSMAP_SSV3_MASK                  0x0000F000
#define _CP0_SRSMAP_SSV3_LENGTH                0x00000004

#define _CP0_SRSMAP_SSV4_POSITION              0x00000010
#define _CP0_SRSMAP_SSV4_MASK                  0x000F0000
#define _CP0_SRSMAP_SSV4_LENGTH                0x00000004

#define _CP0_SRSMAP_SSV5_POSITION              0x00000014
#define _CP0_SRSMAP_SSV5_MASK                  0x00F00000
#define _CP0_SRSMAP_SSV5_LENGTH                0x00000004

#define _CP0_SRSMAP_SSV6_POSITION              0x00000018
#define _CP0_SRSMAP_SSV6_MASK                  0x0F000000
#define _CP0_SRSMAP_SSV6_LENGTH                0x00000004

#define _CP0_SRSMAP_SSV7_POSITION              0x0000001C
#define _CP0_SRSMAP_SSV7_MASK                  0xF0000000
#define _CP0_SRSMAP_SSV7_LENGTH                0x00000004

#define _CP0_CAUSE_EXCCODE_POSITION            0x00000002
#define _CP0_CAUSE_EXCCODE_MASK                0x0000007C
#define _CP0_CAUSE_EXCCODE_LENGTH              0x00000005

#define _CP0_CAUSE_IP0_POSITION                0x00000008
#define _CP0_CAUSE_IP0_MASK                    0x00000100
#define _CP0_CAUSE_IP0_LENGTH                  0x00000001

#define _CP0_CAUSE_IP1_POSITION                0x00000009
#define _CP0_CAUSE_IP1_MASK                    0x00000200
#define _CP0_CAUSE_IP1_LENGTH                  0x00000001

#define _CP0_CAUSE_RIPL_POSITION               0x0000000A
#define _CP0_CAUSE_RIPL_MASK                   0x0000FC00
#define _CP0_CAUSE_RIPL_LENGTH                 0x00000006

#define _CP0_CAUSE_IP2_POSITION                0x0000000A
#define _CP0_CAUSE_IP2_MASK                    0x00000400
#define _CP0_CAUSE_IP2_LENGTH                  0x00000001

#define _CP0_CAUSE_IP3_POSITION                0x0000000B
#define _CP0_CAUSE_IP3_MASK                    0x00000800
#define _CP0_CAUSE_IP3_LENGTH                  0x00000001

#define _CP0_CAUSE_IP4_POSITION                0x0000000C
#define _CP0_CAUSE_IP4_MASK                    0x00001000
#define _CP0_CAUSE_IP4_LENGTH                  0x00000001

#define _CP0_CAUSE_IP5_POSITION                0x0000000D
#define _CP0_CAUSE_IP5_MASK                    0x00002000
#define _CP0_CAUSE_IP5_LENGTH                  0x00000001

#define _CP0_CAUSE_IP6_POSITION                0x0000000E
#define _CP0_CAUSE_IP6_MASK                    0x00004000
#define _CP0_CAUSE_IP6_LENGTH                  0x00000001

#define _CP0_CAUSE_IP7_POSITION                0x0000000F
#define _CP0_CAUSE_IP7_MASK                    0x00008000
#define _CP0_CAUSE_IP7_LENGTH                  0x00000001

#define _CP0_CAUSE_WP_POSITION                 0x00000016
#define _CP0_CAUSE_WP_MASK                     0x00400000
#define _CP0_CAUSE_WP_LENGTH                   0x00000001

#define _CP0_CAUSE_IV_POSITION                 0x00000017
#define _CP0_CAUSE_IV_MASK                     0x00800000
#define _CP0_CAUSE_IV_LENGTH                   0x00000001

#define _CP0_CAUSE_PCI_POSITION                0x0000001A
#define _CP0_CAUSE_PCI_MASK                    0x04000000
#define _CP0_CAUSE_PCI_LENGTH                  0x00000001

#define _CP0_CAUSE_DC_POSITION                 0x0000001B
#define _CP0_CAUSE_DC_MASK                     0x08000000
#define _CP0_CAUSE_DC_LENGTH                   0x00000001

#define _CP0_CAUSE_CE_POSITION                 0x0000001C
#define _CP0_CAUSE_CE_MASK                     0x30000000
#define _CP0_CAUSE_CE_LENGTH                   0x00000002

#define _CP0_CAUSE_TI_POSITION                 0x0000001E
#define _CP0_CAUSE_TI_MASK                     0x40000000
#define _CP0_CAUSE_TI_LENGTH                   0x00000001

#define _CP0_CAUSE_BD_POSITION                 0x0000001F
#define _CP0_CAUSE_BD_MASK                     0x80000000
#define _CP0_CAUSE_BD_LENGTH                   0x00000001

#define _EXCCODE_INT                           0x00
#define _EXCCODE_ADEL                          0x04
#define _EXCCODE_ADES                          0x05
#define _EXCCODE_IBE                           0x06
#define _EXCCODE_DBE                           0x07
#define _EXCCODE_SYS                           0x08
#define _EXCCODE_BP                            0x09
#define _EXCCODE_RI                            0x0A
#define _EXCCODE_CPU                           0x0B
#define _EXCCODE_OV                            0x0C
#define _EXCCODE_TR                            0x0D
#define _EXCCODE_IS1                           0x10
#define _EXCCODE_CEU                           0x11
#define _EXCCODE_C2E                           0x12

#define _CP0_EPC_ALL_POSITION                  0x00000000
#define _CP0_EPC_ALL_MASK                      0xFFFFFFFF
#define _CP0_EPC_ALL_LENGTH                    0x00000020

#define _CP0_PRID_REVISION_POSITION            0x00000000
#define _CP0_PRID_REVISION_MASK                0x000000FF
#define _CP0_PRID_REVISION_LENGTH              0x00000020

#define _CP0_PRID_PATCHREV_POSITION            0x00000000
#define _CP0_PRID_PATCHREV_MASK                0x00000003
#define _CP0_PRID_PATCHREV_LENGTH              0x00000002

#define _CP0_PRID_MINORREV_POSITION            0x00000002
#define _CP0_PRID_MINORREV_MASK                0x0000001C
#define _CP0_PRID_MINORREV_LENGTH              0x00000003

#define _CP0_PRID_MAJORREV_POSITION            0x00000005
#define _CP0_PRID_MAJORREV_MASK                0x000000E0
#define _CP0_PRID_MAJORREV_LENGTH              0x00000003

#define _CP0_PRID_PROCESSORID_POSITION         0x00000008
#define _CP0_PRID_PROCESSORID_MASK             0x0000FF00
#define _CP0_PRID_PROCESSORID_LENGTH           0x00000008

#define _CP0_PRID_COMPANYID_POSITION           0x00000010
#define _CP0_PRID_COMPANYID_MASK               0x00FF0000
#define _CP0_PRID_COMPANYID_LENGTH             0x00000008

#define _CP0_EBASE_CPUNUM_POSITION             0x00000000
#define _CP0_EBASE_CPUNUM_MASK                 0x000003FF
#define _CP0_EBASE_CPUNUM_LENGTH               0x0000000A

#define _CP0_EBASE_EBASE_POSITION              0x0000000C
#define _CP0_EBASE_EBASE_MASK                  0x3FFFF000
#define _CP0_EBASE_EBASE_LENGTH                0x0000000E

#define _CP0_CONFIG_K0_POSITION                0x00000000
#define _CP0_CONFIG_K0_MASK                    0x00000007
#define _CP0_CONFIG_K0_LENGTH                  0x00000003

#define _CP0_CONFIG_MT_POSITION                0x00000007
#define _CP0_CONFIG_MT_MASK                    0x00000380
#define _CP0_CONFIG_MT_LENGTH                  0x00000003

#define _CP0_CONFIG_AR_POSITION                0x0000000A
#define _CP0_CONFIG_AR_MASK                    0x00001C00
#define _CP0_CONFIG_AR_LENGTH                  0x00000003

#define _CP0_CONFIG_AT_POSITION                0x0000000D
#define _CP0_CONFIG_AT_MASK                    0x00006000
#define _CP0_CONFIG_AT_LENGTH                  0x00000002

#define _CP0_CONFIG_BE_POSITION                0x0000000F
#define _CP0_CONFIG_BE_MASK                    0x00008000
#define _CP0_CONFIG_BE_LENGTH                  0x00000001

#define _CP0_CONFIG_DS_POSITION                0x00000010
#define _CP0_CONFIG_DS_MASK                    0x00010000
#define _CP0_CONFIG_DS_LENGTH                  0x00000001

#define _CP0_CONFIG_MDU_POSITION               0x00000014
#define _CP0_CONFIG_MDU_MASK                   0x00100000
#define _CP0_CONFIG_MDU_LENGTH                 0x00000001

#define _CP0_CONFIG_SB_POSITION                0x00000015
#define _CP0_CONFIG_SB_MASK                    0x00200000
#define _CP0_CONFIG_SB_LENGTH                  0x00000001

#define _CP0_CONFIG_UDI_POSITION               0x00000016
#define _CP0_CONFIG_UDI_MASK                   0x00400000
#define _CP0_CONFIG_UDI_LENGTH                 0x00000001

#define _CP0_CONFIG_KU_POSITION                0x00000019
#define _CP0_CONFIG_KU_MASK                    0x70000000
#define _CP0_CONFIG_KU_LENGTH                  0x00000003

#define _CP0_CONFIG_M_POSITION                 0x0000001F
#define _CP0_CONFIG_M_MASK                     0x80000000
#define _CP0_CONFIG_M_LENGTH                   0x00000001

#define _CP0_CONFIG1_FP_POSITION               0x00000000
#define _CP0_CONFIG1_FP_MASK                   0x00000001
#define _CP0_CONFIG1_FP_LENGTH                 0x00000001

#define _CP0_CONFIG1_EP_POSITION               0x00000001
#define _CP0_CONFIG1_EP_MASK                   0x00000002
#define _CP0_CONFIG1_EP_LENGTH                 0x00000001

#define _CP0_CONFIG1_CA_POSITION               0x00000002
#define _CP0_CONFIG1_CA_MASK                   0x00000004
#define _CP0_CONFIG1_CA_LENGTH                 0x00000001

#define _CP0_CONFIG1_WR_POSITION               0x00000003
#define _CP0_CONFIG1_WR_MASK                   0x00000008
#define _CP0_CONFIG1_WR_LENGTH                 0x00000001

#define _CP0_CONFIG1_PC_POSITION               0x00000004
#define _CP0_CONFIG1_PC_MASK                   0x00000010
#define _CP0_CONFIG1_PC_LENGTH                 0x00000001

#define _CP0_CONFIG1_MD_POSITION               0x00000005
#define _CP0_CONFIG1_MD_MASK                   0x00000020
#define _CP0_CONFIG1_MD_LENGTH                 0x00000001

#define _CP0_CONFIG1_C2_POSITION               0x00000006
#define _CP0_CONFIG1_C2_MASK                   0x00000040
#define _CP0_CONFIG1_C2_LENGTH                 0x00000001

#define _CP0_CONFIG1_DA_POSITION               0x00000007
#define _CP0_CONFIG1_DA_MASK                   0x00000380
#define _CP0_CONFIG1_DA_LENGTH                 0x00000003

#define _CP0_CONFIG1_DL_POSITION               0x0000000A
#define _CP0_CONFIG1_DL_MASK                   0x00001C00
#define _CP0_CONFIG1_DL_LENGTH                 0x00000003

#define _CP0_CONFIG1_DS_POSITION               0x0000000D
#define _CP0_CONFIG1_DS_MASK                   0x0000E000
#define _CP0_CONFIG1_DS_LENGTH                 0x00000003

#define _CP0_CONFIG1_IA_POSITION               0x00000010
#define _CP0_CONFIG1_IA_MASK                   0x00070000
#define _CP0_CONFIG1_IA_LENGTH                 0x00000003

#define _CP0_CONFIG1_IL_POSITION               0x00000013
#define _CP0_CONFIG1_IL_MASK                   0x00380000
#define _CP0_CONFIG1_IL_LENGTH                 0x00000003

#define _CP0_CONFIG1_IS_POSITION               0x00000016
#define _CP0_CONFIG1_IS_MASK                   0x01C00000
#define _CP0_CONFIG1_IS_LENGTH                 0x00000003

#define _CP0_CONFIG1_MMUSIZE_POSITION          0x00000019
#define _CP0_CONFIG1_MMUSIZE_MASK              0x7E000000
#define _CP0_CONFIG1_MMUSIZE_LENGTH            0x00000006

#define _CP0_CONFIG1_M_POSITION                0x0000001F
#define _CP0_CONFIG1_M_MASK                    0x80000000
#define _CP0_CONFIG1_M_LENGTH                  0x00000001

#define _CP0_CONFIG2_M_POSITION                0x0000001F
#define _CP0_CONFIG2_M_MASK                    0x80000000
#define _CP0_CONFIG2_M_LENGTH                  0x00000001

#define _CP0_CONFIG3_TL_POSITION               0x00000000
#define _CP0_CONFIG3_TL_MASK                   0x00000001
#define _CP0_CONFIG3_TL_LENGTH                 0x00000001

#define _CP0_CONFIG3_SM_POSITION               0x00000001
#define _CP0_CONFIG3_SM_MASK                   0x00000002
#define _CP0_CONFIG3_SM_LENGTH                 0x00000001

#define _CP0_CONFIG3_SP_POSITION               0x00000004
#define _CP0_CONFIG3_SP_MASK                   0x00000010
#define _CP0_CONFIG3_SP_LENGTH                 0x00000001

#define _CP0_CONFIG3_VINT_POSITION             0x00000005
#define _CP0_CONFIG3_VINT_MASK                 0x00000020
#define _CP0_CONFIG3_VINT_LENGTH               0x00000001

#define _CP0_CONFIG3_VEIC_POSITION             0x00000006
#define _CP0_CONFIG3_VEIC_MASK                 0x00000040
#define _CP0_CONFIG3_VEIC_LENGTH               0x00000001

#define _CP0_CONFIG3_ITL_POSITION              0x00000008
#define _CP0_CONFIG3_ITL_MASK                  0x00000100
#define _CP0_CONFIG3_ITL_LENGTH                0x00000001

#define _CP0_CONFIG3_M_POSITION                0x0000001F
#define _CP0_CONFIG3_M_MASK                    0x80000000
#define _CP0_CONFIG3_M_LENGTH                  0x00000001

#define _CP0_DEBUG_DSS_POSITION                0x00000000
#define _CP0_DEBUG_DSS_MASK                    0x00000001
#define _CP0_DEBUG_DSS_LENGTH                  0x00000001

#define _CP0_DEBUG_DBP_POSITION                0x00000001
#define _CP0_DEBUG_DBP_MASK                    0x00000002
#define _CP0_DEBUG_DBP_LENGTH                  0x00000001

#define _CP0_DEBUG_DDBL_POSITION               0x00000002
#define _CP0_DEBUG_DDBL_MASK                   0x00000004
#define _CP0_DEBUG_DDBL_LENGTH                 0x00000001

#define _CP0_DEBUG_DDBS_POSITION               0x00000003
#define _CP0_DEBUG_DDBS_MASK                   0x00000008
#define _CP0_DEBUG_DDBS_LENGTH                 0x00000001

#define _CP0_DEBUG_DIB_POSITION                0x00000004
#define _CP0_DEBUG_DIB_MASK                    0x00000010
#define _CP0_DEBUG_DIB_LENGTH                  0x00000001

#define _CP0_DEBUG_DINT_POSITION               0x00000005
#define _CP0_DEBUG_DINT_MASK                   0x00000020
#define _CP0_DEBUG_DINT_LENGTH                 0x00000001

#define _CP0_DEBUG_DIBIMPR_POSITION            0x00000006
#define _CP0_DEBUG_DIBIMPR_MASK                0x00000040
#define _CP0_DEBUG_DIBIMPR_LENGTH              0x00000001

#define _CP0_DEBUG_R_POSITION                  0x00000007
#define _CP0_DEBUG_R_MASK                      0x00000080
#define _CP0_DEBUG_R_LENGTH                    0x00000001

#define _CP0_DEBUG_SST_POSITION                0x00000008
#define _CP0_DEBUG_SST_MASK                    0x00000100
#define _CP0_DEBUG_SST_LENGTH                  0x00000001

#define _CP0_DEBUG_NOSST_POSITION              0x00000009
#define _CP0_DEBUG_NOSST_MASK                  0x00000200
#define _CP0_DEBUG_NOSST_LENGTH                0x00000001

#define _CP0_DEBUG_DEXCCODE_POSITION           0x0000000A
#define _CP0_DEBUG_DEXCCODE_MASK               0x00007C00
#define _CP0_DEBUG_DEXCCODE_LENGTH             0x00000005

#define _CP0_DEBUG_VER_POSITION                0x0000000F
#define _CP0_DEBUG_VER_MASK                    0x00038000
#define _CP0_DEBUG_VER_LENGTH                  0x00000003

#define _CP0_DEBUG_DDBLIMPR_POSITION           0x00000012
#define _CP0_DEBUG_DDBLIMPR_MASK               0x00040000
#define _CP0_DEBUG_DDBLIMPR_LENGTH             0x00000001

#define _CP0_DEBUG_DDBSIMPR_POSITION           0x00000013
#define _CP0_DEBUG_DDBSIMPR_MASK               0x00080000
#define _CP0_DEBUG_DDBSIMPR_LENGTH             0x00000001

#define _CP0_DEBUG_IEXI_POSITION               0x00000014
#define _CP0_DEBUG_IEXI_MASK                   0x00100000
#define _CP0_DEBUG_IEXI_LENGTH                 0x00000001

#define _CP0_DEBUG_DBUSEP_POSITION             0x00000015
#define _CP0_DEBUG_DBUSEP_MASK                 0x00200000
#define _CP0_DEBUG_DBUSEP_LENGTH               0x00000001

#define _CP0_DEBUG_CACHEEP_POSITION            0x00000016
#define _CP0_DEBUG_CACHEEP_MASK                0x00400000
#define _CP0_DEBUG_CACHEEP_LENGTH              0x00000001

#define _CP0_DEBUG_MCHECKP_POSITION            0x00000017
#define _CP0_DEBUG_MCHECKP_MASK                0x00800000
#define _CP0_DEBUG_MCHECKP_LENGTH              0x00000001

#define _CP0_DEBUG_IBUSEP_POSITION             0x00000018
#define _CP0_DEBUG_IBUSEP_MASK                 0x01000000
#define _CP0_DEBUG_IBUSEP_LENGTH               0x00000001

#define _CP0_DEBUG_COUNTDM_POSITION            0x00000019
#define _CP0_DEBUG_COUNTDM_MASK                0x02000000
#define _CP0_DEBUG_COUNTDM_LENGTH              0x00000001

#define _CP0_DEBUG_HALT_POSITION               0x0000001A
#define _CP0_DEBUG_HALT_MASK                   0x04000000
#define _CP0_DEBUG_HALT_LENGTH                 0x00000001

#define _CP0_DEBUG_DOZE_POSITION               0x0000001B
#define _CP0_DEBUG_DOZE_MASK                   0x08000000
#define _CP0_DEBUG_DOZE_LENGTH                 0x00000001

#define _CP0_DEBUG_LSNM_POSITION               0x0000001C
#define _CP0_DEBUG_LSNM_MASK                   0x10000000
#define _CP0_DEBUG_LSNM_LENGTH                 0x00000001

#define _CP0_DEBUG_NODCR_POSITION              0x0000001D
#define _CP0_DEBUG_NODCR_MASK                  0x20000000
#define _CP0_DEBUG_NODCR_LENGTH                0x00000001

#define _CP0_DEBUG_DM_POSITION                 0x0000001E
#define _CP0_DEBUG_DM_MASK                     0x40000000
#define _CP0_DEBUG_DM_LENGTH                   0x00000001

#define _CP0_DEBUG_DBD_POSITION                0x0000001F
#define _CP0_DEBUG_DBD_MASK                    0x80000000
#define _CP0_DEBUG_DBD_LENGTH                  0x00000001

#define _CP0_TRACECONTROL_ON_POSITION          0x00000000
#define _CP0_TRACECONTROL_ON_MASK              0x00000001
#define _CP0_TRACECONTROL_ON_LENGTH            0x00000001

#define _CP0_TRACECONTROL_MODE_POSITION        0x00000001
#define _CP0_TRACECONTROL_MODE_MASK            0x0000000E
#define _CP0_TRACECONTROL_MODE_LENGTH          0x00000003

#define _CP0_TRACECONTROL_G_POSITION           0x00000004
#define _CP0_TRACECONTROL_G_MASK               0x00000010
#define _CP0_TRACECONTROL_G_LENGTH             0x00000001

#define _CP0_TRACECONTROL_ASID_POSITION        0x00000005
#define _CP0_TRACECONTROL_ASID_MASK            0x00001FE0
#define _CP0_TRACECONTROL_ASID_LENGTH          0x00000008

#define _CP0_TRACECONTROL_ASID_M_POSITION      0x0000000D
#define _CP0_TRACECONTROL_ASID_M_MASK          0x001FE000
#define _CP0_TRACECONTROL_ASID_M_LENGTH        0x00000008

#define _CP0_TRACECONTROL_U_POSITION           0x00000015
#define _CP0_TRACECONTROL_U_MASK               0x00200000
#define _CP0_TRACECONTROL_U_LENGTH             0x00000001

#define _CP0_TRACECONTROL_0_POSITION           0x00000016
#define _CP0_TRACECONTROL_0_MASK               0x00400000
#define _CP0_TRACECONTROL_0_LENGTH             0x00000001

#define _CP0_TRACECONTROL_K_POSITION           0x00000017
#define _CP0_TRACECONTROL_K_MASK               0x00800000
#define _CP0_TRACECONTROL_K_LENGTH             0x00000001

#define _CP0_TRACECONTROL_E_POSITION           0x00000018
#define _CP0_TRACECONTROL_E_MASK               0x01000000
#define _CP0_TRACECONTROL_E_LENGTH             0x00000001

#define _CP0_TRACECONTROL_D_POSITION           0x00000019
#define _CP0_TRACECONTROL_D_MASK               0x02000000
#define _CP0_TRACECONTROL_D_LENGTH             0x00000001

#define _CP0_TRACECONTROL_IO_POSITION          0x0000001A
#define _CP0_TRACECONTROL_IO_MASK              0x04000000
#define _CP0_TRACECONTROL_IO_LENGTH            0x00000001

#define _CP0_TRACECONTROL_TB_POSITION          0x0000001B
#define _CP0_TRACECONTROL_TB_MASK              0x08000000
#define _CP0_TRACECONTROL_TB_LENGTH            0x00000001

#define _CP0_TRACECONTROL_UT_POSITION          0x0000001E
#define _CP0_TRACECONTROL_UT_MASK              0x40000000
#define _CP0_TRACECONTROL_UT_LENGTH            0x00000001

#define _CP0_TRACECONTROL_TS_POSITION          0x0000001F
#define _CP0_TRACECONTROL_TS_MASK              0x80000000
#define _CP0_TRACECONTROL_TS_LENGTH            0x00000001

#define _CP0_TRACECONTROL2_SYP_POSITION        0x00000000
#define _CP0_TRACECONTROL2_SYP_MASK            0x00000007
#define _CP0_TRACECONTROL2_SYP_LENGTH          0x00000003

#define _CP0_TRACECONTROL2_TBU_POSITION        0x00000003
#define _CP0_TRACECONTROL2_TBU_MASK            0x00000008
#define _CP0_TRACECONTROL2_TBU_LENGTH          0x00000001

#define _CP0_TRACECONTROL2_TBI_POSITION        0x00000004
#define _CP0_TRACECONTROL2_TBI_MASK            0x00000010
#define _CP0_TRACECONTROL2_TBI_LENGTH          0x00000001

#define _CP0_TRACECONTROL2_VALIDMODES_POSITION 0x00000005
#define _CP0_TRACECONTROL2_VALIDMODES_MASK     0x00000060
#define _CP0_TRACECONTROL2_VALIDMODES_LENGTH   0x00000002

#define _CP0_USERTRACEDATA_DATA_POSITION       0x00000000
#define _CP0_USERTRACEDATA_DATA_MASK           0xFFFFFFFF
#define _CP0_USERTRACEDATA_DATA_LENGTH         0x00000020

#define _CP0_TRACEBPC_IBPON_POSITION           0x00000000
#define _CP0_TRACEBPC_IBPON_MASK               0x0000003F
#define _CP0_TRACEBPC_IBPON_LENGTH             0x00000006

#define _CP0_TRACEBPC_IE_POSITION              0x0000000F
#define _CP0_TRACEBPC_IE_MASK                  0x00008000
#define _CP0_TRACEBPC_IE_LENGTH                0x00000001

#define _CP0_TRACEBPC_DBPON_POSITION           0x00000010
#define _CP0_TRACEBPC_DBPON_MASK               0x00030000
#define _CP0_TRACEBPC_DBPON_LENGTH             0x00000002

#define _CP0_TRACEBPC_DE_POSITION              0x0000001F
#define _CP0_TRACEBPC_DE_MASK                  0x80000000
#define _CP0_TRACEBPC_DE_LENGTH                0x00000001

#define _CP0_DEBUG2_PACO_POSITION              0x00000000
#define _CP0_DEBUG2_PACO_MASK                  0x00000001
#define _CP0_DEBUG2_PACO_LENGTH                0x00000001

#define _CP0_DEBUG2_TUP_POSITION               0x00000001
#define _CP0_DEBUG2_TUP_MASK                   0x00000002
#define _CP0_DEBUG2_TUP_LENGTH                 0x00000001

#define _CP0_DEBUG2_DQ_POSITION                0x00000002
#define _CP0_DEBUG2_DQ_MASK                    0x00000004
#define _CP0_DEBUG2_DQ_LENGTH                  0x00000001

#define _CP0_DEBUG2_PRM_POSITION               0x00000003
#define _CP0_DEBUG2_PRM_MASK                   0x00000008
#define _CP0_DEBUG2_PRM_LENGTH                 0x00000001

#define _CP0_DEPC_ALL_POSITION                 0x00000000
#define _CP0_DEPC_ALL_MASK                     0xFFFFFFFF
#define _CP0_DEPC_ALL_LENGTH                   0x00000020

#define _CP0_ERROREPC_ALL_POSITION             0x00000000
#define _CP0_ERROREPC_ALL_MASK                 0xFFFFFFFF
#define _CP0_ERROREPC_ALL_LENGTH               0x00000020

#define _CP0_DESAVE_ALL_POSITION               0x00000000
#define _CP0_DESAVE_ALL_MASK                   0xFFFFFFFF
#define _CP0_DESAVE_ALL_LENGTH                 0x00000020

#endif
