forked from aolofsson/oh
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoh_memory_sp.v
90 lines (79 loc) · 2.81 KB
/
oh_memory_sp.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//#############################################################################
//# Function: Single Port Memory #
//#############################################################################
//# Author: Andreas Olofsson #
//# License: MIT (see LICENSE file in OH! repository) #
//#############################################################################
module oh_memory_sp # (parameter DW = 104, // memory width
parameter DEPTH = 32, // memory depth
parameter MCW = 8, // repair/config width
parameter AW = $clog2(DEPTH) // address bus width
)
(// memory interface (single port)
input clk, // clock
input en, // memory access
input we, // write enable global signal
input [DW-1:0] wem, // write enable vector
input [AW-1:0] addr, // address
input [DW-1:0] din, // data input
output [DW-1:0] dout, // data output
// Power/repair (ASICs)
input vss, // common ground
input vdd, // periphery power rail
input vddm, // sram array power rail
input shutdown, // shutdown signal from always on domain
input [MCW-1:0] memconfig, // generic memory config
input [MCW-1:0] memrepair, // repair vector
// BIST interface (ASICs)
input bist_en, // bist enable
input bist_we, // write enable global signal
input [DW-1:0] bist_wem, // write enable vector
input [AW-1:0] bist_addr, // address
input [DW-1:0] bist_din // data input
);
localparam ASIC = `CFG_ASIC; // use ASIC lib
generate
if(ASIC)
begin : g0
asic_sram_sp #(.DW(DW),
.DEPTH(DEPTH),
.MCW(MCW))
sram_sp (// Outputs
.dout (dout[DW-1:0]),
// Inputs
.clk (clk),
.en (en),
.we (we),
.wem (wem[DW-1:0]),
.addr (addr[AW-1:0]),
.din (din[DW-1:0]),
.vdd (vdd),
.vddm (vddm),
.vss (vss),
.shutdown (shutdown),
.memconfig (memconfig[MCW-1:0]),
.memrepair (memrepair[MCW-1:0]),
.bist_en (bist_en),
.bist_we (bist_we),
.bist_wem (bist_wem[DW-1:0]),
.bist_addr (bist_addr[AW-1:0]),
.bist_din (bist_din[DW-1:0]));
end
else
begin : g0
oh_memory_ram #(.DW(DW),
.DEPTH(DEPTH))
sram_sp (//read port
.rd_dout (dout[DW-1:0]),
.rd_clk (clk),
.rd_addr (addr[AW-1:0]),
.rd_en (en & ~we),
//write port
.wr_clk (clk),
.wr_en (en & we),
.wr_addr (addr[AW-1:0]),
.wr_wem (wem[DW-1:0]),
.wr_din (din[DW-1:0]));
end
endgenerate
endmodule // oh_memory_sp