- #1
ee91
- 1
- 0
Homework Statement
i need help for a VHDL program that uses 8 inputs to represent 2 digits from 00 to 99 on the 7-segment displays. LED1 and LED2 will light up when the values are “20” and “40” respectively. digit1(LSB),digit2(MSB)
Homework Equations
The Attempt at a Solution
Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity decoder is
port (digit1 , digit2 : in std_logic_vector (3 downto 0 );
output : out_std_vector (6 downto 0)
led1 , led2: out std_logic);
end decoder;
architecture arc of decoder is
begin
with input digit1 select
output : "0000001" when "0000";
"1001111"when "0001";
"0010010"when "0010";
"0000110"when "0011";
1001100"when "0100";
"0100100"when "0101";
"0100000"when "0110";
"0001111"when "0111";
"0000000"when "1000";
"0000100"when "1001";
"1111111"when others;
with input digit2 select
output : "0000001" when "0000";
"1001111"when "0001";
"0010010"when "0010";
"0000110"when "0011";
1001100"when "0100";
"0100100"when "0101";
"0100000"when "0110";
"0001111"when "0111";
"0000000"when "1000";
"0000100"when "1001";
"1111111"when others;
process( digit1,digit2)
if (digit1 = "0000" and digit = "0010") then
led1 = '0' ; --led1 will switched on
led2 = '0' ; --led2 will switched on
elsif (digit2 = "0000" and digit = "0100") then
led1 = '0' ; --led1 will switch on
led2 = '0' ; --led2 will switch on
else
led1 = '1'; --led1 will switch off
led2 = '1'; --led1 will switch on
end if;
end process;
end arc;
i wrote the code above but i didn't worked. i did a vhdl that represents hexadecimal digits on a 7-segment display before and it worked. I've never done a vhdl that requires 8 inputs so i need help.