2021-02-04 08:25:55 +00:00
//////////////////////////////////////////
// wally-config.vh
//
// Written: David_Harris@hmc.edu 4 January 2021
2021-10-10 22:07:51 +00:00
// Modified:
2021-02-04 08:25:55 +00:00
//
// Purpose: Specify which features are configured
// Macros to determine which modes are supported based on MISA
//
// A component of the Wally configurable RISC-V project.
//
// Copyright (C) 2021 Harvey Mudd College & Oklahoma State University
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
// modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
// is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
// OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
///////////////////////////////////////////
2021-06-07 16:37:46 +00:00
// include shared configuration
`include "wally-shared.vh"
2021-12-02 23:47:46 +00:00
`define FPGA 0
2021-08-06 15:16:06 +00:00
`define QEMU 0
2021-10-11 18:54:39 +00:00
`define DESIGN_COMPILER 0
2021-04-17 18:44:32 +00:00
2021-02-04 08:25:55 +00:00
// RV32 or RV64: XLEN = 32 or 64
`define XLEN 64
2021-12-29 18:59:17 +00:00
// IEEE 754 compliance
`define IEEE754 0
2021-05-18 18:48:44 +00:00
// MISA RISC-V configuration per specification
2021-10-22 20:18:25 +00:00
`define MISA (32'h00000104 | 1 << 5 | 1 << 3 | 1 << 18 | 1 << 20 | 1 << 12 | 1 << 0 )
2021-09-15 17:14:00 +00:00
`define ZICSR_SUPPORTED 1
`define ZIFENCEI_SUPPORTED 1
2021-06-10 01:03:03 +00:00
`define COUNTERS 32
2021-09-15 17:14:00 +00:00
`define ZICOUNTERS_SUPPORTED 1
2022-04-04 17:17:12 +00:00
`define ZFH_SUPPORTED 0
2021-02-04 08:25:55 +00:00
2021-12-14 21:05:32 +00:00
/// Microarchitectural Features
2021-02-04 08:25:55 +00:00
`define UARCH_PIPELINED 1
`define UARCH_SUPERSCALR 0
`define UARCH_SINGLECYCLE 0
2022-02-03 00:41:09 +00:00
`define DMEM `MEM_CACHE
`define IMEM `MEM_CACHE
2022-03-11 21:18:56 +00:00
`define DBUS 1
`define IBUS 1
2022-02-03 01:08:34 +00:00
`define VIRTMEM_SUPPORTED 1
2021-12-14 21:05:32 +00:00
`define VECTORED_INTERRUPTS_SUPPORTED 1
2021-02-04 08:25:55 +00:00
2021-07-19 22:19:46 +00:00
// TLB configuration. Entries should be a power of 2
2021-07-04 21:52:00 +00:00
`define ITLB_ENTRIES 32
`define DTLB_ENTRIES 32
2021-06-04 15:59:14 +00:00
2021-07-19 22:19:46 +00:00
// Cache configuration. Sizes should be a power of two
2022-01-05 04:08:18 +00:00
// typical configuration 4 ways, 4096 bytes per way, 256 bit or more lines
2021-07-19 22:19:46 +00:00
`define DCACHE_NUMWAYS 4
2021-09-11 20:40:27 +00:00
`define DCACHE_WAYSIZEINBYTES 4096
2022-01-05 04:08:18 +00:00
`define DCACHE_LINELENINBITS 256
2021-09-11 20:40:27 +00:00
`define ICACHE_NUMWAYS 4
2021-07-20 12:57:13 +00:00
`define ICACHE_WAYSIZEINBYTES 4096
2022-01-05 04:08:18 +00:00
`define ICACHE_LINELENINBITS 256
2021-07-19 22:19:46 +00:00
2021-10-03 05:10:15 +00:00
// Integer Divider Configuration
// DIV_BITSPERCYCLE must be 1, 2, or 4
`define DIV_BITSPERCYCLE 4
2021-06-14 17:42:53 +00:00
// Legal number of PMP entries are 0, 16, or 64
2021-09-11 20:40:27 +00:00
`define PMP_ENTRIES 64
2021-06-14 17:42:53 +00:00
2021-02-04 08:25:55 +00:00
// Address space
2021-10-10 22:07:51 +00:00
`define RESET_VECTOR 64'h0000000080000000
2021-02-04 08:25:55 +00:00
2021-10-10 22:07:51 +00:00
// Bus Interface width
`define AHBW 64
2022-04-17 17:20:35 +00:00
// WFI Timeout Wait
`define WFI_TIMEOUT_BIT 20
2021-10-10 22:07:51 +00:00
// Peripheral Physiccal Addresses
2021-02-04 08:25:55 +00:00
// Peripheral memory space extends from BASE to BASE+RANGE
// Range should be a thermometer code with 0's in the upper bits and 1s in the lower bits
2021-10-10 22:07:51 +00:00
// *** each of these is `PA_BITS wide. is this paramaterizable INSIDE the config file?
2021-12-14 21:43:06 +00:00
`define BOOTROM_SUPPORTED 1'b1
`define BOOTROM_BASE 56'h00001000 // spec had been 0x1000 to 0x2FFF, but dh truncated to 0x1000 to 0x1FFF because upper half seems to be all zeros and this is easier for decoder
`define BOOTROM_RANGE 56'h00000FFF
`define RAM_SUPPORTED 1'b1
`define RAM_BASE 56'h80000000
`define RAM_RANGE 56'h7FFFFFFF
2021-12-02 23:47:46 +00:00
`define EXT_MEM_SUPPORTED 1'b0
`define EXT_MEM_BASE 56'h80000000
`define EXT_MEM_RANGE 56'h07FFFFFF
2021-06-18 12:05:50 +00:00
`define CLINT_SUPPORTED 1'b1
2021-07-04 05:19:38 +00:00
`define CLINT_BASE 56'h02000000
`define CLINT_RANGE 56'h0000FFFF
2021-06-18 12:05:50 +00:00
`define GPIO_SUPPORTED 1'b1
2022-01-26 18:16:34 +00:00
`define GPIO_BASE 56'h10060000
2021-07-04 05:19:38 +00:00
`define GPIO_RANGE 56'h000000FF
2021-06-18 12:05:50 +00:00
`define UART_SUPPORTED 1'b1
2021-07-04 05:19:38 +00:00
`define UART_BASE 56'h10000000
`define UART_RANGE 56'h00000007
2021-06-18 12:05:50 +00:00
`define PLIC_SUPPORTED 1'b1
2021-07-04 05:19:38 +00:00
`define PLIC_BASE 56'h0C000000
`define PLIC_RANGE 56'h03FFFFFF
2021-12-02 23:47:46 +00:00
`define SDC_SUPPORTED 1'b0
`define SDC_BASE 56'h00012100
`define SDC_RANGE 56'h0000001F
2021-02-04 08:25:55 +00:00
// Test modes
// Tie GPIO outputs back to inputs
2021-05-21 14:22:17 +00:00
`define GPIO_LOOPBACK_TEST 1
2021-02-04 08:25:55 +00:00
// Hardware configuration
`define UART_PRESCALE 1
2021-05-21 14:22:17 +00:00
// Interrupt configuration
2022-02-22 03:46:08 +00:00
`define PLIC_NUM_SRC 10
2021-05-21 14:22:17 +00:00
// comment out the following if >=32 sources
`define PLIC_NUM_SRC_LT_32
`define PLIC_GPIO_ID 3
2022-02-22 03:46:08 +00:00
`define PLIC_UART_ID 10
2021-05-21 14:22:17 +00:00
2021-10-10 22:07:51 +00:00
`define TWO_BIT_PRELOAD "../config/rv64ic/twoBitPredictor.txt"
`define BTB_PRELOAD "../config/rv64ic/BTBPredictor.txt"
2021-04-26 19:27:42 +00:00
`define BPRED_ENABLED 1
2021-04-01 17:40:08 +00:00
`define BPTYPE "BPGSHARE" // BPLOCALPAg or BPGLOBAL or BPTWOBIT or BPGSHARE
`define TESTSBP 0
2021-10-10 22:07:51 +00:00
2022-02-05 05:19:00 +00:00
`define REPLAY 0
2022-02-17 23:19:41 +00:00
`define HPTW_WRITES_SUPPORTED 0