1 |
11 |
dinesha |
/// Copyright by Syntacore LLC © 2016-2021. See LICENSE for details
|
2 |
|
|
/// @file
|
3 |
|
|
/// @brief Architecture description file
|
4 |
|
|
///
|
5 |
|
|
|
6 |
|
|
`ifndef SCR1_ARCH_DESCRIPTION_SVH
|
7 |
|
|
`define SCR1_ARCH_DESCRIPTION_SVH
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
//------------------------------------------------------------------------------
|
11 |
|
|
// CORE FUNDAMENTAL PARAMETERS
|
12 |
|
|
//------------------------------------------------------------------------------
|
13 |
|
|
|
14 |
|
|
// SCR1 core identifiers
|
15 |
|
|
`define SCR1_MIMPID 32'h21051400
|
16 |
|
|
`define SCR1_MVENDORID 32'h00000000
|
17 |
|
|
|
18 |
|
|
// Width of main registers and buses
|
19 |
|
|
`define SCR1_XLEN 32
|
20 |
|
|
`define SCR1_IMEM_AWIDTH `SCR1_XLEN
|
21 |
|
|
`define SCR1_IMEM_DWIDTH `SCR1_XLEN
|
22 |
|
|
`define SCR1_DMEM_AWIDTH `SCR1_XLEN
|
23 |
|
|
`define SCR1_DMEM_DWIDTH `SCR1_XLEN
|
24 |
|
|
|
25 |
|
|
// TAP IDCODE
|
26 |
|
|
`define SCR1_TAP_IDCODE 'hDEB11001
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
`ifdef SCR1_ARCH_CUSTOM
|
30 |
|
|
//------------------------------------------------------------------------------
|
31 |
|
|
// INCLUDE SCR1_ARCH_CUSTOM.SVH
|
32 |
|
|
//------------------------------------------------------------------------------
|
33 |
|
|
|
34 |
|
|
// The external file scr1_arch_custom.svh is used for the open SCR1-SDK project,
|
35 |
|
|
// and can also be used for any custom projects.
|
36 |
|
|
|
37 |
|
|
// The file sets:
|
38 |
|
|
// - target platform (FPGA/ASIC), which affects the choice of logical constructs;
|
39 |
|
|
// - device build ID;
|
40 |
|
|
// - address constants;
|
41 |
|
|
// - could enables configuration parameters.
|
42 |
|
|
|
43 |
|
|
// Possible targets:
|
44 |
|
|
// `define SCR1_TRGT_FPGA_INTEL // target platform is Intel FPGAs
|
45 |
|
|
// `define SCR1_TRGT_FPGA_INTEL_MAX10 // target platform is Intel MAX 10 FPGAs (used in the SCR1-SDK project)
|
46 |
|
|
// `define SCR1_TRGT_FPGA_INTEL_ARRIAV // target platform is Intel Arria V FPGAs (used in the SCR1-SDK project)
|
47 |
|
|
// `define SCR1_TRGT_FPGA_XILINX // target platform is Xilinx FPGAs (used in the SCR1-SDK project)
|
48 |
|
|
// `define SCR1_TRGT_ASIC // target platform is ASIC
|
49 |
|
|
// `define SCR1_TRGT_SIMULATION // target is simulation (enable simulation code)
|
50 |
|
|
|
51 |
|
|
`include "scr1_arch_custom.svh"
|
52 |
|
|
|
53 |
|
|
`endif // SCR1_ARCH_CUSTOM
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
//------------------------------------------------------------------------------
|
57 |
|
|
// RECOMMENDED CORE ARCHITECTURE CONFIGURATIONS
|
58 |
|
|
//------------------------------------------------------------------------------
|
59 |
|
|
|
60 |
|
|
// Uncomment one of these defines to set the recommended configuration:
|
61 |
|
|
|
62 |
|
|
`define SCR1_CFG_RV32IMC_MAX
|
63 |
|
|
//`define SCR1_CFG_RV32IC_BASE
|
64 |
|
|
//`define SCR1_CFG_RV32EC_MIN
|
65 |
|
|
|
66 |
|
|
// If all defines are commented, custom configuration will be used (see below)
|
67 |
|
|
|
68 |
|
|
//------------------------------------------------------------------------------
|
69 |
|
|
// READ-ONLY: settings for recommended configurations
|
70 |
|
|
`ifdef SCR1_CFG_RV32IMC_MAX
|
71 |
|
|
`define SCR1_RVI_EXT
|
72 |
|
|
`define SCR1_RVM_EXT
|
73 |
|
|
`define SCR1_RVC_EXT
|
74 |
|
|
parameter int unsigned SCR1_MTVEC_BASE_WR_BITS = 26;
|
75 |
|
|
`define SCR1_MTVEC_MODE_EN
|
76 |
|
|
`define SCR1_FAST_MUL
|
77 |
|
|
//`define SCR1_MPRF_RST_EN - yosys fix, two dimensional array init not allowed
|
78 |
|
|
`define SCR1_MCOUNTEN_EN
|
79 |
|
|
// `define SCR1_DBG_EN
|
80 |
|
|
`define SCR1_TDU_EN
|
81 |
|
|
parameter int unsigned SCR1_TDU_TRIG_NUM = 4;
|
82 |
|
|
`define SCR1_TDU_ICOUNT_EN
|
83 |
|
|
`define SCR1_IPIC_EN
|
84 |
|
|
`define SCR1_IPIC_SYNC_EN
|
85 |
|
|
// `define SCR1_TCM_EN
|
86 |
|
|
`elsif SCR1_CFG_RV32IC_BASE
|
87 |
|
|
`define SCR1_RVI_EXT
|
88 |
|
|
`define SCR1_RVC_EXT
|
89 |
|
|
parameter int unsigned SCR1_MTVEC_BASE_WR_BITS = 16;
|
90 |
|
|
`define SCR1_MTVEC_MODE_EN
|
91 |
|
|
`define SCR1_NO_DEC_STAGE
|
92 |
|
|
`define SCR1_MPRF_RST_EN
|
93 |
|
|
`define SCR1_MCOUNTEN_EN
|
94 |
|
|
`define SCR1_DBG_EN
|
95 |
|
|
`define SCR1_TDU_EN
|
96 |
|
|
parameter int unsigned SCR1_TDU_TRIG_NUM = 2;
|
97 |
|
|
`define SCR1_TDU_ICOUNT_EN
|
98 |
|
|
`define SCR1_IPIC_EN
|
99 |
|
|
`define SCR1_IPIC_SYNC_EN
|
100 |
|
|
`define SCR1_TCM_EN
|
101 |
|
|
`elsif SCR1_CFG_RV32EC_MIN
|
102 |
|
|
`define SCR1_RVE_EXT
|
103 |
|
|
`define SCR1_RVC_EXT
|
104 |
|
|
parameter int unsigned SCR1_MTVEC_BASE_WR_BITS = 0;
|
105 |
|
|
`define SCR1_NO_DEC_STAGE
|
106 |
|
|
`define SCR1_NO_EXE_STAGE
|
107 |
|
|
`define SCR1_TCM_EN
|
108 |
|
|
|
109 |
|
|
`else // begin custom configuration section
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
//------------------------------------------------------------------------------
|
113 |
|
|
// CUSTOM CORE ARCHITECTURE CONFIGURATION
|
114 |
|
|
//------------------------------------------------------------------------------
|
115 |
|
|
|
116 |
|
|
// To fine-tune custom configuration, you can change the values in this section.
|
117 |
|
|
// Make sure that the defines of the recommended configurations are commented,
|
118 |
|
|
// otherwise this section will be inactive.
|
119 |
|
|
|
120 |
|
|
// RISC-V ISA options
|
121 |
|
|
//`define SCR1_RVE_EXT // enable RV32E base integer instruction set, otherwise RV32I will be used
|
122 |
|
|
`define SCR1_RVM_EXT // enable standard extension "M" for integer hardware multiplier and divider
|
123 |
|
|
`define SCR1_RVC_EXT // enable standard extension "C" for compressed instructions
|
124 |
|
|
parameter int unsigned SCR1_MTVEC_BASE_WR_BITS = 26; // number of writable high-order bits in MTVEC.base field
|
125 |
|
|
// legal values are 0 to 26
|
126 |
|
|
// read-only bits are hardwired to reset value
|
127 |
|
|
`define SCR1_MTVEC_MODE_EN // enable writable MTVEC.mode field to allow vectored irq mode, otherwise only direct mode is possible
|
128 |
|
|
|
129 |
|
|
`ifndef SCR1_RVE_EXT
|
130 |
|
|
`define SCR1_RVI_EXT // RV32E base integer instruction set if SCR1_RVE_EXT is not enabled
|
131 |
|
|
`endif // ~SCR1_RVE_EXT
|
132 |
|
|
|
133 |
|
|
// Core pipeline options (power-performance-area optimization)
|
134 |
|
|
`define SCR1_NO_DEC_STAGE // disable register between IFU and IDU
|
135 |
|
|
`define SCR1_NO_EXE_STAGE // disable register between IDU and EXU
|
136 |
|
|
`define SCR1_NEW_PC_REG // enable register in IFU for New_PC value
|
137 |
|
|
`define SCR1_FAST_MUL // enable fast one-cycle multiplication, otherwise multiplication takes 32 cycles
|
138 |
|
|
`define SCR1_CLKCTRL_EN // enable global clock gating
|
139 |
|
|
`define SCR1_MPRF_RST_EN // enable reset for MPRF
|
140 |
|
|
`define SCR1_MCOUNTEN_EN // enable custom MCOUNTEN CSR for counter control
|
141 |
|
|
|
142 |
|
|
// Uncore options
|
143 |
|
|
`define SCR1_DBG_EN // enable Debug Subsystem (TAPC, DM, SCU, HDU)
|
144 |
|
|
`define SCR1_TDU_EN // enable Trigger Debug Unit (hardware breakpoints)
|
145 |
|
|
parameter int unsigned SCR1_TDU_TRIG_NUM = 2; // number of hardware triggers
|
146 |
|
|
`define SCR1_TDU_ICOUNT_EN // enable hardware triggers on instruction counter
|
147 |
|
|
`define SCR1_IPIC_EN // enable Integrated Programmable Interrupt Controller
|
148 |
|
|
`define SCR1_IPIC_SYNC_EN // enable IPIC synchronizer
|
149 |
|
|
`define SCR1_TCM_EN // enable Tightly-Coupled Memory
|
150 |
|
|
|
151 |
|
|
`endif // end custom configuration section
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
//------------------------------------------------------------------------------
|
155 |
|
|
// CORE INTEGRATION OPTIONS
|
156 |
|
|
//------------------------------------------------------------------------------
|
157 |
|
|
|
158 |
|
|
// Bypasses on AXI/AHB bridge I/O
|
159 |
|
|
`define SCR1_IMEM_AHB_IN_BP // bypass instruction memory AHB bridge input register
|
160 |
|
|
`define SCR1_IMEM_AHB_OUT_BP // bypass instruction memory AHB bridge output register
|
161 |
|
|
`define SCR1_DMEM_AHB_IN_BP // bypass data memory AHB bridge input register
|
162 |
|
|
`define SCR1_DMEM_AHB_OUT_BP // bypass data memory AHB bridge output register
|
163 |
|
|
`define SCR1_IMEM_AXI_REQ_BP // bypass instruction memory AXI bridge request register
|
164 |
|
|
`define SCR1_IMEM_AXI_RESP_BP // bypass instruction memory AXI bridge response register
|
165 |
|
|
`define SCR1_DMEM_AXI_REQ_BP // bypass data memory AXI bridge request register
|
166 |
|
|
`define SCR1_DMEM_AXI_RESP_BP // bypass data memory AXI bridge response register
|
167 |
|
|
|
168 |
|
|
`ifndef SCR1_ARCH_CUSTOM
|
169 |
|
|
// Default address constants (if scr1_arch_custom.svh is not used)
|
170 |
|
|
parameter bit [`SCR1_XLEN-1:0] SCR1_ARCH_RST_VECTOR = 'h200; // Reset vector value (start address after reset)
|
171 |
|
|
parameter bit [`SCR1_XLEN-1:0] SCR1_ARCH_MTVEC_BASE = 'h1C0; // MTVEC.base field reset value, or constant value for MTVEC.base bits that are hardwired
|
172 |
|
|
|
173 |
|
|
parameter bit [`SCR1_DMEM_AWIDTH-1:0] SCR1_TCM_ADDR_MASK = 'hFFFF0000; // TCM mask and size; size in bytes is two's complement of the mask value
|
174 |
|
|
parameter bit [`SCR1_DMEM_AWIDTH-1:0] SCR1_TCM_ADDR_PATTERN = 'h00480000; // TCM address match pattern
|
175 |
|
|
|
176 |
|
|
parameter bit [`SCR1_DMEM_AWIDTH-1:0] SCR1_TIMER_ADDR_MASK = 'hFFFFFFE0; // Timer mask
|
177 |
|
|
parameter bit [`SCR1_DMEM_AWIDTH-1:0] SCR1_TIMER_ADDR_PATTERN = 'h00490000; // Timer address match pattern
|
178 |
|
|
|
179 |
|
|
// Device build ID
|
180 |
|
|
`define SCR1_ARCH_BUILD_ID `SCR1_MIMPID
|
181 |
|
|
|
182 |
|
|
`endif // SCR1_ARCH_CUSTOM
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
//------------------------------------------------------------------------------
|
186 |
|
|
// TARGET-SPECIFIC OPTIONS
|
187 |
|
|
//------------------------------------------------------------------------------
|
188 |
|
|
|
189 |
|
|
// RAM-based MPRF can be used for Intel FPGAs only
|
190 |
|
|
`ifdef SCR1_TRGT_FPGA_INTEL
|
191 |
|
|
`define SCR1_MPRF_RAM // implements MPRF with dedicated RAM blocks
|
192 |
|
|
`endif
|
193 |
|
|
|
194 |
|
|
// EXU_STAGE_BYPASS and MPRF_RST_EN must be disabled for RAM-based MPRF
|
195 |
|
|
`ifdef SCR1_MPRF_RAM
|
196 |
|
|
`undef SCR1_NO_EXE_STAGE
|
197 |
|
|
`undef SCR1_MPRF_RST_EN
|
198 |
|
|
`endif
|
199 |
|
|
|
200 |
|
|
|
201 |
|
|
//------------------------------------------------------------------------------
|
202 |
|
|
// SIMULATION OPTIONS
|
203 |
|
|
//------------------------------------------------------------------------------
|
204 |
|
|
|
205 |
|
|
//`define SCR1_TRGT_SIMULATION // enable simulation code (automatically defined by root makefile)
|
206 |
|
|
//`define SCR1_TRACE_LOG_EN // enable tracelog
|
207 |
|
|
//`define SCR1_XPROP_EN // enable X-propagation
|
208 |
|
|
|
209 |
|
|
// Addresses used in testbench
|
210 |
|
|
localparam [`SCR1_XLEN-1:0] SCR1_SIM_EXIT_ADDR = 32'h0000_00F8;
|
211 |
|
|
localparam [`SCR1_XLEN-1:0] SCR1_SIM_PRINT_ADDR = 32'hF000_0000;
|
212 |
|
|
localparam [`SCR1_XLEN-1:0] SCR1_SIM_EXT_IRQ_ADDR = 32'hF000_0100;
|
213 |
|
|
localparam [`SCR1_XLEN-1:0] SCR1_SIM_SOFT_IRQ_ADDR = 32'hF000_0200;
|
214 |
|
|
|
215 |
|
|
`endif // SCR1_ARCH_DESCRIPTION_SVH
|