J'ai un décodeur 4 à 16 en vhdl. Je veux mettre une entrée d'enable mais je suis nouveau au codage de vhdl. Je veux garder cette structure du code (je ne veux pas d'autres raccourcis, ou code complètement modifié). J'ai essayé d'écrire une entrée e
pour l'activation, et j'ai essayé de faire if e = "1" then
mais cela ne fonctionne pas.Mise en place d'une entrée de validation sur un décodeur (VHDL)
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity decode4to16 is
port(
oct : in std_logic_vector(3 downto 0);
e : in std_logic;
dec : out std_logic_vector(15 downto 0));
end decode4to16;
architecture arch of decode4to16 is
begin
if e = "1" then
with oct select
dec <=
"0000000000000001" when "0000",
"0000000000000010" when "0001",
"0000000000000100" when "0010",
"0000000000001000" when "0011",
"0000000000010000" when "0100",
"0000000000100000" when "0101",
"0000000001000000" when "0110",
"0000000010000000" when "0111",
"0000000100000000" when "1000",
"0000001000000000" when "1001",
"0000010000000000" when "1010",
"0000100000000000" when "1011",
"0001000000000000" when "1100",
"0010000000000000" when "1101",
"0100000000000000" when "1110",
"1000000000000000" when "1111",
"0000000000000000" when others;
end if;
end arch;