Vhdl 为什么';什么代码不能编译? IEEE库; 使用IEEE.STD_LOGIC_1164.all; 实体并行_reg是 通用(默认值:正:=4); 端口(C、notR、E:标准逻辑中;D:标准逻辑向量中(默认为1); Q:输出标准逻辑向量(默认值为1); 末端平行调节; paralel_reg的架构paralel_reg是 信号q:标准逻辑向量(默认为1); 开始 过程(C,notR) 开始 如果notR='0',则q'0'); else如果上升沿(C)然后q
“else if”在VHDL中不存在,则必须写入:Vhdl 为什么';什么代码不能编译? IEEE库; 使用IEEE.STD_LOGIC_1164.all; 实体并行_reg是 通用(默认值:正:=4); 端口(C、notR、E:标准逻辑中;D:标准逻辑向量中(默认为1); Q:输出标准逻辑向量(默认值为1); 末端平行调节; paralel_reg的架构paralel_reg是 信号q:标准逻辑向量(默认为1); 开始 过程(C,notR) 开始 如果notR='0',则q'0'); else如果上升沿(C)然后q,vhdl,Vhdl,“else if”在VHDL中不存在,则必须写入: library IEEE; use IEEE.STD_LOGIC_1164.all; entity paralel_reg is generic ( default : positive := 4); port(C, notR, E: in std_logic; D: in std_logic_vector(default downto 1); Q: out std_logic_vector(default down
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity paralel_reg is
generic ( default : positive := 4);
port(C, notR, E: in std_logic; D: in std_logic_vector(default downto 1);
Q: out std_logic_vector(default downto 1));
end paralel_reg;
architecture paralel_reg of paralel_reg is
signal q : std_logic_vector(default downto 1);
begin
process (C, notR)
begin
if notR = '0' then q <= (others => '0');
else if rising_edge(C) then q <= D;
end if;
end process; --# Error: COMP96_0019: paralel_register.vhd : (18, 5): Keyword "if" expected.
--# Error: COMP96_0015: paralel_register.vhd : (18, 5): ';' expected.
process (E, q) --# Error: COMP96_0019: paralel_register.vhd : (24, 2): Keyword "end" expected.
begin
if E = '0' then Q <= (others => '0');
else Q <= q; --# Error: COMP96_0019: paralel_register.vhd : (24, 2): Keyword "end" expected.
--# Error: COMP96_0016: paralel_register.vhd : (24, 7): Design unit declaration expected.
end if;
end process;
end paralel_reg;
这:
所有VHDL语句都以分号结尾。以上是一条语句,以end if结尾代码>。VHDL语句可以嵌入到其他语句中。因此,您可以在if
语句中嵌入另一个if
语句,如果您使用else if
而不是elsif
,您就是这样做的:
if ... then
...
elsif ... then
...
elsif ... then
...
else
...
end if;
VHDL中的每个if
语句都需要end if代码>。注意,在上面的语句中,如果一个if
语句嵌入到另一个语句中,则有两个end if
s。所以,你可以写:
if ... then
...
elsif ... then
...
elsif ... then
...
else
IF ... THEN
...
ELSIF ... THEN
...
ELSE
...
END IF;
end if;
过程(C,notR)开始
如果notR='0',则q'0');
else如果上升沿(C),那么q您可以使用else if
,但是您必须更加注意控制流和匹配end if
语句q
和q
在VHDL中在词汇上是相同的,并且有两个声明。将出现的q
更改为qi
(包括敏感度列表),并添加第二个末端if(或使用elsif)和代码分析(编译)。这里的信息是答案应该被证明。不确定E
打算做什么。
process (C, notR)
begin
if notR = '0' then q <= (others => '0');
elsif rising_edge(C) then q <= D;
end if;
end process;
if ... then
...
elsif ... then
...
elsif ... then
...
else
...
end if;
if ... then
...
elsif ... then
...
elsif ... then
...
else
IF ... THEN
...
ELSIF ... THEN
...
ELSE
...
END IF;
end if;
process (C, notR) begin
if notR = '0' then q <= (others => '0');
else if rising_edge(C) then q <= D;
end if;
end if; end process;