Line data Source code
1 : // SPDX-License-Identifier: Apache-2.0
2 : // Copyright 2020 Western Digital Corporation or its affiliates.
3 : // Copyright (c) 2023 Antmicro <www.antmicro.com>
4 : //
5 : // Licensed under the Apache License, Version 2.0 (the "License");
6 : // you may not use this file except in compliance with the License.
7 : // You may obtain a copy of the License at
8 : //
9 : // http://www.apache.org/licenses/LICENSE-2.0
10 : //
11 : // Unless required by applicable law or agreed to in writing, software
12 : // distributed under the License is distributed on an "AS IS" BASIS,
13 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : // See the License for the specific language governing permissions and
15 : // limitations under the License.
16 :
17 : //********************************************************************************
18 : // $Id$
19 : //
20 : // Function: Top wrapper file with el2_veer/mem instantiated inside
21 : // Comments:
22 : //
23 : //********************************************************************************
24 : module el2_veer_wrapper
25 : import el2_pkg::*;
26 : #(
27 : `include "el2_param.vh"
28 : )
29 : (
30 69881587 : input logic clk,
31 338 : input logic rst_l,
32 338 : input logic dbg_rst_l,
33 0 : input logic [31:1] rst_vec,
34 2 : input logic nmi_int,
35 16 : input logic [31:1] nmi_vec,
36 0 : input logic [31:1] jtag_id,
37 :
38 :
39 579463 : output logic [31:0] trace_rv_i_insn_ip,
40 339 : output logic [31:0] trace_rv_i_address_ip,
41 6172835 : output logic trace_rv_i_valid_ip,
42 5204 : output logic trace_rv_i_exception_ip,
43 4 : output logic [4:0] trace_rv_i_ecause_ip,
44 24 : output logic trace_rv_i_interrupt_ip,
45 62 : output logic [31:0] trace_rv_i_tval_ip,
46 :
47 : // Bus signals
48 : `ifdef RV_BUILD_AXI4
49 : //-------------------------- LSU AXI signals--------------------------
50 : // AXI Write Channels
51 659446 : output logic lsu_axi_awvalid,
52 669068 : input logic lsu_axi_awready,
53 0 : output logic [pt.LSU_BUS_TAG-1:0] lsu_axi_awid,
54 282 : output logic [31:0] lsu_axi_awaddr,
55 318 : output logic [3:0] lsu_axi_awregion,
56 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
57 : /*verilator coverage_off*/
58 : output logic [7:0] lsu_axi_awlen,
59 : /*verilator coverage_on*/
60 0 : output logic [2:0] lsu_axi_awsize,
61 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
62 : /*verilator coverage_off*/
63 : output logic [1:0] lsu_axi_awburst,
64 : output logic lsu_axi_awlock,
65 : /*verilator coverage_on*/
66 1773 : output logic [3:0] lsu_axi_awcache,
67 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
68 : /*verilator coverage_off*/
69 : output logic [2:0] lsu_axi_awprot,
70 : output logic [3:0] lsu_axi_awqos,
71 : /*verilator coverage_on*/
72 :
73 659446 : output logic lsu_axi_wvalid,
74 669068 : input logic lsu_axi_wready,
75 29795 : output logic [63:0] lsu_axi_wdata,
76 185761 : output logic [7:0] lsu_axi_wstrb,
77 319 : output logic lsu_axi_wlast,
78 :
79 668810 : input logic lsu_axi_bvalid,
80 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
81 : /*verilator coverage_off*/
82 : output logic lsu_axi_bready,
83 : /*verilator coverage_on*/
84 2 : input logic [1:0] lsu_axi_bresp,
85 0 : input logic [pt.LSU_BUS_TAG-1:0] lsu_axi_bid,
86 :
87 : // AXI Read Channels
88 630888 : output logic lsu_axi_arvalid,
89 673312 : input logic lsu_axi_arready,
90 0 : output logic [pt.LSU_BUS_TAG-1:0] lsu_axi_arid,
91 282 : output logic [31:0] lsu_axi_araddr,
92 318 : output logic [3:0] lsu_axi_arregion,
93 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
94 : /*verilator coverage_off*/
95 : output logic [7:0] lsu_axi_arlen,
96 : /*verilator coverage_on*/
97 0 : output logic [2:0] lsu_axi_arsize,
98 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
99 : /*verilator coverage_off*/
100 : output logic [1:0] lsu_axi_arburst,
101 : output logic lsu_axi_arlock,
102 : /*verilator coverage_on*/
103 1773 : output logic [3:0] lsu_axi_arcache,
104 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
105 : /*verilator coverage_off*/
106 : output logic [2:0] lsu_axi_arprot,
107 : output logic [3:0] lsu_axi_arqos,
108 : /*verilator coverage_on*/
109 :
110 672996 : input logic lsu_axi_rvalid,
111 : /* exclude signals that are tied to constant value in el2_lsu_bus_buffer.sv */
112 : /*verilator coverage_off*/
113 : output logic lsu_axi_rready,
114 : /*verilator coverage_on*/
115 0 : input logic [pt.LSU_BUS_TAG-1:0] lsu_axi_rid,
116 26505 : input logic [63:0] lsu_axi_rdata,
117 2 : input logic [1:0] lsu_axi_rresp,
118 673648 : input logic lsu_axi_rlast,
119 :
120 : //-------------------------- IFU AXI signals--------------------------
121 : // AXI Write Channels
122 : /* exclude signals that are tied to constant value in el2_ifu_mem_ctl.sv */
123 : /*verilator coverage_off*/
124 : output logic ifu_axi_awvalid,
125 : /*verilator coverage_on*/
126 0 : input logic ifu_axi_awready,
127 : /* exclude signals that are tied to constant value in el2_ifu_mem_ctl.sv */
128 : /*verilator coverage_off*/
129 : output logic [pt.IFU_BUS_TAG-1:0] ifu_axi_awid,
130 : output logic [31:0] ifu_axi_awaddr,
131 : output logic [3:0] ifu_axi_awregion,
132 : output logic [7:0] ifu_axi_awlen,
133 : output logic [2:0] ifu_axi_awsize,
134 : output logic [1:0] ifu_axi_awburst,
135 : output logic ifu_axi_awlock,
136 : output logic [3:0] ifu_axi_awcache,
137 : output logic [2:0] ifu_axi_awprot,
138 : output logic [3:0] ifu_axi_awqos,
139 :
140 : output logic ifu_axi_wvalid,
141 : /*verilator coverage_on*/
142 0 : input logic ifu_axi_wready,
143 : /* exclude signals that are tied to constant value in el2_ifu_mem_ctl.sv */
144 : /*verilator coverage_off*/
145 : output logic [63:0] ifu_axi_wdata,
146 : output logic [7:0] ifu_axi_wstrb,
147 : output logic ifu_axi_wlast,
148 : /*verilator coverage_on*/
149 :
150 0 : input logic ifu_axi_bvalid,
151 : /* exclude signals that are tied to constant value in el2_ifu_mem_ctl.sv */
152 : /*verilator coverage_off*/
153 : output logic ifu_axi_bready,
154 : /*verilator coverage_on*/
155 0 : input logic [1:0] ifu_axi_bresp,
156 0 : input logic [pt.IFU_BUS_TAG-1:0] ifu_axi_bid,
157 :
158 : // AXI Read Channels
159 4449495 : output logic ifu_axi_arvalid,
160 8918851 : input logic ifu_axi_arready,
161 2739036 : output logic [pt.IFU_BUS_TAG-1:0] ifu_axi_arid,
162 1937946 : output logic [31:0] ifu_axi_araddr,
163 456 : output logic [3:0] ifu_axi_arregion,
164 : /* exclude signals that are tied to constant value in el2_ifu_mem_ctl.sv */
165 : /*verilator coverage_off*/
166 : output logic [7:0] ifu_axi_arlen,
167 : output logic [2:0] ifu_axi_arsize,
168 : output logic [1:0] ifu_axi_arburst,
169 : output logic ifu_axi_arlock,
170 : output logic [3:0] ifu_axi_arcache,
171 : output logic [2:0] ifu_axi_arprot,
172 : output logic [3:0] ifu_axi_arqos,
173 : /*verilator coverage_on*/
174 :
175 8918533 : input logic ifu_axi_rvalid,
176 : /* exclude signals that are tied to constant value in el2_ifu_mem_ctl.sv */
177 : /*verilator coverage_off*/
178 : output logic ifu_axi_rready,
179 : /*verilator coverage_on*/
180 897578 : input logic [pt.IFU_BUS_TAG-1:0] ifu_axi_rid,
181 744653 : input logic [63:0] ifu_axi_rdata,
182 20 : input logic [1:0] ifu_axi_rresp,
183 8918533 : input logic ifu_axi_rlast,
184 :
185 : //-------------------------- SB AXI signals--------------------------
186 : // AXI Write Channels
187 122 : output logic sb_axi_awvalid,
188 122 : input logic sb_axi_awready,
189 : /* exclude signals that are tied to constant value in dbg/el2_dbg.sv */
190 : /*verilator coverage_off*/
191 : output logic [pt.SB_BUS_TAG-1:0] sb_axi_awid,
192 : /*verilator coverage_on*/
193 2 : output logic [31:0] sb_axi_awaddr,
194 98 : output logic [3:0] sb_axi_awregion,
195 : /* exclude signals that are tied to constant value in dbg/el2_dbg.sv */
196 : /*verilator coverage_off*/
197 : output logic [7:0] sb_axi_awlen,
198 : /*verilator coverage_on*/
199 0 : output logic [2:0] sb_axi_awsize,
200 : /* exclude signals that are tied to constant value in dbg/el2_dbg.sv */
201 : /*verilator coverage_off*/
202 : output logic [1:0] sb_axi_awburst,
203 : output logic sb_axi_awlock,
204 : output logic [3:0] sb_axi_awcache,
205 : output logic [2:0] sb_axi_awprot,
206 : output logic [3:0] sb_axi_awqos,
207 : /*verilator coverage_on*/
208 :
209 122 : output logic sb_axi_wvalid,
210 122 : input logic sb_axi_wready,
211 31 : output logic [63:0] sb_axi_wdata,
212 276 : output logic [7:0] sb_axi_wstrb,
213 319 : output logic sb_axi_wlast,
214 :
215 122 : input logic sb_axi_bvalid,
216 319 : output logic sb_axi_bready,
217 0 : input logic [1:0] sb_axi_bresp,
218 0 : input logic [pt.SB_BUS_TAG-1:0] sb_axi_bid,
219 :
220 : // AXI Read Channels
221 652 : output logic sb_axi_arvalid,
222 652 : input logic sb_axi_arready,
223 : /* exclude signals that are tied to constant value in dbg/el2_dbg.sv */
224 : /*verilator coverage_off*/
225 : output logic [pt.SB_BUS_TAG-1:0] sb_axi_arid,
226 : /*verilator coverage_on*/
227 2 : output logic [31:0] sb_axi_araddr,
228 98 : output logic [3:0] sb_axi_arregion,
229 : /* exclude signals that are tied to constant value in dbg/el2_dbg.sv */
230 : /*verilator coverage_off*/
231 : output logic [7:0] sb_axi_arlen,
232 : /*verilator coverage_on*/
233 0 : output logic [2:0] sb_axi_arsize,
234 : /* exclude signals that are tied to constant value in dbg/el2_dbg.sv */
235 : /*verilator coverage_off*/
236 : output logic [1:0] sb_axi_arburst,
237 : output logic sb_axi_arlock,
238 : output logic [3:0] sb_axi_arcache,
239 : output logic [2:0] sb_axi_arprot,
240 : output logic [3:0] sb_axi_arqos,
241 : /*verilator coverage_on*/
242 :
243 652 : input logic sb_axi_rvalid,
244 : /* exclude signals that are tied to constant value in dbg/el2_dbg.sv */
245 : /*verilator coverage_off*/
246 : output logic sb_axi_rready,
247 : /*verilator coverage_on*/
248 0 : input logic [pt.SB_BUS_TAG-1:0] sb_axi_rid,
249 5 : input logic [63:0] sb_axi_rdata,
250 0 : input logic [1:0] sb_axi_rresp,
251 652 : input logic sb_axi_rlast,
252 :
253 : //-------------------------- DMA AXI signals--------------------------
254 : // AXI Write Channels
255 66 : input logic dma_axi_awvalid,
256 319 : output logic dma_axi_awready,
257 : /* exclude signals that are tied to constant value in tb_top.sv */
258 : /*verilator coverage_off*/
259 : input logic [pt.DMA_BUS_TAG-1:0] dma_axi_awid,
260 : /*verilator coverage_on*/
261 282 : input logic [31:0] dma_axi_awaddr,
262 0 : input logic [2:0] dma_axi_awsize,
263 0 : input logic [2:0] dma_axi_awprot,
264 0 : input logic [7:0] dma_axi_awlen,
265 0 : input logic [1:0] dma_axi_awburst,
266 :
267 :
268 66 : input logic dma_axi_wvalid,
269 319 : output logic dma_axi_wready,
270 29795 : input logic [63:0] dma_axi_wdata,
271 185761 : input logic [7:0] dma_axi_wstrb,
272 318 : input logic dma_axi_wlast,
273 :
274 66 : output logic dma_axi_bvalid,
275 66 : input logic dma_axi_bready,
276 2 : output logic [1:0] dma_axi_bresp,
277 0 : output logic [pt.DMA_BUS_TAG-1:0] dma_axi_bid,
278 :
279 : // AXI Read Channels
280 0 : input logic dma_axi_arvalid,
281 319 : output logic dma_axi_arready,
282 : /* exclude signals that are tied to constant value in tb_top.sv */
283 : /*verilator coverage_off*/
284 : input logic [pt.DMA_BUS_TAG-1:0] dma_axi_arid,
285 : /*verilator coverage_on*/
286 282 : input logic [31:0] dma_axi_araddr,
287 0 : input logic [2:0] dma_axi_arsize,
288 0 : input logic [2:0] dma_axi_arprot,
289 0 : input logic [7:0] dma_axi_arlen,
290 0 : input logic [1:0] dma_axi_arburst,
291 :
292 0 : output logic dma_axi_rvalid,
293 0 : input logic dma_axi_rready,
294 0 : output logic [pt.DMA_BUS_TAG-1:0] dma_axi_rid,
295 12 : output logic [63:0] dma_axi_rdata,
296 2 : output logic [1:0] dma_axi_rresp,
297 319 : output logic dma_axi_rlast,
298 : `endif
299 :
300 : `ifdef RV_BUILD_AHB_LITE
301 : //// AHB LITE BUS
302 17 : output logic [31:0] haddr,
303 : /* exclude signals that are tied to constant value in axi4_to_ahb.sv */
304 : /*verilator coverage_off*/
305 : output logic [2:0] hburst,
306 : output logic hmastlock,
307 : /*verilator coverage_on*/
308 0 : output logic [3:0] hprot,
309 0 : output logic [2:0] hsize,
310 1445565 : output logic [1:0] htrans,
311 0 : output logic hwrite,
312 :
313 : /* exclude signals that are tied to constant value in this file */
314 : /*verilator coverage_off*/
315 : input logic [63:0] hrdata,
316 : input logic hready,
317 : input logic hresp,
318 : /*verilator coverage_on*/
319 :
320 : // LSU AHB Master
321 10 : output logic [31:0] lsu_haddr,
322 : /* exclude signals that are tied to constant value in axi4_to_ahb.sv */
323 : /*verilator coverage_off*/
324 : output logic [2:0] lsu_hburst,
325 : output logic lsu_hmastlock,
326 : /*verilator coverage_on*/
327 0 : output logic [3:0] lsu_hprot,
328 0 : output logic [2:0] lsu_hsize,
329 445316 : output logic [1:0] lsu_htrans,
330 89186 : output logic lsu_hwrite,
331 5340 : output logic [63:0] lsu_hwdata,
332 :
333 : /* exclude signals that are tied to constant value in this file */
334 : /*verilator coverage_off*/
335 : input logic [63:0] lsu_hrdata,
336 : input logic lsu_hready,
337 : input logic lsu_hresp,
338 : /*verilator coverage_on*/
339 : // Debug Syster Bus AHB
340 2 : output logic [31:0] sb_haddr,
341 : /* exclude signals that are tied to constant value in axi4_to_ahb.sv */
342 : /*verilator coverage_off*/
343 : output logic [2:0] sb_hburst,
344 : output logic sb_hmastlock,
345 : /*verilator coverage_on*/
346 0 : output logic [3:0] sb_hprot,
347 0 : output logic [2:0] sb_hsize,
348 974 : output logic [1:0] sb_htrans,
349 119 : output logic sb_hwrite,
350 35 : output logic [63:0] sb_hwdata,
351 :
352 : /* exclude signals that are tied to constant value in this file */
353 : /*verilator coverage_off*/
354 : input logic [63:0] sb_hrdata,
355 : input logic sb_hready,
356 : input logic sb_hresp,
357 : /*verilator coverage_on*/
358 :
359 : // DMA Slave
360 : /* exclude signals that are tied to constant value in tb_top.sv */
361 : /*verilator coverage_off*/
362 : input logic dma_hsel,
363 : input logic [31:0] dma_haddr,
364 : input logic [2:0] dma_hburst,
365 : input logic dma_hmastlock,
366 : input logic [3:0] dma_hprot,
367 : input logic [2:0] dma_hsize,
368 : input logic [1:0] dma_htrans,
369 : input logic dma_hwrite,
370 : input logic [63:0] dma_hwdata,
371 : /*verilator coverage_on*/
372 20 : input logic dma_hreadyin,
373 :
374 0 : output logic [63:0] dma_hrdata,
375 20 : output logic dma_hreadyout,
376 0 : output logic dma_hresp,
377 : `endif
378 : // clk ratio signals
379 338 : input logic lsu_bus_clk_en, // Clock ratio b/w cpu core clk & AHB master interface
380 338 : input logic ifu_bus_clk_en, // Clock ratio b/w cpu core clk & AHB master interface
381 338 : input logic dbg_bus_clk_en, // Clock ratio b/w cpu core clk & AHB master interface
382 338 : input logic dma_bus_clk_en, // Clock ratio b/w cpu core clk & AHB slave interface
383 :
384 : // ICCM/DCCM ECC status
385 8 : output logic iccm_ecc_single_error,
386 4 : output logic iccm_ecc_double_error,
387 4 : output logic dccm_ecc_single_error,
388 4 : output logic dccm_ecc_double_error,
389 :
390 : // all of these test inputs are brought to top-level; must be tied off based on usage by physical design (ie. icache or not, iccm or not, dccm or not)
391 :
392 0 : input el2_ic_data_ext_in_pkt_t [pt.ICACHE_NUM_WAYS-1:0][pt.ICACHE_BANKS_WAY-1:0] ic_data_ext_in_pkt,
393 0 : input el2_ic_tag_ext_in_pkt_t [pt.ICACHE_NUM_WAYS-1:0] ic_tag_ext_in_pkt,
394 :
395 16 : input logic timer_int,
396 15 : input logic soft_int,
397 0 : input logic [pt.PIC_TOTAL_INT:1] extintsrc_req,
398 :
399 340148 : output logic dec_tlu_perfcnt0, // toggles when slot0 perf counter 0 has an event inc
400 514626 : output logic dec_tlu_perfcnt1,
401 312914 : output logic dec_tlu_perfcnt2,
402 48468 : output logic dec_tlu_perfcnt3,
403 :
404 : // ports added by the soc team
405 1559586 : input logic jtag_tck, // JTAG clk
406 93488 : input logic jtag_tms, // JTAG TMS
407 120400 : input logic jtag_tdi, // JTAG tdi
408 4 : input logic jtag_trst_n, // JTAG Reset
409 117554 : output logic jtag_tdo, // JTAG TDO
410 46736 : output logic jtag_tdoEn, // JTAG Test Data Output enable
411 :
412 0 : input logic [31:4] core_id,
413 :
414 : // Memory Export Interface
415 : el2_mem_if.veer_sram_src el2_mem_export,
416 :
417 : `ifdef RV_LOCKSTEP_ENABLE
418 : // Shadow Core control
419 : input logic disable_corruption_detection_i,
420 : input logic lockstep_err_injection_en_i,
421 : output logic corruption_detected_o,
422 : `endif
423 :
424 : // external MPC halt/run interface
425 108 : input logic mpc_debug_halt_req, // Async halt request
426 108 : input logic mpc_debug_run_req, // Async run request
427 338 : input logic mpc_reset_run_req, // Run/halt after reset
428 108 : output logic mpc_debug_halt_ack, // Halt ack
429 108 : output logic mpc_debug_run_ack, // Run ack
430 2 : output logic debug_brkpt_status, // debug breakpoint
431 :
432 108 : input logic i_cpu_halt_req, // Async halt req to CPU
433 108 : output logic o_cpu_halt_ack, // core response to halt
434 108 : output logic o_cpu_halt_status, // 1'b1 indicates core is halted
435 118 : output logic o_debug_mode_status, // Core to the PMU that core is in debug mode. When core is in debug mode, the PMU should refrain from sendng a halt or run request
436 108 : input logic i_cpu_run_req, // Async restart req to CPU
437 108 : output logic o_cpu_run_ack, // Core response to run req
438 :
439 : // Excluding scan_mode and mbist_mode from coverage as their usage is determined by the integrator of the VeeR core.
440 : /* verilator coverage_off */
441 : input logic scan_mode, // To enable scan mode
442 : input logic mbist_mode, // to enable mbist
443 :
444 : // DMI port for uncore
445 : input logic dmi_core_enable,
446 : input logic dmi_uncore_enable,
447 : output logic dmi_uncore_en,
448 : output logic dmi_uncore_wr_en,
449 : output logic [ 6:0] dmi_uncore_addr,
450 : output logic [31:0] dmi_uncore_wdata,
451 : input logic [31:0] dmi_uncore_rdata,
452 : output logic dmi_active
453 : /* verilator coverage_on */
454 : );
455 :
456 69881587 : logic active_l2clk;
457 69881587 : logic free_l2clk;
458 :
459 : // DCCM ports
460 262894 : logic dccm_wren;
461 561000 : logic dccm_rden;
462 18811 : logic [pt.DCCM_BITS-1:0] dccm_wr_addr_lo;
463 18811 : logic [pt.DCCM_BITS-1:0] dccm_wr_addr_hi;
464 471334 : logic [pt.DCCM_BITS-1:0] dccm_rd_addr_lo;
465 677729 : logic [pt.DCCM_BITS-1:0] dccm_rd_addr_hi;
466 5376 : logic [pt.DCCM_FDATA_WIDTH-1:0] dccm_wr_data_lo;
467 5376 : logic [pt.DCCM_FDATA_WIDTH-1:0] dccm_wr_data_hi;
468 :
469 47176 : logic [pt.DCCM_FDATA_WIDTH-1:0] dccm_rd_data_lo;
470 47176 : logic [pt.DCCM_FDATA_WIDTH-1:0] dccm_rd_data_hi;
471 :
472 : // PIC ports
473 :
474 : // Icache & Itag ports
475 489 : logic [31:1] ic_rw_addr;
476 10432 : logic [pt.ICACHE_NUM_WAYS-1:0] ic_wr_en ; // Which way to write
477 680938 : logic ic_rd_en ;
478 :
479 :
480 255918 : logic [pt.ICACHE_NUM_WAYS-1:0] ic_tag_valid; // Valid from the I$ tag valid outside (in flops).
481 :
482 109586 : logic [pt.ICACHE_NUM_WAYS-1:0] ic_rd_hit; // ic_rd_hit[3:0]
483 0 : logic ic_tag_perr; // Ic tag parity error
484 :
485 0 : logic [pt.ICACHE_INDEX_HI:3] ic_debug_addr; // Read/Write addresss to the Icache.
486 20 : logic ic_debug_rd_en; // Icache debug rd
487 20 : logic ic_debug_wr_en; // Icache debug wr
488 8 : logic ic_debug_tag_array; // Debug tag array
489 0 : logic [pt.ICACHE_NUM_WAYS-1:0] ic_debug_way; // Debug way. Rd or Wr.
490 :
491 0 : logic [25:0] ictag_debug_rd_data; // Debug icache tag.
492 560643 : logic [pt.ICACHE_BANKS_WAY-1:0][70:0] ic_wr_data;
493 2137084 : logic [63:0] ic_rd_data;
494 231581 : logic [70:0] ic_debug_rd_data; // Data read from Icache. 2x64bits + parity bits. F2 stage. With ECC
495 0 : logic [70:0] ic_debug_wr_data; // Debug wr cache.
496 :
497 0 : logic [pt.ICACHE_BANKS_WAY-1:0] ic_eccerr; // ecc error per bank
498 0 : logic [pt.ICACHE_BANKS_WAY-1:0] ic_parerr; // parity error per bank
499 :
500 1738674 : logic [63:0] ic_premux_data;
501 5605560 : logic ic_sel_premux_data;
502 :
503 : // ICCM ports
504 160274 : logic [pt.ICCM_BITS-1:1] iccm_rw_addr;
505 74 : logic iccm_wren;
506 133206 : logic iccm_rden;
507 0 : logic [2:0] iccm_wr_size;
508 14 : logic [77:0] iccm_wr_data;
509 8 : logic iccm_buf_correct_ecc;
510 8 : logic iccm_correction_state;
511 :
512 136532 : logic [63:0] iccm_rd_data;
513 161264 : logic [77:0] iccm_rd_data_ecc;
514 :
515 338 : logic core_rst_l; // Core reset including rst_l and dbg_rst_l
516 :
517 2 : logic dccm_clk_override;
518 2 : logic icm_clk_override;
519 8 : logic dec_tlu_core_ecc_disable;
520 :
521 :
522 : // zero out the signals not presented at the wrapper instantiation level
523 : `ifdef RV_BUILD_AXI4
524 : // Since all the signals in this block are tied to constant, we exclude this from coverage analysis
525 : /*verilator coverage_off*/
526 :
527 : //// AHB LITE BUS
528 : logic [31:0] haddr;
529 : logic [2:0] hburst;
530 : logic hmastlock;
531 : logic [3:0] hprot;
532 : logic [2:0] hsize;
533 : logic [1:0] htrans;
534 : logic hwrite;
535 :
536 : logic [63:0] hrdata;
537 : logic hready;
538 : logic hresp;
539 :
540 : // LSU AHB Master
541 : logic [31:0] lsu_haddr;
542 : logic [2:0] lsu_hburst;
543 : logic lsu_hmastlock;
544 : logic [3:0] lsu_hprot;
545 : logic [2:0] lsu_hsize;
546 : logic [1:0] lsu_htrans;
547 : logic lsu_hwrite;
548 : logic [63:0] lsu_hwdata;
549 :
550 : logic [63:0] lsu_hrdata;
551 : logic lsu_hready;
552 : logic lsu_hresp;
553 : // Debug Syster Bus AHB
554 : logic [31:0] sb_haddr;
555 : logic [2:0] sb_hburst;
556 : logic sb_hmastlock;
557 : logic [3:0] sb_hprot;
558 : logic [2:0] sb_hsize;
559 : logic [1:0] sb_htrans;
560 : logic sb_hwrite;
561 : logic [63:0] sb_hwdata;
562 :
563 : logic [63:0] sb_hrdata;
564 : logic sb_hready;
565 : logic sb_hresp;
566 :
567 : // DMA Slave
568 : logic dma_hsel;
569 : logic [31:0] dma_haddr;
570 : logic [2:0] dma_hburst;
571 : logic dma_hmastlock;
572 : logic [3:0] dma_hprot;
573 : logic [2:0] dma_hsize;
574 : logic [1:0] dma_htrans;
575 : logic dma_hwrite;
576 : logic [63:0] dma_hwdata;
577 : logic dma_hreadyin;
578 :
579 : logic [63:0] dma_hrdata;
580 : logic dma_hreadyout;
581 : logic dma_hresp;
582 :
583 :
584 :
585 : // AHB
586 : assign hrdata[63:0] = '0;
587 : assign hready = '0;
588 : assign hresp = '0;
589 : // LSU
590 : assign lsu_hrdata[63:0] = '0;
591 : assign lsu_hready = '0;
592 : assign lsu_hresp = '0;
593 : // Debu
594 : assign sb_hrdata[63:0] = '0;
595 : assign sb_hready = '0;
596 : assign sb_hresp = '0;
597 :
598 : // DMA
599 : assign dma_hsel = '0;
600 : assign dma_haddr[31:0] = '0;
601 : assign dma_hburst[2:0] = '0;
602 : assign dma_hmastlock = '0;
603 : assign dma_hprot[3:0] = '0;
604 : assign dma_hsize[2:0] = '0;
605 : assign dma_htrans[1:0] = '0;
606 : assign dma_hwrite = '0;
607 : assign dma_hwdata[63:0] = '0;
608 : assign dma_hreadyin = '0;
609 :
610 : /*verilator coverage_on*/
611 :
612 : `endif // `ifdef RV_BUILD_AXI4
613 :
614 :
615 : `ifdef RV_BUILD_AHB_LITE
616 : // Since all the signals in this block are tied to constant, we exclude this from coverage analysis
617 : /*verilator coverage_off*/
618 : wire lsu_axi_awvalid;
619 : wire lsu_axi_awready;
620 : wire [pt.LSU_BUS_TAG-1:0] lsu_axi_awid;
621 : wire [31:0] lsu_axi_awaddr;
622 : wire [3:0] lsu_axi_awregion;
623 : wire [7:0] lsu_axi_awlen;
624 : wire [2:0] lsu_axi_awsize;
625 : wire [1:0] lsu_axi_awburst;
626 : wire lsu_axi_awlock;
627 : wire [3:0] lsu_axi_awcache;
628 : wire [2:0] lsu_axi_awprot;
629 : wire [3:0] lsu_axi_awqos;
630 :
631 :
632 : wire lsu_axi_wvalid;
633 : wire lsu_axi_wready;
634 : wire [63:0] lsu_axi_wdata;
635 : wire [7:0] lsu_axi_wstrb;
636 : wire lsu_axi_wlast;
637 :
638 : wire lsu_axi_bvalid;
639 : wire lsu_axi_bready;
640 : wire [1:0] lsu_axi_bresp;
641 : wire [pt.LSU_BUS_TAG-1:0] lsu_axi_bid;
642 :
643 : // AXI Read Channels
644 : wire lsu_axi_arvalid;
645 : wire lsu_axi_arready;
646 : wire [pt.LSU_BUS_TAG-1:0] lsu_axi_arid;
647 : wire [31:0] lsu_axi_araddr;
648 : wire [3:0] lsu_axi_arregion;
649 : wire [7:0] lsu_axi_arlen;
650 : wire [2:0] lsu_axi_arsize;
651 : wire [1:0] lsu_axi_arburst;
652 : wire lsu_axi_arlock;
653 : wire [3:0] lsu_axi_arcache;
654 : wire [2:0] lsu_axi_arprot;
655 : wire [3:0] lsu_axi_arqos;
656 :
657 : wire lsu_axi_rvalid;
658 : wire lsu_axi_rready;
659 : wire [pt.LSU_BUS_TAG-1:0] lsu_axi_rid;
660 : wire [63:0] lsu_axi_rdata;
661 : wire [1:0] lsu_axi_rresp;
662 : wire lsu_axi_rlast;
663 :
664 : assign lsu_axi_awready = '0;
665 : assign lsu_axi_wready = '0;
666 : assign lsu_axi_bvalid = '0;
667 : assign lsu_axi_bresp = '0;
668 : assign lsu_axi_bid = {pt.LSU_BUS_TAG{1'b0}};
669 : assign lsu_axi_arready = '0;
670 : assign lsu_axi_rvalid = '0;
671 : assign lsu_axi_rid = {pt.LSU_BUS_TAG{1'b0}};
672 : assign lsu_axi_rdata = '0;
673 : assign lsu_axi_rresp = '0;
674 : assign lsu_axi_rlast = '0;
675 : //-------------------------- IFU AXI signals--------------------------
676 : // AXI Write Channels
677 : wire ifu_axi_awvalid;
678 : wire ifu_axi_awready;
679 : wire [pt.IFU_BUS_TAG-1:0] ifu_axi_awid;
680 : wire [31:0] ifu_axi_awaddr;
681 : wire [3:0] ifu_axi_awregion;
682 : wire [7:0] ifu_axi_awlen;
683 : wire [2:0] ifu_axi_awsize;
684 : wire [1:0] ifu_axi_awburst;
685 : wire ifu_axi_awlock;
686 : wire [3:0] ifu_axi_awcache;
687 : wire [2:0] ifu_axi_awprot;
688 : wire [3:0] ifu_axi_awqos;
689 :
690 : wire ifu_axi_wvalid;
691 : wire ifu_axi_wready;
692 : wire [63:0] ifu_axi_wdata;
693 : wire [7:0] ifu_axi_wstrb;
694 : wire ifu_axi_wlast;
695 :
696 : wire ifu_axi_bvalid;
697 : wire ifu_axi_bready;
698 : wire [1:0] ifu_axi_bresp;
699 : wire [pt.IFU_BUS_TAG-1:0] ifu_axi_bid;
700 :
701 : // AXI Read Channels
702 : wire ifu_axi_arvalid;
703 : wire ifu_axi_arready;
704 : wire [pt.IFU_BUS_TAG-1:0] ifu_axi_arid;
705 : wire [31:0] ifu_axi_araddr;
706 : wire [3:0] ifu_axi_arregion;
707 : wire [7:0] ifu_axi_arlen;
708 : wire [2:0] ifu_axi_arsize;
709 : wire [1:0] ifu_axi_arburst;
710 : wire ifu_axi_arlock;
711 : wire [3:0] ifu_axi_arcache;
712 : wire [2:0] ifu_axi_arprot;
713 : wire [3:0] ifu_axi_arqos;
714 :
715 : wire ifu_axi_rvalid;
716 : wire ifu_axi_rready;
717 : wire [pt.IFU_BUS_TAG-1:0] ifu_axi_rid;
718 : wire [63:0] ifu_axi_rdata;
719 : wire [1:0] ifu_axi_rresp;
720 : wire ifu_axi_rlast;
721 :
722 : assign ifu_axi_bvalid = '0;
723 : assign ifu_axi_bresp = '0;
724 : assign ifu_axi_bid = {pt.IFU_BUS_TAG{1'b0}};
725 : assign ifu_axi_arready = '0;
726 : assign ifu_axi_rvalid = '0;
727 : assign ifu_axi_rid = {pt.IFU_BUS_TAG{1'b0}};
728 : assign ifu_axi_rdata = 0;
729 : assign ifu_axi_rresp = '0;
730 : assign ifu_axi_rlast = '0;
731 : //-------------------------- SB AXI signals--------------------------
732 : // AXI Write Channels
733 : wire sb_axi_awvalid;
734 : wire sb_axi_awready;
735 : wire [pt.SB_BUS_TAG-1:0] sb_axi_awid;
736 : wire [31:0] sb_axi_awaddr;
737 : wire [3:0] sb_axi_awregion;
738 : wire [7:0] sb_axi_awlen;
739 : wire [2:0] sb_axi_awsize;
740 : wire [1:0] sb_axi_awburst;
741 : wire sb_axi_awlock;
742 : wire [3:0] sb_axi_awcache;
743 : wire [2:0] sb_axi_awprot;
744 : wire [3:0] sb_axi_awqos;
745 :
746 : wire sb_axi_wvalid;
747 : wire sb_axi_wready;
748 : wire [63:0] sb_axi_wdata;
749 : wire [7:0] sb_axi_wstrb;
750 : wire sb_axi_wlast;
751 :
752 : wire sb_axi_bvalid;
753 : wire sb_axi_bready;
754 : wire [1:0] sb_axi_bresp;
755 : wire [pt.SB_BUS_TAG-1:0] sb_axi_bid;
756 :
757 : // AXI Read Channels
758 : wire sb_axi_arvalid;
759 : wire sb_axi_arready;
760 : wire [pt.SB_BUS_TAG-1:0] sb_axi_arid;
761 : wire [31:0] sb_axi_araddr;
762 : wire [3:0] sb_axi_arregion;
763 : wire [7:0] sb_axi_arlen;
764 : wire [2:0] sb_axi_arsize;
765 : wire [1:0] sb_axi_arburst;
766 : wire sb_axi_arlock;
767 : wire [3:0] sb_axi_arcache;
768 : wire [2:0] sb_axi_arprot;
769 : wire [3:0] sb_axi_arqos;
770 :
771 : wire sb_axi_rvalid;
772 : wire sb_axi_rready;
773 : wire [pt.SB_BUS_TAG-1:0] sb_axi_rid;
774 : wire [63:0] sb_axi_rdata;
775 : wire [1:0] sb_axi_rresp;
776 : wire sb_axi_rlast;
777 :
778 : assign sb_axi_awready = '0;
779 : assign sb_axi_wready = '0;
780 : assign sb_axi_bvalid = '0;
781 : assign sb_axi_bresp = '0;
782 : assign sb_axi_bid = {pt.SB_BUS_TAG{1'b0}};
783 : assign sb_axi_arready = '0;
784 : assign sb_axi_rvalid = '0;
785 : assign sb_axi_rid = {pt.SB_BUS_TAG{1'b0}};
786 : assign sb_axi_rdata = '0;
787 : assign sb_axi_rresp = '0;
788 : assign sb_axi_rlast = '0;
789 : //-------------------------- DMA AXI signals--------------------------
790 : // AXI Write Channels
791 : wire dma_axi_awvalid;
792 : wire dma_axi_awready;
793 : wire [pt.DMA_BUS_TAG-1:0] dma_axi_awid;
794 : wire [31:0] dma_axi_awaddr;
795 : wire [2:0] dma_axi_awsize;
796 : wire [2:0] dma_axi_awprot;
797 : wire [7:0] dma_axi_awlen;
798 : wire [1:0] dma_axi_awburst;
799 :
800 :
801 : wire dma_axi_wvalid;
802 : wire dma_axi_wready;
803 : wire [63:0] dma_axi_wdata;
804 : wire [7:0] dma_axi_wstrb;
805 : wire dma_axi_wlast;
806 :
807 : assign dma_axi_awvalid = 1'b0;
808 : assign dma_axi_awid = {pt.DMA_BUS_TAG{1'b0}};
809 : assign dma_axi_awaddr = 32'd0;
810 : assign dma_axi_awsize = 3'd0;
811 : assign dma_axi_awprot = 3'd0;
812 : assign dma_axi_awlen = 8'd0;
813 : assign dma_axi_awburst = 2'd0;
814 :
815 :
816 : assign dma_axi_wvalid = 1'b0;
817 : assign dma_axi_wdata = 64'd0;
818 : assign dma_axi_wstrb = 8'd0;
819 : assign dma_axi_wlast = 1'b0;
820 :
821 :
822 : wire dma_axi_bvalid;
823 : wire dma_axi_bready;
824 : wire [1:0] dma_axi_bresp;
825 : wire [pt.DMA_BUS_TAG-1:0] dma_axi_bid;
826 :
827 : assign dma_axi_bready = 1'b0;
828 : // AXI Read Channels
829 : wire dma_axi_arvalid;
830 : wire dma_axi_arready;
831 : wire [pt.DMA_BUS_TAG-1:0] dma_axi_arid;
832 : wire [31:0] dma_axi_araddr;
833 : wire [2:0] dma_axi_arsize;
834 : wire [2:0] dma_axi_arprot;
835 : wire [7:0] dma_axi_arlen;
836 : wire [1:0] dma_axi_arburst;
837 :
838 : assign dma_axi_arvalid = 1'b0;
839 : assign dma_axi_arid = {pt.DMA_BUS_TAG{1'b0}};
840 : assign dma_axi_araddr = 32'd0;
841 : assign dma_axi_arsize = 3'd0;
842 : assign dma_axi_arprot = 3'd0;
843 : assign dma_axi_arlen = 8'd0;
844 : assign dma_axi_arburst = 2'd0;
845 :
846 :
847 :
848 : wire dma_axi_rvalid;
849 : wire dma_axi_rready;
850 : wire [pt.DMA_BUS_TAG-1:0] dma_axi_rid;
851 : wire [63:0] dma_axi_rdata;
852 : wire [1:0] dma_axi_rresp;
853 : wire dma_axi_rlast;
854 :
855 : assign dma_axi_rready = 1'b0;
856 : // AXI
857 : assign ifu_axi_awready = 1'b1;
858 : assign ifu_axi_wready = 1'b1;
859 : assign ifu_axi_bvalid = '0;
860 : assign ifu_axi_bresp[1:0] = '0;
861 : assign ifu_axi_bid[pt.IFU_BUS_TAG-1:0] = '0;
862 :
863 : /*verilator coverage_on*/
864 :
865 : `endif // `ifdef RV_BUILD_AHB_LITE
866 :
867 : // DMI (core)
868 16990 : logic dmi_en;
869 0 : logic [6:0] dmi_addr;
870 6308 : logic dmi_wr_en;
871 86 : logic [31:0] dmi_wdata;
872 112 : logic [31:0] dmi_rdata;
873 :
874 : // DMI (core)
875 16990 : logic dmi_reg_en;
876 0 : logic [6:0] dmi_reg_addr;
877 6308 : logic dmi_reg_wr_en;
878 86 : logic [31:0] dmi_reg_wdata;
879 112 : logic [31:0] dmi_reg_rdata;
880 :
881 : `ifdef RV_LOCKSTEP_REGFILE_ENABLE
882 : el2_regfile_if regfile ();
883 : `endif
884 :
885 : // Instantiate the el2_veer core
886 : el2_veer #(.pt(pt)) veer (
887 : .clk(clk),
888 : `ifdef RV_LOCKSTEP_REGFILE_ENABLE
889 : .regfile(regfile.veer_rf_src),
890 : `endif
891 : .*
892 : );
893 :
894 : `ifdef RV_LOCKSTEP_ENABLE
895 : initial begin
896 : $display("Dual Core Lockstep enabled!\n");
897 : end
898 :
899 : el2_veer_lockstep #(.pt(pt)) lockstep (
900 : .clk(clk),
901 : `ifdef RV_LOCKSTEP_REGFILE_ENABLE
902 : .main_core_regfile(regfile.veer_rf_sink),
903 : `endif // `ifdef RV_LOCKSTEP_REGFILE_ENABLE
904 : .*
905 : );
906 : `endif // `ifdef RV_LOCKSTEP_ENABLE
907 :
908 : // Instantiate the mem
909 : el2_mem #(.pt(pt)) mem (
910 : .clk(active_l2clk),
911 : .rst_l(core_rst_l),
912 : .mem_export(el2_mem_export),
913 : .*
914 : );
915 :
916 :
917 0 : logic unused_dmi_hard_reset;
918 : // JTAG/DMI instance
919 : dmi_wrapper dmi_wrapper (
920 : // JTAG signals
921 : .trst_n (jtag_trst_n), // JTAG reset
922 : .tck (jtag_tck), // JTAG clock
923 : .tms (jtag_tms), // Test mode select
924 : .tdi (jtag_tdi), // Test Data Input
925 : .tdo (jtag_tdo), // Test Data Output
926 : .tdoEnable (jtag_tdoEn), // Test Data Output enable
927 : // Processor Signals
928 : .core_rst_n (dbg_rst_l), // Debug reset, active low
929 : .core_clk (clk), // Core clock
930 : .jtag_id (jtag_id), // JTAG ID
931 : .rd_data (dmi_rdata), // Read data from Processor
932 : .reg_wr_data (dmi_wdata), // Write data to Processor
933 : .reg_wr_addr (dmi_addr), // Write address to Processor
934 : .reg_en (dmi_en), // Write interface bit to Processor
935 : .reg_wr_en (dmi_wr_en), // Write enable to Processor
936 : .dmi_hard_reset (unused_dmi_hard_reset)
937 : );
938 :
939 : // DMI core/uncore mux
940 : dmi_mux dmi_mux (
941 : .core_enable (dmi_core_enable),
942 : .uncore_enable (dmi_uncore_enable),
943 :
944 : .dmi_en (dmi_en),
945 : .dmi_wr_en (dmi_wr_en),
946 : .dmi_addr (dmi_addr),
947 : .dmi_wdata (dmi_wdata),
948 : .dmi_rdata (dmi_rdata),
949 :
950 : .dmi_core_en (dmi_reg_en),
951 : .dmi_core_wr_en (dmi_reg_wr_en),
952 : .dmi_core_addr (dmi_reg_addr),
953 : .dmi_core_wdata (dmi_reg_wdata),
954 : .dmi_core_rdata (dmi_reg_rdata),
955 :
956 : .dmi_uncore_en (dmi_uncore_en),
957 : .dmi_uncore_wr_en (dmi_uncore_wr_en),
958 : .dmi_uncore_addr (dmi_uncore_addr),
959 : .dmi_uncore_wdata (dmi_uncore_wdata),
960 : .dmi_uncore_rdata (dmi_uncore_rdata)
961 : );
962 :
963 339 : always_comb dmi_active = dmi_en;
964 :
965 : `ifdef RV_ASSERT_ON
966 : // to avoid internal assertions failure at time 0
967 : initial begin
968 : $assertoff(0, veer);
969 : @(negedge clk) $asserton(0, veer);
970 : end
971 : `endif
972 :
973 : endmodule
|