Design of BCD to 7-Segment Driver For Common Anode using When-Else (Data Flow Modeling Style)-
Program-
-------------------------------------------------------------------------------
--
-- Title : segment7_driver
-- Design : vhdl_test
-- Author : Naresh Singh Dobal
-- Company : nsd
--
-------------------------------------------------------------------------------
--
-- File : BCD to 7 Segment Driver using when else.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity segment7_driver is
port(
bcd : in STD_LOGIC_VECTOR(3 downto 0);
seg7 : out STD_LOGIC_VECTOR(6 downto 0)
);
end segment7_driver;
architecture segment7_driver_arc of segment7_driver is
begin
seg7 <= "0000001" when (bcd="0000")else
"1001111" when (bcd="0001")else
"0010010" when (bcd="0010")else
"0000110" when (bcd="0011")else
"1001100" when (bcd="0100")else
"0100100" when (bcd="0101")else
"1100000" when (bcd="0110")else
"0001111" when (bcd="0111")else
"0000000" when (bcd="1000")else
"0001100" when (bcd="1001")else
"1111111" ;
end segment7_driver_arc;
Output Waveform : BCD to 7 Segment Driver |
Program-
-------------------------------------------------------------------------------
--
-- Title : segment7_driver
-- Design : vhdl_test
-- Author : Naresh Singh Dobal
-- Company : nsd
--
-------------------------------------------------------------------------------
--
-- File : BCD to 7 Segment Driver using when else.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity segment7_driver is
port(
bcd : in STD_LOGIC_VECTOR(3 downto 0);
seg7 : out STD_LOGIC_VECTOR(6 downto 0)
);
end segment7_driver;
architecture segment7_driver_arc of segment7_driver is
begin
seg7 <= "0000001" when (bcd="0000")else
"1001111" when (bcd="0001")else
"0010010" when (bcd="0010")else
"0000110" when (bcd="0011")else
"1001100" when (bcd="0100")else
"0100100" when (bcd="0101")else
"1100000" when (bcd="0110")else
"0001111" when (bcd="0111")else
"0000000" when (bcd="1000")else
"0001100" when (bcd="1001")else
"1111111" ;
end segment7_driver_arc;
No comments:
Post a Comment