1 /*
2  * Copyright (c) 2021 Henrik Brix Andersen <henrik@brixandersen.dk>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef RISCV_NEORV32_SOC_H
8 #define RISCV_NEORV32_SOC_H
9 
10 /* System information (SYSINFO) register offsets */
11 #define NEORV32_SYSINFO_CLK         0x00U
12 #define NEORV32_SYSINFO_CPU         0x04U
13 #define NEORV32_SYSINFO_FEATURES    0x08U
14 #define NEORV32_SYSINFO_CACHE       0x0cU
15 #define NEORV32_SYSINFO_ISPACE_BASE 0xf0U
16 #define NEORV32_SYSINFO_IMEM_SIZE   0xf4U
17 #define NEORV32_SYSINFO_DSPACE_BASE 0xf8U
18 #define NEORV32_SYSINFO_DMEM_SIZE   0xfcU
19 
20 /* System information (SYSINFO) CPU register bits */
21 #define NEORV32_SYSINFO_CPU_ZICSR     BIT(0)
22 #define NEORV32_SYSINFO_CPU_ZIFENCEI  BIT(1)
23 #define NEORV32_SYSINFO_CPU_ZMMUL     BIT(2)
24 #define NEORV32_SYSINFO_CPU_ZBB       BIT(3)
25 #define NEORV32_SYSINFO_CPU_ZFINX     BIT(5)
26 #define NEORV32_SYSINFO_CPU_ZXSCNT    BIT(6)
27 #define NEORV32_SYSINFO_CPU_ZXNOCNT   BIT(7)
28 #define NEORV32_SYSINFO_CPU_PMP       BIT(8)
29 #define NEORV32_SYSINFO_CPU_HPM       BIT(9)
30 #define NEORV32_SYSINFO_CPU_DEBUGMODE BIT(10)
31 #define NEORV32_SYSINFO_CPU_FASTMUL   BIT(30)
32 #define NEORV32_SYSINFO_CPU_FASTSHIFT BIT(31)
33 
34 /* System information (SYSINFO) FEATURES register bits */
35 #define NEORV32_SYSINFO_FEATURES_BOOTLOADER     BIT(0)
36 #define NEORV32_SYSINFO_FEATURES_MEM_EXT        BIT(1)
37 #define NEORV32_SYSINFO_FEATURES_MEM_INT_IMEM   BIT(2)
38 #define NEORV32_SYSINFO_FEATURES_MEM_INT_DMEM   BIT(3)
39 #define NEORV32_SYSINFO_FEATURES_MEM_EXT_ENDIAN BIT(4)
40 #define NEORV32_SYSINFO_FEATURES_ICACHE         BIT(5)
41 #define NEORV32_SYSINFO_FEATURES_OCD            BIT(14)
42 #define NEORV32_SYSINFO_FEATURES_HW_RESET       BIT(15)
43 #define NEORV32_SYSINFO_FEATURES_IO_GPIO        BIT(16)
44 #define NEORV32_SYSINFO_FEATURES_IO_MTIME       BIT(17)
45 #define NEORV32_SYSINFO_FEATURES_IO_UART0       BIT(18)
46 #define NEORV32_SYSINFO_FEATURES_IO_SPI         BIT(19)
47 #define NEORV32_SYSINFO_FEATURES_IO_TWI         BIT(20)
48 #define NEORV32_SYSINFO_FEATURES_IO_PWM         BIT(21)
49 #define NEORV32_SYSINFO_FEATURES_IO_WDT         BIT(22)
50 #define NEORV32_SYSINFO_FEATURES_IO_CFS         BIT(23)
51 #define NEORV32_SYSINFO_FEATURES_IO_TRNG        BIT(24)
52 #define NEORV32_SYSINFO_FEATURES_IO_SLINK       BIT(25)
53 #define NEORV32_SYSINFO_FEATURES_IO_UART1       BIT(26)
54 #define NEORV32_SYSINFO_FEATURES_IO_NEOLED      BIT(27)
55 
56 #endif /* RISCV_NEORV32_SOC_H */
57