hahaconma
Newbie level 1
![Newbie level 1](/styles/images/ranks/alevel1.gif)
i'm a beginer in VHDL, when i wrote this code, it generated some errors, can somebody help me?
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 40. parse error, unexpected TICK
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 45. parse error, unexpected TICK
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 51. parse error, unexpected TICK
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 55. parse error, unexpected TICK
LIBRARY ieee;
USE ieee.std_logic_1164.all;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY STAT_MAC IS
PORT (CLK,RESET: IN std_logic;
TIMER : in std_logic_vector ( 3 downto 0);
AMB, GRN, RD : out std_logic);
END STAT_MAC;
ARCHITECTURE BEHAVIOR OF STAT_MAC IS
-- State variables for machine sreg
-- SIGNAL AMBER, next_AMBER, GREEN, next_GREEN, RED, next_RED, REDAMB,
-- next_REDAMB : std_logic;
SIGNAL next_AMB,next_GRN,next_RD : std_logic;
signal tmr : std_logic_vector (3 downto 0);
BEGIN
p00: PROCESS (CLK,next_AMB,next_GRN, next_RD)
BEGIN
IF CLK='1' AND CLK'event THEN
AMB <= next_AMB;
GRN <= next_GRN;
RD <= next_RD;
END IF;
END PROCESS;
p01 : process (TIMER)
begin
if ((TIMER = '0100' or TIMER = '0101' or TIMER = '0110' or TIMER = '0111' or
TIMER = '1100' or TIMER = '1101' or TIMER = '1110' or TIMER = '1111') and RESET = '0') then
next_AMB <= '1';
ELSE next_AMB <= '0';
END IF;
if ((TIMER = '0000' or TIMER = '0001' or TIMER = '0010' or TIMER = '0011' or
TIMER = '0100' or TIMER = '0101' or TIMER = '0110' or TIMER = '0111') and RESET = '0' ) then
next_RD <= '1';
else next_RD <= '0';
end if;
IF ((TIMER = '1000' or TIMER = '1001' or TIMER = '1010' or TIMER = '1011' )and RESET = '0') then
next_GRN <='1';
ELSE next_GRN <='0';
END IF;
if RESET = '1' then TIMER <= '0000'; end if;
end process;
END BEHAVIOR;
i wote it in XINLINX ISE 10.1
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 40. parse error, unexpected TICK
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 45. parse error, unexpected TICK
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 51. parse error, unexpected TICK
ERROR:HDLParsers:164 - "D:/Chinh/FPGA/lab/traffic/STAT_MAC.vhd" Line 55. parse error, unexpected TICK
LIBRARY ieee;
USE ieee.std_logic_1164.all;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY STAT_MAC IS
PORT (CLK,RESET: IN std_logic;
TIMER : in std_logic_vector ( 3 downto 0);
AMB, GRN, RD : out std_logic);
END STAT_MAC;
ARCHITECTURE BEHAVIOR OF STAT_MAC IS
-- State variables for machine sreg
-- SIGNAL AMBER, next_AMBER, GREEN, next_GREEN, RED, next_RED, REDAMB,
-- next_REDAMB : std_logic;
SIGNAL next_AMB,next_GRN,next_RD : std_logic;
signal tmr : std_logic_vector (3 downto 0);
BEGIN
p00: PROCESS (CLK,next_AMB,next_GRN, next_RD)
BEGIN
IF CLK='1' AND CLK'event THEN
AMB <= next_AMB;
GRN <= next_GRN;
RD <= next_RD;
END IF;
END PROCESS;
p01 : process (TIMER)
begin
if ((TIMER = '0100' or TIMER = '0101' or TIMER = '0110' or TIMER = '0111' or
TIMER = '1100' or TIMER = '1101' or TIMER = '1110' or TIMER = '1111') and RESET = '0') then
next_AMB <= '1';
ELSE next_AMB <= '0';
END IF;
if ((TIMER = '0000' or TIMER = '0001' or TIMER = '0010' or TIMER = '0011' or
TIMER = '0100' or TIMER = '0101' or TIMER = '0110' or TIMER = '0111') and RESET = '0' ) then
next_RD <= '1';
else next_RD <= '0';
end if;
IF ((TIMER = '1000' or TIMER = '1001' or TIMER = '1010' or TIMER = '1011' )and RESET = '0') then
next_GRN <='1';
ELSE next_GRN <='0';
END IF;
if RESET = '1' then TIMER <= '0000'; end if;
end process;
END BEHAVIOR;
i wote it in XINLINX ISE 10.1