18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * OpenRISC Linux
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * SPR Definitions
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2000 Damjan Lampret
88c2ecf20Sopenharmony_ci * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
98c2ecf20Sopenharmony_ci * Copyright (C) 2008, 2010 Embecosm Limited
108c2ecf20Sopenharmony_ci * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
118c2ecf20Sopenharmony_ci * et al.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * This file is part of OpenRISC 1000 Architectural Simulator.
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#ifndef SPR_DEFS__H
178c2ecf20Sopenharmony_ci#define SPR_DEFS__H
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* Definition of special-purpose registers (SPRs). */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define MAX_GRPS (32)
228c2ecf20Sopenharmony_ci#define MAX_SPRS_PER_GRP_BITS (11)
238c2ecf20Sopenharmony_ci#define MAX_SPRS_PER_GRP (1 << MAX_SPRS_PER_GRP_BITS)
248c2ecf20Sopenharmony_ci#define MAX_SPRS (0x10000)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Base addresses for the groups */
278c2ecf20Sopenharmony_ci#define SPRGROUP_SYS	(0 << MAX_SPRS_PER_GRP_BITS)
288c2ecf20Sopenharmony_ci#define SPRGROUP_DMMU	(1 << MAX_SPRS_PER_GRP_BITS)
298c2ecf20Sopenharmony_ci#define SPRGROUP_IMMU	(2 << MAX_SPRS_PER_GRP_BITS)
308c2ecf20Sopenharmony_ci#define SPRGROUP_DC	(3 << MAX_SPRS_PER_GRP_BITS)
318c2ecf20Sopenharmony_ci#define SPRGROUP_IC	(4 << MAX_SPRS_PER_GRP_BITS)
328c2ecf20Sopenharmony_ci#define SPRGROUP_MAC	(5 << MAX_SPRS_PER_GRP_BITS)
338c2ecf20Sopenharmony_ci#define SPRGROUP_D	(6 << MAX_SPRS_PER_GRP_BITS)
348c2ecf20Sopenharmony_ci#define SPRGROUP_PC	(7 << MAX_SPRS_PER_GRP_BITS)
358c2ecf20Sopenharmony_ci#define SPRGROUP_PM	(8 << MAX_SPRS_PER_GRP_BITS)
368c2ecf20Sopenharmony_ci#define SPRGROUP_PIC	(9 << MAX_SPRS_PER_GRP_BITS)
378c2ecf20Sopenharmony_ci#define SPRGROUP_TT	(10 << MAX_SPRS_PER_GRP_BITS)
388c2ecf20Sopenharmony_ci#define SPRGROUP_FP	(11 << MAX_SPRS_PER_GRP_BITS)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* System control and status group */
418c2ecf20Sopenharmony_ci#define SPR_VR		(SPRGROUP_SYS + 0)
428c2ecf20Sopenharmony_ci#define SPR_UPR		(SPRGROUP_SYS + 1)
438c2ecf20Sopenharmony_ci#define SPR_CPUCFGR	(SPRGROUP_SYS + 2)
448c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR	(SPRGROUP_SYS + 3)
458c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR	(SPRGROUP_SYS + 4)
468c2ecf20Sopenharmony_ci#define SPR_DCCFGR	(SPRGROUP_SYS + 5)
478c2ecf20Sopenharmony_ci#define SPR_ICCFGR	(SPRGROUP_SYS + 6)
488c2ecf20Sopenharmony_ci#define SPR_DCFGR	(SPRGROUP_SYS + 7)
498c2ecf20Sopenharmony_ci#define SPR_PCCFGR	(SPRGROUP_SYS + 8)
508c2ecf20Sopenharmony_ci#define SPR_VR2		(SPRGROUP_SYS + 9)
518c2ecf20Sopenharmony_ci#define SPR_AVR		(SPRGROUP_SYS + 10)
528c2ecf20Sopenharmony_ci#define SPR_EVBAR	(SPRGROUP_SYS + 11)
538c2ecf20Sopenharmony_ci#define SPR_AECR	(SPRGROUP_SYS + 12)
548c2ecf20Sopenharmony_ci#define SPR_AESR	(SPRGROUP_SYS + 13)
558c2ecf20Sopenharmony_ci#define SPR_NPC         (SPRGROUP_SYS + 16)  /* CZ 21/06/01 */
568c2ecf20Sopenharmony_ci#define SPR_SR		(SPRGROUP_SYS + 17)  /* CZ 21/06/01 */
578c2ecf20Sopenharmony_ci#define SPR_PPC         (SPRGROUP_SYS + 18)  /* CZ 21/06/01 */
588c2ecf20Sopenharmony_ci#define SPR_FPCSR       (SPRGROUP_SYS + 20)  /* CZ 21/06/01 */
598c2ecf20Sopenharmony_ci#define SPR_EPCR_BASE	(SPRGROUP_SYS + 32)  /* CZ 21/06/01 */
608c2ecf20Sopenharmony_ci#define SPR_EPCR_LAST	(SPRGROUP_SYS + 47)  /* CZ 21/06/01 */
618c2ecf20Sopenharmony_ci#define SPR_EEAR_BASE	(SPRGROUP_SYS + 48)
628c2ecf20Sopenharmony_ci#define SPR_EEAR_LAST	(SPRGROUP_SYS + 63)
638c2ecf20Sopenharmony_ci#define SPR_ESR_BASE	(SPRGROUP_SYS + 64)
648c2ecf20Sopenharmony_ci#define SPR_ESR_LAST	(SPRGROUP_SYS + 79)
658c2ecf20Sopenharmony_ci#define SPR_COREID	(SPRGROUP_SYS + 128)
668c2ecf20Sopenharmony_ci#define SPR_NUMCORES	(SPRGROUP_SYS + 129)
678c2ecf20Sopenharmony_ci#define SPR_GPR_BASE	(SPRGROUP_SYS + 1024)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* Data MMU group */
708c2ecf20Sopenharmony_ci#define SPR_DMMUCR	(SPRGROUP_DMMU + 0)
718c2ecf20Sopenharmony_ci#define SPR_DTLBEIR	(SPRGROUP_DMMU + 2)
728c2ecf20Sopenharmony_ci#define SPR_DTLBMR_BASE(WAY)	(SPRGROUP_DMMU + 0x200 + (WAY) * 0x100)
738c2ecf20Sopenharmony_ci#define SPR_DTLBMR_LAST(WAY)	(SPRGROUP_DMMU + 0x27f + (WAY) * 0x100)
748c2ecf20Sopenharmony_ci#define SPR_DTLBTR_BASE(WAY)	(SPRGROUP_DMMU + 0x280 + (WAY) * 0x100)
758c2ecf20Sopenharmony_ci#define SPR_DTLBTR_LAST(WAY)	(SPRGROUP_DMMU + 0x2ff + (WAY) * 0x100)
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/* Instruction MMU group */
788c2ecf20Sopenharmony_ci#define SPR_IMMUCR	(SPRGROUP_IMMU + 0)
798c2ecf20Sopenharmony_ci#define SPR_ITLBEIR	(SPRGROUP_IMMU + 2)
808c2ecf20Sopenharmony_ci#define SPR_ITLBMR_BASE(WAY)	(SPRGROUP_IMMU + 0x200 + (WAY) * 0x100)
818c2ecf20Sopenharmony_ci#define SPR_ITLBMR_LAST(WAY)	(SPRGROUP_IMMU + 0x27f + (WAY) * 0x100)
828c2ecf20Sopenharmony_ci#define SPR_ITLBTR_BASE(WAY)	(SPRGROUP_IMMU + 0x280 + (WAY) * 0x100)
838c2ecf20Sopenharmony_ci#define SPR_ITLBTR_LAST(WAY)	(SPRGROUP_IMMU + 0x2ff + (WAY) * 0x100)
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* Data cache group */
868c2ecf20Sopenharmony_ci#define SPR_DCCR	(SPRGROUP_DC + 0)
878c2ecf20Sopenharmony_ci#define SPR_DCBPR	(SPRGROUP_DC + 1)
888c2ecf20Sopenharmony_ci#define SPR_DCBFR	(SPRGROUP_DC + 2)
898c2ecf20Sopenharmony_ci#define SPR_DCBIR	(SPRGROUP_DC + 3)
908c2ecf20Sopenharmony_ci#define SPR_DCBWR	(SPRGROUP_DC + 4)
918c2ecf20Sopenharmony_ci#define SPR_DCBLR	(SPRGROUP_DC + 5)
928c2ecf20Sopenharmony_ci#define SPR_DCR_BASE(WAY)	(SPRGROUP_DC + 0x200 + (WAY) * 0x200)
938c2ecf20Sopenharmony_ci#define SPR_DCR_LAST(WAY)	(SPRGROUP_DC + 0x3ff + (WAY) * 0x200)
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* Instruction cache group */
968c2ecf20Sopenharmony_ci#define SPR_ICCR	(SPRGROUP_IC + 0)
978c2ecf20Sopenharmony_ci#define SPR_ICBPR	(SPRGROUP_IC + 1)
988c2ecf20Sopenharmony_ci#define SPR_ICBIR	(SPRGROUP_IC + 2)
998c2ecf20Sopenharmony_ci#define SPR_ICBLR	(SPRGROUP_IC + 3)
1008c2ecf20Sopenharmony_ci#define SPR_ICR_BASE(WAY)	(SPRGROUP_IC + 0x200 + (WAY) * 0x200)
1018c2ecf20Sopenharmony_ci#define SPR_ICR_LAST(WAY)	(SPRGROUP_IC + 0x3ff + (WAY) * 0x200)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* MAC group */
1048c2ecf20Sopenharmony_ci#define SPR_MACLO	(SPRGROUP_MAC + 1)
1058c2ecf20Sopenharmony_ci#define SPR_MACHI	(SPRGROUP_MAC + 2)
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci/* Debug group */
1088c2ecf20Sopenharmony_ci#define SPR_DVR(N)	(SPRGROUP_D + (N))
1098c2ecf20Sopenharmony_ci#define SPR_DCR(N)	(SPRGROUP_D + 8 + (N))
1108c2ecf20Sopenharmony_ci#define SPR_DMR1	(SPRGROUP_D + 16)
1118c2ecf20Sopenharmony_ci#define SPR_DMR2	(SPRGROUP_D + 17)
1128c2ecf20Sopenharmony_ci#define SPR_DWCR0	(SPRGROUP_D + 18)
1138c2ecf20Sopenharmony_ci#define SPR_DWCR1	(SPRGROUP_D + 19)
1148c2ecf20Sopenharmony_ci#define SPR_DSR		(SPRGROUP_D + 20)
1158c2ecf20Sopenharmony_ci#define SPR_DRR		(SPRGROUP_D + 21)
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* Performance counters group */
1188c2ecf20Sopenharmony_ci#define SPR_PCCR(N)	(SPRGROUP_PC + (N))
1198c2ecf20Sopenharmony_ci#define SPR_PCMR(N)	(SPRGROUP_PC + 8 + (N))
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci/* Power management group */
1228c2ecf20Sopenharmony_ci#define SPR_PMR (SPRGROUP_PM + 0)
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/* PIC group */
1258c2ecf20Sopenharmony_ci#define SPR_PICMR (SPRGROUP_PIC + 0)
1268c2ecf20Sopenharmony_ci#define SPR_PICPR (SPRGROUP_PIC + 1)
1278c2ecf20Sopenharmony_ci#define SPR_PICSR (SPRGROUP_PIC + 2)
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/* Tick Timer group */
1308c2ecf20Sopenharmony_ci#define SPR_TTMR (SPRGROUP_TT + 0)
1318c2ecf20Sopenharmony_ci#define SPR_TTCR (SPRGROUP_TT + 1)
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci/*
1348c2ecf20Sopenharmony_ci * Bit definitions for the Version Register
1358c2ecf20Sopenharmony_ci *
1368c2ecf20Sopenharmony_ci */
1378c2ecf20Sopenharmony_ci#define SPR_VR_VER	0xff000000  /* Processor version */
1388c2ecf20Sopenharmony_ci#define SPR_VR_CFG	0x00ff0000  /* Processor configuration */
1398c2ecf20Sopenharmony_ci#define SPR_VR_RES	0x0000ffc0  /* Reserved */
1408c2ecf20Sopenharmony_ci#define SPR_VR_REV	0x0000003f  /* Processor revision */
1418c2ecf20Sopenharmony_ci#define SPR_VR_UVRP	0x00000040  /* Updated Version Registers Present */
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define SPR_VR_VER_OFF	24
1448c2ecf20Sopenharmony_ci#define SPR_VR_CFG_OFF	16
1458c2ecf20Sopenharmony_ci#define SPR_VR_REV_OFF	0
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/*
1488c2ecf20Sopenharmony_ci * Bit definitions for the Version Register 2
1498c2ecf20Sopenharmony_ci */
1508c2ecf20Sopenharmony_ci#define SPR_VR2_CPUID	0xff000000  /* Processor ID */
1518c2ecf20Sopenharmony_ci#define SPR_VR2_VER	0x00ffffff  /* Processor version */
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/*
1548c2ecf20Sopenharmony_ci * Bit definitions for the Unit Present Register
1558c2ecf20Sopenharmony_ci *
1568c2ecf20Sopenharmony_ci */
1578c2ecf20Sopenharmony_ci#define SPR_UPR_UP	   0x00000001  /* UPR present */
1588c2ecf20Sopenharmony_ci#define SPR_UPR_DCP	   0x00000002  /* Data cache present */
1598c2ecf20Sopenharmony_ci#define SPR_UPR_ICP	   0x00000004  /* Instruction cache present */
1608c2ecf20Sopenharmony_ci#define SPR_UPR_DMP	   0x00000008  /* Data MMU present */
1618c2ecf20Sopenharmony_ci#define SPR_UPR_IMP	   0x00000010  /* Instruction MMU present */
1628c2ecf20Sopenharmony_ci#define SPR_UPR_MP	   0x00000020  /* MAC present */
1638c2ecf20Sopenharmony_ci#define SPR_UPR_DUP	   0x00000040  /* Debug unit present */
1648c2ecf20Sopenharmony_ci#define SPR_UPR_PCUP	   0x00000080  /* Performance counters unit present */
1658c2ecf20Sopenharmony_ci#define SPR_UPR_PICP	   0x00000100  /* PIC present */
1668c2ecf20Sopenharmony_ci#define SPR_UPR_PMP	   0x00000200  /* Power management present */
1678c2ecf20Sopenharmony_ci#define SPR_UPR_TTP	   0x00000400  /* Tick timer present */
1688c2ecf20Sopenharmony_ci#define SPR_UPR_RES	   0x00fe0000  /* Reserved */
1698c2ecf20Sopenharmony_ci#define SPR_UPR_CUP	   0xff000000  /* Context units present */
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/*
1728c2ecf20Sopenharmony_ci * JPB: Bit definitions for the CPU configuration register
1738c2ecf20Sopenharmony_ci *
1748c2ecf20Sopenharmony_ci */
1758c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_NSGF   0x0000000f  /* Number of shadow GPR files */
1768c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_CGF	   0x00000010  /* Custom GPR file */
1778c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_OB32S  0x00000020  /* ORBIS32 supported */
1788c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_OB64S  0x00000040  /* ORBIS64 supported */
1798c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_OF32S  0x00000080  /* ORFPX32 supported */
1808c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_OF64S  0x00000100  /* ORFPX64 supported */
1818c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_OV64S  0x00000200  /* ORVDX64 supported */
1828c2ecf20Sopenharmony_ci#define SPR_CPUCFGR_RES	   0xfffffc00  /* Reserved */
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci/*
1858c2ecf20Sopenharmony_ci * JPB: Bit definitions for the Debug configuration register and other
1868c2ecf20Sopenharmony_ci * constants.
1878c2ecf20Sopenharmony_ci *
1888c2ecf20Sopenharmony_ci */
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP      0x00000007  /* Number of matchpoints mask */
1918c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP1     0x00000000  /* One matchpoint supported */
1928c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP2     0x00000001  /* Two matchpoints supported */
1938c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP3     0x00000002  /* Three matchpoints supported */
1948c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP4     0x00000003  /* Four matchpoints supported */
1958c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP5     0x00000004  /* Five matchpoints supported */
1968c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP6     0x00000005  /* Six matchpoints supported */
1978c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP7     0x00000006  /* Seven matchpoints supported */
1988c2ecf20Sopenharmony_ci#define SPR_DCFGR_NDP8     0x00000007  /* Eight matchpoints supported */
1998c2ecf20Sopenharmony_ci#define SPR_DCFGR_WPCI     0x00000008  /* Watchpoint counters implemented */
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci#define MATCHPOINTS_TO_NDP(n) (1 == n ? SPR_DCFGR_NDP1 : \
2028c2ecf20Sopenharmony_ci                               2 == n ? SPR_DCFGR_NDP2 : \
2038c2ecf20Sopenharmony_ci                               3 == n ? SPR_DCFGR_NDP3 : \
2048c2ecf20Sopenharmony_ci                               4 == n ? SPR_DCFGR_NDP4 : \
2058c2ecf20Sopenharmony_ci                               5 == n ? SPR_DCFGR_NDP5 : \
2068c2ecf20Sopenharmony_ci                               6 == n ? SPR_DCFGR_NDP6 : \
2078c2ecf20Sopenharmony_ci                               7 == n ? SPR_DCFGR_NDP7 : SPR_DCFGR_NDP8)
2088c2ecf20Sopenharmony_ci#define MAX_MATCHPOINTS  8
2098c2ecf20Sopenharmony_ci#define MAX_WATCHPOINTS  (MAX_MATCHPOINTS + 2)
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci/*
2128c2ecf20Sopenharmony_ci * Bit definitions for the Supervision Register
2138c2ecf20Sopenharmony_ci *
2148c2ecf20Sopenharmony_ci */
2158c2ecf20Sopenharmony_ci#define SPR_SR_SM          0x00000001  /* Supervisor Mode */
2168c2ecf20Sopenharmony_ci#define SPR_SR_TEE         0x00000002  /* Tick timer Exception Enable */
2178c2ecf20Sopenharmony_ci#define SPR_SR_IEE         0x00000004  /* Interrupt Exception Enable */
2188c2ecf20Sopenharmony_ci#define SPR_SR_DCE         0x00000008  /* Data Cache Enable */
2198c2ecf20Sopenharmony_ci#define SPR_SR_ICE         0x00000010  /* Instruction Cache Enable */
2208c2ecf20Sopenharmony_ci#define SPR_SR_DME         0x00000020  /* Data MMU Enable */
2218c2ecf20Sopenharmony_ci#define SPR_SR_IME         0x00000040  /* Instruction MMU Enable */
2228c2ecf20Sopenharmony_ci#define SPR_SR_LEE         0x00000080  /* Little Endian Enable */
2238c2ecf20Sopenharmony_ci#define SPR_SR_CE          0x00000100  /* CID Enable */
2248c2ecf20Sopenharmony_ci#define SPR_SR_F           0x00000200  /* Condition Flag */
2258c2ecf20Sopenharmony_ci#define SPR_SR_CY          0x00000400  /* Carry flag */
2268c2ecf20Sopenharmony_ci#define SPR_SR_OV          0x00000800  /* Overflow flag */
2278c2ecf20Sopenharmony_ci#define SPR_SR_OVE         0x00001000  /* Overflow flag Exception */
2288c2ecf20Sopenharmony_ci#define SPR_SR_DSX         0x00002000  /* Delay Slot Exception */
2298c2ecf20Sopenharmony_ci#define SPR_SR_EPH         0x00004000  /* Exception Prefix High */
2308c2ecf20Sopenharmony_ci#define SPR_SR_FO          0x00008000  /* Fixed one */
2318c2ecf20Sopenharmony_ci#define SPR_SR_SUMRA       0x00010000  /* Supervisor SPR read access */
2328c2ecf20Sopenharmony_ci#define SPR_SR_RES         0x0ffe0000  /* Reserved */
2338c2ecf20Sopenharmony_ci#define SPR_SR_CID         0xf0000000  /* Context ID */
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ci/*
2368c2ecf20Sopenharmony_ci * Bit definitions for the Data MMU Control Register
2378c2ecf20Sopenharmony_ci *
2388c2ecf20Sopenharmony_ci */
2398c2ecf20Sopenharmony_ci#define SPR_DMMUCR_P2S	   0x0000003e  /* Level 2 Page Size */
2408c2ecf20Sopenharmony_ci#define SPR_DMMUCR_P1S	   0x000007c0  /* Level 1 Page Size */
2418c2ecf20Sopenharmony_ci#define SPR_DMMUCR_VADDR_WIDTH	0x0000f800  /* Virtual ADDR Width */
2428c2ecf20Sopenharmony_ci#define SPR_DMMUCR_PADDR_WIDTH	0x000f0000  /* Physical ADDR Width */
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/*
2458c2ecf20Sopenharmony_ci * Bit definitions for the Instruction MMU Control Register
2468c2ecf20Sopenharmony_ci *
2478c2ecf20Sopenharmony_ci */
2488c2ecf20Sopenharmony_ci#define SPR_IMMUCR_P2S	   0x0000003e  /* Level 2 Page Size */
2498c2ecf20Sopenharmony_ci#define SPR_IMMUCR_P1S	   0x000007c0  /* Level 1 Page Size */
2508c2ecf20Sopenharmony_ci#define SPR_IMMUCR_VADDR_WIDTH	0x0000f800  /* Virtual ADDR Width */
2518c2ecf20Sopenharmony_ci#define SPR_IMMUCR_PADDR_WIDTH	0x000f0000  /* Physical ADDR Width */
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci/*
2548c2ecf20Sopenharmony_ci * Bit definitions for the Data TLB Match Register
2558c2ecf20Sopenharmony_ci *
2568c2ecf20Sopenharmony_ci */
2578c2ecf20Sopenharmony_ci#define SPR_DTLBMR_V	   0x00000001  /* Valid */
2588c2ecf20Sopenharmony_ci#define SPR_DTLBMR_PL1	   0x00000002  /* Page Level 1 (if 0 then PL2) */
2598c2ecf20Sopenharmony_ci#define SPR_DTLBMR_CID	   0x0000003c  /* Context ID */
2608c2ecf20Sopenharmony_ci#define SPR_DTLBMR_LRU	   0x000000c0  /* Least Recently Used */
2618c2ecf20Sopenharmony_ci#define SPR_DTLBMR_VPN	   0xfffff000  /* Virtual Page Number */
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/*
2648c2ecf20Sopenharmony_ci * Bit definitions for the Data TLB Translate Register
2658c2ecf20Sopenharmony_ci *
2668c2ecf20Sopenharmony_ci */
2678c2ecf20Sopenharmony_ci#define SPR_DTLBTR_CC	   0x00000001  /* Cache Coherency */
2688c2ecf20Sopenharmony_ci#define SPR_DTLBTR_CI	   0x00000002  /* Cache Inhibit */
2698c2ecf20Sopenharmony_ci#define SPR_DTLBTR_WBC	   0x00000004  /* Write-Back Cache */
2708c2ecf20Sopenharmony_ci#define SPR_DTLBTR_WOM	   0x00000008  /* Weakly-Ordered Memory */
2718c2ecf20Sopenharmony_ci#define SPR_DTLBTR_A	   0x00000010  /* Accessed */
2728c2ecf20Sopenharmony_ci#define SPR_DTLBTR_D	   0x00000020  /* Dirty */
2738c2ecf20Sopenharmony_ci#define SPR_DTLBTR_URE	   0x00000040  /* User Read Enable */
2748c2ecf20Sopenharmony_ci#define SPR_DTLBTR_UWE	   0x00000080  /* User Write Enable */
2758c2ecf20Sopenharmony_ci#define SPR_DTLBTR_SRE	   0x00000100  /* Supervisor Read Enable */
2768c2ecf20Sopenharmony_ci#define SPR_DTLBTR_SWE	   0x00000200  /* Supervisor Write Enable */
2778c2ecf20Sopenharmony_ci#define SPR_DTLBTR_PPN	   0xfffff000  /* Physical Page Number */
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci/*
2808c2ecf20Sopenharmony_ci * Bit definitions for the Instruction TLB Match Register
2818c2ecf20Sopenharmony_ci *
2828c2ecf20Sopenharmony_ci */
2838c2ecf20Sopenharmony_ci#define SPR_ITLBMR_V	   0x00000001  /* Valid */
2848c2ecf20Sopenharmony_ci#define SPR_ITLBMR_PL1	   0x00000002  /* Page Level 1 (if 0 then PL2) */
2858c2ecf20Sopenharmony_ci#define SPR_ITLBMR_CID	   0x0000003c  /* Context ID */
2868c2ecf20Sopenharmony_ci#define SPR_ITLBMR_LRU	   0x000000c0  /* Least Recently Used */
2878c2ecf20Sopenharmony_ci#define SPR_ITLBMR_VPN	   0xfffff000  /* Virtual Page Number */
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci/*
2908c2ecf20Sopenharmony_ci * Bit definitions for the Instruction TLB Translate Register
2918c2ecf20Sopenharmony_ci *
2928c2ecf20Sopenharmony_ci */
2938c2ecf20Sopenharmony_ci#define SPR_ITLBTR_CC	   0x00000001  /* Cache Coherency */
2948c2ecf20Sopenharmony_ci#define SPR_ITLBTR_CI	   0x00000002  /* Cache Inhibit */
2958c2ecf20Sopenharmony_ci#define SPR_ITLBTR_WBC	   0x00000004  /* Write-Back Cache */
2968c2ecf20Sopenharmony_ci#define SPR_ITLBTR_WOM	   0x00000008  /* Weakly-Ordered Memory */
2978c2ecf20Sopenharmony_ci#define SPR_ITLBTR_A	   0x00000010  /* Accessed */
2988c2ecf20Sopenharmony_ci#define SPR_ITLBTR_D	   0x00000020  /* Dirty */
2998c2ecf20Sopenharmony_ci#define SPR_ITLBTR_SXE	   0x00000040  /* User Read Enable */
3008c2ecf20Sopenharmony_ci#define SPR_ITLBTR_UXE	   0x00000080  /* User Write Enable */
3018c2ecf20Sopenharmony_ci#define SPR_ITLBTR_PPN	   0xfffff000  /* Physical Page Number */
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci/*
3048c2ecf20Sopenharmony_ci * Bit definitions for Data Cache Control register
3058c2ecf20Sopenharmony_ci *
3068c2ecf20Sopenharmony_ci */
3078c2ecf20Sopenharmony_ci#define SPR_DCCR_EW	   0x000000ff  /* Enable ways */
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/*
3108c2ecf20Sopenharmony_ci * Bit definitions for Insn Cache Control register
3118c2ecf20Sopenharmony_ci *
3128c2ecf20Sopenharmony_ci */
3138c2ecf20Sopenharmony_ci#define SPR_ICCR_EW	   0x000000ff  /* Enable ways */
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci/*
3168c2ecf20Sopenharmony_ci * Bit definitions for Data Cache Configuration Register
3178c2ecf20Sopenharmony_ci *
3188c2ecf20Sopenharmony_ci */
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci#define SPR_DCCFGR_NCW		0x00000007
3218c2ecf20Sopenharmony_ci#define SPR_DCCFGR_NCS		0x00000078
3228c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CBS		0x00000080
3238c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CWS		0x00000100
3248c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CCRI		0x00000200
3258c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CBIRI	0x00000400
3268c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CBPRI	0x00000800
3278c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CBLRI	0x00001000
3288c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CBFRI	0x00002000
3298c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CBWBRI	0x00004000
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci#define SPR_DCCFGR_NCW_OFF      0
3328c2ecf20Sopenharmony_ci#define SPR_DCCFGR_NCS_OFF      3
3338c2ecf20Sopenharmony_ci#define SPR_DCCFGR_CBS_OFF	7
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/*
3368c2ecf20Sopenharmony_ci * Bit definitions for Instruction Cache Configuration Register
3378c2ecf20Sopenharmony_ci *
3388c2ecf20Sopenharmony_ci */
3398c2ecf20Sopenharmony_ci#define SPR_ICCFGR_NCW		0x00000007
3408c2ecf20Sopenharmony_ci#define SPR_ICCFGR_NCS		0x00000078
3418c2ecf20Sopenharmony_ci#define SPR_ICCFGR_CBS		0x00000080
3428c2ecf20Sopenharmony_ci#define SPR_ICCFGR_CCRI		0x00000200
3438c2ecf20Sopenharmony_ci#define SPR_ICCFGR_CBIRI	0x00000400
3448c2ecf20Sopenharmony_ci#define SPR_ICCFGR_CBPRI	0x00000800
3458c2ecf20Sopenharmony_ci#define SPR_ICCFGR_CBLRI	0x00001000
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci#define SPR_ICCFGR_NCW_OFF      0
3488c2ecf20Sopenharmony_ci#define SPR_ICCFGR_NCS_OFF      3
3498c2ecf20Sopenharmony_ci#define SPR_ICCFGR_CBS_OFF	7
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci/*
3528c2ecf20Sopenharmony_ci * Bit definitions for Data MMU Configuration Register
3538c2ecf20Sopenharmony_ci *
3548c2ecf20Sopenharmony_ci */
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_NTW	0x00000003
3578c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_NTS	0x0000001C
3588c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_NAE	0x000000E0
3598c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_CRI	0x00000100
3608c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_PRI        0x00000200
3618c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_TEIRI	0x00000400
3628c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_HTR	0x00000800
3638c2ecf20Sopenharmony_ci
3648c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_NTW_OFF	0
3658c2ecf20Sopenharmony_ci#define SPR_DMMUCFGR_NTS_OFF	2
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci/*
3688c2ecf20Sopenharmony_ci * Bit definitions for Instruction MMU Configuration Register
3698c2ecf20Sopenharmony_ci *
3708c2ecf20Sopenharmony_ci */
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_NTW	0x00000003
3738c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_NTS	0x0000001C
3748c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_NAE	0x000000E0
3758c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_CRI	0x00000100
3768c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_PRI	0x00000200
3778c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_TEIRI	0x00000400
3788c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_HTR	0x00000800
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_NTW_OFF	0
3818c2ecf20Sopenharmony_ci#define SPR_IMMUCFGR_NTS_OFF	2
3828c2ecf20Sopenharmony_ci
3838c2ecf20Sopenharmony_ci/*
3848c2ecf20Sopenharmony_ci * Bit definitions for Debug Control registers
3858c2ecf20Sopenharmony_ci *
3868c2ecf20Sopenharmony_ci */
3878c2ecf20Sopenharmony_ci#define SPR_DCR_DP	0x00000001  /* DVR/DCR present */
3888c2ecf20Sopenharmony_ci#define SPR_DCR_CC	0x0000000e  /* Compare condition */
3898c2ecf20Sopenharmony_ci#define SPR_DCR_SC	0x00000010  /* Signed compare */
3908c2ecf20Sopenharmony_ci#define SPR_DCR_CT	0x000000e0  /* Compare to */
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci/* Bit results with SPR_DCR_CC mask */
3938c2ecf20Sopenharmony_ci#define SPR_DCR_CC_MASKED 0x00000000
3948c2ecf20Sopenharmony_ci#define SPR_DCR_CC_EQUAL  0x00000002
3958c2ecf20Sopenharmony_ci#define SPR_DCR_CC_LESS   0x00000004
3968c2ecf20Sopenharmony_ci#define SPR_DCR_CC_LESSE  0x00000006
3978c2ecf20Sopenharmony_ci#define SPR_DCR_CC_GREAT  0x00000008
3988c2ecf20Sopenharmony_ci#define SPR_DCR_CC_GREATE 0x0000000a
3998c2ecf20Sopenharmony_ci#define SPR_DCR_CC_NEQUAL 0x0000000c
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci/* Bit results with SPR_DCR_CT mask */
4028c2ecf20Sopenharmony_ci#define SPR_DCR_CT_DISABLED 0x00000000
4038c2ecf20Sopenharmony_ci#define SPR_DCR_CT_IFEA     0x00000020
4048c2ecf20Sopenharmony_ci#define SPR_DCR_CT_LEA      0x00000040
4058c2ecf20Sopenharmony_ci#define SPR_DCR_CT_SEA      0x00000060
4068c2ecf20Sopenharmony_ci#define SPR_DCR_CT_LD       0x00000080
4078c2ecf20Sopenharmony_ci#define SPR_DCR_CT_SD       0x000000a0
4088c2ecf20Sopenharmony_ci#define SPR_DCR_CT_LSEA     0x000000c0
4098c2ecf20Sopenharmony_ci#define SPR_DCR_CT_LSD	    0x000000e0
4108c2ecf20Sopenharmony_ci/* SPR_DCR_CT_LSD doesn't seem to be implemented anywhere in or1ksim. 2004-1-30 HP */
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci/*
4138c2ecf20Sopenharmony_ci * Bit definitions for Debug Mode 1 register
4148c2ecf20Sopenharmony_ci *
4158c2ecf20Sopenharmony_ci */
4168c2ecf20Sopenharmony_ci#define SPR_DMR1_CW       0x000fffff  /* Chain register pair data */
4178c2ecf20Sopenharmony_ci#define SPR_DMR1_CW0_AND  0x00000001
4188c2ecf20Sopenharmony_ci#define SPR_DMR1_CW0_OR   0x00000002
4198c2ecf20Sopenharmony_ci#define SPR_DMR1_CW0      (SPR_DMR1_CW0_AND | SPR_DMR1_CW0_OR)
4208c2ecf20Sopenharmony_ci#define SPR_DMR1_CW1_AND  0x00000004
4218c2ecf20Sopenharmony_ci#define SPR_DMR1_CW1_OR   0x00000008
4228c2ecf20Sopenharmony_ci#define SPR_DMR1_CW1      (SPR_DMR1_CW1_AND | SPR_DMR1_CW1_OR)
4238c2ecf20Sopenharmony_ci#define SPR_DMR1_CW2_AND  0x00000010
4248c2ecf20Sopenharmony_ci#define SPR_DMR1_CW2_OR   0x00000020
4258c2ecf20Sopenharmony_ci#define SPR_DMR1_CW2      (SPR_DMR1_CW2_AND | SPR_DMR1_CW2_OR)
4268c2ecf20Sopenharmony_ci#define SPR_DMR1_CW3_AND  0x00000040
4278c2ecf20Sopenharmony_ci#define SPR_DMR1_CW3_OR   0x00000080
4288c2ecf20Sopenharmony_ci#define SPR_DMR1_CW3      (SPR_DMR1_CW3_AND | SPR_DMR1_CW3_OR)
4298c2ecf20Sopenharmony_ci#define SPR_DMR1_CW4_AND  0x00000100
4308c2ecf20Sopenharmony_ci#define SPR_DMR1_CW4_OR   0x00000200
4318c2ecf20Sopenharmony_ci#define SPR_DMR1_CW4      (SPR_DMR1_CW4_AND | SPR_DMR1_CW4_OR)
4328c2ecf20Sopenharmony_ci#define SPR_DMR1_CW5_AND  0x00000400
4338c2ecf20Sopenharmony_ci#define SPR_DMR1_CW5_OR   0x00000800
4348c2ecf20Sopenharmony_ci#define SPR_DMR1_CW5      (SPR_DMR1_CW5_AND | SPR_DMR1_CW5_OR)
4358c2ecf20Sopenharmony_ci#define SPR_DMR1_CW6_AND  0x00001000
4368c2ecf20Sopenharmony_ci#define SPR_DMR1_CW6_OR   0x00002000
4378c2ecf20Sopenharmony_ci#define SPR_DMR1_CW6      (SPR_DMR1_CW6_AND | SPR_DMR1_CW6_OR)
4388c2ecf20Sopenharmony_ci#define SPR_DMR1_CW7_AND  0x00004000
4398c2ecf20Sopenharmony_ci#define SPR_DMR1_CW7_OR   0x00008000
4408c2ecf20Sopenharmony_ci#define SPR_DMR1_CW7      (SPR_DMR1_CW7_AND | SPR_DMR1_CW7_OR)
4418c2ecf20Sopenharmony_ci#define SPR_DMR1_CW8_AND  0x00010000
4428c2ecf20Sopenharmony_ci#define SPR_DMR1_CW8_OR   0x00020000
4438c2ecf20Sopenharmony_ci#define SPR_DMR1_CW8      (SPR_DMR1_CW8_AND | SPR_DMR1_CW8_OR)
4448c2ecf20Sopenharmony_ci#define SPR_DMR1_CW9_AND  0x00040000
4458c2ecf20Sopenharmony_ci#define SPR_DMR1_CW9_OR   0x00080000
4468c2ecf20Sopenharmony_ci#define SPR_DMR1_CW9      (SPR_DMR1_CW9_AND | SPR_DMR1_CW9_OR)
4478c2ecf20Sopenharmony_ci#define SPR_DMR1_RES1      0x00300000  /* Reserved */
4488c2ecf20Sopenharmony_ci#define SPR_DMR1_ST	  0x00400000  /* Single-step trace*/
4498c2ecf20Sopenharmony_ci#define SPR_DMR1_BT	  0x00800000  /* Branch trace */
4508c2ecf20Sopenharmony_ci#define SPR_DMR1_RES2	  0xff000000  /* Reserved */
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci/*
4538c2ecf20Sopenharmony_ci * Bit definitions for Debug Mode 2 register. AWTC and WGB corrected by JPB
4548c2ecf20Sopenharmony_ci *
4558c2ecf20Sopenharmony_ci */
4568c2ecf20Sopenharmony_ci#define SPR_DMR2_WCE0	   0x00000001  /* Watchpoint counter 0 enable */
4578c2ecf20Sopenharmony_ci#define SPR_DMR2_WCE1	   0x00000002  /* Watchpoint counter 0 enable */
4588c2ecf20Sopenharmony_ci#define SPR_DMR2_AWTC	   0x00000ffc  /* Assign watchpoints to counters */
4598c2ecf20Sopenharmony_ci#define SPR_DMR2_AWTC_OFF           2  /* Bit offset to AWTC field */
4608c2ecf20Sopenharmony_ci#define SPR_DMR2_WGB	   0x003ff000  /* Watchpoints generating breakpoint */
4618c2ecf20Sopenharmony_ci#define SPR_DMR2_WGB_OFF           12  /* Bit offset to WGB field */
4628c2ecf20Sopenharmony_ci#define SPR_DMR2_WBS	   0xffc00000  /* JPB: Watchpoint status */
4638c2ecf20Sopenharmony_ci#define SPR_DMR2_WBS_OFF           22  /* Bit offset to WBS field */
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/*
4668c2ecf20Sopenharmony_ci * Bit definitions for Debug watchpoint counter registers
4678c2ecf20Sopenharmony_ci *
4688c2ecf20Sopenharmony_ci */
4698c2ecf20Sopenharmony_ci#define SPR_DWCR_COUNT	    0x0000ffff  /* Count */
4708c2ecf20Sopenharmony_ci#define SPR_DWCR_MATCH	    0xffff0000  /* Match */
4718c2ecf20Sopenharmony_ci#define SPR_DWCR_MATCH_OFF          16  /* Match bit offset */
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci/*
4748c2ecf20Sopenharmony_ci * Bit definitions for Debug stop register
4758c2ecf20Sopenharmony_ci *
4768c2ecf20Sopenharmony_ci */
4778c2ecf20Sopenharmony_ci#define SPR_DSR_RSTE	0x00000001  /* Reset exception */
4788c2ecf20Sopenharmony_ci#define SPR_DSR_BUSEE	0x00000002  /* Bus error exception */
4798c2ecf20Sopenharmony_ci#define SPR_DSR_DPFE	0x00000004  /* Data Page Fault exception */
4808c2ecf20Sopenharmony_ci#define SPR_DSR_IPFE	0x00000008  /* Insn Page Fault exception */
4818c2ecf20Sopenharmony_ci#define SPR_DSR_TTE	0x00000010  /* Tick Timer exception */
4828c2ecf20Sopenharmony_ci#define SPR_DSR_AE	0x00000020  /* Alignment exception */
4838c2ecf20Sopenharmony_ci#define SPR_DSR_IIE	0x00000040  /* Illegal Instruction exception */
4848c2ecf20Sopenharmony_ci#define SPR_DSR_IE	0x00000080  /* Interrupt exception */
4858c2ecf20Sopenharmony_ci#define SPR_DSR_DME	0x00000100  /* DTLB miss exception */
4868c2ecf20Sopenharmony_ci#define SPR_DSR_IME	0x00000200  /* ITLB miss exception */
4878c2ecf20Sopenharmony_ci#define SPR_DSR_RE	0x00000400  /* Range exception */
4888c2ecf20Sopenharmony_ci#define SPR_DSR_SCE	0x00000800  /* System call exception */
4898c2ecf20Sopenharmony_ci#define SPR_DSR_FPE     0x00001000  /* Floating Point Exception */
4908c2ecf20Sopenharmony_ci#define SPR_DSR_TE	0x00002000  /* Trap exception */
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci/*
4938c2ecf20Sopenharmony_ci * Bit definitions for Debug reason register
4948c2ecf20Sopenharmony_ci *
4958c2ecf20Sopenharmony_ci */
4968c2ecf20Sopenharmony_ci#define SPR_DRR_RSTE	0x00000001  /* Reset exception */
4978c2ecf20Sopenharmony_ci#define SPR_DRR_BUSEE	0x00000002  /* Bus error exception */
4988c2ecf20Sopenharmony_ci#define SPR_DRR_DPFE	0x00000004  /* Data Page Fault exception */
4998c2ecf20Sopenharmony_ci#define SPR_DRR_IPFE	0x00000008  /* Insn Page Fault exception */
5008c2ecf20Sopenharmony_ci#define SPR_DRR_TTE	0x00000010  /* Tick Timer exception */
5018c2ecf20Sopenharmony_ci#define SPR_DRR_AE	0x00000020  /* Alignment exception */
5028c2ecf20Sopenharmony_ci#define SPR_DRR_IIE	0x00000040  /* Illegal Instruction exception */
5038c2ecf20Sopenharmony_ci#define SPR_DRR_IE	0x00000080  /* Interrupt exception */
5048c2ecf20Sopenharmony_ci#define SPR_DRR_DME	0x00000100  /* DTLB miss exception */
5058c2ecf20Sopenharmony_ci#define SPR_DRR_IME	0x00000200  /* ITLB miss exception */
5068c2ecf20Sopenharmony_ci#define SPR_DRR_RE	0x00000400  /* Range exception */
5078c2ecf20Sopenharmony_ci#define SPR_DRR_SCE	0x00000800  /* System call exception */
5088c2ecf20Sopenharmony_ci#define SPR_DRR_FPE     0x00001000  /* Floating Point Exception */
5098c2ecf20Sopenharmony_ci#define SPR_DRR_TE	0x00002000  /* Trap exception */
5108c2ecf20Sopenharmony_ci
5118c2ecf20Sopenharmony_ci/*
5128c2ecf20Sopenharmony_ci * Bit definitions for Performance counters mode registers
5138c2ecf20Sopenharmony_ci *
5148c2ecf20Sopenharmony_ci */
5158c2ecf20Sopenharmony_ci#define SPR_PCMR_CP	0x00000001  /* Counter present */
5168c2ecf20Sopenharmony_ci#define SPR_PCMR_UMRA	0x00000002  /* User mode read access */
5178c2ecf20Sopenharmony_ci#define SPR_PCMR_CISM	0x00000004  /* Count in supervisor mode */
5188c2ecf20Sopenharmony_ci#define SPR_PCMR_CIUM	0x00000008  /* Count in user mode */
5198c2ecf20Sopenharmony_ci#define SPR_PCMR_LA	0x00000010  /* Load access event */
5208c2ecf20Sopenharmony_ci#define SPR_PCMR_SA	0x00000020  /* Store access event */
5218c2ecf20Sopenharmony_ci#define SPR_PCMR_IF	0x00000040  /* Instruction fetch event*/
5228c2ecf20Sopenharmony_ci#define SPR_PCMR_DCM	0x00000080  /* Data cache miss event */
5238c2ecf20Sopenharmony_ci#define SPR_PCMR_ICM	0x00000100  /* Insn cache miss event */
5248c2ecf20Sopenharmony_ci#define SPR_PCMR_IFS	0x00000200  /* Insn fetch stall event */
5258c2ecf20Sopenharmony_ci#define SPR_PCMR_LSUS	0x00000400  /* LSU stall event */
5268c2ecf20Sopenharmony_ci#define SPR_PCMR_BS	0x00000800  /* Branch stall event */
5278c2ecf20Sopenharmony_ci#define SPR_PCMR_DTLBM	0x00001000  /* DTLB miss event */
5288c2ecf20Sopenharmony_ci#define SPR_PCMR_ITLBM	0x00002000  /* ITLB miss event */
5298c2ecf20Sopenharmony_ci#define SPR_PCMR_DDS	0x00004000  /* Data dependency stall event */
5308c2ecf20Sopenharmony_ci#define SPR_PCMR_WPE	0x03ff8000  /* Watchpoint events */
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci/*
5338c2ecf20Sopenharmony_ci * Bit definitions for the Power management register
5348c2ecf20Sopenharmony_ci *
5358c2ecf20Sopenharmony_ci */
5368c2ecf20Sopenharmony_ci#define SPR_PMR_SDF	0x0000000f  /* Slow down factor */
5378c2ecf20Sopenharmony_ci#define SPR_PMR_DME	0x00000010  /* Doze mode enable */
5388c2ecf20Sopenharmony_ci#define SPR_PMR_SME	0x00000020  /* Sleep mode enable */
5398c2ecf20Sopenharmony_ci#define SPR_PMR_DCGE	0x00000040  /* Dynamic clock gating enable */
5408c2ecf20Sopenharmony_ci#define SPR_PMR_SUME	0x00000080  /* Suspend mode enable */
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_ci/*
5438c2ecf20Sopenharmony_ci * Bit definitions for PICMR
5448c2ecf20Sopenharmony_ci *
5458c2ecf20Sopenharmony_ci */
5468c2ecf20Sopenharmony_ci#define SPR_PICMR_IUM	0xfffffffc  /* Interrupt unmask */
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci/*
5498c2ecf20Sopenharmony_ci * Bit definitions for PICPR
5508c2ecf20Sopenharmony_ci *
5518c2ecf20Sopenharmony_ci */
5528c2ecf20Sopenharmony_ci#define SPR_PICPR_IPRIO	0xfffffffc  /* Interrupt priority */
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_ci/*
5558c2ecf20Sopenharmony_ci * Bit definitions for PICSR
5568c2ecf20Sopenharmony_ci *
5578c2ecf20Sopenharmony_ci */
5588c2ecf20Sopenharmony_ci#define SPR_PICSR_IS	0xffffffff  /* Interrupt status */
5598c2ecf20Sopenharmony_ci
5608c2ecf20Sopenharmony_ci/*
5618c2ecf20Sopenharmony_ci * Bit definitions for Tick Timer Control Register
5628c2ecf20Sopenharmony_ci *
5638c2ecf20Sopenharmony_ci */
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_ci#define SPR_TTCR_CNT	0xffffffff  /* Count, time period */
5668c2ecf20Sopenharmony_ci#define SPR_TTMR_TP	0x0fffffff  /* Time period */
5678c2ecf20Sopenharmony_ci#define SPR_TTMR_IP	0x10000000  /* Interrupt Pending */
5688c2ecf20Sopenharmony_ci#define SPR_TTMR_IE	0x20000000  /* Interrupt Enable */
5698c2ecf20Sopenharmony_ci#define SPR_TTMR_DI	0x00000000  /* Disabled */
5708c2ecf20Sopenharmony_ci#define SPR_TTMR_RT	0x40000000  /* Restart tick */
5718c2ecf20Sopenharmony_ci#define SPR_TTMR_SR     0x80000000  /* Single run */
5728c2ecf20Sopenharmony_ci#define SPR_TTMR_CR     0xc0000000  /* Continuous run */
5738c2ecf20Sopenharmony_ci#define SPR_TTMR_M      0xc0000000  /* Tick mode */
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci/*
5768c2ecf20Sopenharmony_ci * Bit definitions for the FP Control Status Register
5778c2ecf20Sopenharmony_ci *
5788c2ecf20Sopenharmony_ci */
5798c2ecf20Sopenharmony_ci#define SPR_FPCSR_FPEE  0x00000001  /* Floating Point Exception Enable */
5808c2ecf20Sopenharmony_ci#define SPR_FPCSR_RM    0x00000006  /* Rounding Mode */
5818c2ecf20Sopenharmony_ci#define SPR_FPCSR_OVF   0x00000008  /* Overflow Flag */
5828c2ecf20Sopenharmony_ci#define SPR_FPCSR_UNF   0x00000010  /* Underflow Flag */
5838c2ecf20Sopenharmony_ci#define SPR_FPCSR_SNF   0x00000020  /* SNAN Flag */
5848c2ecf20Sopenharmony_ci#define SPR_FPCSR_QNF   0x00000040  /* QNAN Flag */
5858c2ecf20Sopenharmony_ci#define SPR_FPCSR_ZF    0x00000080  /* Zero Flag */
5868c2ecf20Sopenharmony_ci#define SPR_FPCSR_IXF   0x00000100  /* Inexact Flag */
5878c2ecf20Sopenharmony_ci#define SPR_FPCSR_IVF   0x00000200  /* Invalid Flag */
5888c2ecf20Sopenharmony_ci#define SPR_FPCSR_INF   0x00000400  /* Infinity Flag */
5898c2ecf20Sopenharmony_ci#define SPR_FPCSR_DZF   0x00000800  /* Divide By Zero Flag */
5908c2ecf20Sopenharmony_ci#define SPR_FPCSR_ALLF (SPR_FPCSR_OVF | SPR_FPCSR_UNF | SPR_FPCSR_SNF | \
5918c2ecf20Sopenharmony_ci			SPR_FPCSR_QNF | SPR_FPCSR_ZF | SPR_FPCSR_IXF |  \
5928c2ecf20Sopenharmony_ci			SPR_FPCSR_IVF | SPR_FPCSR_INF | SPR_FPCSR_DZF)
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci#define FPCSR_RM_RN (0<<1)
5958c2ecf20Sopenharmony_ci#define FPCSR_RM_RZ (1<<1)
5968c2ecf20Sopenharmony_ci#define FPCSR_RM_RIP (2<<1)
5978c2ecf20Sopenharmony_ci#define FPCSR_RM_RIN (3<<1)
5988c2ecf20Sopenharmony_ci
5998c2ecf20Sopenharmony_ci/*
6008c2ecf20Sopenharmony_ci * l.nop constants
6018c2ecf20Sopenharmony_ci *
6028c2ecf20Sopenharmony_ci */
6038c2ecf20Sopenharmony_ci#define NOP_NOP          0x0000      /* Normal nop instruction */
6048c2ecf20Sopenharmony_ci#define NOP_EXIT         0x0001      /* End of simulation */
6058c2ecf20Sopenharmony_ci#define NOP_REPORT       0x0002      /* Simple report */
6068c2ecf20Sopenharmony_ci/*#define NOP_PRINTF       0x0003       Simprintf instruction (obsolete)*/
6078c2ecf20Sopenharmony_ci#define NOP_PUTC         0x0004      /* JPB: Simputc instruction */
6088c2ecf20Sopenharmony_ci#define NOP_CNT_RESET    0x0005	     /* Reset statistics counters */
6098c2ecf20Sopenharmony_ci#define NOP_GET_TICKS    0x0006	     /* JPB: Get # ticks running */
6108c2ecf20Sopenharmony_ci#define NOP_GET_PS       0x0007      /* JPB: Get picosecs/cycle */
6118c2ecf20Sopenharmony_ci#define NOP_REPORT_FIRST 0x0400      /* Report with number */
6128c2ecf20Sopenharmony_ci#define NOP_REPORT_LAST  0x03ff      /* Report with number */
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_ci#endif	/* SPR_DEFS__H */
615