本帖最后由 jht123456789 于 2010-4-29 22:15 编辑
一下程序出现此错误:Error (10500): VHDL syntax error at counter.vhd(82) near text "process"; expecting "if"
程序:
1、LIBRARY IEEE;
2、USE IEEE.STD_LOGIC_1164.ALL;
3、USE IEEE.STD_LOGIC_UNSIGNED.ALL;
4、ENTITY counter IS
5、PORT(rst:in std_logic;
6、ADD: IN STD_LOGIC;
7、CHOS:IN STD_LOGIC_VECTOR(3 DOWNTO 0);
8、A2,A1,A0:OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
9、B2,B1,B0:OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
10、C2,C1,C0:OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
11、D2,D1,D0:OUT STD_LOGIC_VECTOR(3 DOWNTO 0));
12、END counter;
13、ARCHITECTURE rtl OF counter IS
14、BEGIN
15、PROCESS(rst,ADD,CHOS)
16、VARIABLE POINTS_A2:STD_LOGIC_VECTOR(3 DOWNTO 0);
17、VARIABLE POINTS_A1:STD_LOGIC_VECTOR(3 DOWNTO 0);
18、VARIABLE POINTS_B2:STD_LOGIC_VECTOR(3 DOWNTO 0);
19、VARIABLE POINTS_B1:STD_LOGIC_VECTOR(3 DOWNTO 0);
20、VARIABLE POINTS_C2:STD_LOGIC_VECTOR(3 DOWNTO 0);
21、VARIABLE POINTS_C1:STD_LOGIC_VECTOR(3 DOWNTO 0);
22、VARIABLE POINTS_D2:STD_LOGIC_VECTOR(3 DOWNTO 0);
23、VARIABLE POINTS_D1:STD_LOGIC_VECTOR(3 DOWNTO 0);
24、BEGIN
25、case rst is
26、when 0 => points_a2:="0001";points_a1:="0000";
27、 points_b2:="0001";points_b1:="0000";
28、 points_c2:="0001";points_c1:="0000";
29、 points_d2:="0001";points_d1:="0000";
30、end case; ---加分信号上升沿有效
31、if (ADD'EVENT AND ADD='1') THEN
32、if chos="0001" then ---A组答对,加10分
33、 IF POINTS_A1= "1001" then --十位为9
34、 POINTS_A1:="0000";
35、else POINTS_A2:=POINTS_A2+"0001"; ----十位清零
36、IF points_a2="1001" then ----百位为9
37、POINTS_A2:="0000";
38、else POINTS_A1:=(POINTS_A1)+"0001";
39、end if; ----百位清零
40、END IF;
41、IF (CHOS="0010") THEN
42、IF POINTS_B1="1001" THEN
43、 else POINTS_B1:="0000";
44、POINTS_B2:=POINTS_B2+"0001";
45、 IF POINTS_B2="1001" THEN
46、POINTS_B2:="0000";
47、else POINTS_B1:=POINTS_B1+"0001";
48、END IF;
49、end if;
50、IF CHOS="0010" THEN
51、IF POINTS_C1="1001" THEN
52、 POINTS_C1:="0000";
53、else POINTS_C2:=POINTS_C2+"0001";
54、 IF POINTS_C2="1001" THEN
55、 POINTS_C2:="0000";
56、else POINTS_C1:=POINTS_C1+"0001";
57、END IF;
58、end if;
59、IF CHOS="0010" THEN
60、IF POINTS_D1="1001" THEN
61、 POINTS_D1:="0000";
62、else POINTS_D2:=POINTS_D2+"0001";
63、 IF POINTS_D2="1001" THEN
64、POINTS_D2:="0000";
65、else POINTS_D1:=POINTS_D1+"0001";
66、END IF;
67、END IF;
68、END IF;
69、 A2<=POINTS_A2; -------将各组得分赋给输出信号
70、A1<=POINTS_A1;
71、A0<="0000";
72、B2<=POINTS_B2;
73、B1<=POINTS_B1;
74、B0<="0000";
75、 C2<=POINTS_C2;
76、C1<=POINTS_C1;
77、C0<="0000";
78、 D2<=POINTS_D2;
79、D1<=POINTS_D1;
80、D0<="0000";
81、end if;
82、end process;
END rtl; |