Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views2 pages

Decoder

The document presents three VHDL models for a 2:4 decoder: a dataflow model, a behavioral model using a case statement, and a behavioral model using if-else statements. Each model defines an entity with a 2-bit input and a 4-bit output, implementing the decoding logic in different ways. The models utilize the IEEE library for standard logic operations.

Uploaded by

anktech201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Decoder

The document presents three VHDL models for a 2:4 decoder: a dataflow model, a behavioral model using a case statement, and a behavioral model using if-else statements. Each model defines an entity with a 2-bit input and a 4-bit output, implementing the decoding logic in different ways. The models utilize the IEEE library for standard logic operations.

Uploaded by

anktech201
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

VHDL model for 2:4 decoder Dataflow model

library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity decoder2 is
port(
a : in STD_LOGIC_VECTOR(1 downto 0);
b : out STD_LOGIC_VECTOR(3 downto 0)
);
end decoder2;

architecture bhv of decoder2 is


begin

b(0) <= not a(0) and not a(1);


b(1) <= not a(0) and a(1);
b(2) <= a(0) and not a(1);
b(3) <= a(0) and a(1);

end bhv;

VHDL model for 2:4 decoder Behavioural Model

library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity decoder is
port(
a : in STD_LOGIC_VECTOR(1 downto 0);
b : out STD_LOGIC_VECTOR(3 downto 0)
);
end decoder;
architecture bhv of decoder is
begin

process(a)
begin
case a is
when "00" => b <= "0001"; when "01" => b <= "0010"; when "10" => b <= "0100"; when "11" => b <=
"1000";
end case;
end process;

end bhv;
VHDL model for 2:4 decoder using If-else statement

library IEEE;
use IEEE.STD_LOGIC_1164.all;

entity decoder1 is
port(
a : in STD_LOGIC_VECTOR(1 downto 0);
b : out STD_LOGIC_VECTOR(3 downto 0)
);
end decoder1;

architecture bhv of decoder1 is


begin

process(a)
begin
if (a="00") then
b <= "0001";
elsif (a="01") then
b <= "0010";
elsif (a="10") then
b <= "0100";
else
b <= "1000";
end if;
end process;

end bhv;

You might also like