预期类型为 void,语法错误 "process" 附近有传输延迟代码 - vhdl 错误传输

Expecting type void, Syntax error near "process" with transport delay code - vhdl error transport

我是 FPGA 的新手,我正在尝试编写一个带有传输延迟的简单演示。但我收到以下错误:

1.ERROR:HDLCompiler:806 - "../PGAND2.vhd" Line 54: Syntax error near "process".
2.ERROR:HDLCompiler:841 - "../PGAND2.vhd" Line 55: Expecting type  void for <behavioral>.

我对此很困惑,我无法解决这个问题。能否请您提供一些解决此问题的提示,非常感谢!这是我的代码:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity PGAND2 is
    generic( trise : TIME := 1ns ;
            tfall : TIME := 1ns ) ;
    port(   a0 : in std_logic ;
        a1 : in std_logic ;
        z0 : out std_logic ) ;
end PGAND2;

architecture Behavioral of PGAND2 is

begin
process ( a1, a0) 
    variable zdf :std_logic ;
    begin 
        zdf := a1 AND a0 ;
        if zdf = '1' then
            z0 <= transport zdf after trise ;
        else if zdf = '0' then
            z0 <= transport zdf after tfall ;
        else
            z0 <= transport zdf ;
    end if ;
    end process ;
end Behavioral;

环境是 Windows10 上的 ISE 14.7。 非常感谢!

VHDL中的if then else语句格式如下:

if [condition] then 
   [statements]
else 
   [statements]
end if;

然后else if语句不是elsif所以 else if 语句本身需要 end if 关键字。

您应该使用 elsif 关键字或 else if ... then ...结束 if 语句。

您描述的正确代码是:

process( a1, a0) 
    variable zdf :std_logic ;
begin 
    zdf := a1 AND a0 ;
    if zdf = '1' then
        z0 <= transport zdf after trise ;
    elsif zdf = '0' then
        z0 <= transport zdf after tfall ;
    else
        z0 <= transport zdf ;
    end if ;
end process ;

process( a1, a0) 
    variable zdf :std_logic ;
begin 
    zdf := a1 AND a0 ;
    if zdf = '1' then
        z0 <= transport zdf after trise ;
    else if zdf = '0' then
        z0 <= transport zdf after tfall ;
        end if;
    else
        z0 <= transport zdf ;
    end if ;
end process ;