1 |
2 |
DavidRAMBA |
--------------------------------------------------------------------------------
|
2 |
|
|
-- Company:
|
3 |
|
|
-- Engineer:
|
4 |
|
|
--
|
5 |
|
|
-- Create Date: 16:29:20 04/02/2014
|
6 |
|
|
-- Design Name:
|
7 |
|
|
-- Module Name: R:/CONCERTO SIL2/LP/FPGA Concentrateur SIL2/fpga_cosil2/top_fpgacosil2_tb.vhd
|
8 |
|
|
-- Project Name: fpga_cosil2
|
9 |
|
|
-- Target Device:
|
10 |
|
|
-- Tool versions:
|
11 |
|
|
-- Description:
|
12 |
|
|
--
|
13 |
|
|
-- VHDL Test Bench Created by ISE for module: top_fpgacosil2
|
14 |
|
|
--
|
15 |
|
|
-- Dependencies:
|
16 |
|
|
--
|
17 |
|
|
-- Revision:
|
18 |
|
|
-- Revision 0.01 - File Created
|
19 |
|
|
-- Additional Comments:
|
20 |
|
|
--
|
21 |
|
|
-- Notes:
|
22 |
|
|
-- This testbench has been automatically generated using types std_logic and
|
23 |
|
|
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
|
24 |
|
|
-- that these types always be used for the top-level I/O of a design in order
|
25 |
|
|
-- to guarantee that the testbench will bind correctly to the post-implementation
|
26 |
|
|
-- simulation model.
|
27 |
|
|
--------------------------------------------------------------------------------
|
28 |
|
|
LIBRARY ieee;
|
29 |
|
|
USE ieee.std_logic_1164.ALL;
|
30 |
|
|
|
31 |
|
|
-- Uncomment the following library declaration if using
|
32 |
|
|
-- arithmetic functions with Signed or Unsigned values
|
33 |
|
|
--USE ieee.numeric_std.ALL;
|
34 |
|
|
|
35 |
|
|
ENTITY top_fpgacosil2_tb IS
|
36 |
|
|
END top_fpgacosil2_tb;
|
37 |
|
|
|
38 |
|
|
ARCHITECTURE behavior OF top_fpgacosil2_tb IS
|
39 |
|
|
|
40 |
|
|
-- Component Declaration for the Unit Under Test (UUT)
|
41 |
|
|
|
42 |
|
|
COMPONENT top_fpgacosil2
|
43 |
|
|
PORT(
|
44 |
|
|
clk_24 : IN STD_LOGIC; -- Horloge principale à 24MHz
|
45 |
|
|
clk_25 : IN STD_LOGIC; -- Horloge spare à 25MHz
|
46 |
|
|
rst_n : IN STD_LOGIC; -- Reset principal de la carte
|
47 |
|
|
rst_fpgan : IN STD_LOGIC; -- Reset issu du PIC32
|
48 |
|
|
led_confok : OUT STD_LOGIC; -- Pilotage de la led rouge
|
49 |
|
|
led_run : OUT STD_LOGIC; -- Pilotage de la 1ère LED verte
|
50 |
|
|
led_fail : OUT STD_LOGIC; -- Pilotage de la 2ème LED verte
|
51 |
|
|
power_rstn : IN STD_LOGIC; -- Indique que l'alim 3.3V du PIC est coupée
|
52 |
|
|
rst_switchn : OUT STD_LOGIC; -- Gestion du reset du SWITCH
|
53 |
|
|
interrupt : IN STD_LOGIC; -- Signal d'interruption issu du SWITCH
|
54 |
|
|
prog_b : IN STD_LOGIC; -- Force la reprog du FPGA
|
55 |
|
|
|
56 |
|
|
-- Interfaces ports séries
|
57 |
|
|
ls485_de1 : OUT STD_LOGIC; -- Signal d'autorisation à émettre de la LS1
|
58 |
|
|
ls485_ren1 : OUT STD_LOGIC; -- Signal d'autorisation à émettre de la LS1
|
59 |
|
|
ls485_rx1 : IN STD_LOGIC; -- Signal de réception de la LS1
|
60 |
|
|
ls485_tx1 : OUT STD_LOGIC; -- Signal d'émission de la LS1
|
61 |
|
|
|
62 |
|
|
ls485_de2 : OUT STD_LOGIC; -- Signal d'autorisation à émettre de la LS2
|
63 |
|
|
ls485_ren2 : OUT STD_LOGIC; -- Signal d'autorisation à émettre de la LS2
|
64 |
|
|
ls485_rx2 : IN STD_LOGIC; -- Signal de réception de la LS2
|
65 |
|
|
ls485_tx2 : OUT STD_LOGIC; -- Signal d'émission de la LS2
|
66 |
|
|
|
67 |
|
|
-- Interface PMP (Interface PIC)
|
68 |
|
|
pmd : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0); -- Bus Data / Adresse
|
69 |
|
|
pmall : IN STD_LOGIC; -- Latch des LSB de l'adresse
|
70 |
|
|
pmalh : IN STD_LOGIC; -- Latch des MSB de l'adresse
|
71 |
|
|
pmrd : IN STD_LOGIC; -- Signal de read
|
72 |
|
|
pmwr : IN STD_LOGIC; -- Signal de write
|
73 |
|
|
|
74 |
|
|
-- Interface de pilotage des Alim isolées
|
75 |
|
|
cdehigh_5vid : OUT STD_LOGIC;
|
76 |
|
|
cdelow_5vid : OUT STD_LOGIC;
|
77 |
|
|
cdehigh_5vls1 : OUT STD_LOGIC;
|
78 |
|
|
cdelow_5vls1 : OUT STD_LOGIC;
|
79 |
|
|
cdehigh_5vls2 : OUT STD_LOGIC;
|
80 |
|
|
cdelow_5vls2 : OUT STD_LOGIC;
|
81 |
|
|
cdehigh_5vlsm2 : OUT STD_LOGIC;
|
82 |
|
|
cdelow_5vlsm2 : OUT STD_LOGIC;
|
83 |
|
|
cdehigh_5vcan : OUT STD_LOGIC;
|
84 |
|
|
cdelow_5vcan : OUT STD_LOGIC;
|
85 |
|
|
|
86 |
|
|
-- Interface PCIe
|
87 |
|
|
pci_rstn : IN STD_LOGIC;
|
88 |
|
|
pci_exp_txp : OUT STD_LOGIC;
|
89 |
|
|
pci_exp_txn : OUT STD_LOGIC;
|
90 |
|
|
pci_exp_rxp : IN STD_LOGIC;
|
91 |
|
|
pci_exp_rxn : IN STD_LOGIC;
|
92 |
|
|
pci_clk_p : IN STD_LOGIC;
|
93 |
|
|
pci_clk_n : IN STD_LOGIC;
|
94 |
|
|
pci_waken : OUT STD_LOGIC;
|
95 |
|
|
pci_spare : IN STD_LOGIC;
|
96 |
|
|
|
97 |
|
|
-- Interface Spare avec la passerelle
|
98 |
|
|
uc_pmd : INOUT STD_LOGIC_VECTOR(7 DOWNTO 0);
|
99 |
|
|
uc_pmrd : IN STD_LOGIC;
|
100 |
|
|
uc_pmwr : IN STD_LOGIC;
|
101 |
|
|
uc_pmall : IN STD_LOGIC;
|
102 |
|
|
uc_pmalh : IN STD_LOGIC;
|
103 |
|
|
uc_pmacs1 : IN STD_LOGIC;
|
104 |
|
|
uc_pmacs2 : IN STD_LOGIC;
|
105 |
|
|
uc_sck : IN STD_LOGIC;
|
106 |
|
|
uc_ssn : IN STD_LOGIC;
|
107 |
|
|
uc_sdi : IN STD_LOGIC;
|
108 |
|
|
uc_sdo : IN STD_LOGIC;
|
109 |
|
|
|
110 |
|
|
-- Interface I2C
|
111 |
|
|
sda : IN STD_LOGIC;
|
112 |
|
|
scl : IN STD_LOGIC;
|
113 |
|
|
|
114 |
|
|
-- Interface SPI (programmation de la flash de configuration)
|
115 |
|
|
wp_flashn : OUT STD_LOGIC; -- Autorisation d'écriture dans la flash SPI
|
116 |
|
|
cclk : OUT STD_LOGIC; -- Horloge d'accès à la flash SPI
|
117 |
|
|
din_miso : IN STD_LOGIC; -- Data série en lecture SPI
|
118 |
|
|
mosi : OUT STD_LOGIC; -- Data série en écriture SPI
|
119 |
|
|
cso_b : OUT STD_LOGIC; -- Chip select SPI
|
120 |
|
|
|
121 |
|
|
-- Interface Spare avec le PIC
|
122 |
|
|
pic_rx : IN STD_LOGIC;
|
123 |
|
|
pic_tx : OUT STD_LOGIC;
|
124 |
|
|
pic_spare : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
|
125 |
|
|
pic_sck : IN STD_LOGIC;
|
126 |
|
|
pic_sdi : IN STD_LOGIC;
|
127 |
|
|
pic_sdo : OUT STD_LOGIC;
|
128 |
|
|
pic_ssn : IN STD_LOGIC;
|
129 |
|
|
|
130 |
|
|
-- Spare
|
131 |
|
|
tp : OUT STD_LOGIC_VECTOR(28 DOWNTO 22);
|
132 |
|
|
spare : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
|
133 |
|
|
);
|
134 |
|
|
END COMPONENT;
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
--Inputs
|
138 |
|
|
signal clk_24 : std_logic := '0';
|
139 |
|
|
signal rst_n : std_logic := '0';
|
140 |
|
|
signal rst_fpgan : std_logic := '0';
|
141 |
|
|
signal power_rstn : std_logic := '0';
|
142 |
|
|
signal ls485_rx1 : std_logic := '0';
|
143 |
|
|
signal ls485_rx2 : std_logic := '0';
|
144 |
|
|
signal pmall : std_logic := '0';
|
145 |
|
|
signal pmalh : std_logic := '0';
|
146 |
|
|
signal pmrd : std_logic := '0';
|
147 |
|
|
signal pmwr : std_logic := '0';
|
148 |
|
|
signal pci_rstn : std_logic := '0';
|
149 |
|
|
signal pci_exp_rxp : std_logic := '0';
|
150 |
|
|
signal pci_exp_rxn : std_logic := '0';
|
151 |
|
|
signal pci_clk_p : std_logic := '1';
|
152 |
|
|
signal pci_clk_n : std_logic := '0';
|
153 |
|
|
signal din_miso : std_logic := '0';
|
154 |
|
|
|
155 |
|
|
--BiDirs
|
156 |
|
|
signal pmd : std_logic_vector(7 downto 0) := "ZZZZZZZZ";
|
157 |
|
|
|
158 |
|
|
--Outputs
|
159 |
|
|
signal led_confok : std_logic;
|
160 |
|
|
signal led_run : std_logic;
|
161 |
|
|
signal led_fail : std_logic;
|
162 |
|
|
signal ls485_de1 : std_logic;
|
163 |
|
|
signal ls485_ren1 : std_logic;
|
164 |
|
|
signal ls485_tx1 : std_logic;
|
165 |
|
|
signal ls485_de2 : std_logic;
|
166 |
|
|
signal ls485_ren2 : std_logic;
|
167 |
|
|
signal ls485_tx2 : std_logic;
|
168 |
|
|
signal cdehigh_5vid : std_logic;
|
169 |
|
|
signal cdelow_5vid : std_logic;
|
170 |
|
|
signal cdehigh_5vls1 : std_logic;
|
171 |
|
|
signal cdelow_5vls1 : std_logic;
|
172 |
|
|
signal cdehigh_5vls2 : std_logic;
|
173 |
|
|
signal cdelow_5vls2 : std_logic;
|
174 |
|
|
signal pci_exp_txp : std_logic;
|
175 |
|
|
signal pci_exp_txn : std_logic;
|
176 |
|
|
signal pci_waken : std_logic;
|
177 |
|
|
signal wp_flashn : std_logic;
|
178 |
|
|
signal cclk : std_logic;
|
179 |
|
|
signal mosi : std_logic;
|
180 |
|
|
signal cso_b : std_logic;
|
181 |
|
|
|
182 |
|
|
-- Clock period definitions
|
183 |
|
|
constant clk_24_period : time := 42 ns;
|
184 |
|
|
constant pci_period : time := 10 ns;
|
185 |
|
|
|
186 |
|
|
BEGIN
|
187 |
|
|
rst_n <= '0', '1' after 200 ns;
|
188 |
|
|
clk_24 <= NOT(clk_24) after clk_24_period/2;
|
189 |
|
|
pci_clk_p <= NOT(pci_clk_p) after pci_period/2;
|
190 |
|
|
pci_clk_n <= NOT(pci_clk_n) after pci_period/2;
|
191 |
|
|
|
192 |
|
|
-- Instantiate the Unit Under Test (UUT)
|
193 |
|
|
uut: top_fpgacosil2 PORT MAP (
|
194 |
|
|
clk_24 => clk_24,
|
195 |
|
|
rst_n => rst_n,
|
196 |
|
|
rst_fpgan => rst_fpgan,
|
197 |
|
|
led_confok => led_confok,
|
198 |
|
|
led_run => led_run,
|
199 |
|
|
led_fail => led_fail,
|
200 |
|
|
power_rstn => power_rstn,
|
201 |
|
|
ls485_de1 => ls485_de1,
|
202 |
|
|
ls485_ren1 => ls485_ren1,
|
203 |
|
|
ls485_rx1 => ls485_rx1,
|
204 |
|
|
ls485_tx1 => ls485_tx1,
|
205 |
|
|
ls485_de2 => ls485_de2,
|
206 |
|
|
ls485_ren2 => ls485_ren2,
|
207 |
|
|
ls485_rx2 => ls485_rx2,
|
208 |
|
|
ls485_tx2 => ls485_tx2,
|
209 |
|
|
pmd => pmd,
|
210 |
|
|
pmall => pmall,
|
211 |
|
|
pmalh => pmalh,
|
212 |
|
|
pmrd => pmrd,
|
213 |
|
|
pmwr => pmwr,
|
214 |
|
|
cdehigh_5vid => cdehigh_5vid,
|
215 |
|
|
cdelow_5vid => cdelow_5vid,
|
216 |
|
|
cdehigh_5vls1 => cdehigh_5vls1,
|
217 |
|
|
cdelow_5vls1 => cdelow_5vls1,
|
218 |
|
|
cdehigh_5vls2 => cdehigh_5vls2,
|
219 |
|
|
cdelow_5vls2 => cdelow_5vls2,
|
220 |
|
|
pci_rstn => pci_rstn,
|
221 |
|
|
pci_exp_txp => pci_exp_txp,
|
222 |
|
|
pci_exp_txn => pci_exp_txn,
|
223 |
|
|
pci_exp_rxp => pci_exp_rxp,
|
224 |
|
|
pci_exp_rxn => pci_exp_rxn,
|
225 |
|
|
pci_clk_p => pci_clk_p,
|
226 |
|
|
pci_clk_n => pci_clk_n,
|
227 |
|
|
pci_waken => pci_waken,
|
228 |
|
|
pci_spare => '0',
|
229 |
|
|
wp_flashn => wp_flashn,
|
230 |
|
|
cclk => cclk,
|
231 |
|
|
din_miso => din_miso,
|
232 |
|
|
mosi => mosi,
|
233 |
|
|
cso_b => cso_b,
|
234 |
|
|
pic_spare => "0000",
|
235 |
|
|
clk_25 => '0',
|
236 |
|
|
interrupt => '0',
|
237 |
|
|
prog_b => '0',
|
238 |
|
|
--uc_pmd => "00000000",
|
239 |
|
|
uc_pmrd => '0',
|
240 |
|
|
uc_pmwr => '0',
|
241 |
|
|
uc_pmall => '0',
|
242 |
|
|
uc_pmalh => '0',
|
243 |
|
|
uc_pmacs1 => '0',
|
244 |
|
|
uc_pmacs2 => '0',
|
245 |
|
|
uc_sck => '0',
|
246 |
|
|
uc_ssn => '0',
|
247 |
|
|
uc_sdi => '0',
|
248 |
|
|
uc_sdo => '0',
|
249 |
|
|
sda => '0',
|
250 |
|
|
scl => '0',
|
251 |
|
|
pic_rx => '0',
|
252 |
|
|
pic_sck => '0',
|
253 |
|
|
pic_sdi => '0',
|
254 |
|
|
pic_ssn => '0'
|
255 |
|
|
);
|
256 |
|
|
|
257 |
|
|
|
258 |
|
|
pmd <= (others => 'Z');
|
259 |
|
|
pmall <= '0';
|
260 |
|
|
pmwr <= '0';
|
261 |
|
|
pmrd <= not(pmrd) after 100 ns;
|
262 |
|
|
|
263 |
|
|
END;
|