Avatar of errang
errang
Flag for Afghanistan asked on

A question about if statements in VHDL

Hey,

        I had a quick question about IF statements in VHDL, for some reason I keep getting this error:

ERROR:HDLParsers:164 - "C:/Xilinx/Workspace/Homework3/homework3.vhd" Line 23. parse error, unexpected IF

I have tried everything I could think of, and looked a little through google, but I can't figure out why it doesn't like the IF statement.

Appreciate any help on this.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity homework3 is
    Port ( num1 : in  STD_LOGIC_VECTOR(1 downto 0);
           num2 : in  STD_LOGIC_VECTOR(1 downto 0);
           result : out  STD_LOGIC_VECTOR(3 downto 0));
end homework3;

architecture Behavioral of homework3 is

begin
	--process (num1, num2)
	--begin
	if( (num1 = "00") or (num2 = "00") ) then
		result <= "0000";
	else if( (num1 = "01") and (num2 = "01") ) then
		result <= "0001";
	else if( (num1 = "01") and (num2 = "10") ) then
		result <= "0010";
	else if( (num1 = "10") and (num2 = "01") ) then
		result <= "0010";
	else if( (num1 = "01") and (num2 = "11") ) then
		result <= "0011";
	else if( (num1 = "11") and (num2 = "01") ) then
		result <= "0011";
	else if( (num1 = "10") and (num2 = "11") ) then
		result <= "0110";
	else if( (num1 = "11") and (num2 = "10") ) then
		result <= "0110";
	else if( (num1 = "10") and (num2 = "10") ) then
		result <= "0100";
	else
		result <= "1001";
	end if;
	--end process;

end Behavioral;

Open in new window

ProgrammingProgramming Languages-Other

Avatar of undefined
Last Comment
errang

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Kendor

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
errang

ASKER
Ah, awesome.

Been programming java so long didn't occur to me as what was wrong with it.. lol.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck