Docsity

Practicas laboratorio ELDI, Ejercicios de Electrónica

Toggle sidebar
bg1
comptador3.vhd Sun Nov 12 22:46:33 2017
Page 1
1 library IEEE;
2 use IEEE.STD_LOGIC_1164.ALL;
3 use ieee.std_logic_unsigned.all;
4
5 entity comptador3 is
6 port( E,RST,CLK : in std_logic;
7 O : out std_logic_vector(1downto 0));
8 end comptador3;
9
10 architecture Behavioral of comptador3 is
11
12 signal tmp : std_logic_vector(1 downto 0);
13
14 begin
15 O <= tmp;
16 process(CLK)
17 begin
18 if(rising_edge(CLK)) then
19 if(RST = '1') then
20 tmp <= "00";
21 elsif(E = '1') then
22 if(tmp(1) = '1') then
23 tmp <= "00";
24 else
25 tmp <= tmp + '1';
26 end if;
27 end if;
28 end if;
29 end process;
30
31 end Behavioral;

Vista previa parcial del texto

¡Descarga Practicas laboratorio ELDI y más Ejercicios en PDF de Electrónica solo en Docsity!

comptador3.vhd Sun^ Nov^12 22:46:33^2017 Page 1

10111213141516171819202122232425262728293031123456789 libraryuseuseentityendarchitecturesignalbeginend^ portOprocessbeginend IEEEieeecomptador3;Behavioral;<=^ ifend^ comptador3(tmpprocess^ IEEE..tmp;( STD_LOGIC_1164std_logic_unsignedE,RST,CLKOrising_edgeifelsifend^ (CLK)if::(RST^ ;tmpifelseend;outBehavioralstd_logic_vectorif(E(tmp(1); (^) tmptmp;^ =<=if^ std_logic_vector=^ is'1');:"00"'1')<=<=^ (CLK)) in (^) ="00"tmp^ .then;ALLstd_logicofthen'1') ;+ ;.comptador3then all'1';(1then ;downto;(1downto is0);^ 0));