Skip to content

Commit 4b6dbd3

Browse files
committed
hpdcache: point SRAM models to tc_sram
1 parent 31b4563 commit 4b6dbd3

2 files changed

Lines changed: 106 additions & 6 deletions

File tree

Bender.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,7 @@ sources:
234234
- core/cache_subsystem/hpdcache/rtl/src/utils/ecc/prim_secded_72_64_dec.sv
235235
- core/cache_subsystem/hpdcache/rtl/src/utils/ecc/prim_secded_72_64_enc.sv
236236
# HPDCache SRAM models
237-
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_1rw.sv
238-
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_ecc_1rw.sv
239-
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_wbyteenable_1rw.sv
240-
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_wbyteenable_ecc_1rw.sv
241-
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_wmask_1rw.sv
242-
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_wmask_ecc_1rw.sv
237+
- common/local/util/hpdcache_tc_sram.sv
243238

244239
# Physical Memory Protection
245240
- core/pmp/src/pmp.sv
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// Copyright 2022 ETH Zurich and University of Bologna.
2+
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
3+
// SPDX-License-Identifier: SHL-0.51
4+
//
5+
// Paul Scheffler <paulsc@iis.ee.ethz.ch>
6+
7+
// Wrappers mapping HPDcache SRAMs to PULP `tc_sram`.
8+
9+
/// SRAM with one R/W port and no write mask
10+
module hpdcache_sram_1rw #(
11+
parameter int unsigned ADDR_SIZE = 0,
12+
parameter int unsigned DATA_SIZE = 0,
13+
parameter int unsigned DEPTH = 2 ** ADDR_SIZE
14+
) (
15+
input logic clk,
16+
input logic rst_n,
17+
input logic cs,
18+
input logic we,
19+
input logic [ADDR_SIZE-1:0] addr,
20+
input logic [DATA_SIZE-1:0] wdata,
21+
output logic [DATA_SIZE-1:0] rdata
22+
);
23+
tc_sram #(
24+
.NumWords (DEPTH),
25+
.DataWidth(DATA_SIZE),
26+
.ByteWidth(DATA_SIZE),
27+
.NumPorts (1),
28+
.Latency (1)
29+
) i_tc_sram (
30+
.clk_i (clk),
31+
.rst_ni (rst_n),
32+
.req_i (cs),
33+
.we_i (we),
34+
.addr_i (addr),
35+
.wdata_i(wdata),
36+
.be_i (1'b1),
37+
.rdata_o(rdata)
38+
);
39+
endmodule
40+
41+
/// SRAM with one R/W port and per-byte write mask
42+
module hpdcache_sram_wbyteenable_1rw #(
43+
parameter int unsigned ADDR_SIZE = 0,
44+
parameter int unsigned DATA_SIZE = 0,
45+
parameter int unsigned DEPTH = 2 ** ADDR_SIZE
46+
) (
47+
input logic clk,
48+
input logic rst_n,
49+
input logic cs,
50+
input logic we,
51+
input logic [ ADDR_SIZE-1:0] addr,
52+
input logic [ DATA_SIZE-1:0] wdata,
53+
input logic [DATA_SIZE/8-1:0] wbyteenable,
54+
output logic [ DATA_SIZE-1:0] rdata
55+
);
56+
tc_sram #(
57+
.NumWords (DEPTH),
58+
.DataWidth(DATA_SIZE),
59+
.ByteWidth(8),
60+
.NumPorts (1),
61+
.Latency (1)
62+
) i_tc_sram (
63+
.clk_i (clk),
64+
.rst_ni (rst_n),
65+
.req_i (cs),
66+
.we_i (we),
67+
.addr_i (addr),
68+
.wdata_i(wdata),
69+
.be_i (wbyteenable),
70+
.rdata_o(rdata)
71+
);
72+
endmodule
73+
74+
/// SRAM with one R/W port and per-bit write mask
75+
module hpdcache_sram_wmask_1rw #(
76+
parameter int unsigned ADDR_SIZE = 0,
77+
parameter int unsigned DATA_SIZE = 0,
78+
parameter int unsigned DEPTH = 2 ** ADDR_SIZE
79+
) (
80+
input logic clk,
81+
input logic rst_n,
82+
input logic cs,
83+
input logic we,
84+
input logic [ADDR_SIZE-1:0] addr,
85+
input logic [DATA_SIZE-1:0] wdata,
86+
input logic [DATA_SIZE-1:0] wmask,
87+
output logic [DATA_SIZE-1:0] rdata
88+
);
89+
tc_sram #(
90+
.NumWords (DEPTH),
91+
.DataWidth(DATA_SIZE),
92+
.ByteWidth(1),
93+
.NumPorts (1),
94+
.Latency (1)
95+
) i_tc_sram (
96+
.clk_i (clk),
97+
.rst_ni (rst_n),
98+
.req_i (cs),
99+
.we_i (we),
100+
.addr_i (addr),
101+
.wdata_i(wdata),
102+
.be_i (wmask),
103+
.rdata_o(rdata)
104+
);
105+
endmodule

0 commit comments

Comments
 (0)