15b4beba1SMichael Clark /* 25b4beba1SMichael Clark * Spike machine interface 35b4beba1SMichael Clark * 45b4beba1SMichael Clark * Copyright (c) 2017 SiFive, Inc. 55b4beba1SMichael Clark * 65b4beba1SMichael Clark * This program is free software; you can redistribute it and/or modify it 75b4beba1SMichael Clark * under the terms and conditions of the GNU General Public License, 85b4beba1SMichael Clark * version 2 or later, as published by the Free Software Foundation. 95b4beba1SMichael Clark * 105b4beba1SMichael Clark * This program is distributed in the hope it will be useful, but WITHOUT 115b4beba1SMichael Clark * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 125b4beba1SMichael Clark * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 135b4beba1SMichael Clark * more details. 145b4beba1SMichael Clark * 155b4beba1SMichael Clark * You should have received a copy of the GNU General Public License along with 165b4beba1SMichael Clark * this program. If not, see <http://www.gnu.org/licenses/>. 175b4beba1SMichael Clark */ 185b4beba1SMichael Clark 194996b128SMichael Clark #ifndef HW_RISCV_SPIKE_H 204996b128SMichael Clark #define HW_RISCV_SPIKE_H 215b4beba1SMichael Clark 22ec150c7eSMarkus Armbruster #include "hw/riscv/riscv_hart.h" 23ec150c7eSMarkus Armbruster #include "hw/sysbus.h" 24*db1015e9SEduardo Habkost #include "qom/object.h" 25ec150c7eSMarkus Armbruster 26a7172791SAnup Patel #define SPIKE_CPUS_MAX 8 27a7172791SAnup Patel #define SPIKE_SOCKETS_MAX 8 28a7172791SAnup Patel 29a7172791SAnup Patel #define TYPE_SPIKE_MACHINE MACHINE_TYPE_NAME("spike") 30*db1015e9SEduardo Habkost typedef struct SpikeState SpikeState; 31a7172791SAnup Patel #define SPIKE_MACHINE(obj) \ 32a7172791SAnup Patel OBJECT_CHECK(SpikeState, (obj), TYPE_SPIKE_MACHINE) 33a7172791SAnup Patel 34*db1015e9SEduardo Habkost struct SpikeState { 355b4beba1SMichael Clark /*< private >*/ 36a7172791SAnup Patel MachineState parent; 375b4beba1SMichael Clark 385b4beba1SMichael Clark /*< public >*/ 39a7172791SAnup Patel RISCVHartArrayState soc[SPIKE_SOCKETS_MAX]; 405b4beba1SMichael Clark void *fdt; 415b4beba1SMichael Clark int fdt_size; 42*db1015e9SEduardo Habkost }; 435b4beba1SMichael Clark 445b4beba1SMichael Clark enum { 455b4beba1SMichael Clark SPIKE_MROM, 465b4beba1SMichael Clark SPIKE_CLINT, 475b4beba1SMichael Clark SPIKE_DRAM 485b4beba1SMichael Clark }; 495b4beba1SMichael Clark 505b4beba1SMichael Clark #if defined(TARGET_RISCV32) 5126cd0362SAlistair Francis #define SPIKE_V1_10_0_CPU TYPE_RISCV_CPU_BASE32 525b4beba1SMichael Clark #elif defined(TARGET_RISCV64) 5326cd0362SAlistair Francis #define SPIKE_V1_10_0_CPU TYPE_RISCV_CPU_BASE64 545b4beba1SMichael Clark #endif 555b4beba1SMichael Clark 565b4beba1SMichael Clark #endif 57