blob: b7731584bf00b32bc7b9aa38cdceb789dfc8e807 [file] [log] [blame]
Manar14f7ca02020-10-30 11:58:16 +02001
2/* User area has R/W access for USER_BLOCKS and RO access for MGMT_BLOCKS
3 Management area has R/W access for MGMT_BLOCKS and RO access for USER_BLOCKS */
4
5module storage #(
6 parameter USER_BLOCKS = 4, // R/W access
7 parameter MGMT_BLOCKS = 2 // R/W access
8) (
9 // MGMT_AREA R/W Interface (MGMT_BLOCKS)
10 input mgmt_clk,
11 input [MGMT_BLOCKS-1:0] mgmt_ena,
12 input [MGMT_BLOCKS-1:0] mgmt_wen, // not shared
13 input [(MGMT_BLOCKS*4)-1:0] mgmt_wen_mask, // not shared
14 input [7:0] mgmt_addr,
15 input [31:0] mgmt_wdata,
16 output [(MGMT_BLOCKS*32)-1:0] mgmt_rdata,
17
18 // MGMT_AREA RO Interface (USER_BLOCKS)
19 input [USER_BLOCKS-1:0] mgmt_user_ena,
20 input [7:0] mgmt_user_addr,
21 output [(USER_BLOCKS*32)-1:0] mgmt_user_rdata,
22
23 // USER_AREA R/W Interface (USER_BLOCKS)
24 input user_clk,
25 input [USER_BLOCKS-1:0] user_ena,
26 input [USER_BLOCKS-1:0] user_wen,
27 input [(USER_BLOCKS*4)-1:0] user_wen_mask,
28 input [7:0] user_addr,
29 input [31:0] user_wdata,
30 output [(USER_BLOCKS*32)-1:0] user_rdata,
31
32 // USER_AREA RO Interface (MGMT_BLOCS)
33 input [MGMT_BLOCKS-1:0] user_mgmt_ena,
34 input [7:0] user_mgmt_addr,
35 output [(MGMT_BLOCKS*32)-1:0] user_mgmt_rdata
36);
37
38 sram_1rw1r_32_256_8_sky130 SRAM_0 [MGMT_BLOCKS-1:0] (
39 // MGMT R/W port
40 .clk0(mgmt_clk),
41 .csb0(mgmt_ena),
42 .web0(mgmt_wen),
43 .wmask0(mgmt_wen_mask),
44 .addr0(mgmt_addr[7:0]),
45 .din0(mgmt_wdata),
46 .dout0(mgmt_rdata),
47 // User RO port
48 .clk1(user_clk),
49 .csb1(user_mgmt_ena),
50 .addr1(user_mgmt_addr),
51 .dout1(user_mgmt_rdata)
52 );
53
54 sram_1rw1r_32_256_8_sky130 SRAM_1 [USER_BLOCKS-1:0](
55 // User R/W port
56 .clk0(user_clk),
57 .csb0(user_ena),
58 .web0(user_wen),
59 .wmask0(user_wen_mask),
60 .addr0(user_addr),
61 .din0(user_wdata),
62 .dout0(user_rdata),
63 // MGMT RO port
64 .clk1(mgmt_clk),
65 .csb1(mgmt_user_ena),
66 .addr1(mgmt_user_addr),
67 .dout1(mgmt_user_rdata)
68 );
69
70endmodule