Using the ifthenelse statement complete the VHDL code for a

Using the if...then...else statement, complete the VHDL code for a 4-to-1 Multiplexer shown below, where a, b, c, d, X are all 4-bit vectors: ENTITY _____ IS port (_____: _____; _____: _____; _____: _____); END _____; ARCHITECTURE _____OF _____ IS _____ process(_____) _____ if_____then_____; elsif_____then_____; elsif_____then_____; elsif_____;

Solution

entity mux_4to1 is

port( a,b,c,d : in_std_logic_vector(3 downto 0); // a,b,c,d are 4 bit vectors

s : in_std_logic_vector(1 downto 0);

x: out_std_logic_vector(3 downto 0)); // output also 4 bit vector

end mux_4to1;

Architecture behvavioral of mux_4to1 is

begin

process(s,a,b,c,d)

begin

if (s=\"00\") then x<= a;

elsif (s=\"01\") then x<= b;

elsif (s=\"10\") then x<= c;

else x<= d;

end if;

end process;

end behavioral;

 Using the if...then...else statement, complete the VHDL code for a 4-to-1 Multiplexer shown below, where a, b, c, d, X are all 4-bit vectors: ENTITY _____ IS p

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site