1 |
3 |
guanucolui |
library IEEE;
|
2 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
3 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
4 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
5 |
|
|
|
6 |
|
|
-- Uncomment the following lines to use the declarations that are
|
7 |
|
|
-- provided for instantiating Xilinx primitive components.
|
8 |
|
|
--library UNISIM;
|
9 |
|
|
--use UNISIM.VComponents.all;
|
10 |
|
|
|
11 |
|
|
entity top_enlace is
|
12 |
|
|
generic ( bits : integer := 8; -- ancho de datos de la memoria
|
13 |
|
|
addr_bits : integer := 8 -- 2^addr_bits = numero bits de direccionamiento
|
14 |
|
|
);
|
15 |
|
|
Port (
|
16 |
|
|
--nexys2
|
17 |
|
|
Led : out std_logic_vector (7 downto 0);
|
18 |
|
|
an : out std_logic_vector (3 downto 0);
|
19 |
|
|
|
20 |
|
|
-- analizar lógico
|
21 |
|
|
canalA :out std_logic_vector (7 downto 0);
|
22 |
|
|
canalB :out std_logic_vector (7 downto 0);
|
23 |
|
|
|
24 |
|
|
--++++++++++++++++
|
25 |
|
|
clk : in std_logic; -- clock global
|
26 |
|
|
reset : in std_logic; -- reset global
|
27 |
|
|
-- send_ram : in std_logic; -- orden para sacar dato de ram por RS232
|
28 |
|
|
rxd : in std_logic; -- linea de recepcion del RS232
|
29 |
|
|
error_uart : out std_logic;
|
30 |
|
|
error_lrc : out std_logic;
|
31 |
|
|
txd : out std_logic; -- linea de transmision del RS232
|
32 |
|
|
-- puertos comunicacin con pico Blaze
|
33 |
|
|
picoB_ok :in std_logic;
|
34 |
|
|
addr_picoB : in std_logic_vector (addr_bits-1 downto 0);
|
35 |
|
|
Eram_picoB : in std_logic;
|
36 |
|
|
WEram_picoB : in std_logic;
|
37 |
|
|
data_in_ram_picoB : in std_logic_vector (7 downto 0);
|
38 |
|
|
data_out_ram_picoB : out std_logic_vector (7 downto 0);
|
39 |
|
|
cant_datos_picoB : in std_logic_vector (7 downto 0);
|
40 |
|
|
det_trama_ok_PB : out std_logic; --avisa cuando una trama est lista para usar
|
41 |
|
|
gen_trama_ok_PB : out std_logic --avisa cuando una trama fue enviada por la uart
|
42 |
|
|
);
|
43 |
|
|
|
44 |
|
|
end top_enlace;
|
45 |
|
|
|
46 |
|
|
architecture Behavioral of top_enlace is
|
47 |
|
|
|
48 |
|
|
--*******************************************************************
|
49 |
|
|
-- DECLARACION COMPONENTE UART_RS232
|
50 |
|
|
--*******************************************************************
|
51 |
|
|
component uart_rs232
|
52 |
|
|
Port ( clk : in std_logic; -- global clock
|
53 |
|
|
reset : in std_logic; -- global reset
|
54 |
|
|
send_data : in std_logic; -- this signal orders to send the data present at the data_in inputs through the TXD line
|
55 |
|
|
data_in : in std_logic_vector(7 downto 0); -- data to be sent
|
56 |
|
|
even_odd : in std_logic; -- it selects the desired parity (0: odd/impar; 1: even/par)
|
57 |
|
|
rxd : in std_logic; -- The RS232 RXD line
|
58 |
|
|
txd : out std_logic; -- The RS232 TXD line
|
59 |
|
|
transmitter_busy : out std_logic; -- it indicates that the transmitter is busy sending one character
|
60 |
|
|
send_done : out std_logic; -- it indicates that the character has been sent
|
61 |
|
|
data_out : out std_logic_vector(7 downto 0); -- The data received, in parallel
|
62 |
|
|
parity_error : out std_logic; -- it indicates a parity error in the received data
|
63 |
|
|
start_error : out std_logic; -- it indicates an error in the start bit (false start) of the received data. The receiver will wait for a new complete start bit
|
64 |
|
|
stop_error : out std_logic; -- it indicates an error in the stop bit of the received data (though the data could have been received correctly and it is presented at the outputs).
|
65 |
|
|
discrepancy_error : out std_logic; -- it indicates an error because the three samples of the same bit of the data being currently received have different values.
|
66 |
|
|
receiver_busy : out std_logic; -- it indicates that the receiver is busy receiving one character
|
67 |
|
|
new_data : out std_logic -- it indicates that the receiving process has ended and a new character is available
|
68 |
|
|
);
|
69 |
|
|
end component;
|
70 |
|
|
|
71 |
|
|
--*******************************************************************
|
72 |
|
|
-- DECLARACION COMPONENTE Detector (mquina de estado)
|
73 |
|
|
--*******************************************************************
|
74 |
|
|
component det_top
|
75 |
|
|
generic (
|
76 |
|
|
DIRE_LOCAL_ALTO : std_logic_vector(7 downto 0) := "00110001"; -- 1 ASCII
|
77 |
|
|
DIRE_LOCAL_BAJO : std_logic_vector(7 downto 0) := "00110001"; -- 1 ASCII
|
78 |
|
|
bits : integer := 8; -- ancho de datos de la memoria
|
79 |
|
|
addr_bits : integer := 8 -- 2^addr_bits = numero bits de direccionamiento
|
80 |
|
|
);
|
81 |
|
|
Port (
|
82 |
|
|
clk :in std_logic;
|
83 |
|
|
reset :in std_logic;
|
84 |
|
|
data :in std_logic_vector(7 downto 0);
|
85 |
|
|
new_data :in std_logic;
|
86 |
|
|
error :out std_logic;
|
87 |
|
|
end_det :out std_logic;
|
88 |
|
|
--para escritura de ram:
|
89 |
|
|
E :out std_logic; -- habilitador de la ram
|
90 |
|
|
WE :out std_logic; -- habilitador de escritura
|
91 |
|
|
ADDR :out std_logic_vector(addr_bits-1 downto 0);
|
92 |
|
|
data_ram :out std_logic_vector(bits-1 downto 0) --dato a guardar en ram
|
93 |
|
|
);
|
94 |
|
|
end component;
|
95 |
|
|
|
96 |
|
|
--*******************************************************************
|
97 |
|
|
-- DECLARACION COMPONENTE BLOQUE RAM
|
98 |
|
|
--*******************************************************************
|
99 |
|
|
component ram2_top
|
100 |
|
|
generic (
|
101 |
|
|
bits : integer := 8; -- ancho de datos de la memoria
|
102 |
|
|
addr_bits : integer := 8 -- 2^addr_bits = numero bits de direccionamiento
|
103 |
|
|
);
|
104 |
|
|
port(
|
105 |
|
|
clk :in std_logic;
|
106 |
|
|
reset :in std_logic;
|
107 |
|
|
E :in std_logic; -- habilitador de la ram
|
108 |
|
|
WE :in std_logic; -- habilitador de escritura
|
109 |
|
|
ADDR :in std_logic_vector(addr_bits-1 downto 0);
|
110 |
|
|
data_in :in std_logic_vector(bits-1 downto 0);
|
111 |
|
|
data_out :out std_logic_vector(bits-1 downto 0)
|
112 |
|
|
);
|
113 |
|
|
end component;
|
114 |
|
|
|
115 |
|
|
--*******************************************************************
|
116 |
|
|
-- DECLARACION COMPONENTE generador trama (maquina de estado)
|
117 |
|
|
--*******************************************************************
|
118 |
|
|
component gen_trama_top
|
119 |
|
|
generic(
|
120 |
|
|
addr_bits : integer := 8 -- 2^addr_bits = numero bits de direccionamiento
|
121 |
|
|
);
|
122 |
|
|
port(
|
123 |
|
|
clk :in std_logic;
|
124 |
|
|
reset :in std_logic;
|
125 |
|
|
end_gen :out std_logic;
|
126 |
|
|
-- PicoBlaze
|
127 |
|
|
cant_datos_picoB :in std_logic_vector(7 downto 0); -- cantidad de datos cargados en ram
|
128 |
|
|
picoB_ok :in std_logic; -- arrancar transmision (tomando datos desde ram)
|
129 |
|
|
-- ram
|
130 |
|
|
data_out_ram :in std_logic_vector(7 downto 0); --dato leido desde ram
|
131 |
|
|
addr_ram :out std_logic_vector(addr_bits-1 downto 0); --dato leido desde ram
|
132 |
|
|
E_ram :out std_logic; -- habilitador de ram
|
133 |
|
|
WE_ram :out std_logic; -- habilitador de escritura ram: 0-lectura 1-escritura
|
134 |
|
|
-- uart
|
135 |
|
|
send_done_uart :in std_logic; -- aviso de dato enviado (por uart), seal habilitadora para obtener nuevo dato de ram
|
136 |
|
|
data_in_uart :out std_logic_vector(7 downto 0); --dato leido desde ram
|
137 |
|
|
send_data_uart :out std_logic
|
138 |
|
|
);
|
139 |
|
|
end component;
|
140 |
|
|
|
141 |
|
|
--*******************************************************************
|
142 |
|
|
-- DECLARACION COMPONENTE generador trama (maquina de estado)
|
143 |
|
|
--*******************************************************************
|
144 |
|
|
component contro_ram
|
145 |
|
|
generic(
|
146 |
|
|
addr_bits : integer := 8); -- 2^addr_bits = numero bits de direccionamiento
|
147 |
|
|
port(
|
148 |
|
|
--entradas y salidas de la RAM
|
149 |
|
|
clk :in std_logic;
|
150 |
|
|
reset :in std_logic;
|
151 |
|
|
Eram :out std_logic;
|
152 |
|
|
Eram_write :out std_logic;
|
153 |
|
|
ram_addr :out std_logic_vector(addr_bits-1 downto 0);
|
154 |
|
|
data_in_ram :out std_logic_vector(7 downto 0);
|
155 |
|
|
data_out_ram :in std_logic_vector(7 downto 0);
|
156 |
|
|
--entradas y salidas del pico blaze
|
157 |
|
|
Eram_picoB :in std_logic;
|
158 |
|
|
WEram_picoB :in std_logic;
|
159 |
|
|
addr_picoB :in std_logic_vector(addr_bits-1 downto 0);
|
160 |
|
|
data_in_ram_picoB:in std_logic_vector(7 downto 0);
|
161 |
|
|
data_out_ram_picoB:out std_logic_vector(7 downto 0);
|
162 |
|
|
--entradas y salidas del componente detector
|
163 |
|
|
Eram_det :in std_logic;
|
164 |
|
|
Eram_write_det :in std_logic;
|
165 |
|
|
ram_addr_det :in std_logic_vector(addr_bits-1 downto 0);
|
166 |
|
|
data_in_ram_det:in std_logic_vector(7 downto 0);
|
167 |
|
|
--entradas y salidas del componente generador trama
|
168 |
|
|
E_ram_gen :in std_logic;
|
169 |
|
|
WE_ram_gen :in std_logic;
|
170 |
|
|
addr_ram_gen :in std_logic_vector(addr_bits-1 downto 0);
|
171 |
|
|
data_out_ram_gen:out std_logic_vector(7 downto 0)
|
172 |
|
|
);
|
173 |
|
|
end component;
|
174 |
|
|
signal Q1,Q2,Q3 : std_logic:='0';
|
175 |
|
|
signal picoB_ok_pulso : std_logic:='0';
|
176 |
|
|
signal Stxd : std_logic:='1';
|
177 |
|
|
--*******************************************************************
|
178 |
|
|
-- SEALES DE COMPONENTE UART_RS232
|
179 |
|
|
--*******************************************************************
|
180 |
|
|
signal Sdata_out : std_logic_vector(7 downto 0):= (others=>'0');
|
181 |
|
|
signal Snew_data : std_logic:='0';
|
182 |
|
|
signal Ssend_done : std_logic:='1';
|
183 |
|
|
signal Ssend_data_uart : std_logic:='0';
|
184 |
|
|
signal Sdata_in_uart: std_logic_vector(7 downto 0):= (others=>'0');
|
185 |
|
|
signal Stransmitter_busy : std_logic := '0';
|
186 |
|
|
signal Sparity_error : std_logic := '0';
|
187 |
|
|
signal Sstart_error : std_logic := '0';
|
188 |
|
|
signal Sstop_error : std_logic := '0';
|
189 |
|
|
signal Sdiscrepancy_error: std_logic := '0';
|
190 |
|
|
signal Sreceiver_busy : std_logic := '0';
|
191 |
|
|
|
192 |
|
|
--*******************************************************************
|
193 |
|
|
-- SEALES DE COMPONENTE DET_TOP
|
194 |
|
|
--*******************************************************************
|
195 |
|
|
|
196 |
|
|
signal Serror_det : std_logic := '0';
|
197 |
|
|
signal SEram_det : std_logic := '0';
|
198 |
|
|
signal Sram_addr_det: std_logic_vector (addr_bits-1 downto 0):=(others=>'0') ;
|
199 |
|
|
signal SEram_write_det: std_logic := '0';-- habilitador de escritura
|
200 |
|
|
signal Sdata_in_ram_det: std_logic_vector (7 downto 0):=(others=>'0') ;
|
201 |
|
|
signal Send_det : std_logic:='0';
|
202 |
|
|
|
203 |
|
|
--*******************************************************************
|
204 |
|
|
-- SEALES DE COMPONENTE BLOQUE RAM
|
205 |
|
|
--*******************************************************************
|
206 |
|
|
|
207 |
|
|
signal SEram : std_logic; -- habilitador de la ram
|
208 |
|
|
signal SEram_write : std_logic; -- habilitador de escritura
|
209 |
|
|
signal Sram_addr :std_logic_vector(addr_bits-1 downto 0):=(others=>'0') ;
|
210 |
|
|
signal Sdata_in_ram :std_logic_vector(bits-1 downto 0):=(others=>'0') ;
|
211 |
|
|
signal Sdata_out_ram:std_logic_vector(bits-1 downto 0):=(others=>'0') ;
|
212 |
|
|
|
213 |
|
|
--*******************************************************************
|
214 |
|
|
-- SEALES DE COMPONENTE generador trama (maquina de estado)
|
215 |
|
|
--*******************************************************************
|
216 |
|
|
signal Send_gen : std_logic:='0';
|
217 |
|
|
signal Sdata_out_ram_gen:std_logic_vector(bits-1 downto 0):=(others=>'0'); --dato leido desde ram
|
218 |
|
|
signal Saddr_ram_gen:std_logic_vector(addr_bits-1 downto 0):=(others=>'0') ; --dato leido desde ram
|
219 |
|
|
signal SE_ram_gen : std_logic:='0'; -- habilitador de ram
|
220 |
|
|
signal SWE_ram_gen : std_logic:='0';
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
-- *********************Señales para CE **************
|
224 |
|
|
signal cont_div :std_logic_vector(20 downto 0):=(others=> '0');
|
225 |
|
|
signal CE_clock :std_logic:='0';
|
226 |
|
|
|
227 |
|
|
signal contador_canalA : std_logic_vector(7 downto 0) := (others=>'0');
|
228 |
|
|
signal RAM_trucha :std_logic_vector(7 downto 0) := (others=>'0');
|
229 |
|
|
begin
|
230 |
|
|
|
231 |
|
|
--*******************************************************************
|
232 |
|
|
-- INSTANCIACION COMPONENTE UART_RS232
|
233 |
|
|
--*******************************************************************
|
234 |
|
|
IC_uart : uart_rs232
|
235 |
|
|
Port map (
|
236 |
|
|
clk => clk, -- global clock
|
237 |
|
|
reset => reset, -- global reset
|
238 |
|
|
send_data => Ssend_data_uart,--send_ram, -- this signal orders to send the data present at the data_in inputs through the TXD line
|
239 |
|
|
data_in => Sdata_in_uart,--Sdata_out_ram, -- data to be sent
|
240 |
|
|
even_odd => '0',--Seven_odd, -- it selects the desired parity (0: odd/impar; 1: even/par)
|
241 |
|
|
rxd => rxd, -- The RS232 RXD line
|
242 |
|
|
txd => Stxd, -- The RS232 TXD line
|
243 |
|
|
transmitter_busy => Stransmitter_busy, -- it indicates that the transmitter is busy sending one character
|
244 |
|
|
send_done => Ssend_done, -- it indicates that the character has been sent
|
245 |
|
|
data_out => Sdata_out, -- The data received, in parallel
|
246 |
|
|
parity_error => Sparity_error, -- it indicates a parity error in the received data
|
247 |
|
|
start_error => Sstart_error, -- it indicates an error in the start bit (false start) of the received data. The receiver will wait for a new complete start bit
|
248 |
|
|
stop_error => Sstop_error, -- it indicates an error in the stop bit of the received data (though the data could have been received correctly and it is presented at the outputs).
|
249 |
|
|
discrepancy_error => Sdiscrepancy_error, -- it indicates an error because the three samples of the same bit of the data being currently received have different values.
|
250 |
|
|
receiver_busy => Sreceiver_busy, -- it indicates that the receiver is busy receiving one character
|
251 |
|
|
new_data => Snew_data -- it indicates that the receiving process has ended and a new character is available
|
252 |
|
|
);
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
--*******************************************************************
|
256 |
|
|
-- INSTANCIACION COMPONENTE Detector (mquina de estado)
|
257 |
|
|
--*******************************************************************
|
258 |
|
|
IC_det: det_top
|
259 |
|
|
generic map (
|
260 |
|
|
DIRE_LOCAL_ALTO => "00110001", -- 0 ASCII
|
261 |
|
|
DIRE_LOCAL_BAJO => "00110001", -- 7 ASCII
|
262 |
|
|
bits => 8, -- ancho de datos de la memoria
|
263 |
|
|
addr_bits => 8 -- 2^addr_bits = numero bits de direccionamiento
|
264 |
|
|
)
|
265 |
|
|
Port map (
|
266 |
|
|
clk => clk,
|
267 |
|
|
reset => reset,
|
268 |
|
|
data => Sdata_out, --datos recibidos por la UART en 8bit
|
269 |
|
|
new_data => Snew_data, --bandera que detecta cuando se recibe un dato en la UART
|
270 |
|
|
error => Serror_det,
|
271 |
|
|
end_det => Send_det,
|
272 |
|
|
--para escritura de ram:
|
273 |
|
|
E => SEram_det, -- habilitador de la ram
|
274 |
|
|
WE => SEram_write_det,-- habilitador de escritura
|
275 |
|
|
ADDR => Sram_addr_det, -- direccion de ram donde quiero escribir
|
276 |
|
|
data_ram => Sdata_in_ram_det -- dato a guardar en ram
|
277 |
|
|
);
|
278 |
|
|
|
279 |
|
|
--*******************************************************************
|
280 |
|
|
-- INSTANCIACION COMPONENTE BLOQUE RAM (mquina de estado)
|
281 |
|
|
--*******************************************************************
|
282 |
|
|
bloque_ram: ram2_top
|
283 |
|
|
generic map(
|
284 |
|
|
bits => 8, -- ancho de datos de la memoria
|
285 |
|
|
addr_bits => 8 -- 2^addr_bits = numero bits de direccionamiento
|
286 |
|
|
)
|
287 |
|
|
port map (
|
288 |
|
|
clk => clk,
|
289 |
|
|
reset => reset,
|
290 |
|
|
E => SEram, -- habilitador de la ram
|
291 |
|
|
WE => SEram_write, -- habilitador de escritura
|
292 |
|
|
ADDR => Sram_addr,
|
293 |
|
|
data_in => Sdata_in_ram,
|
294 |
|
|
data_out => Sdata_out_ram
|
295 |
|
|
);
|
296 |
|
|
|
297 |
|
|
--*******************************************************************
|
298 |
|
|
-- INSTANCIACION COMPONENTE generador trama (maquina de estado)
|
299 |
|
|
--*******************************************************************
|
300 |
|
|
gen_top: gen_trama_top
|
301 |
|
|
generic map(
|
302 |
|
|
addr_bits => 8 -- 2^addr_bits = numero bits de direccionamiento
|
303 |
|
|
)
|
304 |
|
|
port map(
|
305 |
|
|
clk => clk,
|
306 |
|
|
reset => reset,
|
307 |
|
|
end_gen => Send_gen,
|
308 |
|
|
-- PicoBlaze
|
309 |
|
|
cant_datos_picoB => cant_datos_picoB,-- cantidad de datos cargados en ram
|
310 |
|
|
picoB_ok => picoB_ok_pulso, -- arrancar transmision (tomando datos desde ram)
|
311 |
|
|
-- ram
|
312 |
|
|
data_out_ram => Sdata_out_ram_gen, --dato leido desde ram
|
313 |
|
|
addr_ram => Saddr_ram_gen, --dato leido desde ram
|
314 |
|
|
E_ram => SE_ram_gen, -- habilitador de ram
|
315 |
|
|
WE_ram => SWE_ram_gen, -- habilitador de escritura ram: 0-lectura 1-escritura
|
316 |
|
|
-- uart
|
317 |
|
|
send_done_uart => Ssend_done, -- aviso de dato enviado (por uart), seal habilitadora para obtener nuevo dato de ram
|
318 |
|
|
data_in_uart => Sdata_in_uart, --dato leido desde ram
|
319 |
|
|
send_data_uart => Ssend_data_uart
|
320 |
|
|
);
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
--*******************************************************************
|
324 |
|
|
-- ESCRITURA / LECTURA EN RAM
|
325 |
|
|
--*******************************************************************
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
control_RAM: contro_ram
|
329 |
|
|
generic map(
|
330 |
|
|
addr_bits => 8) -- 2^addr_bits = numero bits de direccionamiento
|
331 |
|
|
port map(
|
332 |
|
|
--entradas y salidas de la RAM
|
333 |
|
|
clk => clk,
|
334 |
|
|
reset => reset,
|
335 |
|
|
Eram => SEram, -- habilitador de la ram
|
336 |
|
|
Eram_write => SEram_write, -- habilitador de escritura
|
337 |
|
|
ram_addr => Sram_addr,
|
338 |
|
|
data_in_ram => Sdata_in_ram,
|
339 |
|
|
data_out_ram => Sdata_out_ram,
|
340 |
|
|
--entradas y salidas del pico blaze
|
341 |
|
|
Eram_picoB => Eram_picoB,
|
342 |
|
|
WEram_picoB => WEram_picoB,
|
343 |
|
|
addr_picoB => addr_picoB,
|
344 |
|
|
data_in_ram_picoB=> data_in_ram_picoB,
|
345 |
|
|
data_out_ram_picoB=> data_out_ram_picoB,
|
346 |
|
|
--entradas y salidas del componente detector
|
347 |
|
|
Eram_det => SEram_det, -- habilitador de la ram
|
348 |
|
|
Eram_write_det => SEram_write_det,-- habilitador de escritura
|
349 |
|
|
ram_addr_det => Sram_addr_det, -- direccion de ram donde quiero escribir
|
350 |
|
|
data_in_ram_det=> Sdata_in_ram_det, -- dato a guardar en ram
|
351 |
|
|
--entradas y salidas del componente generador trama
|
352 |
|
|
E_ram_gen => SE_ram_gen, -- habilitador de ram:in std_logic;
|
353 |
|
|
WE_ram_gen => SWE_ram_gen, -- habilitador de escritura ram: 0-lectura 1-escritura
|
354 |
|
|
addr_ram_gen => Saddr_ram_gen, --dato leido desde ram
|
355 |
|
|
data_out_ram_gen=> Sdata_out_ram_gen --dato leido desde ram
|
356 |
|
|
);
|
357 |
|
|
|
358 |
|
|
--*******************************************************************
|
359 |
|
|
-- SEALES DE ERROR
|
360 |
|
|
--*******************************************************************
|
361 |
|
|
error_uart <= Stransmitter_busy or Sparity_error or Sstart_error or Sstop_error or Sdiscrepancy_error or Sreceiver_busy;
|
362 |
|
|
error_lrc <= Serror_det;
|
363 |
|
|
|
364 |
|
|
--*******************************************************************
|
365 |
|
|
-- SEALES QUE AVISAN EL ESTADO DE LA INFORMACION ENVIADO/RECIBIDO
|
366 |
|
|
--*******************************************************************
|
367 |
|
|
det_trama_ok_PB <= Send_det;
|
368 |
|
|
gen_trama_ok_PB <= Send_gen;
|
369 |
|
|
--nexys2
|
370 |
|
|
an <= "1111";
|
371 |
|
|
--Led(6 downto 0) <= Sram_addr(6 downto 0);
|
372 |
|
|
--Led(7) <= SEram;
|
373 |
|
|
Led(3 downto 0) <= (others=>'0');--contador_canalA(4 downto 0);
|
374 |
|
|
Led(4) <= Serror_det;
|
375 |
|
|
Led(5) <=SEram;
|
376 |
|
|
Led(6) <=SE_ram_gen;
|
377 |
|
|
Led(7) <=SEram_det;
|
378 |
|
|
canalA <= contador_canalA;--Sdata_in_uart;
|
379 |
|
|
|
380 |
|
|
canalB(0) <= SEram; -- habilitador de la ram
|
381 |
|
|
canalB(1) <= SEram_write;
|
382 |
|
|
canalB(2) <= Stxd;
|
383 |
|
|
txd <= Stxd;
|
384 |
|
|
canalB(7 downto 3) <= Sram_addr(4 downto 0);
|
385 |
|
|
|
386 |
|
|
--**Insert the following after the 'begin' keyword**
|
387 |
|
|
process(clk)
|
388 |
|
|
begin
|
389 |
|
|
if (clk'event and clk = '1') then
|
390 |
|
|
if (reset = '1') then
|
391 |
|
|
Q1 <= '0';
|
392 |
|
|
Q2 <= '0';
|
393 |
|
|
Q3 <= '0';
|
394 |
|
|
else--if CE_clock = '1' then
|
395 |
|
|
Q1 <= picoB_ok;
|
396 |
|
|
Q2 <= Q1;
|
397 |
|
|
Q3 <= Q2;
|
398 |
|
|
end if;
|
399 |
|
|
end if;
|
400 |
|
|
end process;
|
401 |
|
|
|
402 |
|
|
picoB_ok_pulso <= Q1 and Q2 and (not Q3);
|
403 |
|
|
|
404 |
|
|
process(clk)
|
405 |
|
|
begin
|
406 |
|
|
if CE_clock = '1' then
|
407 |
|
|
cont_div <= (others=>'0');
|
408 |
|
|
elsif clk'event and clk = '1' then
|
409 |
|
|
cont_div <= cont_div + 1;
|
410 |
|
|
end if;
|
411 |
|
|
end process;
|
412 |
|
|
|
413 |
|
|
process(clk)
|
414 |
|
|
begin
|
415 |
|
|
if clk'event and clk = '1' then
|
416 |
|
|
if cont_div > "111111111111111111100" then
|
417 |
|
|
CE_clock <= '1';
|
418 |
|
|
else
|
419 |
|
|
CE_clock <= '0';
|
420 |
|
|
end if;
|
421 |
|
|
end if;
|
422 |
|
|
end process;
|
423 |
|
|
|
424 |
|
|
process (clk)
|
425 |
|
|
begin
|
426 |
|
|
if clk='1' and clk'event then
|
427 |
|
|
if CE_clock='1' then
|
428 |
|
|
contador_canalA <= contador_canalA + 1;
|
429 |
|
|
end if;
|
430 |
|
|
end if;
|
431 |
|
|
end process;
|
432 |
|
|
|
433 |
|
|
RAM_trucha <= "00110101";
|
434 |
|
|
end Behavioral;
|