这个哪里错误 我是新手
时间:10-02
整理:3721RD
点击:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity counter is
port(
clk:in std_logic;
reset:in std_logic;
ce,load,dir:in std_logic;
din:in std_logic_vector(3 downto 0);
count: inout std_logic_vector(3 downto 0));
end counter;
architecture Behavioral of counter is
begin
process(clk,reset)
begin
if reset='1' then
count<="0000";
else if clk='1' and clk'event then
if load='1' then
count<=din;
else
if ce='1' then
if dir='1' then
count<=count+1;
else
count<=count-1;
end if;
end if;
end if;
end if;
end process;
end Behavioral;
语法编译的时候说ERROR:HDLParsers:164 - "E:/example/fpga/counter/counter.vhd" Line 58. parse error, unexpected PROCESS, expecting IF
怎么回事 请高手解决
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity counter is
port(
clk:in std_logic;
reset:in std_logic;
ce,load,dir:in std_logic;
din:in std_logic_vector(3 downto 0);
count: inout std_logic_vector(3 downto 0));
end counter;
architecture Behavioral of counter is
begin
process(clk,reset)
begin
if reset='1' then
count<="0000";
else if clk='1' and clk'event then
if load='1' then
count<=din;
else
if ce='1' then
if dir='1' then
count<=count+1;
else
count<=count-1;
end if;
end if;
end if;
end if;
end process;
end Behavioral;
语法编译的时候说ERROR:HDLParsers:164 - "E:/example/fpga/counter/counter.vhd" Line 58. parse error, unexpected PROCESS, expecting IF
怎么回事 请高手解决
add end if before end process.
呵呵,没见过这样用IF语句的,IF 语句里面不应该再含有IF 语句。
楼上的,IF的嵌套貌似可以吧。
原则上是不超过三个,不然影响可读性和代码质量。
貌似5个if,4个endif
不够数目啊
