library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.
ALL; entity test is port ( clk : in std_logic; b : in std_logic_vector(3 downto 0); --BCD input segment7 : out std_logic_vector(6 downto 0) -- 7 bit decoded output. ); end test; --'a' corresponds to MSB of segment7 and g corresponds to LSB of segment7. architecture Behavioral of test is begin segment7(6) <= b(3) or b(1) or (b(2) and b(0)) or (not b(2) and not b(0));--a segment7(5) <= (not b(1) and not b(0)) or (b(2) and not b(1)) or (b(2) and not b (0)) or b(3);--b segment7(4) <= (b(1) and not b(0)) or (not b(2) and b(0));--c segment7(3) <= (not b(2) and not b(0)) or (b(1) and not b(0)) or(not b(2) and b( 1)) or(b(2) and not b(1) and b(0));--d segment7(2) <= not b(1) or not b(0) or (b(2) and b(1));--e segment7(1) <= not b(2) or (b(1) and b(0)) or (not b(1) and not b(0));--f segment7(0) <= (b(2) and not b(1)) or (b(2) and not b(0)) or (not b(2) and b(1)) or b(3);--g end Behavioral;