Skip to content

Commit 9e05f41

Browse files
ricted98ezelioli
authored andcommitted
cva6rt: add configuration using the HPDCache
1 parent c084b39 commit 9e05f41

2 files changed

Lines changed: 202 additions & 2 deletions

File tree

Bender.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ sources:
115115
files:
116116
- core/include/cv64a6_rt_config_pkg.sv
117117

118+
- target: cv64a6_rt_hpdcache
119+
files:
120+
- core/include/cv64a6_rt_hpdcache_config_pkg.sv
121+
118122
# General config infrastructure
119123
- core/include/riscv_pkg.sv
120124
- core/include/ariane_pkg.sv
@@ -125,12 +129,12 @@ sources:
125129
- core/cva6_accel_first_pass_decoder_stub.sv
126130

127131
# CLIC controller
128-
- target: any(cv64a6_imafdchsclic_sv39, cv64a6_imafdchsclic_sv39_hpdcache_wb, cv64a6_imafdchsclic_sv39_wb, cv64a6_imafdchxhclic_sv39_wb, cv64a6_imafdchxhclic_sv39_hpdcache_wb, cv64a6_rt)
132+
- target: any(cv64a6_imafdchsclic_sv39, cv64a6_imafdchsclic_sv39_hpdcache_wb, cv64a6_imafdchsclic_sv39_wb, cv64a6_imafdchxhclic_sv39_wb, cv64a6_imafdchxhclic_sv39_hpdcache_wb, cv64a6_rt, cv64a6_rt_hpdcache)
129133
files:
130134
- core/cva6_clic_controller.sv
131135

132136
# MMU
133-
- target: any(cv64a6_imafdcv_sv39, cv64a6_imafdc_sv39, cv64a6_imafdc_sv39_wb, cv64a6_imafdch_sv39, cv64a6_imafdc_sv39_hpdcache, cv64a6_imafdc_sv39_hpdcache_wb, cv64a6_imafdch_sv39_wb, cv64a6_imafdchsclic_sv39, cv64a6_imafdchsclic_sv39_wb, cv64a6_imafdchsclic_sv39_hpdcache_wb, cv64a6_imafdchxhclic_sv39_wb, cv64a6_imafdchxhclic_sv39_hpdcache_wb, cv64a6_splus, cv32a6_imac_sv0, cv32a6_imac_sv32, cv32a6_imafc_sv32, cv64a6_rt)
137+
- target: any(cv64a6_imafdcv_sv39, cv64a6_imafdc_sv39, cv64a6_imafdc_sv39_wb, cv64a6_imafdch_sv39, cv64a6_imafdc_sv39_hpdcache, cv64a6_imafdc_sv39_hpdcache_wb, cv64a6_imafdch_sv39_wb, cv64a6_imafdchsclic_sv39, cv64a6_imafdchsclic_sv39_wb, cv64a6_imafdchsclic_sv39_hpdcache_wb, cv64a6_imafdchxhclic_sv39_wb, cv64a6_imafdchxhclic_sv39_hpdcache_wb, cv64a6_splus, cv32a6_imac_sv0, cv32a6_imac_sv32, cv32a6_imafc_sv32, cv64a6_rt, cv64a6_rt_hpdcache)
134138
files:
135139
- core/cva6_mmu/cva6_tlb.sv
136140
- core/cva6_mmu/cva6_shared_tlb.sv
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
// Copyright 2021 Thales DIS design services SAS
2+
//
3+
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
6+
// You may obtain a copy of the License at https://solderpad.org/licenses/
7+
//
8+
// Original Author: Enrico Zelioli <ezelioli@iis.ee.ethz.ch> - ETH Zurich
9+
10+
11+
package cva6_config_pkg;
12+
13+
localparam CVA6ConfigXlen = 64;
14+
15+
localparam CVA6ConfigRVF = 1;
16+
localparam CVA6ConfigRVD = 1;
17+
localparam CVA6ConfigF16En = 0;
18+
localparam CVA6ConfigF16AltEn = 0;
19+
localparam CVA6ConfigF8En = 0;
20+
localparam CVA6ConfigFVecEn = 0;
21+
22+
localparam CVA6ConfigCvxifEn = 0;
23+
localparam CVA6ConfigCExtEn = 1;
24+
localparam CVA6ConfigZcbExtEn = 1;
25+
localparam CVA6ConfigZcmpExtEn = 0;
26+
localparam CVA6ConfigAExtEn = 1;
27+
localparam CVA6ConfigHExtEn = 1;
28+
localparam CVA6ConfigBExtEn = 0;
29+
localparam CVA6ConfigVExtEn = 0;
30+
localparam CVA6ConfigRVZiCond = 1;
31+
localparam CVA6ConfigSclicExtEn = 1;
32+
localparam CVA6ConfigXhclicExtEn = 1;
33+
34+
localparam CVA6ConfigAxiIdWidth = 4;
35+
localparam CVA6ConfigAxiAddrWidth = 48;
36+
localparam CVA6ConfigAxiDataWidth = 64;
37+
localparam CVA6ConfigFetchUserEn = 0;
38+
localparam CVA6ConfigFetchUserWidth = CVA6ConfigXlen;
39+
localparam CVA6ConfigDataUserEn = 0;
40+
localparam CVA6ConfigDataUserWidth = 1;
41+
42+
localparam CVA6ConfigIcacheByteSize = 16384;
43+
localparam CVA6ConfigIcacheSetAssoc = 4;
44+
localparam CVA6ConfigIcacheLineWidth = 128;
45+
localparam CVA6ConfigDcacheByteSize = 32768;
46+
localparam CVA6ConfigDcacheSetAssoc = 8;
47+
localparam CVA6ConfigDcacheLineWidth = 128;
48+
49+
localparam CVA6ConfigICacheSpmAddrBase = 56'h01A0_0000;
50+
localparam CVA6ConfigDCacheSpmAddrBase = 56'h0180_0000;
51+
52+
// do not flush Dcache for EVERY fence - dramatic performance impact
53+
// use RVZiCbom to synchronize caches with DMA devices instead
54+
// CAUTION - a configuration with CVA6ConfigDcacheFlushOnFence might be required for different SoCs, e.g., cache-coherent SMP configurations
55+
localparam CVA6ConfigDcacheFlushOnFence = 1'b0;
56+
localparam CVA6ConfigDcacheFlushOnFenceI = 1'b1;
57+
localparam CVA6ConfigDcacheInvalidateOnFlush = 1'b0;
58+
59+
localparam CVA6ConfigDcacheIdWidth = 1; // Must be >= $clog2(CVA6Cfg.NrLoadBufEntries)
60+
localparam CVA6ConfigMemTidWidth = CVA6ConfigAxiIdWidth;
61+
62+
localparam CVA6ConfigWtDcacheWbufDepth = 7;
63+
64+
localparam CVA6ConfigNrScoreboardEntries = 8;
65+
66+
localparam CVA6ConfigNrLoadPipeRegs = 1;
67+
localparam CVA6ConfigNrStorePipeRegs = 0;
68+
localparam CVA6ConfigNrLoadBufEntries = 2;
69+
70+
localparam CVA6ConfigRASDepth = 2;
71+
localparam CVA6ConfigBTBEntries = 32;
72+
localparam CVA6ConfigBHTEntries = 128;
73+
74+
localparam CVA6ConfigTvalEn = 1;
75+
76+
localparam CVA6ConfigNrPMPEntries = 8;
77+
78+
localparam CVA6ConfigPerfCounterEn = 1;
79+
80+
localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::HPDCACHE_WB;
81+
82+
localparam CVA6ConfigMmuPresent = 1;
83+
84+
localparam CVA6ConfigRvfiTrace = 1;
85+
86+
localparam config_pkg::cva6_user_cfg_t cva6_cfg = '{
87+
XLEN: unsigned'(CVA6ConfigXlen),
88+
VLEN: unsigned'(64),
89+
FpgaEn: bit'(0), // for Xilinx and Altera
90+
FpgaAlteraEn: bit'(0), // for Altera (only)
91+
TechnoCut: bit'(0),
92+
SuperscalarEn: bit'(0),
93+
ALUBypass: bit'(0),
94+
NrCommitPorts: unsigned'(2),
95+
AxiAddrWidth: unsigned'(CVA6ConfigAxiAddrWidth),
96+
AxiDataWidth: unsigned'(CVA6ConfigAxiDataWidth),
97+
AxiIdWidth: unsigned'(CVA6ConfigAxiIdWidth),
98+
AxiUserWidth: unsigned'(CVA6ConfigDataUserWidth),
99+
MemTidWidth: unsigned'(CVA6ConfigMemTidWidth),
100+
NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries),
101+
RVF: bit'(CVA6ConfigRVF),
102+
RVD: bit'(CVA6ConfigRVD),
103+
XF16: bit'(CVA6ConfigF16En),
104+
XF16ALT: bit'(CVA6ConfigF16AltEn),
105+
XF8: bit'(CVA6ConfigF8En),
106+
RVA: bit'(CVA6ConfigAExtEn),
107+
RVB: bit'(CVA6ConfigBExtEn),
108+
ZKN: bit'(0),
109+
RVV: bit'(CVA6ConfigVExtEn),
110+
RVC: bit'(CVA6ConfigCExtEn),
111+
RVH: bit'(CVA6ConfigHExtEn),
112+
RVZCB: bit'(CVA6ConfigZcbExtEn),
113+
RVZCMT: bit'(0),
114+
RVZCMP: bit'(CVA6ConfigZcmpExtEn),
115+
RVSCLIC: bit'(CVA6ConfigSclicExtEn),
116+
RVXHCLIC: bit'(CVA6ConfigXhclicExtEn),
117+
XFVec: bit'(CVA6ConfigFVecEn),
118+
CvxifEn: bit'(CVA6ConfigCvxifEn),
119+
CoproType: config_pkg::COPRO_NONE,
120+
RVZiCond: bit'(CVA6ConfigRVZiCond),
121+
RVZiCbom: bit'(0),
122+
RVZicntr: bit'(1),
123+
RVZihpm: bit'(1),
124+
NrScoreboardEntries: unsigned'(CVA6ConfigNrScoreboardEntries),
125+
PerfCounterEn: bit'(CVA6ConfigPerfCounterEn),
126+
MmuPresent: bit'(CVA6ConfigMmuPresent),
127+
RVS: bit'(1),
128+
RVU: bit'(1),
129+
SoftwareInterruptEn: bit'(1),
130+
HaltAddress: 64'h800,
131+
ExceptionAddress: 64'h808,
132+
RASDepth: unsigned'(CVA6ConfigRASDepth),
133+
BTBEntries: unsigned'(CVA6ConfigBTBEntries),
134+
BPType: config_pkg::BHT,
135+
BHTEntries: unsigned'(CVA6ConfigBHTEntries),
136+
BHTHist: unsigned'(3),
137+
DmBaseAddress: 64'h0,
138+
TvalEn: bit'(CVA6ConfigTvalEn),
139+
DirectVecOnly: bit'(0),
140+
NrPMPEntries: unsigned'(CVA6ConfigNrPMPEntries),
141+
PMPCfgRstVal: {64{64'h0}},
142+
PMPAddrRstVal: {64{64'h0}},
143+
PMPEntryReadOnly: 64'd0,
144+
PMPNapotEn: bit'(1),
145+
NOCType: config_pkg::NOC_TYPE_AXI4_ATOP,
146+
CLICNumInterruptSrc: unsigned'(256),
147+
NrNonIdempotentRules: unsigned'(2),
148+
NonIdempotentAddrBase: 1024'({64'b0, 64'b0}),
149+
NonIdempotentLength: 1024'({64'b0, 64'b0}),
150+
NrExecuteRegionRules: unsigned'(4),
151+
ExecuteRegionAddrBase: 1024'({64'h8000_0000, 64'(CVA6ConfigICacheSpmAddrBase), 64'h1_0000, 64'h0}),
152+
ExecuteRegionLength: 1024'({64'h40000000, 64'(CVA6ConfigIcacheByteSize), 64'h10000, 64'h1000}),
153+
NrCachedRegionRules: unsigned'(1),
154+
CachedRegionAddrBase: 1024'({64'h8000_0000}),
155+
CachedRegionLength: 1024'({64'h40000000}),
156+
MaxOutstandingStores: unsigned'(7),
157+
DebugEn: bit'(1),
158+
SDTRIG: bit'(0),
159+
Mcontrol6: bit'(0),
160+
Icount: bit'(0),
161+
Etrigger: bit'(0),
162+
Itrigger: bit'(0),
163+
AxiBurstWriteEn: bit'(0),
164+
IcacheByteSize: unsigned'(CVA6ConfigIcacheByteSize),
165+
IcacheSetAssoc: unsigned'(CVA6ConfigIcacheSetAssoc),
166+
IcacheLineWidth: unsigned'(CVA6ConfigIcacheLineWidth),
167+
ICacheSpmAddrBase: 56'(CVA6ConfigICacheSpmAddrBase),
168+
ICacheSpmLength: 56'(CVA6ConfigIcacheByteSize),
169+
DCacheSpmAddrBase: 56'(CVA6ConfigDCacheSpmAddrBase),
170+
DCacheSpmLength: 56'(CVA6ConfigDcacheByteSize),
171+
DCacheType: CVA6ConfigDcacheType,
172+
DcacheByteSize: unsigned'(CVA6ConfigDcacheByteSize),
173+
DcacheSetAssoc: unsigned'(CVA6ConfigDcacheSetAssoc),
174+
DcacheLineWidth: unsigned'(CVA6ConfigDcacheLineWidth),
175+
DcacheFlushOnFence: bit'(CVA6ConfigDcacheFlushOnFence),
176+
DcacheFlushOnFenceI: unsigned'(CVA6ConfigDcacheFlushOnFenceI),
177+
DcacheInvalidateOnFlush: bit'(CVA6ConfigDcacheInvalidateOnFlush),
178+
DataUserEn: unsigned'(CVA6ConfigDataUserEn),
179+
WtDcacheWbufDepth: int'(CVA6ConfigWtDcacheWbufDepth),
180+
FetchUserWidth: unsigned'(CVA6ConfigFetchUserWidth),
181+
FetchUserEn: unsigned'(CVA6ConfigFetchUserEn),
182+
InstrTlbEntries: int'(16),
183+
DataTlbEntries: int'(64),
184+
TlbColoring: bit'(1),
185+
NumTlbColors: int'(16),
186+
LockableTlbWays: int'(8),
187+
UseSharedTlb: bit'(0),
188+
SvnapotEn: bit'(0),
189+
SharedTlbDepth: int'(64),
190+
NrLoadPipeRegs: int'(CVA6ConfigNrLoadPipeRegs),
191+
NrStorePipeRegs: int'(CVA6ConfigNrStorePipeRegs),
192+
DcacheIdWidth: int'(CVA6ConfigDcacheIdWidth)
193+
};
194+
195+
endpackage
196+

0 commit comments

Comments
 (0)