Experiment-5: Aim: To Write VHDL Code For 2:4 Decoder, Observe The Waveform and Synthesize The Code With

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Experiment-5

Aim: To write VHDL code for 2:4 decoder, observe the waveform and synthesize the code with
technological library with given Constraints.
Apparatus: Modelsim PE Student Edition 11.1 Software
Theory:
A decoder is a combinational circuit that converts binary information from n inputs line to a
maximum of 2^n unique output lines.

Fligure 5.1: 2:4 Decoder

Table 5.1 Decoder circuit Truth Table


E A1 A0 D3 D2 D1 D0
0 X X 0 0 0 0
1 0 0 0 0 0 1
1 0 1 0 0 1 0
1 1 0 0 1 0 0
1 1 1 1 0 0 0

VHDL Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity Decoder is
port (A : in STD_LOGIC_VECTOR(1 downto 0); E : in STD_LOGIC;D : out
STD_LOGIC_VECTOR (3 downto 0));
end Decoder;

1
architecture behavioral of Decoder is
begin
process (A)
begin
if(E = '1')
then
case A is
when "00"=> D<="0001";
when "01"=> D<="0010";
when "10"=> D<="0100";
when "11"=> D<="1000";
end case;
end if;
end process;
end behavioral;

Simulation waveform results of 2 to 4 Decoder


Results: VHDL code for the Decider is written, the waveform is observed and the code is synthesized
with the technological library and is verified.

You might also like