【发布时间】:2017-03-25 03:32:56
【问题描述】:
我很难在编码中找到语法错误。任何帮助将不胜感激。我的合成器说错误位于 blowoncompon>= 时的状态,但是我认为错误在其他地方,因为当我提交该代码状态时,错误会移动到下一个状态。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity question4 is
Port (
--System Clock Declaration--------------------------
clk: in std_logic;
--Button Inputs-------------------------------------
btnL: in std_logic; --
btnU: in std_logic; --Clear
btnD: in std_logic; --Reset
sw: in std_logic_vector(7 downto 0);
led: out std_logic_vector(15 downto 0)
);
end question4;
architecture Behavioral of question4 is
constant active: std_logic := '1';
constant bloweron: std_logic_vector(15 downto 0) := "000000011111111";
constant compon: std_logic_vector(15 downto 0) := "1111111000000000";
signal clear: std_logic := btnU;
signal reset: std_logic := btnD;
type states is (blowoncompoff,
blowoffcompoff,
blowoncompon);
signal CurrentState: states;
signal NextState: states;
begin
motorstatetrans: process(currentsate)
begin
if clear = active then
currentstate <= blowoffcompoff;
end if;
case currentstate is
when blowoncompon>= --------Why syntax error near here
led <= bloweron;
led <= compon;
if currenttemp=settemp then
Nextstate <= blowoncompoff;
elsif
currenttemp>settemp then
Nextstate <= bloweroncompon;
end if;
when blowoncompoff >=
led <= bloweron;
if currenttemp < settemp then
Nextstate <= bloweroncompon;
elsif current temp = set temp then
Nextstate <= blowoffcompoff;
when blowoffcompoff >=
if current temp < settemp then
Nextstate <= blowoncompon;
end case;
end process;
【问题讨论】:
-
不,错误就在工具指示的位置。 ` when blowoncompon>= --------Why syntax error near here`。 IEEE Std 1076-2008 10.9 Case 语句,语法为 case_statement_alternative ::= when selections => sequence_of_statements。而不是“>=”,您应该在一系列语句之前使用“=>”(一个或多个顺序语句,10.1)。显示您的错误消息。