library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity operaciones is port(
clk: in std_logic;
switch1,switch2,push1,push2: inout std_logic;
display: out std_logic_vector (7 downto 0):="00000000";
leds, anodos: out std_logic_vector (3 downto 0):="0000");
end operaciones;
architecture Behavioral of operaciones is
signal barrido,bleds,modo: std_logic_vector (1 downto 0):="00";
signal break,break2: std_logic :='0';
signal mode,anod: std_logic_vector (3 downto 0):="0000";
signal contador: std_logic_vector (9 downto 0):="0000000000";
signal disp,disp1,disp2,disp3: std_logic_vector (7 downto 0):="00000010";
signal x,y,z,w: std_logic_vector (3 downto 0):="0000";
signal x2,y2,z2,w2: std_logic_vector (3 downto 0):="0000";
signal matr: std_logic_vector (3 downto 0):="0000";
signal dispa,disp1a,disp2a,disp3a: std_logic_vector (7 downto 0):="00000010";
begin
process (clk,switch1,switch2,push1,push2,mode,x)
begin
if(clk'event and clk='1') then
barrido<=barrido+'1';
if switch1 = '1' then
if switch2 = '1' then
-------------------------------------------------------------Inicia Mode-------------------------------------------------------------------
if push1='0' then
if break='0' then
mode<=mode+'1';
break<='1';
x<="0000";
y<="0000";
z<="0000";
w<="0000";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
end if;
elsif push2='0' then
case barrido is
when "00" => display<="11111111";
anodos<="0111";
when "01" => display<="11111111";
anodos<="1011";
when "10" => display<="11111111";
anodos<="1101";
when others =>
case mode is
when "0000" => display <= "00000010";
when "0001" => display <= "10011110";
when "0010" => display <= "00100100";
when "0011" => display <= "00001100";
when "0100" => display <= "10011000";
when "0101" => display <= "01001000";
when "0110" => display <= "01000000";
when "0111" => display <= "00011110";
when "1000" => display <= "00000000";
when "1001" => display <= "00011000";
when "1010" => display <= "00010000";
when "1011" => display <= "11000000";
when "1100" => display <= "11100100";
when "1101" => display <= "10000100";
when "1110" => display <= "01100000";
when others => display <= "01110000";
end case;
anodos<="1110";
end case;
if break2='0' then
mode<=mode-'1';
break2<='1';
x<="0000";
y<="0000";
z<="0000";
w<="0000";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
end if;
-------------------------------------------------------------Inicia asignacion--------------------------------------------------------------
else
mode<=mode;
break<='0';
break2<='0';
case barrido is
when "00" => display<=disp3;
anodos<="1110";
when "01" => display<=disp2;
anodos<="1101";
when "10" => display<=disp1;
anodos<="1011";
when others => display<=disp;
anodos<="0111";
end case;
if (switch1='1' and mode ="0001") then--cron
disp<="11100100";
disp1<="11110100";
disp2<="00000010";
disp3<="11010100";
elsif (switch1='1' and mode ="0010") then--cont
disp<="11100100";
disp1<="11000100";
disp2<="11010100";
disp3<="11110000";
elsif (switch1='1' and mode ="0000") then--matr
disp<="10010000";
disp1<="11000100";
disp2<="10011110";
disp3<="00010000";
elsif (switch1='1' and mode ="0011") then--sum
disp<="01001000";
disp1<="11000110";
disp2<="11010100";
disp3<="00010000";
elsif (switch1='1' and mode ="0100") then--and
disp<="00010000";
disp1<="11010100";
disp2<="10000100";
disp3<="11111111";
elsif (switch1='1' and mode ="0101") then--or
disp<="11111111";
disp1<="00000010";
disp2<="11110100";
disp3<="11111111";
elsif (switch1='1' and mode ="0110") then--not
disp<="11010100";
disp1<="11000100";
disp2<="11110000";
disp3<="11111111";
elsif (switch1='1' and mode ="0111") then--izq
disp<="11110010";
disp1<="00100100";
disp2<="00011000";
disp3<="11111111";
elsif (switch1='1' and mode ="1000") then--der
disp<="10000100";
disp1<="01100000";
disp2<="11110100";
disp3<="11111111";
else
disp<="11010100";
disp1<="00000010";
disp2<="10000100";
case mode is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when "1010" => disp3 <= "00010000";
when "1011" => disp3 <= "11000000";
when "1100" => disp3 <= "11100100";
when "1101" => disp3 <= "10000100";
when "1110" => disp3 <= "01100000";
when others => disp3 <= "01110000";
end case;
end if;
end if;
else
case barrido is
when "00" => display<="11111111";----off
anodos<="0111";
when "01" => display<="00000010";
anodos<="1011";
when "10" => display<="01110000";
anodos<="1101";
when others => display<="01110000";
anodos<="1110";
end case;
x<="0000";
y<="0000";
z<="0000";
w<="0000";
x2<="0000";
y2<="0000";
z2<="0000";
w2<="0000";
modo<="00";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
matr<="0000";
end if;
else
if switch2 = '0' then
case barrido is
when "00" => display<="00010000";-----rest
anodos<="0111";
when "01" => display<="01100000";
anodos<="1011";
when "10" => display<="01001000";
anodos<="1101";
when others => display<="11110000";
anodos<="1110";
end case;
x<="0000";
y<="0000";
z<="0000";
w<="0000";
x2<="0000";
y2<="0000";
z2<="0000";
w2<="0000";
modo<="00";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
matr<="0000";
else
-----------------------------------------------------------------reloj-----------------------------------------------------------------
if (switch1='0' and mode ="0001") then
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
if(contador="1111111111") then
contador<="0000000000";
x<=x+'1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
else
contador<=contador+'1';
x<=x;
y<=y;
z<=z;
w<=w;
disp<=disp;
disp1<=disp1;
disp2<=disp2;
disp3<=disp3;
end if;
-------------------------------------------------------------contador-----------------------------------------------------------------------
elsif (switch1='0' and mode ="0010") then
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
if push1='0' and break='0' then
x<=x+'1';
break<='1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
elsif push1='1' then
break<='0';
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
end if;
---------------------------------------------------------------------------sumador------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0011") then
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
if push2='0' and break2='0' then
break2<='1';
modo<=modo+'1';
if modo="11" then
x<="0000";
y<="0000";
z<="0000";
w<="0000";
x2<="0000";
y2<="0000";
z2<="0000";
w2<="0000";
modo<="00";
end if;
elsif push2='1' then
break2<='0';
end if;
if push1='0' and break='0' and modo="00" then
x<=x+'1';
break<='1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
elsif push1='0' and break='0' and modo="01" then
x<=x+'1';
x2<=x2+'1';
break<='1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if x2="1001" then
y2<=y2+'1';
x2<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if y2="1010" then
z2<=z2+'1';
y2<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if z2="1010" then
w2<=w2+'1';
z2<="0000";
end if;
if w="1010" then
w<="0000";
end if;
if w2="1010" then
w2<="0000";
end if;
elsif push1='1' and modo="00" then
break<='0';
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
elsif push1='1' and modo="01" then
break<='0';
case x2 is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y2 is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z2 is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w2 is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
elsif push1='1' and modo="10" then
break<='0';
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
end if;
-----------------------------------------------------------------------------and-------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0100") then
if push2='0' then
disp3a<="10011110";
else
disp3a<="00000010";
end if;
if push1='0' then
disp2a<="10011110";
else
disp2a<="00000010";
end if;
if push1='0' and push2='0' then
dispa<="10011110";
else
dispa<="00000010";
end if;
case barrido is
when "00" => display<=dispa;
anodos<="1110";
when "01" => display<="11111111";
anodos<="1101";
when "10" => display<=disp2a;
anodos<="1011";
when others => display<=disp3a;
anodos<="0111";
end case;
-----------------------------------------------------------------------------or-------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0101") then
if push2='0' then
disp3a<="10011110";
else
disp3a<="00000010";
end if;
if push1='0' then
disp2a<="10011110";
else
disp2a<="00000010";
end if;
if push1='0' or push2='0' then
dispa<="10011110";
else
dispa<="00000010";
end if;
case barrido is
when "00" => display<=dispa;
anodos<="1110";
when "01" => display<="11111111";
anodos<="1101";
when "10" => display<=disp2a;
anodos<="1011";
when others => display<=disp3a;
anodos<="0111";
end case;
-----------------------------------------------------------------------------not-------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0110") then
if push2='0' then
disp3a<="10011110";
dispa<="00000010";
else
disp3a<="00000010";
dispa<="10011110";
end if;
case barrido is
when "00" => display<=dispa;
anodos<="1110";
when "01" => display<="11111111";
anodos<="1101";
when "10" => display<="11111111";
anodos<="1011";
when others => display<=disp3a;
anodos<="0111";
end case;
--------------------------------------------------------------------------------izq-----------------------------------------------------------------------------
elsif (switch1='0' and mode ="0111") then
case bleds is
when "00" => display<="11111101";
anodos<="1110";
leds<="0111";
when "01" => display<="11111101";
anodos<="1101";
leds<="1011";
when "10" => display<="11111101";
anodos<="1011";
leds<="1101";
when others => display<="11111101";
anodos<="0111";
leds<="1110";
end case;
if(contador="1111111111") then
contador<="0000000000";
bleds<=bleds+'1';
else
contador<=contador+'1';
end if;
--------------------------------------------------------------------------------der-----------------------------------------------------------------------------
elsif (switch1='0' and mode ="1000") then
case bleds is
when "00" => display<="11111101";
anodos<="0111";
leds<="1110";
when "01" => display<="11111101";
anodos<="1011";
leds<="1101";
when "10" => display<="11111101";
anodos<="1101";
leds<="1011";
when others => display<="11111101";
anodos<="1110";
leds<="0111";
end case;
if(contador="1111111111") then
contador<="0000000000";
bleds<=bleds+'1';
else
contador<=contador+'1';
end if;
--------------------------------------------------------------------------hola mundo---------------------------------------------------------------------------
elsif (switch1='0' and mode ="0000") then
case barrido is
when "00" =>
case matr is
when "0000" => display<="11111111";--
when "0001" => display<="11111111";--
when "0010" => display<="11111111";--
when "0011" => display<="10010000";--h
when "0100" => display<="11000100";--o
when "0101" => display<="10011110";--l
when "0110" => display<="00010000";--a
when "0111" => display<="11111111";--
when "1000" => display<="11010100";--m
when "1001" => display<="11000110";--u
when "1010" => display<="11010100";--n
when "1011" => display<="10000100";--d
when "1100" => display<="11000100";--o
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="0111";
when "01" =>
case matr is
when "0000" => display<="11111111";--
when "0001" => display<="11111111";--
when "0010" => display<="10010000";--h
when "0011" => display<="11000100";--o
when "0100" => display<="10011110";--l
when "0101" => display<="00010000";--a
when "0110" => display<="11111111";--
when "0111" => display<="11010100";--m
when "1000" => display<="11000110";--u
when "1001" => display<="11010100";--n
when "1010" => display<="10000100";--d
when "1011" => display<="11000100";--o
when "1100" => display<="11111111";--
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="1011";
when "10" =>
case matr is
when "0000" => display<="11111111";--
when "0001" => display<="10010000";--h
when "0010" => display<="11000100";--o
when "0011" => display<="10011110";--l
when "0100" => display<="00010000";--a
when "0101" => display<="11111111";--
when "0110" => display<="11010100";--m
when "0111" => display<="11000110";--u
when "1000" => display<="11010100";--n
when "1001" => display<="10000100";--d
when "1010" => display<="11000100";--o
when "1011" => display<="11111111";--
when "1100" => display<="11111111";--
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="1101";
when others =>
case matr is
when "0000" => display<="10010000";--h
when "0001" => display<="11000100";--o
when "0010" => display<="10011110";--l
when "0011" => display<="00010000";--a
when "0100" => display<="11111111";--
when "0101" => display<="11010100";--m
when "0110" => display<="11000110";--u
when "0111" => display<="11010100";--n
when "1000" => display<="10000100";--d
when "1001" => display<="11000100";--o
when "1010" => display<="11111111";--
when "1011" => display<="11111111";--
when "1100" => display<="11111111";--
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="1110";
end case;
leds<=matr;
if(contador="1111111111") then
contador<="0000000000";
matr<=matr+'1';
else
contador<=contador+'1';
end if;
-----------------------------------------------------------------No asignado----------------------------------------------------------------
else
case barrido is
when "00" => display<="11010100";
anodos<="0111";
when "01" => display<="00000010";
anodos<="1011";
when "10" => display<="10000100";
anodos<="1101";
when others =>
case mode is
when "0000" => display <= "00000010";
when "0001" => display <= "10011110";
when "0010" => display <= "00100100";
when "0011" => display <= "00001100";
when "0100" => display <= "10011000";
when "0101" => display <= "01001000";
when "0110" => display <= "01000000";
when "0111" => display <= "00011110";
when "1000" => display <= "00000000";
when "1001" => display <= "00011000";
when "1010" => display <= "00010000";
when "1011" => display <= "11000000";
when "1100" => display <= "11100100";
when "1101" => display <= "10000100";
when "1110" => display <= "01100000";
when others => display <= "01110000";
end case;
anodos<="1110";
end case;
mode<=mode;
break<='0';
end if;
-----------------------------------------------------------------Fin mode-------------------------------------------------------------------
end if;
end if;--switch1
--leds<="0000";
else --reloj
--contador<=contador+'1';
end if;--reloj
end process;
end Behavioral;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity operaciones is port(
clk: in std_logic;
switch1,switch2,push1,push2: inout std_logic;
display: out std_logic_vector (7 downto 0):="00000000";
leds, anodos: out std_logic_vector (3 downto 0):="0000");
end operaciones;
architecture Behavioral of operaciones is
signal barrido,bleds,modo: std_logic_vector (1 downto 0):="00";
signal break,break2: std_logic :='0';
signal mode,anod: std_logic_vector (3 downto 0):="0000";
signal contador: std_logic_vector (9 downto 0):="0000000000";
signal disp,disp1,disp2,disp3: std_logic_vector (7 downto 0):="00000010";
signal x,y,z,w: std_logic_vector (3 downto 0):="0000";
signal x2,y2,z2,w2: std_logic_vector (3 downto 0):="0000";
signal matr: std_logic_vector (3 downto 0):="0000";
signal dispa,disp1a,disp2a,disp3a: std_logic_vector (7 downto 0):="00000010";
begin
process (clk,switch1,switch2,push1,push2,mode,x)
begin
if(clk'event and clk='1') then
barrido<=barrido+'1';
if switch1 = '1' then
if switch2 = '1' then
-------------------------------------------------------------Inicia Mode-------------------------------------------------------------------
if push1='0' then
if break='0' then
mode<=mode+'1';
break<='1';
x<="0000";
y<="0000";
z<="0000";
w<="0000";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
end if;
elsif push2='0' then
case barrido is
when "00" => display<="11111111";
anodos<="0111";
when "01" => display<="11111111";
anodos<="1011";
when "10" => display<="11111111";
anodos<="1101";
when others =>
case mode is
when "0000" => display <= "00000010";
when "0001" => display <= "10011110";
when "0010" => display <= "00100100";
when "0011" => display <= "00001100";
when "0100" => display <= "10011000";
when "0101" => display <= "01001000";
when "0110" => display <= "01000000";
when "0111" => display <= "00011110";
when "1000" => display <= "00000000";
when "1001" => display <= "00011000";
when "1010" => display <= "00010000";
when "1011" => display <= "11000000";
when "1100" => display <= "11100100";
when "1101" => display <= "10000100";
when "1110" => display <= "01100000";
when others => display <= "01110000";
end case;
anodos<="1110";
end case;
if break2='0' then
mode<=mode-'1';
break2<='1';
x<="0000";
y<="0000";
z<="0000";
w<="0000";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
end if;
-------------------------------------------------------------Inicia asignacion--------------------------------------------------------------
else
mode<=mode;
break<='0';
break2<='0';
case barrido is
when "00" => display<=disp3;
anodos<="1110";
when "01" => display<=disp2;
anodos<="1101";
when "10" => display<=disp1;
anodos<="1011";
when others => display<=disp;
anodos<="0111";
end case;
if (switch1='1' and mode ="0001") then--cron
disp<="11100100";
disp1<="11110100";
disp2<="00000010";
disp3<="11010100";
elsif (switch1='1' and mode ="0010") then--cont
disp<="11100100";
disp1<="11000100";
disp2<="11010100";
disp3<="11110000";
elsif (switch1='1' and mode ="0000") then--matr
disp<="10010000";
disp1<="11000100";
disp2<="10011110";
disp3<="00010000";
elsif (switch1='1' and mode ="0011") then--sum
disp<="01001000";
disp1<="11000110";
disp2<="11010100";
disp3<="00010000";
elsif (switch1='1' and mode ="0100") then--and
disp<="00010000";
disp1<="11010100";
disp2<="10000100";
disp3<="11111111";
elsif (switch1='1' and mode ="0101") then--or
disp<="11111111";
disp1<="00000010";
disp2<="11110100";
disp3<="11111111";
elsif (switch1='1' and mode ="0110") then--not
disp<="11010100";
disp1<="11000100";
disp2<="11110000";
disp3<="11111111";
elsif (switch1='1' and mode ="0111") then--izq
disp<="11110010";
disp1<="00100100";
disp2<="00011000";
disp3<="11111111";
elsif (switch1='1' and mode ="1000") then--der
disp<="10000100";
disp1<="01100000";
disp2<="11110100";
disp3<="11111111";
else
disp<="11010100";
disp1<="00000010";
disp2<="10000100";
case mode is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when "1010" => disp3 <= "00010000";
when "1011" => disp3 <= "11000000";
when "1100" => disp3 <= "11100100";
when "1101" => disp3 <= "10000100";
when "1110" => disp3 <= "01100000";
when others => disp3 <= "01110000";
end case;
end if;
end if;
else
case barrido is
when "00" => display<="11111111";----off
anodos<="0111";
when "01" => display<="00000010";
anodos<="1011";
when "10" => display<="01110000";
anodos<="1101";
when others => display<="01110000";
anodos<="1110";
end case;
x<="0000";
y<="0000";
z<="0000";
w<="0000";
x2<="0000";
y2<="0000";
z2<="0000";
w2<="0000";
modo<="00";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
matr<="0000";
end if;
else
if switch2 = '0' then
case barrido is
when "00" => display<="00010000";-----rest
anodos<="0111";
when "01" => display<="01100000";
anodos<="1011";
when "10" => display<="01001000";
anodos<="1101";
when others => display<="11110000";
anodos<="1110";
end case;
x<="0000";
y<="0000";
z<="0000";
w<="0000";
x2<="0000";
y2<="0000";
z2<="0000";
w2<="0000";
modo<="00";
disp<="00000010";
disp1<="00000010";
disp2<="00000010";
disp3<="00000010";
matr<="0000";
else
-----------------------------------------------------------------reloj-----------------------------------------------------------------
if (switch1='0' and mode ="0001") then
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
if(contador="1111111111") then
contador<="0000000000";
x<=x+'1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
else
contador<=contador+'1';
x<=x;
y<=y;
z<=z;
w<=w;
disp<=disp;
disp1<=disp1;
disp2<=disp2;
disp3<=disp3;
end if;
-------------------------------------------------------------contador-----------------------------------------------------------------------
elsif (switch1='0' and mode ="0010") then
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
if push1='0' and break='0' then
x<=x+'1';
break<='1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
elsif push1='1' then
break<='0';
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
end if;
---------------------------------------------------------------------------sumador------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0011") then
case barrido is
when "00" => display<=disp;
anodos<="1110";
when "01" => display<=disp1;
anodos<="1101";
when "10" => display<=disp2;
anodos<="1011";
when others => display<=disp3;
anodos<="0111";
end case;
if push2='0' and break2='0' then
break2<='1';
modo<=modo+'1';
if modo="11" then
x<="0000";
y<="0000";
z<="0000";
w<="0000";
x2<="0000";
y2<="0000";
z2<="0000";
w2<="0000";
modo<="00";
end if;
elsif push2='1' then
break2<='0';
end if;
if push1='0' and break='0' and modo="00" then
x<=x+'1';
break<='1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if w="1010" then
w<="0000";
end if;
elsif push1='0' and break='0' and modo="01" then
x<=x+'1';
x2<=x2+'1';
break<='1';
if x="1001" then
y<=y+'1';
x<="0000";
end if;
if x2="1001" then
y2<=y2+'1';
x2<="0000";
end if;
if y="1010" then
z<=z+'1';
y<="0000";
end if;
if y2="1010" then
z2<=z2+'1';
y2<="0000";
end if;
if z="1010" then
w<=w+'1';
z<="0000";
end if;
if z2="1010" then
w2<=w2+'1';
z2<="0000";
end if;
if w="1010" then
w<="0000";
end if;
if w2="1010" then
w2<="0000";
end if;
elsif push1='1' and modo="00" then
break<='0';
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
elsif push1='1' and modo="01" then
break<='0';
case x2 is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y2 is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z2 is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w2 is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
elsif push1='1' and modo="10" then
break<='0';
case x is
when "0000" => disp <= "00000010";
when "0001" => disp <= "10011110";
when "0010" => disp <= "00100100";
when "0011" => disp <= "00001100";
when "0100" => disp <= "10011000";
when "0101" => disp <= "01001000";
when "0110" => disp <= "01000000";
when "0111" => disp <= "00011110";
when "1000" => disp <= "00000000";
when "1001" => disp <= "00011000";
when others => disp <= "00000000";
end case;
case y is
when "0000" => disp1 <= "00000010";
when "0001" => disp1 <= "10011110";
when "0010" => disp1 <= "00100100";
when "0011" => disp1 <= "00001100";
when "0100" => disp1 <= "10011000";
when "0101" => disp1 <= "01001000";
when "0110" => disp1 <= "01000000";
when "0111" => disp1 <= "00011110";
when "1000" => disp1 <= "00000000";
when "1001" => disp1 <= "00011000";
when others => disp1 <= "00000010";
end case;
case z is
when "0000" => disp2 <= "00000010";
when "0001" => disp2 <= "10011110";
when "0010" => disp2 <= "00100100";
when "0011" => disp2 <= "00001100";
when "0100" => disp2 <= "10011000";
when "0101" => disp2 <= "01001000";
when "0110" => disp2 <= "01000000";
when "0111" => disp2 <= "00011110";
when "1000" => disp2 <= "00000000";
when "1001" => disp2 <= "00011000";
when others => disp2 <= "00000010";
end case;
case w is
when "0000" => disp3 <= "00000010";
when "0001" => disp3 <= "10011110";
when "0010" => disp3 <= "00100100";
when "0011" => disp3 <= "00001100";
when "0100" => disp3 <= "10011000";
when "0101" => disp3 <= "01001000";
when "0110" => disp3 <= "01000000";
when "0111" => disp3 <= "00011110";
when "1000" => disp3 <= "00000000";
when "1001" => disp3 <= "00011000";
when others => disp3 <= "00000010";
end case;
end if;
-----------------------------------------------------------------------------and-------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0100") then
if push2='0' then
disp3a<="10011110";
else
disp3a<="00000010";
end if;
if push1='0' then
disp2a<="10011110";
else
disp2a<="00000010";
end if;
if push1='0' and push2='0' then
dispa<="10011110";
else
dispa<="00000010";
end if;
case barrido is
when "00" => display<=dispa;
anodos<="1110";
when "01" => display<="11111111";
anodos<="1101";
when "10" => display<=disp2a;
anodos<="1011";
when others => display<=disp3a;
anodos<="0111";
end case;
-----------------------------------------------------------------------------or-------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0101") then
if push2='0' then
disp3a<="10011110";
else
disp3a<="00000010";
end if;
if push1='0' then
disp2a<="10011110";
else
disp2a<="00000010";
end if;
if push1='0' or push2='0' then
dispa<="10011110";
else
dispa<="00000010";
end if;
case barrido is
when "00" => display<=dispa;
anodos<="1110";
when "01" => display<="11111111";
anodos<="1101";
when "10" => display<=disp2a;
anodos<="1011";
when others => display<=disp3a;
anodos<="0111";
end case;
-----------------------------------------------------------------------------not-------------------------------------------------------------------------------
elsif (switch1='0' and mode ="0110") then
if push2='0' then
disp3a<="10011110";
dispa<="00000010";
else
disp3a<="00000010";
dispa<="10011110";
end if;
case barrido is
when "00" => display<=dispa;
anodos<="1110";
when "01" => display<="11111111";
anodos<="1101";
when "10" => display<="11111111";
anodos<="1011";
when others => display<=disp3a;
anodos<="0111";
end case;
--------------------------------------------------------------------------------izq-----------------------------------------------------------------------------
elsif (switch1='0' and mode ="0111") then
case bleds is
when "00" => display<="11111101";
anodos<="1110";
leds<="0111";
when "01" => display<="11111101";
anodos<="1101";
leds<="1011";
when "10" => display<="11111101";
anodos<="1011";
leds<="1101";
when others => display<="11111101";
anodos<="0111";
leds<="1110";
end case;
if(contador="1111111111") then
contador<="0000000000";
bleds<=bleds+'1';
else
contador<=contador+'1';
end if;
--------------------------------------------------------------------------------der-----------------------------------------------------------------------------
elsif (switch1='0' and mode ="1000") then
case bleds is
when "00" => display<="11111101";
anodos<="0111";
leds<="1110";
when "01" => display<="11111101";
anodos<="1011";
leds<="1101";
when "10" => display<="11111101";
anodos<="1101";
leds<="1011";
when others => display<="11111101";
anodos<="1110";
leds<="0111";
end case;
if(contador="1111111111") then
contador<="0000000000";
bleds<=bleds+'1';
else
contador<=contador+'1';
end if;
--------------------------------------------------------------------------hola mundo---------------------------------------------------------------------------
elsif (switch1='0' and mode ="0000") then
case barrido is
when "00" =>
case matr is
when "0000" => display<="11111111";--
when "0001" => display<="11111111";--
when "0010" => display<="11111111";--
when "0011" => display<="10010000";--h
when "0100" => display<="11000100";--o
when "0101" => display<="10011110";--l
when "0110" => display<="00010000";--a
when "0111" => display<="11111111";--
when "1000" => display<="11010100";--m
when "1001" => display<="11000110";--u
when "1010" => display<="11010100";--n
when "1011" => display<="10000100";--d
when "1100" => display<="11000100";--o
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="0111";
when "01" =>
case matr is
when "0000" => display<="11111111";--
when "0001" => display<="11111111";--
when "0010" => display<="10010000";--h
when "0011" => display<="11000100";--o
when "0100" => display<="10011110";--l
when "0101" => display<="00010000";--a
when "0110" => display<="11111111";--
when "0111" => display<="11010100";--m
when "1000" => display<="11000110";--u
when "1001" => display<="11010100";--n
when "1010" => display<="10000100";--d
when "1011" => display<="11000100";--o
when "1100" => display<="11111111";--
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="1011";
when "10" =>
case matr is
when "0000" => display<="11111111";--
when "0001" => display<="10010000";--h
when "0010" => display<="11000100";--o
when "0011" => display<="10011110";--l
when "0100" => display<="00010000";--a
when "0101" => display<="11111111";--
when "0110" => display<="11010100";--m
when "0111" => display<="11000110";--u
when "1000" => display<="11010100";--n
when "1001" => display<="10000100";--d
when "1010" => display<="11000100";--o
when "1011" => display<="11111111";--
when "1100" => display<="11111111";--
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="1101";
when others =>
case matr is
when "0000" => display<="10010000";--h
when "0001" => display<="11000100";--o
when "0010" => display<="10011110";--l
when "0011" => display<="00010000";--a
when "0100" => display<="11111111";--
when "0101" => display<="11010100";--m
when "0110" => display<="11000110";--u
when "0111" => display<="11010100";--n
when "1000" => display<="10000100";--d
when "1001" => display<="11000100";--o
when "1010" => display<="11111111";--
when "1011" => display<="11111111";--
when "1100" => display<="11111111";--
when "1101" => display<="11111111";--
when "1110" => display<="11111111";--
when others => display<="11111111";--
end case;
anodos<="1110";
end case;
leds<=matr;
if(contador="1111111111") then
contador<="0000000000";
matr<=matr+'1';
else
contador<=contador+'1';
end if;
-----------------------------------------------------------------No asignado----------------------------------------------------------------
else
case barrido is
when "00" => display<="11010100";
anodos<="0111";
when "01" => display<="00000010";
anodos<="1011";
when "10" => display<="10000100";
anodos<="1101";
when others =>
case mode is
when "0000" => display <= "00000010";
when "0001" => display <= "10011110";
when "0010" => display <= "00100100";
when "0011" => display <= "00001100";
when "0100" => display <= "10011000";
when "0101" => display <= "01001000";
when "0110" => display <= "01000000";
when "0111" => display <= "00011110";
when "1000" => display <= "00000000";
when "1001" => display <= "00011000";
when "1010" => display <= "00010000";
when "1011" => display <= "11000000";
when "1100" => display <= "11100100";
when "1101" => display <= "10000100";
when "1110" => display <= "01100000";
when others => display <= "01110000";
end case;
anodos<="1110";
end case;
mode<=mode;
break<='0';
end if;
-----------------------------------------------------------------Fin mode-------------------------------------------------------------------
end if;
end if;--switch1
--leds<="0000";
else --reloj
--contador<=contador+'1';
end if;--reloj
end process;
end Behavioral;
Comments