1 |
2 |
dimamali |
--***************************************************************************************
|
2 |
|
|
--
|
3 |
|
|
-- File Name: CY7C1380_PL_SCD.vhd
|
4 |
|
|
-- Version: 1.0
|
5 |
|
|
-- Date: December 22nd, 2004
|
6 |
|
|
-- Model: BUS Functional
|
7 |
|
|
-- Simulator: Modelsim
|
8 |
|
|
--
|
9 |
|
|
--
|
10 |
|
|
-- Queries: MPD Applications
|
11 |
|
|
-- Website: www.cypress.com/support
|
12 |
|
|
-- Company: Cypress Semiconductor
|
13 |
|
|
-- Part #: CY7C1380D (512K x 36)
|
14 |
|
|
--
|
15 |
|
|
-- Description: Cypress 18Mb Synburst SRAM (Pipelined SCD)
|
16 |
|
|
--
|
17 |
|
|
--
|
18 |
|
|
-- Disclaimer: THESE DESIGNS ARE PROVIDED "AS IS" WITH NO WARRANTY
|
19 |
|
|
-- WHATSOEVER AND CYPRESS SPECIFICALLY DISCLAIMS ANY
|
20 |
|
|
-- IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
|
21 |
|
|
-- A PARTICULAR PURPOSE, OR AGAINST INFRINGEMENT.
|
22 |
|
|
--
|
23 |
|
|
-- Copyright(c) Cypress Semiconductor, 2004
|
24 |
|
|
-- All rights reserved
|
25 |
|
|
--
|
26 |
|
|
-- Rev Date Changes
|
27 |
|
|
-- --- ---------- ---------------------------------------
|
28 |
|
|
-- 1.0 12/22/2004 - New Model
|
29 |
|
|
-- - New Test Bench
|
30 |
|
|
-- - New Test Vectors
|
31 |
|
|
--
|
32 |
|
|
--***************************************************************************************
|
33 |
|
|
|
34 |
|
|
-- Timings for Different Speed Bins (sb): 250MHz, 225MHz, 200MHz, 167MHz, 133MHz
|
35 |
|
|
|
36 |
|
|
LIBRARY ieee, grlib, gaisler, work;
|
37 |
|
|
USE ieee.std_logic_1164.all;
|
38 |
|
|
-- USE ieee.std_logic_unsigned.all;
|
39 |
|
|
-- Use IEEE.Std_Logic_Arith.all;
|
40 |
|
|
USE work.package_utility.all;
|
41 |
|
|
use grlib.stdlib.all;
|
42 |
|
|
use ieee.std_logic_1164.all;
|
43 |
|
|
use std.textio.all;
|
44 |
|
|
use gaisler.sim.all;
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
entity CY7C1380D is
|
48 |
|
|
|
49 |
|
|
GENERIC (
|
50 |
|
|
fname : string := "prom.srec"; -- File to read from
|
51 |
|
|
-- Constant Parameters
|
52 |
|
|
addr_bits : INTEGER := 19; -- This is external address
|
53 |
|
|
data_bits : INTEGER := 36;
|
54 |
|
|
|
55 |
|
|
--Clock timings for 250Mhz
|
56 |
|
|
Cyp_tCO : TIME := 2.6 ns; -- Data Output Valid After CLK Rise
|
57 |
|
|
|
58 |
|
|
Cyp_tCYC : TIME := 4.0 ns; -- Clock cycle time
|
59 |
|
|
Cyp_tCH : TIME := 1.7 ns; -- Clock HIGH time
|
60 |
|
|
Cyp_tCL : TIME := 1.7 ns; -- Clock LOW time
|
61 |
|
|
|
62 |
|
|
Cyp_tCHZ : TIME := 2.6 ns; -- Clock to High-Z
|
63 |
|
|
Cyp_tCLZ : TIME := 1.0 ns; -- Clock to Low-Z
|
64 |
|
|
Cyp_tOEHZ : TIME := 2.6 ns; -- OE# HIGH to Output High-Z
|
65 |
|
|
Cyp_tOELZ : TIME := 0.0 ns; -- OE# LOW to Output Low-Z
|
66 |
|
|
Cyp_tOEV : TIME := 2.6 ns; -- OE# LOW to Output Valid
|
67 |
|
|
|
68 |
|
|
Cyp_tAS : TIME := 1.2 ns; -- Address Set-up Before CLK Rise
|
69 |
|
|
Cyp_tADS : TIME := 1.2 ns; -- ADSC#, ADSP# Set-up Before CLK Rise
|
70 |
|
|
Cyp_tADVS : TIME := 1.2 ns; -- ADV# Set-up Before CLK Rise
|
71 |
|
|
Cyp_tWES : TIME := 1.2 ns; -- BWx#, GW#, BWE# Set-up Before CLK Rise
|
72 |
|
|
Cyp_tDS : TIME := 1.2 ns; -- Data Input Set-up Before CLK Rise
|
73 |
|
|
Cyp_tCES : TIME := 1.2 ns; -- Chip Enable Set-up
|
74 |
|
|
|
75 |
|
|
Cyp_tAH : TIME := 0.3 ns; -- Address Hold After CLK Rise
|
76 |
|
|
Cyp_tADH : TIME := 0.3 ns; -- ADSC#, ADSP# Hold After CLK Rise
|
77 |
|
|
Cyp_tADVH : TIME := 0.3 ns; -- ADV# Hold After CLK Rise
|
78 |
|
|
Cyp_tWEH : TIME := 0.3 ns; -- BWx#, GW#, BWE# Hold After CLK Rise
|
79 |
|
|
Cyp_tDH : TIME := 0.3 ns; -- Data Input Hold After CLK Rise
|
80 |
|
|
Cyp_tCEH : TIME := 0.3 ns -- Chip Enable Hold After CLK Rise
|
81 |
|
|
|
82 |
|
|
--Clock timings for 225Mhz
|
83 |
|
|
-- Cyp_tCO : TIME := 2.8 ns; -- Data Output Valid After CLK Rise
|
84 |
|
|
|
85 |
|
|
-- Cyp_tCYC : TIME := 4.4 ns; -- Clock cycle time
|
86 |
|
|
-- Cyp_tCH : TIME := 2.0 ns; -- Clock HIGH time
|
87 |
|
|
-- Cyp_tCL : TIME := 2.0 ns; -- Clock LOW time
|
88 |
|
|
|
89 |
|
|
-- Cyp_tCHZ : TIME := 2.8 ns; -- Clock to High-Z
|
90 |
|
|
-- Cyp_tCLZ : TIME := 1.0 ns; -- Clock to Low-Z
|
91 |
|
|
-- Cyp_tOEHZ: TIME := 2.8 ns; -- OE# HIGH to Output High-Z
|
92 |
|
|
-- Cyp_tOELZ: TIME := 0.0 ns; -- OE# LOW to Output Low-Z
|
93 |
|
|
-- Cyp_tOEV : TIME := 2.8 ns; -- OE# LOW to Output Valid
|
94 |
|
|
|
95 |
|
|
-- Cyp_tAS : TIME := 1.4 ns; -- Address Set-up Before CLK Rise
|
96 |
|
|
-- Cyp_tADS : TIME := 1.4 ns; -- ADSC#, ADSP# Set-up Before CLK Rise
|
97 |
|
|
-- Cyp_tADVS: TIME := 1.4 ns; -- ADV# Set-up Before CLK Rise
|
98 |
|
|
-- Cyp_tWES : TIME := 1.4 ns; -- BWx#, GW#, BWE# Set-up Before CLK Rise
|
99 |
|
|
-- Cyp_tDS : TIME := 1.4 ns; -- Data Input Set-up Before CLK Rise
|
100 |
|
|
-- Cyp_tCES : TIME := 1.4 ns; -- Chip Enable Set-up
|
101 |
|
|
|
102 |
|
|
-- Cyp_tAH : TIME := 0.4 ns; -- Address Hold After CLK Rise
|
103 |
|
|
-- Cyp_tADH : TIME := 0.4 ns; -- ADSC#, ADSP# Hold After CLK Rise
|
104 |
|
|
-- Cyp_tADVH: TIME := 0.4 ns; -- ADV# Hold After CLK Rise
|
105 |
|
|
-- Cyp_tWEH : TIME := 0.4 ns; -- BWx#, GW#, BWE# Hold After CLK Rise
|
106 |
|
|
-- Cyp_tDH : TIME := 0.4 ns; -- Data Input Hold After CLK Rise
|
107 |
|
|
-- Cyp_tCEH : TIME := 0.4 ns -- Chip Enable Hold After CLK Rise
|
108 |
|
|
|
109 |
|
|
--Clock timings for 200Mhz
|
110 |
|
|
-- Cyp_tCO : TIME := 3.0 ns; -- Data Output Valid After CLK Rise
|
111 |
|
|
|
112 |
|
|
-- Cyp_tCYC : TIME := 5.0 ns; -- Clock cycle time
|
113 |
|
|
-- Cyp_tCH : TIME := 2.0 ns; -- Clock HIGH time
|
114 |
|
|
-- Cyp_tCL : TIME := 2.0 ns; -- Clock LOW time
|
115 |
|
|
|
116 |
|
|
-- Cyp_tCHZ : TIME := 3.0 ns; -- Clock to High-Z
|
117 |
|
|
-- Cyp_tCLZ : TIME := 1.3 ns; -- Clock to Low-Z
|
118 |
|
|
-- Cyp_tOEHZ: TIME := 3.0 ns; -- OE# HIGH to Output High-Z
|
119 |
|
|
-- Cyp_tOELZ: TIME := 0.0 ns; -- OE# LOW to Output Low-Z
|
120 |
|
|
-- Cyp_tOEV : TIME := 3.0 ns; -- OE# LOW to Output Valid
|
121 |
|
|
|
122 |
|
|
-- Cyp_tAS : TIME := 1.4 ns; -- Address Set-up Before CLK Rise
|
123 |
|
|
-- Cyp_tADS : TIME := 1.4 ns; -- ADSC#, ADSP# Set-up Before CLK Rise
|
124 |
|
|
-- Cyp_tADVS: TIME := 1.4 ns; -- ADV# Set-up Before CLK Rise
|
125 |
|
|
-- Cyp_tWES : TIME := 1.4 ns; -- BWx#, GW#, BWE# Set-up Before CLK Rise
|
126 |
|
|
-- Cyp_tDS : TIME := 1.4 ns; -- Data Input Set-up Before CLK Rise
|
127 |
|
|
-- Cyp_tCES : TIME := 1.4 ns; -- Chip Enable Set-up
|
128 |
|
|
|
129 |
|
|
-- Cyp_tAH : TIME := 0.4 ns; -- Address Hold After CLK Rise
|
130 |
|
|
-- Cyp_tADH : TIME := 0.4 ns; -- ADSC#, ADSP# Hold After CLK Rise
|
131 |
|
|
-- Cyp_tADVH: TIME := 0.4 ns; -- ADV# Hold After CLK Rise
|
132 |
|
|
-- Cyp_tWEH : TIME := 0.4 ns; -- BWx#, GW#, BWE# Hold After CLK Rise
|
133 |
|
|
-- Cyp_tDH : TIME := 0.4 ns; -- Data Input Hold After CLK Rise
|
134 |
|
|
-- Cyp_tCEH : TIME := 0.4 ns -- Chip Enable Hold After CLK Rise
|
135 |
|
|
|
136 |
|
|
--Clock timings for 167Mhz
|
137 |
|
|
-- Cyp_tCO : TIME := 3.4 ns; -- Data Output Valid After CLK Rise
|
138 |
|
|
|
139 |
|
|
-- Cyp_tCYC : TIME := 6.0 ns; -- Clock cycle time
|
140 |
|
|
-- Cyp_tCH : TIME := 2.2 ns; -- Clock HIGH time
|
141 |
|
|
-- Cyp_tCL : TIME := 2.2 ns; -- Clock LOW time
|
142 |
|
|
|
143 |
|
|
-- Cyp_tCHZ : TIME := 3.4 ns; -- Clock to High-Z
|
144 |
|
|
-- Cyp_tCLZ : TIME := 1.3 ns; -- Clock to Low-Z
|
145 |
|
|
-- Cyp_tOEHZ: TIME := 3.4 ns; -- OE# HIGH to Output High-Z
|
146 |
|
|
-- Cyp_tOELZ: TIME := 0.0 ns; -- OE# LOW to Output Low-Z
|
147 |
|
|
-- Cyp_tOEV : TIME := 3.4 ns; -- OE# LOW to Output Valid
|
148 |
|
|
|
149 |
|
|
-- Cyp_tAS : TIME := 1.5 ns; -- Address Set-up Before CLK Rise
|
150 |
|
|
-- Cyp_tADS : TIME := 1.5 ns; -- ADSC#, ADSP# Set-up Before CLK Rise
|
151 |
|
|
-- Cyp_tADVS: TIME := 1.5 ns; -- ADV# Set-up Before CLK Rise
|
152 |
|
|
-- Cyp_tWES : TIME := 1.5 ns; -- BWx#, GW#, BWE# Set-up Before CLK Rise
|
153 |
|
|
-- Cyp_tDS : TIME := 1.5 ns; -- Data Input Set-up Before CLK Rise
|
154 |
|
|
-- Cyp_tCES : TIME := 1.5 ns; -- Chip Enable Set-up
|
155 |
|
|
|
156 |
|
|
-- Cyp_tAH : TIME := 0.5 ns; -- Address Hold After CLK Rise
|
157 |
|
|
-- Cyp_tADH : TIME := 0.5 ns; -- ADSC#, ADSP# Hold After CLK Rise
|
158 |
|
|
-- Cyp_tADVH: TIME := 0.5 ns; -- ADV# Hold After CLK Rise
|
159 |
|
|
-- Cyp_tWEH : TIME := 0.5 ns; -- BWx#, GW#, BWE# Hold After CLK Rise
|
160 |
|
|
-- Cyp_tDH : TIME := 0.5 ns; -- Data Input Hold After CLK Rise
|
161 |
|
|
-- Cyp_tCEH : TIME := 0.5 ns -- Chip Enable Hold After CLK Rise
|
162 |
|
|
|
163 |
|
|
--Clock timings for 133Mhz
|
164 |
|
|
-- Cyp_tCO : TIME := 4.2 ns; -- Data Output Valid After CLK Rise
|
165 |
|
|
|
166 |
|
|
-- Cyp_tCYC : TIME := 7.5 ns; -- Clock cycle time
|
167 |
|
|
-- Cyp_tCH : TIME := 2.5 ns; -- Clock HIGH time
|
168 |
|
|
-- Cyp_tCL : TIME := 2.5 ns; -- Clock LOW time
|
169 |
|
|
|
170 |
|
|
-- Cyp_tCHZ : TIME := 3.4 ns; -- Clock to High-Z
|
171 |
|
|
-- Cyp_tCLZ : TIME := 1.3 ns; -- Clock to Low-Z
|
172 |
|
|
-- Cyp_tOEHZ: TIME := 4.0 ns; -- OE# HIGH to Output High-Z
|
173 |
|
|
-- Cyp_tOELZ: TIME := 0.0 ns; -- OE# LOW to Output Low-Z
|
174 |
|
|
-- Cyp_tOEV : TIME := 4.2 ns; -- OE# LOW to Output Valid
|
175 |
|
|
|
176 |
|
|
-- Cyp_tAS : TIME := 1.5 ns; -- Address Set-up Before CLK Rise
|
177 |
|
|
-- Cyp_tADS : TIME := 1.5 ns; -- ADSC#, ADSP# Set-up Before CLK Rise
|
178 |
|
|
-- Cyp_tADVS: TIME := 1.5 ns; -- ADV# Set-up Before CLK Rise
|
179 |
|
|
-- Cyp_tWES : TIME := 1.5 ns; -- BWx#, GW#, BWE# Set-up Before CLK Rise
|
180 |
|
|
-- Cyp_tDS : TIME := 1.5 ns; -- Data Input Set-up Before CLK Rise
|
181 |
|
|
-- Cyp_tCES : TIME := 1.5 ns; -- Chip Enable Set-up
|
182 |
|
|
|
183 |
|
|
-- Cyp_tAH : TIME := 0.5 ns; -- Address Hold After CLK Rise
|
184 |
|
|
-- Cyp_tADH : TIME := 0.5 ns; -- ADSC#, ADSP# Hold After CLK Rise
|
185 |
|
|
-- Cyp_tADVH: TIME := 0.5 ns; -- ADV# Hold After CLK Rise
|
186 |
|
|
-- Cyp_tWEH : TIME := 0.5 ns; -- BWx#, GW#, BWE# Hold After CLK Rise
|
187 |
|
|
-- Cyp_tDH : TIME := 0.5 ns; -- Data Input Hold After CLK Rise
|
188 |
|
|
-- Cyp_tCEH : TIME := 0.5 ns -- Chip Enable Hold After CLK Rise
|
189 |
|
|
);
|
190 |
|
|
PORT (iZZ : IN STD_LOGIC;
|
191 |
|
|
iMode : IN STD_LOGIC;
|
192 |
|
|
iADDR : IN STD_LOGIC_VECTOR ((addr_bits -1) downto 0);
|
193 |
|
|
inGW : IN STD_LOGIC;
|
194 |
|
|
inBWE : IN STD_LOGIC;
|
195 |
|
|
inBWd : IN STD_LOGIC;
|
196 |
|
|
inBWc : IN STD_LOGIC;
|
197 |
|
|
inBWb : IN STD_LOGIC;
|
198 |
|
|
inBWa : IN STD_LOGIC;
|
199 |
|
|
inCE1 : IN STD_LOGIC;
|
200 |
|
|
iCE2 : IN STD_LOGIC;
|
201 |
|
|
inCE3 : IN STD_LOGIC;
|
202 |
|
|
inADSP : IN STD_LOGIC;
|
203 |
|
|
inADSC : IN STD_LOGIC;
|
204 |
|
|
inADV : IN STD_LOGIC;
|
205 |
|
|
inOE : IN STD_LOGIC;
|
206 |
|
|
ioDQ : INOUT STD_LOGIC_VECTOR ((data_bits-1) downto 0);
|
207 |
|
|
iCLK : IN STD_LOGIC);
|
208 |
|
|
|
209 |
|
|
end CY7C1380D;
|
210 |
|
|
ARCHITECTURE CY7C1380D_arch OF CY7C1380D IS
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
signal Read_reg_o1, Read_reg1 : STD_LOGIC;
|
215 |
|
|
signal WrN_reg1 : STD_LOGIC;
|
216 |
|
|
signal ADSP_N_o : STD_LOGIC;
|
217 |
|
|
signal pipe_reg1, ce_reg1,pcsr_write1, ctlr_write1 : STD_LOGIC;
|
218 |
|
|
signal Sys_clk : STD_LOGIC := '0';
|
219 |
|
|
signal test : STD_LOGIC;
|
220 |
|
|
signal dout, din1 : STD_LOGIC_VECTOR (data_bits-1 downto 0);
|
221 |
|
|
signal ce : STD_LOGIC;
|
222 |
|
|
signal Write_n : STD_LOGIC;
|
223 |
|
|
signal Read : STD_LOGIC;
|
224 |
|
|
|
225 |
|
|
signal bwa_n1 : STD_LOGIC;
|
226 |
|
|
signal bwb_n1 : STD_LOGIC;
|
227 |
|
|
signal bwc_n1 : STD_LOGIC;
|
228 |
|
|
signal bwd_n1 : STD_LOGIC;
|
229 |
|
|
|
230 |
|
|
signal latch_addr : STD_LOGIC;
|
231 |
|
|
signal addr_reg_read1,addr_reg_write1,addr_reg_in1 : STD_LOGIC_VECTOR (addr_bits-1 downto 0);
|
232 |
|
|
|
233 |
|
|
signal OeN_HZ : STD_LOGIC;
|
234 |
|
|
signal OeN_DataValid : STD_LOGIC;
|
235 |
|
|
signal OeN_efct : STD_LOGIC;
|
236 |
|
|
|
237 |
|
|
signal WR_HZ : STD_LOGIC;
|
238 |
|
|
signal WR_LZ : STD_LOGIC;
|
239 |
|
|
signal WR_efct : STD_LOGIC;
|
240 |
|
|
|
241 |
|
|
signal CE_HZ : STD_LOGIC;
|
242 |
|
|
signal CE_LZ : STD_LOGIC;
|
243 |
|
|
signal Pipe_efct : STD_LOGIC;
|
244 |
|
|
|
245 |
|
|
signal RD_HZ : STD_LOGIC;
|
246 |
|
|
signal RD_LZ : STD_LOGIC;
|
247 |
|
|
signal RD_efct : STD_LOGIC;
|
248 |
|
|
|
249 |
|
|
begin
|
250 |
|
|
|
251 |
|
|
ce <= ((not inCE1) and (iCE2) and (not inCE3));
|
252 |
|
|
Write_n <= not((((not inBWa) OR (not inBWb) OR (not inBWc) OR (not inBWd)) AND (not inBWE)) OR (not inGW));
|
253 |
|
|
Read <= (((inBWa AND inBWb AND inBWc AND inBWd) AND (not inBWE)) OR (inGW AND inBWE) OR (( not inADSP) AND ce));
|
254 |
|
|
bwa_n1 <= not((not Write_n) AND ((not inGW) OR ((not inBWE) AND (not inBWa))));
|
255 |
|
|
bwb_n1 <= not((not Write_n) AND ((not inGW) OR ((not inBWE) AND (not inBWb))));
|
256 |
|
|
bwc_n1 <= not((not Write_n) AND ((not inGW) OR ((not inBWE) AND (not inBWc))));
|
257 |
|
|
bwd_n1 <= not((not Write_n) AND ((not inGW) OR ((not inBWE) AND (not inBWd))));
|
258 |
|
|
latch_addr <= ((not inADSC) OR ((not inADSP) AND (not inCE1)));
|
259 |
|
|
OeN_efct <= OeN_DataValid when (inOE = '0') else OeN_HZ;
|
260 |
|
|
WR_efct <= WR_LZ when (WrN_reg1 = '0') else WR_HZ;
|
261 |
|
|
Pipe_efct <= CE_LZ when ((ce_reg1 = '1') and (pipe_reg1 = '1')) else CE_HZ;
|
262 |
|
|
RD_efct <= CE_LZ when (Read_reg_o1 = '1') else CE_HZ ;
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
Process (Read_reg_o1)
|
266 |
|
|
begin
|
267 |
|
|
if (Read_reg_o1 = '0') then
|
268 |
|
|
RD_HZ <= '0' after Cyp_tCHZ;
|
269 |
|
|
RD_LZ <= '0' after Cyp_tCLZ;
|
270 |
|
|
elsif (Read_reg_o1 = '1') then
|
271 |
|
|
RD_HZ <= '1' after Cyp_tCHZ;
|
272 |
|
|
RD_LZ <= '1' after Cyp_tCLZ;
|
273 |
|
|
else
|
274 |
|
|
RD_HZ <= 'X' after Cyp_tCHZ;
|
275 |
|
|
RD_LZ <= 'X' after Cyp_tCLZ;
|
276 |
|
|
end if;
|
277 |
|
|
end process;
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
|
281 |
|
|
Process (pipe_reg1)
|
282 |
|
|
begin
|
283 |
|
|
if (pipe_reg1 = '1') then
|
284 |
|
|
CE_LZ <= '1' after Cyp_tCLZ;
|
285 |
|
|
elsif (pipe_reg1 = '0') then
|
286 |
|
|
CE_LZ <= '0' after Cyp_tCLZ;
|
287 |
|
|
else
|
288 |
|
|
CE_LZ <= 'X' after Cyp_tCLZ;
|
289 |
|
|
end if;
|
290 |
|
|
end process;
|
291 |
|
|
|
292 |
|
|
-- System Clock Decode
|
293 |
|
|
Process (iclk)
|
294 |
|
|
variable Sys_clk1 : std_logic := '0';
|
295 |
|
|
begin
|
296 |
|
|
if (rising_edge (iclk)) then
|
297 |
|
|
Sys_clk1 := not iZZ;
|
298 |
|
|
end if;
|
299 |
|
|
if (falling_edge (iCLK)) then
|
300 |
|
|
Sys_clk1 := '0';
|
301 |
|
|
end if;
|
302 |
|
|
Sys_clk <= Sys_clk1;
|
303 |
|
|
end process;
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
Process (WrN_reg1)
|
308 |
|
|
begin
|
309 |
|
|
if (WrN_reg1 = '1') then
|
310 |
|
|
WR_HZ <= '1' after Cyp_tCHZ;
|
311 |
|
|
WR_LZ <= '1' after Cyp_tCLZ;
|
312 |
|
|
elsif (WrN_reg1 = '0') then
|
313 |
|
|
WR_HZ <= '0' after Cyp_tCHZ;
|
314 |
|
|
WR_LZ <= '0' after Cyp_tCLZ;
|
315 |
|
|
else
|
316 |
|
|
WR_HZ <= 'X' after Cyp_tCHZ;
|
317 |
|
|
WR_LZ <= 'X' after Cyp_tCLZ;
|
318 |
|
|
end if;
|
319 |
|
|
end process;
|
320 |
|
|
|
321 |
|
|
Process (inOE)
|
322 |
|
|
begin
|
323 |
|
|
if (inOE = '1') then
|
324 |
|
|
OeN_HZ <= '1' after Cyp_tOEHZ;
|
325 |
|
|
OeN_DataValid <= '1' after Cyp_tOEV;
|
326 |
|
|
elsif (inOE = '0') then
|
327 |
|
|
OeN_HZ <= '0' after Cyp_tOEHZ;
|
328 |
|
|
OeN_DataValid <= '0' after Cyp_tOEV;
|
329 |
|
|
else
|
330 |
|
|
OeN_HZ <= 'X' after Cyp_tOEHZ;
|
331 |
|
|
OeN_DataValid <= 'X' after Cyp_tOEV;
|
332 |
|
|
end if;
|
333 |
|
|
end process;
|
334 |
|
|
|
335 |
|
|
process (ce_reg1, pipe_reg1)
|
336 |
|
|
begin
|
337 |
|
|
if ((ce_reg1 = '0') or (pipe_reg1 = '0')) then
|
338 |
|
|
CE_HZ <= '0' after Cyp_tCHZ;
|
339 |
|
|
elsif ((ce_reg1 = '1') and (pipe_reg1 = '1')) then
|
340 |
|
|
CE_HZ <= '1' after Cyp_tCHZ;
|
341 |
|
|
else
|
342 |
|
|
CE_HZ <= 'X' after Cyp_tCHZ;
|
343 |
|
|
end if;
|
344 |
|
|
end process;
|
345 |
|
|
|
346 |
|
|
Process (Sys_clk)
|
347 |
|
|
TYPE memory_array IS ARRAY ((2**addr_bits -1) DOWNTO 0) OF STD_LOGIC_VECTOR ((data_bits/4) - 1 DOWNTO 0);
|
348 |
|
|
variable Read_reg_o : std_logic;
|
349 |
|
|
variable Read_reg : std_logic;
|
350 |
|
|
variable pcsr_write, ctlr_write : std_logic;
|
351 |
|
|
variable WrN_reg : std_logic;
|
352 |
|
|
variable latch_addr_old, latch_addr_current : std_logic;
|
353 |
|
|
variable addr_reg_in, addr_reg_read, addr_reg_write : std_logic_vector (addr_bits -1 downto 0) := (others => '0');
|
354 |
|
|
variable bcount, first_addr : std_logic_vector (1 downto 0) := "00";
|
355 |
|
|
variable bwa_reg,bwb_reg,bwc_reg,bwd_reg, pipe_reg, ce_reg : std_logic;
|
356 |
|
|
variable din : std_logic_vector (data_bits-1 downto 0);
|
357 |
|
|
variable first_addr_int : integer;
|
358 |
|
|
variable bank0 : memory_array;
|
359 |
|
|
variable bank1 : memory_array;
|
360 |
|
|
variable bank2 : memory_array;
|
361 |
|
|
variable bank3 : memory_array;
|
362 |
|
|
|
363 |
|
|
variable FIRST : boolean := true;
|
364 |
|
|
file TCF : text open read_mode is fname;
|
365 |
|
|
variable rectype : std_logic_vector(3 downto 0);
|
366 |
|
|
variable recaddr : std_logic_vector(31 downto 0);
|
367 |
|
|
variable reclen : std_logic_vector(7 downto 0);
|
368 |
|
|
variable recdata : std_logic_vector(0 to 16*8-1);
|
369 |
|
|
variable CH : character;
|
370 |
|
|
variable ai : integer := 0;
|
371 |
|
|
variable L1 : line;
|
372 |
|
|
|
373 |
|
|
begin
|
374 |
|
|
if FIRST then
|
375 |
|
|
|
376 |
|
|
L1:= new string'("");
|
377 |
|
|
while not endfile(TCF) loop
|
378 |
|
|
readline(TCF,L1);
|
379 |
|
|
if (L1'length /= 0) then
|
380 |
|
|
while (not (L1'length=0)) and (L1(L1'left) = ' ') loop
|
381 |
|
|
std.textio.read(L1,CH);
|
382 |
|
|
end loop;
|
383 |
|
|
|
384 |
|
|
if L1'length > 0 then
|
385 |
|
|
std.textio.read(L1, ch);
|
386 |
|
|
if (ch = 'S') or (ch = 's') then
|
387 |
|
|
hexread(L1, rectype);
|
388 |
|
|
hexread(L1, reclen);
|
389 |
|
|
recaddr := (others => '0');
|
390 |
|
|
case rectype is
|
391 |
|
|
when "0001" =>
|
392 |
|
|
hexread(L1, recaddr(15 downto 0));
|
393 |
|
|
when "0010" =>
|
394 |
|
|
hexread(L1, recaddr(23 downto 0));
|
395 |
|
|
when "0011" =>
|
396 |
|
|
hexread(L1, recaddr);
|
397 |
|
|
recaddr(31 downto 24) := (others => '0');
|
398 |
|
|
when others => next;
|
399 |
|
|
end case;
|
400 |
|
|
hexread(L1, recdata);
|
401 |
|
|
ai := conv_integer(recaddr)/4;
|
402 |
|
|
for i in 0 to 3 loop
|
403 |
|
|
bank3 (ai+i) := "0000" & recdata((i*32) to (i*32+4));
|
404 |
|
|
bank2 (ai+i) := recdata((i*32+5) to (i*32+13));
|
405 |
|
|
bank1 (ai+i) := recdata((i*32+14) to (i*32+22));
|
406 |
|
|
bank0 (ai+i) := recdata((i*32+23) to (i*32+31));
|
407 |
|
|
end loop;
|
408 |
|
|
end if;
|
409 |
|
|
end if;
|
410 |
|
|
end if;
|
411 |
|
|
end loop;
|
412 |
|
|
|
413 |
|
|
FIRST := false;
|
414 |
|
|
end if;
|
415 |
|
|
|
416 |
|
|
if rising_edge (Sys_clk) then
|
417 |
|
|
|
418 |
|
|
if (Write_n = '0') then
|
419 |
|
|
Read_reg_o := '0';
|
420 |
|
|
else
|
421 |
|
|
Read_reg_o := Read_reg;
|
422 |
|
|
end if;
|
423 |
|
|
|
424 |
|
|
if (Write_n = '0') then
|
425 |
|
|
Read_reg := '0';
|
426 |
|
|
else
|
427 |
|
|
Read_reg := Read;
|
428 |
|
|
end if;
|
429 |
|
|
Read_reg1 <= Read_reg;
|
430 |
|
|
Read_reg_o1 <= Read_reg_o;
|
431 |
|
|
|
432 |
|
|
if (Read_reg = '1') then
|
433 |
|
|
pcsr_write := '0';
|
434 |
|
|
ctlr_write := '0';
|
435 |
|
|
end if;
|
436 |
|
|
|
437 |
|
|
-- Write Register
|
438 |
|
|
|
439 |
|
|
if (Read_reg_o = '1') then
|
440 |
|
|
WrN_reg := '1';
|
441 |
|
|
else
|
442 |
|
|
WrN_reg := Write_n;
|
443 |
|
|
end if;
|
444 |
|
|
WrN_reg1 <= WrN_reg;
|
445 |
|
|
|
446 |
|
|
latch_addr_old := latch_addr_current;
|
447 |
|
|
latch_addr_current := latch_addr;
|
448 |
|
|
|
449 |
|
|
if (latch_addr_old = '1' and (Write_n = '0') and ADSP_N_o = '0') then
|
450 |
|
|
pcsr_write := '1'; --Ctlr Write = 0; Pcsr Write = 1;
|
451 |
|
|
|
452 |
|
|
elsif (latch_addr_current = '1' and (Write_n = '0') and inADSP = '1' and inADSC = '0') then
|
453 |
|
|
ctlr_write := '1'; --Ctlr Write = 0; Pcsr Write = 1;
|
454 |
|
|
end if;
|
455 |
|
|
-- ADDRess Register
|
456 |
|
|
if (latch_addr = '1') then
|
457 |
|
|
addr_reg_in := iADDR;
|
458 |
|
|
bcount := iADDR (1 downto 0);
|
459 |
|
|
first_addr := iADDR (1 downto 0);
|
460 |
|
|
end if;
|
461 |
|
|
addr_reg_in1 <= addr_reg_in;
|
462 |
|
|
-- ADSP_N Previous-Cycle Register
|
463 |
|
|
ADSP_N_o <= inADSP;
|
464 |
|
|
pcsr_write1 <= pcsr_write;
|
465 |
|
|
ctlr_write1 <= ctlr_write;
|
466 |
|
|
first_addr_int := CONV_INTEGER1 (first_addr);
|
467 |
|
|
-- Binary Counter and Logic
|
468 |
|
|
|
469 |
|
|
if ((iMode = '0') and (inADV = '0') and (latch_addr = '0')) then -- Linear Burst
|
470 |
|
|
bcount := (bcount + '1'); -- Advance Counter
|
471 |
|
|
|
472 |
|
|
elsif ((iMode = '1') and (inADV = '0') and (latch_addr = '0')) then -- Interleaved Burst
|
473 |
|
|
if ((first_addr_int REM 2) = 0) then
|
474 |
|
|
bcount := (bcount + '1'); -- Increment Counter
|
475 |
|
|
elsif ((first_addr_int REM 2) = 1) then
|
476 |
|
|
bcount := (bcount - '1'); -- Decrement Counter
|
477 |
|
|
end if;
|
478 |
|
|
end if;
|
479 |
|
|
|
480 |
|
|
-- Read ADDRess
|
481 |
|
|
addr_reg_read := addr_reg_write;
|
482 |
|
|
addr_reg_read1 <= addr_reg_read;
|
483 |
|
|
|
484 |
|
|
-- Write ADDRess
|
485 |
|
|
addr_reg_write := addr_reg_in ((addr_bits - 1) downto 2) & bcount(1) & bcount(0);
|
486 |
|
|
addr_reg_write1 <= addr_reg_write;
|
487 |
|
|
-- Byte Write Register
|
488 |
|
|
bwa_reg := not bwa_n1;
|
489 |
|
|
bwb_reg := not bwb_n1;
|
490 |
|
|
bwc_reg := not bwc_n1;
|
491 |
|
|
bwd_reg := not bwd_n1;
|
492 |
|
|
|
493 |
|
|
-- Enable Register
|
494 |
|
|
pipe_reg := ce_reg;
|
495 |
|
|
|
496 |
|
|
-- Enable Register
|
497 |
|
|
if (latch_addr = '1') then
|
498 |
|
|
ce_reg := ce;
|
499 |
|
|
end if;
|
500 |
|
|
|
501 |
|
|
pipe_reg1 <= pipe_reg;
|
502 |
|
|
ce_reg1 <= ce_reg;
|
503 |
|
|
|
504 |
|
|
-- Input Register
|
505 |
|
|
if ((ce_reg = '1') and ((bwa_n1 ='0') or (bwb_n1 = '0') or (bwc_n1 = '0') or (bwd_n1 = '0')) and
|
506 |
|
|
((pcsr_write = '1') or (ctlr_write = '1'))) then
|
507 |
|
|
din := ioDQ;
|
508 |
|
|
end if;
|
509 |
|
|
din1 <= din;
|
510 |
|
|
|
511 |
|
|
-- Byte Write Driver
|
512 |
|
|
if ((ce_reg = '1') and (bwa_reg = '1')) then
|
513 |
|
|
bank0 (CONV_INTEGER1 (addr_reg_write)) := din (8 downto 0);
|
514 |
|
|
end if;
|
515 |
|
|
if ((ce_reg = '1') and (bwb_reg = '1')) then
|
516 |
|
|
bank1 (CONV_INTEGER1 (addr_reg_write)) := din (17 downto 9);
|
517 |
|
|
end if;
|
518 |
|
|
if ((ce_reg = '1') and (bwc_reg = '1')) then
|
519 |
|
|
bank2 (CONV_INTEGER1 (addr_reg_write)) := din (26 downto 18);
|
520 |
|
|
end if;
|
521 |
|
|
if ((ce_reg = '1') and (bwd_reg = '1')) then
|
522 |
|
|
bank3 (CONV_INTEGER1 (addr_reg_write)) := din (35 downto 27);
|
523 |
|
|
end if;
|
524 |
|
|
|
525 |
|
|
-- Output Registers
|
526 |
|
|
|
527 |
|
|
if ((Write_n = '0') or (pipe_reg = '0')) then
|
528 |
|
|
dout (35 downto 0) <= "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ" after Cyp_tCHZ;
|
529 |
|
|
elsif (Read_reg_o = '1') then
|
530 |
|
|
dout ( 8 downto 0) <= bank0 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO;
|
531 |
|
|
dout (17 downto 9) <= bank1 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO;
|
532 |
|
|
dout (26 downto 18) <= bank2 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO;
|
533 |
|
|
dout (35 downto 27) <= bank3 (CONV_INTEGER1 (addr_reg_read)) after Cyp_tCO;
|
534 |
|
|
end if;
|
535 |
|
|
|
536 |
|
|
end if;
|
537 |
|
|
end process;
|
538 |
|
|
|
539 |
|
|
-- Output Buffers
|
540 |
|
|
ioDQ <= dout when ((inOE ='0') and (iZZ='0') and (Pipe_efct='1') and (RD_efct='1') and (WR_efct='1'))
|
541 |
|
|
else "ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ";
|
542 |
|
|
|
543 |
|
|
|
544 |
|
|
clk_check : PROCESS
|
545 |
|
|
VARIABLE clk_high, clk_low : TIME := 0 ns;
|
546 |
|
|
BEGIN
|
547 |
|
|
WAIT ON iClk;
|
548 |
|
|
IF iClk = '1' AND NOW >= Cyp_tCYC THEN
|
549 |
|
|
ASSERT (NOW - clk_low >= Cyp_tCH)
|
550 |
|
|
REPORT "Clk width low - tCH violation"
|
551 |
|
|
SEVERITY ERROR;
|
552 |
|
|
ASSERT (NOW - clk_high >= Cyp_tCYC)
|
553 |
|
|
REPORT "Clk period high - tCYC violation"
|
554 |
|
|
SEVERITY ERROR;
|
555 |
|
|
clk_high := NOW;
|
556 |
|
|
ELSIF iClk = '0' AND NOW /= 0 ns THEN
|
557 |
|
|
ASSERT (NOW - clk_high >= Cyp_tCL)
|
558 |
|
|
REPORT "Clk width high - tCL violation"
|
559 |
|
|
SEVERITY ERROR;
|
560 |
|
|
ASSERT (NOW - clk_low >= Cyp_tCYC)
|
561 |
|
|
REPORT "Clk period low - tCYC violation"
|
562 |
|
|
SEVERITY ERROR;
|
563 |
|
|
clk_low := NOW;
|
564 |
|
|
END IF;
|
565 |
|
|
END PROCESS;
|
566 |
|
|
|
567 |
|
|
-- Check for Setup Timing Violation
|
568 |
|
|
setup_check : PROCESS
|
569 |
|
|
BEGIN
|
570 |
|
|
WAIT ON iClk;
|
571 |
|
|
IF iClk = '1' THEN
|
572 |
|
|
ASSERT (iAddr'LAST_EVENT >= Cyp_tAS)
|
573 |
|
|
REPORT "Addr - tAS violation"
|
574 |
|
|
SEVERITY ERROR;
|
575 |
|
|
ASSERT (inGW'LAST_EVENT >= Cyp_tWES)
|
576 |
|
|
REPORT "GW# - tWES violation"
|
577 |
|
|
SEVERITY ERROR;
|
578 |
|
|
ASSERT (inBWE'LAST_EVENT >= Cyp_tWES)
|
579 |
|
|
REPORT "BWE# - tWES violation"
|
580 |
|
|
SEVERITY ERROR;
|
581 |
|
|
ASSERT (inCe1'LAST_EVENT >= Cyp_tWES)
|
582 |
|
|
REPORT "CE1# - tWES violation"
|
583 |
|
|
SEVERITY ERROR;
|
584 |
|
|
ASSERT (iCe2'LAST_EVENT >= Cyp_tWES)
|
585 |
|
|
REPORT "CE2 - tWES violation"
|
586 |
|
|
SEVERITY ERROR;
|
587 |
|
|
ASSERT (inCe3'LAST_EVENT >= Cyp_tWES)
|
588 |
|
|
REPORT "CE3# - tWES violation"
|
589 |
|
|
SEVERITY ERROR;
|
590 |
|
|
ASSERT (inAdv'LAST_EVENT >= Cyp_tADVS)
|
591 |
|
|
REPORT "ADV# - tWES violation"
|
592 |
|
|
SEVERITY ERROR;
|
593 |
|
|
ASSERT (inAdsp'LAST_EVENT >= Cyp_tADVS)
|
594 |
|
|
REPORT "ADSP# - tWES violation"
|
595 |
|
|
SEVERITY ERROR;
|
596 |
|
|
ASSERT (inAdsc'LAST_EVENT >= Cyp_tADVS)
|
597 |
|
|
REPORT "ADSC# - tWES violation"
|
598 |
|
|
SEVERITY ERROR;
|
599 |
|
|
ASSERT (inBwa'LAST_EVENT >= Cyp_tWES)
|
600 |
|
|
REPORT "BWa# - tWES violation"
|
601 |
|
|
SEVERITY ERROR;
|
602 |
|
|
ASSERT (inBwb'LAST_EVENT >= Cyp_tWES)
|
603 |
|
|
REPORT "BWb# - tWES violation"
|
604 |
|
|
SEVERITY ERROR;
|
605 |
|
|
ASSERT (inBwc'LAST_EVENT >= Cyp_tWES)
|
606 |
|
|
REPORT "BWc# - tWES violation"
|
607 |
|
|
SEVERITY ERROR;
|
608 |
|
|
ASSERT (inBwd'LAST_EVENT >= Cyp_tWES)
|
609 |
|
|
REPORT "BWd# - tWES violation"
|
610 |
|
|
SEVERITY ERROR;
|
611 |
|
|
ASSERT (ioDq'LAST_EVENT >= Cyp_tDS)
|
612 |
|
|
REPORT "Dq - tDS violation"
|
613 |
|
|
SEVERITY ERROR;
|
614 |
|
|
END IF;
|
615 |
|
|
END PROCESS;
|
616 |
|
|
|
617 |
|
|
-- Check for Hold Timing Violation
|
618 |
|
|
hold_check : PROCESS
|
619 |
|
|
BEGIN
|
620 |
|
|
WAIT ON iClk'DELAYED(Cyp_tAH), iClk'DELAYED(Cyp_tWEH), iClk'DELAYED(Cyp_tDH);
|
621 |
|
|
IF iClk'DELAYED(Cyp_tAH) = '1' THEN
|
622 |
|
|
ASSERT (iAddr'LAST_EVENT > Cyp_tAH)
|
623 |
|
|
REPORT "Addr - tAH violation"
|
624 |
|
|
SEVERITY ERROR;
|
625 |
|
|
END IF;
|
626 |
|
|
IF iClk'DELAYED(Cyp_tDH) = '1' THEN
|
627 |
|
|
ASSERT (ioDq'LAST_EVENT > Cyp_tDH)
|
628 |
|
|
REPORT "Dq - tDH violation"
|
629 |
|
|
SEVERITY ERROR;
|
630 |
|
|
END IF;
|
631 |
|
|
IF iClk'DELAYED(Cyp_tWEH) = '1' THEN
|
632 |
|
|
ASSERT (inCe1'LAST_EVENT > Cyp_tWEH)
|
633 |
|
|
REPORT "CE1# - tWEH violation"
|
634 |
|
|
SEVERITY ERROR;
|
635 |
|
|
ASSERT (iCe2'LAST_EVENT > Cyp_tWEH)
|
636 |
|
|
REPORT "CE2 - tWEH violation"
|
637 |
|
|
SEVERITY ERROR;
|
638 |
|
|
ASSERT (inCe3'LAST_EVENT > Cyp_tWEH)
|
639 |
|
|
REPORT "CE3 - tWEH violation"
|
640 |
|
|
SEVERITY ERROR;
|
641 |
|
|
ASSERT (inAdv'LAST_EVENT > Cyp_tWEH)
|
642 |
|
|
REPORT "ADV# - tWEH violation"
|
643 |
|
|
SEVERITY ERROR;
|
644 |
|
|
ASSERT (inADSP'LAST_EVENT > Cyp_tWEH)
|
645 |
|
|
REPORT "ADSP# - tWEH violation"
|
646 |
|
|
SEVERITY ERROR;
|
647 |
|
|
ASSERT (inADSC'LAST_EVENT > Cyp_tWEH)
|
648 |
|
|
REPORT "ADSC# - tWEH violation"
|
649 |
|
|
SEVERITY ERROR;
|
650 |
|
|
ASSERT (inBwa'LAST_EVENT > Cyp_tWEH)
|
651 |
|
|
REPORT "BWa# - tWEH violation"
|
652 |
|
|
SEVERITY ERROR;
|
653 |
|
|
ASSERT (inBwb'LAST_EVENT > Cyp_tWEH)
|
654 |
|
|
REPORT "BWb# - tWEH violation"
|
655 |
|
|
SEVERITY ERROR;
|
656 |
|
|
ASSERT (inBwc'LAST_EVENT > Cyp_tWEH)
|
657 |
|
|
REPORT "BWc# - tWEH violation"
|
658 |
|
|
SEVERITY ERROR;
|
659 |
|
|
ASSERT (inBwd'LAST_EVENT > Cyp_tWEH)
|
660 |
|
|
REPORT "BWd# - tWEH violation"
|
661 |
|
|
SEVERITY ERROR;
|
662 |
|
|
END IF;
|
663 |
|
|
|
664 |
|
|
END PROCESS;
|
665 |
|
|
end CY7C1380D_arch;
|
666 |
|
|
|
667 |
|
|
|
668 |
|
|
|
669 |
|
|
|
670 |
|
|
|
671 |
|
|
|
672 |
|
|
|