Altera_Forum
Honored Contributor
11 years agoWhy am I getting a syntax error in my case structure?
I am building an ALU control unit in VHDL and I have been getting these errors when compiling.
Error (10500): VHDL syntax error at alu_control.vhd(43) near text "when"; expecting "end", or "(", or an identifier ("when" is a reserved keyword), or a sequential statement Error (10500): VHDL syntax error at alu_control.vhd(45) near text "case"; expecting "if" I have used a very similar case structure when building the actual ALU unit with no erros so I cant seem to find what exactly is wrong. library ieee ; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; --------------------------------------------------- entity alu_control is port( ALUOp: in std_logic_vector(1 downto 0); Funct: in std_logic_vector(5 downto 0); ALUCtrl: out std_logic_vector(3 downto 0)); end entity alu_control; ---------------------------------------------------- architecture alu_control_arch of alu_control is begin process (ALUOp, Funct, ALUCtrl) begin case ALUOp is when "00" => if Funct = "xxxxxx" then ALUCtrl <= "0010"; end if; when "01" => if Funct = "xxxxxx" then ALUCtrl <= "0110"; end if; when "10" => if Funct = "100000" then ALUCtrl <= "0010"; else if Funct = "100010" then ALUCtrl <= "0110"; else if Funct = "100100" then ALUCtrl <= "0000"; else if Funct = "100101" then ALUCtrl <= "0001"; else if Funct = "101010" then ALUCtrl <= "0111"; else ALUCtr <= "xxxx"; end if; when others => ALUCtrl <= "xxxx"; end case; end process; end architecture alu_control_arch;