YAI
Newbie level 6
- Joined
- Feb 12, 2015
- Messages
- 13
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 118
Im really new in all about programing in vhdl so please describe your answers.
my teacher ask me to do a calc that can solve multiplication, sums, subtractions and compare between 2 number of 2 bits and be displayed in a 7 segment display.
I did this program and only gives me 3 errors saying that CASE statement is missing 6551 choices. i dont know what to do with that i need help please!!!
my teacher ask me to do a calc that can solve multiplication, sums, subtractions and compare between 2 number of 2 bits and be displayed in a 7 segment display.
I did this program and only gives me 3 errors saying that CASE statement is missing 6551 choices. i dont know what to do with that i need help please!!!
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 library IEEE; use IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; USE IEEE.numeric_std.ALL; use work.std_arith.all; ENTITY calc is Port (Num1: in Signed (1 downto 0); Num2: in Signed (1 downto 0); S: in STD_LOGIC_VECTOR (1 downto 0); a_to_g:out STD_LOGIC_VECTOR (6 downto 0)); end calc; Architecture tris of calc is signal SUM:Signed (3 downto 0); signal RES:Signed (3 downto 0); signal MUL:Signed (3 downto 0); signal COM:STD_LOGIC_VECTOR (3 downto 0); begin process(Num1,Num2,S) BEGIN CASE S IS WHEN "00"=>SUM<=resize(Num1,4)+Num2; WHEN "01"=>RES<=resize(Num1,4)-Num2; WHEN "10"=> if Num1>Num2 then COM <= "1110"; elsif Num1<Num2 then COM <= "1011"; else COM <= "1010"; end if; WHEN OTHERS=>MUL<=(Num1*Num2); END CASE; END PROCESS; process (SUM) begin case SUM is when "0000"=> a_to_g <="0000001"; --0 when "0001"=> a_to_g <="1001111"; --1 when "0010"=> a_to_g <="0010010"; --2 when "0011"=> a_to_g <="0000110"; --3 when "0100"=> a_to_g <="1001100"; --4 when "0101"=> a_to_g <="0100100"; --5 when "0110"=> a_to_g <="0100000"; --6 when "0111"=> a_to_g <="0001101"; --7 when "1000"=> a_to_g <="0000000"; --8 when "1001"=> a_to_g <="0000100"; --9 end case; end process; process (RES) begin case RES is when "0000"=> a_to_g <="0000001"; --0 when "0001"=> a_to_g <="1001111"; --1 when "0010"=> a_to_g <="0010010"; --2 when "0011"=> a_to_g <="0000110"; --3 when "0100"=> a_to_g <="1001100"; --4 when "0101"=> a_to_g <="0100100"; --5 when "0110"=> a_to_g <="0100000"; --6 when "0111"=> a_to_g <="0001101"; --7 when "1000"=> a_to_g <="0000000"; --8 when "1001"=> a_to_g <="0000100"; --9 end case; end process; process (MUL) begin case MUL is when "0000"=> a_to_g <="0000001"; --0 when "0001"=> a_to_g <="1001111"; --1 when "0010"=> a_to_g <="0010010"; --2 when "0011"=> a_to_g <="0000110"; --3 when "0100"=> a_to_g <="1001100"; --4 when "0101"=> a_to_g <="0100100"; --5 when "0110"=> a_to_g <="0100000"; --6 when "0111"=> a_to_g <="0001101"; --7 when "1000"=> a_to_g <="0000000"; --8 when "1001"=> a_to_g <="0000100"; --9 end case; end process; process (COM) begin case COM is when "1010"=> a_to_g <="1000001"; --= when "1011"=> a_to_g <="1001110"; --< when "1110"=> a_to_g <="1111000"; --> when others => a_to_g <="0000000"; end case; end process; end tris;
Last edited by a moderator: