Library ieee;
Use ieee.std_logic_1164.all;
Use ieee.numeric_std.all;
ENTITY clavier is
PORT (
clk : IN STD_LOGIC;
y0 : IN STD_LOGIC;
y1 : IN STD_LOGIC;
y2 : IN STD_LOGIC;
y3 : IN STD_LOGIC;
x0 : OUT STD_LOGIC;
x1 : OUT STD_LOGIC;
x2 : OUT STD_LOGIC;
CT0 : OUT STD_LOGIC;
CT1 : OUT STD_LOGIC;
CT2 : OUT STD_LOGIC;
CT3 : OUT STD_LOGIC;
ta : OUT STD_LOGIC;
Q0 : OUT STD_LOGIC;
Q1 : OUT STD_LOGIC);
END clavier;
ARCHITECTURE behavior OF clavier IS
signal etat : unsigned(1 downto 0);
signal code_touche : std_logic_vector(3 downto 0);
signal colonne : std_logic_vector(2 downto 0);
BEGIN
Q0<=etat(0);Q1<=etat(1);
CT0<=code_touche(0);CT1<=code_touche(1);CT2<=code_touche(2);CT3<=code_touche(3);
x0<=colonne(0);x1<=colonne(1);x2<=colonne(2);
compteur : process(clk)
begin
if (clk'event and clk='1') then
if ta='1' then
case etat is
when "10" => etat<="00";
when others =>etat<=etat+1;
end case;
end if;
end if;
end process compteur;
with etat select
colonne<= "110" when "00",
"101" when "01",
"011" when "10",
"111" when others;
with colonne & y3 & y2 & y1 & y0 select
code_touche<= "0010" when "1011110", --> Touche 2
"0110" when "0111101", --> Touche 6
"0101" when "1011101", --> Touche 5
"0100" when "1101101", --> Touche 4
"0000" when "1010111", --> Touche 8
"0001" when "1100111", --> Touche Etoile
"0011" when "0110111", --> Touche Diese
"1111" when others;
with y3 & y2 & y1 & y0 select
ta<= '1' when "1111",
'0' when others;
END behavior;

Inconnu.






![[Valid RSS]](/design/valid-rss.png)