Syntax error 我的VHDL代码中有错误,但我似乎不知道为什么

Syntax error 我的VHDL代码中有错误,但我似乎不知道为什么,syntax-error,vhdl,state-diagram,Syntax Error,Vhdl,State Diagram,我为状态图shownaugh编写了一个VHDL代码,因为我是新用户,所以无法发布图像。然而,当我编译它时,它说有错误: 第16行:processclk—解析时检测到语法错误 第21行:else-解析时检测到语法错误 第23行:如果结束;-分析时检测到语法错误 这是我的代码: library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_arith.all; use IEEE.std_logic_unsigned.ALL; entity

我为状态图shownaugh编写了一个VHDL代码,因为我是新用户,所以无法发布图像。然而,当我编译它时,它说有错误: 第16行:processclk—解析时检测到语法错误 第21行:else-解析时检测到语法错误 第23行:如果结束;-分析时检测到语法错误

这是我的代码:

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.ALL;
entity memory_controller is
port(clk: in std_logic;
 reset: in std_logic;
 bus_id: in std_logic_vector(7 downto 0);
 read_write, burst: in std_logic;
 oe, we, addr_1, addr_2: out std_logic
 );
end memory_controller;
architecture behavioral of memory_controller is
type statetype is (idle, decision, wr, rd1, rd2, rd3, rd4);
signal present_state, next_state : statetype;
process(clk) [LINE 16]
begin
if (rising_edge(clk)) then
    if (reset ='0') then
        present_state <= next_state;  
    else [LINE 21]
        present_state <= idle;   
    end if; [LINE 23]
end if;
end process;  
process(present_state, read_write, ready, burst)
begin
case present_state is
when idle => 
    oe => '0'; we=> '0'; addr_1=> '0'; addr_2=> '0';
if(bus_id = "11110011") then
    next_state <= decision;
else
    next_state <= idle;
end if;
when decision =>
    if (read_write = '1')
        then next_state <= rd1;
    else next_state <= wr;
end if;
when wr =>
we = '1';
    if (ready = '1')
then next_state <= idle;
else
next_state <= wr;
end if;
when rd1 =>
oe = '1';
addr_1 = addr_1 + '1';
addr_2 = addr_2 + '1';
if(ready = '0') then
next_state <= rd1;
if(burst = '0') then
next_state <= idle;
else next_state <= rd2;
end if;
when rd2 =>
oe = '1';
addr_1 = addr_1 + '1';
 addr_2 = addr_2 + '1';
if(ready = '1') then
next_state => rd3;
else
next_state => rd2;
end if;
when rd3 =>
oe = '1';
addr_1 = addr_1 + '1';
 addr_2 = addr_2 + '1';
if(ready = '1') then 
next_state => rd4;
else
next_state => rd3;
when rd4 =>
oe = '1';
addr_1 = addr_1 + '1';
addr_2 = addr_2 + '1';
if(ready = '1')
 then next_state => idle;
else next_state => rd4;
end if;
end case;
end process;
end behavioral;
语法完全正确,我不明白为什么会出错。有什么不对劲吗

另外,我想在ready=0、burst=0、ready=0和burst=1的情况下使用assert语句,但我不太确定如何在主代码中实现它们

我突出显示了第16、21和23行


任何帮助都很好。

VHDL模块的形式通常是:

entity MODULENAME is
  <Port description>
end MODULENAME;

architecture behavioral of MODULENAME is
  <signal declarations and similar>
begin
  <synchronous and combinatorial logic statements>
end architecture behavioral;
致:


VHDL模块的形式通常为:

entity MODULENAME is
  <Port description>
end MODULENAME;

architecture behavioral of MODULENAME is
  <signal declarations and similar>
begin
  <synchronous and combinatorial logic statements>
end architecture behavioral;
致:


正如Sonicwave指出的,在第一条语句之前缺少begin关键字

还有几个语法错误。 信号指定使用左箭头:


非oe=>0';但是,正如Sonicwave指出的那样,您在第一个语句之前缺少begin关键字

还有几个语法错误。 信号指定使用左箭头:


非oe=>0';但是谢谢你!我也发现了这一点,并对代码进行了一些修改,现在又出现了一些错误。我将地址声明为std_logic_vector7,降为0,在初始化时,将其命名为addr_1@Khanh Dang。谢谢你的建议,我一天前学习了VHDL,所以我仍然掌握了它的窍门,因此犯了很多错误…*不好意思*谢谢!我也发现了这一点,并对代码进行了一些修改,现在又出现了一些错误。我将地址声明为std_logic_vector7,降为0,在初始化时,将其命名为addr_1@Khanh Dang。感谢您的建议,我一天前学习了VHDL,所以我仍然掌握了它的诀窍,因此犯了很多错误…*不好意思*我想您的代码中缺少了begin。VHDL是严格的语法语言。在从一些书/源代码编写模型之前,应该使用一些模板。另一种方法是使用具有对齐和/或自动完成功能的更好的编辑器。带VHDL模式的Emacs最适合新手,尽管它很难使用。P/S:您应该为aligment添加制表符,这看起来对每个人来说都很容易阅读:我认为您的代码中缺少了begin。VHDL是严格的语法语言。在从一些书/源代码编写模型之前,应该使用一些模板。另一种方法是使用具有对齐和/或自动完成功能的更好的编辑器。带VHDL模式的Emacs最适合新手,尽管它很难使用。P/S:您应该为aligment添加制表符,这看起来很容易为每个人阅读:D@Pinkyandthebrain屏幕截图是使用Sigasi free Starter Edition:@Pinky拍摄的,而屏幕截图是使用Sigasi free Starter Edition拍摄的:
architecture behavioral of memory_controller is
  type statetype is (idle, decision, wr, rd1, rd2, rd3, rd4);
  signal present_state, next_state : statetype;

begin

  process(clk) [LINE 16]
  begin
    if (rising_edge(clk)) then