Professional Documents
Culture Documents
EXPERIMENT-8
Aim: Design, synthesis and simulation of Binary to Excess3 code Converter.
Theory: To convert any decimal numbers into its excess- 3 form add 3 to each decimal digit
and then convert the sum to a BCD number As weights are not assigned, it is a kind of nonweighted codes.
Logic Diagram:
Truth Table:
Binary
Excess 3
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
VHDL Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity binary2excess is
Port ( b : in STD_LOGIC_VECTOR (3 downto 0);
Jashanpreet Sandhu
12BEC1092
ECE-II
CHANDIGARH UNIVERSITY
ex : out STD_LOGIC_VECTOR (3 downto 0));
end binary2excess;
architecture Behavioral of binary2excess is
begin
process(b)
begin
if(b="0000") then
ex<="0011";
elsif(b="0001")then
ex<="0100";
elsif(b="0010")then
ex<="0101";
elsif(b="0011")then
ex<="0110";
elsif(b="0100")then
ex<="0111";
elsif(b="0101")then
ex<="1000";
elsif(b="0110")then
ex<="1001";
elsif(b="0111")then
ex<="1010";
elsif(b="1000")then
ex<="1011";
elsif(b="1001")then
ex<="1100";
else
ex<="ZZZZ";
end if;
end process;
end Behavioral;
Simulation Results:
Jashanpreet Sandhu
12BEC1092
ECE-II
CHANDIGARH UNIVERSITY
Jashanpreet Sandhu
12BEC1092
ECE-II