if error on sequence detector

OP #5238116
Rate this post
• ▲ useful
▼ not useful
Hello, i have the following error on every "if" and "case" line.
i am using quartus 2 'why i get these errors??

Thanks
*******************************************************
Error (10500): VHDL syntax error at case_vhdl.vhd(19) near text "clk"; 
expecting "(", or "'", or "."
Error (10500): VHDL syntax error at case_vhdl.vhd(19) near text "and"; 
expecting "(", or "'", or "."
Error (10500): VHDL syntax error at case_vhdl.vhd(32) near text "else"; 
expecting "end", or "(", or an identifier ("else" is a reserved 
keyword), or a sequential statement
Error (10500): VHDL syntax error at case_vhdl.vhd(40) near text "when"; 
expecting "end", or "(", or an identifier ("when" is a reserved 
keyword), or a sequential statement
Error (10500): VHDL syntax error at case_vhdl.vhd(47) near text "when"; 
expecting "end", or "(", or an identifier ("when" is a reserved 
keyword), or a sequential statement
Error (10500): VHDL syntax error at case_vhdl.vhd(56) near text "when"; 
expecting "end", or "(", or an identifier ("when" is a reserved 
keyword), or a sequential statement
Error (10500): VHDL syntax error at case_vhdl.vhd(63) near text "when"; 
expecting "end", or "(", or an identifier ("when" is a reserved 
keyword), or a sequential statement
Error (10500): VHDL syntax error at case_vhdl.vhd(65) near text "case"; 
expecting "if"
Error (10500): VHDL syntax error at case_vhdl.vhd(70) near text "begin"; 
expecting ":=", or "<="
Error (10500): VHDL syntax error at case_vhdl.vhd(76) near text 
"process";  expecting "if"
**********************************************************
1
library IEEE;
2
use IEEE.STD_LOGIC_1164.all;
3
entity seqdeta is
4
 port (clk:in STD_LOGIC;
5
       clr:in STD_LOGIC;
6
     din:in STD_LOGIC;
7
     dout:in STD_LOGIC);
8
end seqdeta;     
9

10
architecture seqdeta of seqdeta is
11
type state_type is (s0, s2, s3, s4);
12
signal present_state,next_state: state_type;
13
begin  
14

15
 sreg: process(clk,clr)
16
 begin
17
        if clr='1' then 
18
             present_state<=s0;
19
        elseif clk'event and clk='1' then
20
                present_state<=next_state;      
21
         end if;
22
 end process;
23
 
24
 C1: process(present_state, din)
25
 begin
26
   case present_state is
27
       when s0=>
28
        if din='1' then
29
        next_state<=s1;
30
       else
31
         next_state<=s0;
32
      else if;
33
      when s1=>
34
        if din='1' then 
35
          next_state<=s2;
36
       else 
37
         next_state<=s0;
38
          end if;      
39
         
40
      when s2=>
41
         if din='0' then
42
            next_state<=s3;
43
        else
44
           next_state<=s2;
45
           end if;
46
        
47
        when s3=>
48
         if din='1' then
49
            next_state<=s4;
50
        else
51
           next_state<=s0;
52
           end if;
53
        
54
        
55
        
56
        when s4=>
57
         if din='0' then
58
            next_state<=s0;
59
        else
60
           next_state<=s2;
61
           end if;
62
        
63
        when others =>
64
          null;
65
      end case;
66
  
67
     end process;  
68
    
69
C2: process(present_state)
70
begin
71
   if present_state=s4 then
72
      dout<='1';
73
  else
74
      dout<='0';
75
  end if;
76
end process;
77
end seqdeta;
OP #5238121
Rate this post
• ▲ useful
▼ not useful
Hello , my first error is in the following "if" shown bellow

i used , end if , i ended every statement inside it with ";"
where did i go wrong?


**************************************************
if clr='1' then
             present_state<=s0;
        elseif clk'event and clk='1' then
                present_state<=next_state;
end if;
****************************************************

Thanks

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.