boyzzun
Junior Member level 1
i have a homework that i have to code the decoder 2_4 like ic 74139,then i found the code for this
but i don't know the code test for this,could you help me
Code:
library ieee ;
use ieee.std_logic_1164.ALL;
entity decoder_2_4 is
port( a : in std_logic_vector(1 downto 0);
en : in std_logic;
y : out std_logic_vector(3 downto 0)
);
end entity;
architecture cond_arch of decoder_2_4 is
begin
y <= "0000" when (en='0') else
"0001" when (a="00") else
"0010" when (a="01") else
"0100" when (a="10") else
"1000";
end cond_arch;