1 |
266 |
lampret |
// $Header: /home/marcus/revision_ctrl_test/oc_cvs/cvs/or1k/mp3/lib/xilinx/unisims/RAMB4_S8.v,v 1.1.1.1 2001-11-04 19:00:00 lampret Exp $
|
2 |
|
|
|
3 |
|
|
/*
|
4 |
|
|
|
5 |
|
|
FUNCTION : 4x8 Block RAM with synchronous write capability
|
6 |
|
|
|
7 |
|
|
*/
|
8 |
|
|
|
9 |
|
|
`timescale 100 ps / 10 ps
|
10 |
|
|
|
11 |
|
|
`celldefine
|
12 |
|
|
|
13 |
|
|
module RAMB4_S8 (DO, ADDR, DI, EN, CLK, WE, RST);
|
14 |
|
|
|
15 |
|
|
parameter cds_action = "ignore";
|
16 |
|
|
|
17 |
|
|
parameter INIT_00 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
18 |
|
|
parameter INIT_01 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
19 |
|
|
parameter INIT_02 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
20 |
|
|
parameter INIT_03 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
21 |
|
|
parameter INIT_04 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
22 |
|
|
parameter INIT_05 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
23 |
|
|
parameter INIT_06 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
24 |
|
|
parameter INIT_07 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
25 |
|
|
parameter INIT_08 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
26 |
|
|
parameter INIT_09 = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
27 |
|
|
parameter INIT_0A = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
28 |
|
|
parameter INIT_0B = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
29 |
|
|
parameter INIT_0C = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
30 |
|
|
parameter INIT_0D = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
31 |
|
|
parameter INIT_0E = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
32 |
|
|
parameter INIT_0F = 256'h0000000000000000000000000000000000000000000000000000000000000000;
|
33 |
|
|
|
34 |
|
|
output [7:0] DO;
|
35 |
|
|
reg d0_out, d1_out, d2_out, d3_out, d4_out, d5_out, d6_out, d7_out;
|
36 |
|
|
|
37 |
|
|
input [8:0] ADDR;
|
38 |
|
|
input [7:0] DI;
|
39 |
|
|
input EN, CLK, WE, RST;
|
40 |
|
|
|
41 |
|
|
reg [4095:0] mem;
|
42 |
|
|
reg [8:0] count;
|
43 |
|
|
|
44 |
|
|
wire [8:0] addr_int;
|
45 |
|
|
wire [7:0] di_int;
|
46 |
|
|
wire en_int, clk_int, we_int, rst_int;
|
47 |
|
|
|
48 |
|
|
tri0 GSR = glbl.GSR;
|
49 |
|
|
|
50 |
|
|
always @(GSR)
|
51 |
|
|
if (GSR)
|
52 |
|
|
begin
|
53 |
|
|
assign d0_out = 0;
|
54 |
|
|
assign d1_out = 0;
|
55 |
|
|
assign d2_out = 0;
|
56 |
|
|
assign d3_out = 0;
|
57 |
|
|
assign d4_out = 0;
|
58 |
|
|
assign d5_out = 0;
|
59 |
|
|
assign d6_out = 0;
|
60 |
|
|
assign d7_out = 0;
|
61 |
|
|
end
|
62 |
|
|
else
|
63 |
|
|
begin
|
64 |
|
|
deassign d0_out;
|
65 |
|
|
deassign d1_out;
|
66 |
|
|
deassign d2_out;
|
67 |
|
|
deassign d3_out;
|
68 |
|
|
deassign d4_out;
|
69 |
|
|
deassign d5_out;
|
70 |
|
|
deassign d6_out;
|
71 |
|
|
deassign d7_out;
|
72 |
|
|
end
|
73 |
|
|
|
74 |
|
|
buf b_do_out0 (DO[0], d0_out);
|
75 |
|
|
buf b_do_out1 (DO[1], d1_out);
|
76 |
|
|
buf b_do_out2 (DO[2], d2_out);
|
77 |
|
|
buf b_do_out3 (DO[3], d3_out);
|
78 |
|
|
buf b_do_out4 (DO[4], d4_out);
|
79 |
|
|
buf b_do_out5 (DO[5], d5_out);
|
80 |
|
|
buf b_do_out6 (DO[6], d6_out);
|
81 |
|
|
buf b_do_out7 (DO[7], d7_out);
|
82 |
|
|
buf b_addr_0 (addr_int[0], ADDR[0]);
|
83 |
|
|
buf b_addr_1 (addr_int[1], ADDR[1]);
|
84 |
|
|
buf b_addr_2 (addr_int[2], ADDR[2]);
|
85 |
|
|
buf b_addr_3 (addr_int[3], ADDR[3]);
|
86 |
|
|
buf b_addr_4 (addr_int[4], ADDR[4]);
|
87 |
|
|
buf b_addr_5 (addr_int[5], ADDR[5]);
|
88 |
|
|
buf b_addr_6 (addr_int[6], ADDR[6]);
|
89 |
|
|
buf b_addr_7 (addr_int[7], ADDR[7]);
|
90 |
|
|
buf b_addr_8 (addr_int[8], ADDR[8]);
|
91 |
|
|
buf b_di_0 (di_int[0], DI[0]);
|
92 |
|
|
buf b_di_1 (di_int[1], DI[1]);
|
93 |
|
|
buf b_di_2 (di_int[2], DI[2]);
|
94 |
|
|
buf b_di_3 (di_int[3], DI[3]);
|
95 |
|
|
buf b_di_4 (di_int[4], DI[4]);
|
96 |
|
|
buf b_di_5 (di_int[5], DI[5]);
|
97 |
|
|
buf b_di_6 (di_int[6], DI[6]);
|
98 |
|
|
buf b_di_7 (di_int[7], DI[7]);
|
99 |
|
|
buf b_en (en_int, EN);
|
100 |
|
|
buf b_clk (clk_int, CLK);
|
101 |
|
|
buf b_we (we_int, WE);
|
102 |
|
|
buf b_rst (rst_int, RST);
|
103 |
|
|
|
104 |
|
|
initial
|
105 |
|
|
begin
|
106 |
|
|
for (count = 0; count < 256; count = count + 1)
|
107 |
|
|
begin
|
108 |
|
|
mem[count] <= INIT_00[count];
|
109 |
|
|
mem[256 * 1 + count] <= INIT_01[count];
|
110 |
|
|
mem[256 * 2 + count] <= INIT_02[count];
|
111 |
|
|
mem[256 * 3 + count] <= INIT_03[count];
|
112 |
|
|
mem[256 * 4 + count] <= INIT_04[count];
|
113 |
|
|
mem[256 * 5 + count] <= INIT_05[count];
|
114 |
|
|
mem[256 * 6 + count] <= INIT_06[count];
|
115 |
|
|
mem[256 * 7 + count] <= INIT_07[count];
|
116 |
|
|
mem[256 * 8 + count] <= INIT_08[count];
|
117 |
|
|
mem[256 * 9 + count] <= INIT_09[count];
|
118 |
|
|
mem[256 * 10 + count] <= INIT_0A[count];
|
119 |
|
|
mem[256 * 11 + count] <= INIT_0B[count];
|
120 |
|
|
mem[256 * 12 + count] <= INIT_0C[count];
|
121 |
|
|
mem[256 * 13 + count] <= INIT_0D[count];
|
122 |
|
|
mem[256 * 14 + count] <= INIT_0E[count];
|
123 |
|
|
mem[256 * 15 + count] <= INIT_0F[count];
|
124 |
|
|
end
|
125 |
|
|
end
|
126 |
|
|
|
127 |
|
|
always @(posedge clk_int)
|
128 |
|
|
begin
|
129 |
|
|
if (en_int == 1'b1)
|
130 |
|
|
if (rst_int == 1'b1)
|
131 |
|
|
begin
|
132 |
|
|
d0_out <= 0;
|
133 |
|
|
d1_out <= 0;
|
134 |
|
|
d2_out <= 0;
|
135 |
|
|
d3_out <= 0;
|
136 |
|
|
d4_out <= 0;
|
137 |
|
|
d5_out <= 0;
|
138 |
|
|
d6_out <= 0;
|
139 |
|
|
d7_out <= 0;
|
140 |
|
|
end
|
141 |
|
|
else
|
142 |
|
|
if (we_int == 1'b1)
|
143 |
|
|
begin
|
144 |
|
|
d0_out <= di_int[0];
|
145 |
|
|
d1_out <= di_int[1];
|
146 |
|
|
d2_out <= di_int[2];
|
147 |
|
|
d3_out <= di_int[3];
|
148 |
|
|
d4_out <= di_int[4];
|
149 |
|
|
d5_out <= di_int[5];
|
150 |
|
|
d6_out <= di_int[6];
|
151 |
|
|
d7_out <= di_int[7];
|
152 |
|
|
end
|
153 |
|
|
else
|
154 |
|
|
begin
|
155 |
|
|
d0_out <= mem[addr_int * 8];
|
156 |
|
|
d1_out <= mem[addr_int * 8 + 1];
|
157 |
|
|
d2_out <= mem[addr_int * 8 + 2];
|
158 |
|
|
d3_out <= mem[addr_int * 8 + 3];
|
159 |
|
|
d4_out <= mem[addr_int * 8 + 4];
|
160 |
|
|
d5_out <= mem[addr_int * 8 + 5];
|
161 |
|
|
d6_out <= mem[addr_int * 8 + 6];
|
162 |
|
|
d7_out <= mem[addr_int * 8 + 7];
|
163 |
|
|
end
|
164 |
|
|
end
|
165 |
|
|
|
166 |
|
|
always @(posedge clk_int)
|
167 |
|
|
begin
|
168 |
|
|
if (en_int == 1'b1 && we_int == 1'b1)
|
169 |
|
|
begin
|
170 |
|
|
mem[addr_int * 8] <= di_int[0];
|
171 |
|
|
mem[addr_int * 8 + 1] <= di_int[1];
|
172 |
|
|
mem[addr_int * 8 + 2] <= di_int[2];
|
173 |
|
|
mem[addr_int * 8 + 3] <= di_int[3];
|
174 |
|
|
mem[addr_int * 8 + 4] <= di_int[4];
|
175 |
|
|
mem[addr_int * 8 + 5] <= di_int[5];
|
176 |
|
|
mem[addr_int * 8 + 6] <= di_int[6];
|
177 |
|
|
mem[addr_int * 8 + 7] <= di_int[7];
|
178 |
|
|
end
|
179 |
|
|
end
|
180 |
|
|
|
181 |
|
|
specify
|
182 |
|
|
(CLK => DO) = (1, 1);
|
183 |
|
|
endspecify
|
184 |
|
|
|
185 |
|
|
endmodule
|
186 |
|
|
|
187 |
|
|
`endcelldefine
|