Experiment 4
Experiment 4
Aim:-implement VHDL code for 8x3 encoder and decoder circuit using Xilinx tool.
Software Used:-Xilinx 12.1,ISim Simulator.
Activity1:-Write a VHDL code for 8x3 encoder circuit using structural modeling.
Truth Table:
Circuit Diagram:
VHDL CODE(Implementation):-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity encoder8X3 is
Port ( d0,d1,d2,d3,d4,d5,d6,d7 : in STD_LOGIC;
y0,y1,y2 : out STD_LOGIC;
e : in STD_LOGIC);
end encoder8X3;
architecture Behavioral of encoder8X3 is
begin
y0<=(e AND d1) OR(e AND d3) OR(e AND d5) OR(e AND d7) ;
y1<=(e AND d2) OR(e AND d3) OR(e AND d6) OR(e AND d7) ;
y2<=(e AND d4) OR(e AND d5) OR(e AND d6) OR(e AND d7) ;
end Behavioral;
Synthesis Report:-
Number of Slices: 2 out of 768 0%
Delay: 7.850ns (Levels of Logic = 3)
Schematic Diagram:-
Activity2:-Write a VHDL code for 3x8 decoder circuit using Behavioral Modeling.
Truth Table:-
Circuit Diagram:-
VHDL CODE(Implementation):-
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity decode_beh is
Port ( a2,a1,a0 : in STD_LOGIC;
d7,d6,d5,d4,d3,d2,d1,d0 : out STD_LOGIC);
end decode_beh;
architecture Behavioral of decode_beh is
begin
process(a2,a1,a0)
begin
if(a2='0' and a1='0' and a0='0') then
d7<='0';d6<='0';d5<='0';d4<='0';d3<='0';d2<='0';d1<='0';d0<='1';
elsif(a2='0' and a1='0' and a0='1') then
d7<='0';d6<='0';d5<='0';d4<='0';d3<='0';d2<='0';d1<='1';d0<='0';
elsif(a2='0' and a1='1' and a0='0') then
d7<='0';d6<='0';d5<='0';d4<='0';d3<='0';d2<='1';d1<='0';d0<='0';
elsif(a2='0' and a1='1' and a0='1') then
d7<='0';d6<='0';d5<='0';d4<='0';d3<='1';d2<='0';d1<='0';d0<='0';
elsif(a2='1' and a1='0' and a0='0') then
d7<='0';d6<='0';d5<='0';d4<='1';d3<='0';d2<='0';d1<='0';d0<='0';
elsif(a2='1' and a1='0' and a0='1') then
d7<='0';d6<='0';d5<='1';d4<='0';d3<='0';d2<='0';d1<='0';d0<='0';
elsif(a2='1' and a1='1' and a0='0') then
d7<='0';d6<='1';d5<='0';d4<='0';d3<='0';d2<='0';d1<='0';d0<='0';
else
d7<='1';d6<='0';d5<='0';d4<='0';d3<='0';d2<='0';d1<='0';d0<='0';
end if;
end process;
end Behavioral;
Schematic Diagram:-
Synthesis Report:-
decoder encoder
Number of Slices: 5 out of 768
0% Number of Slices: 1 out of 768
Number of 4 input LUTs: 8 out of 0%
1536 0% Number of 4 input LUTs: 2 out of
Number of bonded IOBs: 11 out of 1536 0%
97 11% Number of bonded IOBs: 5 out of
97 5%
Conclusion:- in 8x3 encoder and decoder Number of Slices: 1 out of 768 0% and in
decoder Delay: 7.622ns (Levels of Logic = 3)and in encoder delay is 7.340ns
(Levels of Logic = 3)