Skip to content

Commit e7e9de3

Browse files
committed
obi_icache_wrap: Propagate parameters from icache
1 parent 4362489 commit e7e9de3

File tree

2 files changed

+60
-34
lines changed

2 files changed

+60
-34
lines changed

src/obi_icache_wrap.sv

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
/// Unsupported: different line width, banks in L1, L0 not fully associative
1111
/// [SH_FETCH_DATA_WIDTH == Cache line width]
1212
/// [SH_NB_BANKS == 1]
13-
/// [PRI_NB_WAYS == L0_LINE_COUNT] -> here fully associative
13+
/// [PRI_NB_WAYS == L0LineCount] -> here fully associative
1414
/// [SH_CACHE_LINE == PRI_CACHE_LINE]
1515
/// NumFetchPorts = NB_CORES
16-
/// L0_LINE_COUNT = PRI_CACHE_SIZE/(bytes per line)
17-
/// LINE_WIDTH = X_CACHE_LINE * DATA_WIDTH -> Use >= 32*NB_CORES for optimal performance
18-
/// LINE_COUNT = SH_CACHE_SIZE/(bytes per line)
19-
/// WAY_COUNT = SH_NB_WAYS
16+
/// L0LineCount = PRI_CACHE_SIZE/(bytes per line)
17+
/// LineWidth = X_CACHE_LINE * DATA_WIDTH -> Use >= 32*NB_CORES for optimal performance
18+
/// LineCount = SH_CACHE_SIZE/(bytes per line)
19+
/// WayCount = SH_NB_WAYS
2020
/// FetchAddrWidth = FETCH_ADDR_WIDTH
2121
/// FetchDataWidth = PRI_FETCH_DATA_WIDTH
2222
/// AxiAddrWidth = AXI_ADDR
@@ -25,23 +25,47 @@ module obi_icache_wrap #(
2525
/// Number of request (fetch) ports
2626
parameter int NumFetchPorts = -1,
2727
/// L0 Cache Line Count
28-
parameter int L0_LINE_COUNT = -1,
28+
parameter int L0LineCount = -1,
2929
/// Cache Line Width
3030
/// For optimal performance, use >= 32*NumFetchPorts to allow execution of 32-bit instructions
3131
/// for each core before requiring another L0-L1 fetch.
32-
parameter int LINE_WIDTH = -1,
33-
/// The number of cache lines per set. Power of two; >= 2.
34-
parameter int LINE_COUNT = -1,
32+
parameter int LineWidth = -1,
33+
/// The number of cache lines per way. Power of two; >= 2.
34+
parameter int LineCount = -1,
3535
/// The set associativity of the cache. Power of two; >= 1.
36-
parameter int WAY_COUNT = 1,
36+
parameter int WayCount = 1,
3737
/// Fetch interface address width. Same as FILL_AW; >= 1.
3838
parameter int FetchAddrWidth = -1,
3939
/// Fetch interface data width. Power of two; >= 8.
4040
parameter int FetchDataWidth = -1,
41-
/// Fill interface address width. Same as FETCH_AW; >= 1.
41+
/// Fill interface address width. Same as FetchAddrWidth; >= 1.
4242
parameter int AxiAddrWidth = -1,
4343
/// Fill interface data width. Power of two; >= 8.
4444
parameter int AxiDataWidth = -1,
45+
/// Allow fetches to have priority over prefetches for L0 to L1
46+
parameter bit FetchPriority = 1'b1,
47+
/// Merge L0-L1 fetches if requesting the same address
48+
parameter bit MergeFetches = 1'b1,
49+
/// Serialize the L1 lookup (parallel tag/data lookup by default)
50+
parameter bit SerialLookup = 1'b1,
51+
/// Replace the L1 tag banks with latch-based SCM.
52+
parameter bit L1TagScm = 1'b1,
53+
/// Number of pending response beats for the L1 cache.
54+
parameter int unsigned NumAxiOutstanding = 4,
55+
/// This reduces area impact at the cost of
56+
/// increased hassle of having latches in
57+
/// the design.
58+
/// i_snitch_icache/gen_prefetcher*i_snitch_icache_l0/data*/Q
59+
parameter bit EarlyLatch = 1'b0,
60+
/// Tag width of the data determining logic, this can reduce the
61+
/// the critical path into the L0 cache when small. The trade-off
62+
/// is a higher miss-rate in case the smaller tag matches more
63+
/// tags. The tag must be smaller than the necessary L0 tag.
64+
/// If configured to `-1` the entire tag is used, effectively
65+
/// disabling this feature.
66+
parameter int L0EarlyTagWidth = -1,
67+
/// Operate L0 cache in slower clock-domain
68+
parameter bit IsoCrossing = 1,
4569
/// Configuration input types for memory cuts used in implementation.
4670
parameter type sram_cfg_data_t = logic,
4771
parameter type sram_cfg_tag_t = logic,
@@ -73,6 +97,7 @@ module obi_icache_wrap #(
7397
output axi_req_t axi_req_o,
7498
input axi_rsp_t axi_rsp_i
7599
);
100+
// AdapterType 1 is the only tested variant
76101
localparam int unsigned AdapterType = 1;
77102

78103
logic [NumFetchPorts-1:0] fetch_valid, fetch_ready, fetch_rerror;
@@ -192,26 +217,27 @@ module obi_icache_wrap #(
192217
end
193218

194219
snitch_icache #(
195-
.NR_FETCH_PORTS ( NumFetchPorts ),
196-
.L0_LINE_COUNT ( L0_LINE_COUNT ),
197-
.LINE_WIDTH ( LINE_WIDTH ),
198-
.LINE_COUNT ( LINE_COUNT ),
199-
.WAY_COUNT ( WAY_COUNT ),
200-
.FETCH_AW ( FetchAddrWidth ),
201-
.FETCH_DW ( FetchDataWidth ),
202-
.FILL_AW ( AxiAddrWidth ),
203-
.FILL_DW ( AxiDataWidth ),
204-
.FETCH_PRIORITY ( 1 ),
205-
.MERGE_FETCHES ( 1 ),
206-
.L1_TAG_SCM ( 1 ),
207-
.SERIAL_LOOKUP ( 1 ),
208-
.NUM_AXI_OUTSTANDING( 4 ),
209-
.EARLY_LATCH ( 0 ),
210-
.ISO_CROSSING ( 0 ),
211-
.sram_cfg_data_t ( sram_cfg_data_t ),
212-
.sram_cfg_tag_t ( sram_cfg_tag_t ),
213-
.axi_req_t ( axi_req_t ),
214-
.axi_rsp_t ( axi_rsp_t )
220+
.NR_FETCH_PORTS ( NumFetchPorts ),
221+
.L0_LINE_COUNT ( L0LineCount ),
222+
.LINE_WIDTH ( LineWidth ),
223+
.LINE_COUNT ( LineCount ),
224+
.WAY_COUNT ( WayCount ),
225+
.FETCH_AW ( FetchAddrWidth ),
226+
.FETCH_DW ( FetchDataWidth ),
227+
.FILL_AW ( AxiAddrWidth ),
228+
.FILL_DW ( AxiDataWidth ),
229+
.FETCH_PRIORITY ( FetchPriority ),
230+
.MERGE_FETCHES ( MergeFetches ),
231+
.SERIAL_LOOKUP ( SerialLookup ),
232+
.L1_TAG_SCM ( L1TagScm ),
233+
.NUM_AXI_OUTSTANDING( NumAxiOutstanding ),
234+
.EARLY_LATCH ( EarlyLatch ),
235+
.L0_EARLY_TAG_WIDTH ( L0EarlyTagWidth ),
236+
.ISO_CROSSING ( IsoCrossing ),
237+
.sram_cfg_data_t ( sram_cfg_data_t ),
238+
.sram_cfg_tag_t ( sram_cfg_tag_t ),
239+
.axi_req_t ( axi_req_t ),
240+
.axi_rsp_t ( axi_rsp_t )
215241
) i_snitch_icache (
216242
.clk_i,
217243
.clk_d2_i ( clk_i ),

src/snitch_icache.sv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ module snitch_icache import snitch_icache_pkg::*; #(
3131
/// Merge L0-L1 fetches if requesting the same address
3232
parameter bit MERGE_FETCHES = 1'b0,
3333
/// Serialize the L1 lookup (parallel tag/data lookup by default)
34-
parameter bit SERIAL_LOOKUP = 0,
34+
parameter bit SERIAL_LOOKUP = 1'b0,
3535
/// Replace the L1 tag banks with latch-based SCM.
36-
parameter bit L1_TAG_SCM = 0,
36+
parameter bit L1_TAG_SCM = 1'b0,
3737
/// Number of pending response beats for the L1 cache.
3838
parameter int unsigned NUM_AXI_OUTSTANDING = 2,
3939
/// This reduces area impact at the cost of
4040
/// increased hassle of having latches in
4141
/// the design.
4242
/// i_snitch_icache/gen_prefetcher*i_snitch_icache_l0/data*/Q
43-
parameter bit EARLY_LATCH = 0,
43+
parameter bit EARLY_LATCH = 1'b0,
4444
/// Tag width of the data determining logic, this can reduce the
4545
/// the critical path into the L0 cache when small. The trade-off
4646
/// is a higher miss-rate in case the smaller tag matches more

0 commit comments

Comments
 (0)