jadda123876
jadda123876

Reputation: 1

VHDL Morse Code Decoder - Parse Error, Unexpected Process, Expecting If

I'm working on a project for Digital Electronics in VHDL that consists of a button or paddle that takes an input from a user and converts that to an ASCII code output on a 17-segment display. My problem is that it is throwing the error Parse error, unexpected PROCESS, expecting IF even though my if statements should all have an END.

The error appears on the third to last line of the code below, where it reads end process

This is for a Xilinx Coolrunner ii CPLD chip. I've already tried a bunch of different fixes from other solutions as well as running through my entire program and making sure the if statements I do have are closed. I have it localized (at least I think so) to the process below:

Checker: process(clock) begin
    if(rising_edge(clock)) then
        if(BTN_CNT = 1) then
                case morse_code(0 downto 0) is
                        when "0" => LED_16SEGLETTER <=      "00110000011111111"; --E
                        when "1" => LED_16SEGLETTER <=      "00111111111011011"; --T
                        when others => LED_16SEGLETTER <=   "00000000000000001"; --something rando

                end case;
        else if(BTN_CNT = 2) then
                case morse_code(1 downto 0) is
                        when "00" => LED_16SEGLETTER <=     "00110011111011011"; --I
                        when "01" => LED_16SEGLETTER <=     "00001100001111111"; --A
                        when "10" => LED_16SEGLETTER <=     "11001100110110111"; --N
                        when "11" => LED_16SEGLETTER <=     "11001100110101111"; --M
                        when others => LED_16SEGLETTER <=   "00000000000000001"; --something weird
                end case;
        else if(BTN_CNT = 3) then
                case morse_code(2 downto 0) is
                        when "000" => LED_16SEGLETTER <=    "00100010001111111"; --S
                        when "001" => LED_16SEGLETTER <=    "11000000111111111"; --U
                        when "010" => LED_16SEGLETTER <=    "00011100001110111"; --R
                        when "011" => LED_16SEGLETTER <=    "11001100111110101"; --W
                        when "100" => LED_16SEGLETTER <=    "00000011111011011"; --D
                        when "101" => LED_16SEGLETTER <=    "11111100011100111"; --K
                        when "110" => LED_16SEGLETTER <=    "00100000101111111"; --G
                        when "111" => LED_16SEGLETTER <=    "00000000111111111"; --O
                        when others => LED_16SEGLETTER <=   "00000000000000001"; --something weird

                end case;
        else if(BTN_CNT = 4) then
                case morse_code(3 downto 0) is
                        when "0000" => LED_16SEGLETTER <=   "11001100001111111"; --H
                        when "0001" => LED_16SEGLETTER <=   "11111100111101101"; --V
                        when "0010" => LED_16SEGLETTER <=   "00111100011111111"; --F
                        when "0100" => LED_16SEGLETTER <=   "11110000111111111"; --L
                        when "0110" => LED_16SEGLETTER <=   "00011100001111111"; --P
                        when "0111" => LED_16SEGLETTER <=   "11000001111111111"; --J
                        when "1000" => LED_16SEGLETTER <=   "00000011101011011"; --B
                        when "1001" => LED_16SEGLETTER <=   "11111111110100101"; --X
                        when "1010" => LED_16SEGLETTER <=   "00110000111111111"; --C
                        when "1011" => LED_16SEGLETTER <=   "11011110001111011"; --Y
                        when "1100" => LED_16SEGLETTER <=   "00110011111101101"; --Z
                        when "1101" => LED_16SEGLETTER <=   "00000000111110111"; --Q
                        when others => LED_16SEGLETTER <=   "00000000000000001"; --something weird
                end case;
        else if(BTN_CNT = 5)then
                case morse_code(4 downto 0) is
                        when "11111" => LED_16SEGLETTER <=  "00000000111101101"; --0
                        when "01111" => LED_16SEGLETTER <=  "11001111111101111"; --1
                        when "00111" => LED_16SEGLETTER <=  "00010001001111111"; --2
                        when "00011" => LED_16SEGLETTER <=  "00000011101111111"; --3
                        when "00001" => LED_16SEGLETTER <=  "11001110001111111"; --4
                        when "00000" => LED_16SEGLETTER <=  "00100010001111111"; --5
                        when "10000" => LED_16SEGLETTER <=  "01100000001111111"; --6
                        when "11000" => LED_16SEGLETTER <=  "00001111111111111"; --7
                        when "11100" => LED_16SEGLETTER <=  "00000000001111111"; --8
                        when "11110" => LED_16SEGLETTER <=  "00000110001111111"; --9
                        when others => LED_16SEGLETTER <=   "00000000000000001"; --something weird
                end case;
        else if(BTN_CNT = 6) then
                case morse_code(5 downto 0) is
                        when "010101" => LED_16SEGLETTER <= "11111111111111110"; --FullStop
                        when "110011" => LED_16SEGLETTER <= "11111111111110111"; --Comma
                        when "001100" => LED_16SEGLETTER <= "00011111101111010"; --Query
                        when others => LED_16SEGLETTER <=   "00000000000000001"; --something weird
                end case;
        else 
                LED_16SEGLETTER <= "00000000000000001";
        end if;
    end if;
end process;

end arc;

This process is supposed to find the correct 16-segment output for a specific dot/dash combination. This is hopefully the last thing I need to have done before the whole program can be implemented onto the CPLD.

As a footnote, I'm pretty sure I have all the syntax right at least for this process itself.

Upvotes: -1

Views: 724

Answers (1)

alfr32
alfr32

Reputation: 1

Replace all the statements in the code that have the tipe of:

else if(BTN_CNT = 2) then

with:

elsif(BTN_CNT = 2)

that is the correct statement. Well I had a similar problem and that´s the way I fixed.

Upvotes: -1

Related Questions