stryker213
Technical User
Hello, I'm having some trouble implementing my 4:1 MUX and was hoping I could get some input. My main issue is this, the MUX will need to have an output of 'Z' when EN=0. I coded the following:
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
ENTITY mux4 IS
Port(D: in std_logic_vector(3 downto 0);
s: IN STD_LOGIC_VECTOR(1 DOWNTO 0);
EN: in std_logic; f: OUT STD_LOGIC);
END mux4 ;
ARCHITECTURE beh1 OF mux4 IS
BEGIN
WITH s SELECT
f <= D(0) WHEN "00",
D(1) WHEN "01",
D(2) WHEN "10",
D(3) WHEN OTHERS;
END beh1;
ARCHITECTURE beh2 OF mux4 IS
begin
with EN select
f<='Z' when '0',
null when others;
end beh2;
I just can't figure out how to fix my error!
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
ENTITY mux4 IS
Port(D: in std_logic_vector(3 downto 0);
s: IN STD_LOGIC_VECTOR(1 DOWNTO 0);
EN: in std_logic; f: OUT STD_LOGIC);
END mux4 ;
ARCHITECTURE beh1 OF mux4 IS
BEGIN
WITH s SELECT
f <= D(0) WHEN "00",
D(1) WHEN "01",
D(2) WHEN "10",
D(3) WHEN OTHERS;
END beh1;
ARCHITECTURE beh2 OF mux4 IS
begin
with EN select
f<='Z' when '0',
null when others;
end beh2;
I just can't figure out how to fix my error!