syntax-error - 获取语​​法错误

标签 syntax-error vhdl

我不断出错。它们被声明为语法错误,但我认为还有其他问题。

LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;

entity bottlefill is
port (  clk, reset: IN STD_LOGIC;
        b, p: in std_logic;
        m, v: out std_logic;
);

end bottlefill;

ARCHITECTURE a of bottlefill is
type state is (stopped, posi, fill);
signal current1, next1: state;
signal c: integer range 0 to 15;
signal full: std_logic; 

begin
process(clk, reset)
begin
    if reset = '1' then
        current1 <= stopped;
        elsif clk'event and clk = 1
                then current1 <= next1;
        end if;
end process;

process(current1, b, p, stop)
begin
    next1 <= current1;
    case current1 is
    when stopped =>
        if b = '1' then
                next1 <= posi;
                end if;
                m = '1';
                v = '0';
    when posi =>
        if p = '1' then 
                next1 <= fill;
                end if;
                m = '0';
                v = '1';
    when fill  =>
        if full = '1' then
                next1 <= stopped;
                end if;
                m = '0';
                v = '0';
    end case;
end process;


process(clk reset)
begin
    if reset = '1'
        then c <= 0;
    elsif clk'event and clk = '1' 
        then if current1 = fill
            then c <= c + 1;
        else
            c <= 0;
        end if
    end process;

    full <= '1' when c >= 5
        else '0';

Info: Command: quartus_map --read_settings_files=on --write_settings_files=off bottlefill -c bottlefill
Error (10500): VHDL syntax error at bottlefill.vhd(9) near text ")"; expecting an identifier, or "constant", or "file", or "signal", or "variable"
Error (10500): VHDL syntax error at bottlefill.vhd(14) near text ")"; expecting ":", or ","
Error (10500): VHDL syntax error at bottlefill.vhd(19) near text "begin"; expecting an identifier ("begin" is a reserved keyword), or "constant", or "file", or "signal", or "variable"
Error (10500): VHDL syntax error at bottlefill.vhd(29) near text ")"; expecting ":", or ","
Info: Found 0 design units, including 0 entities, in source file bottlefill.vhd

最佳答案

我已经纠正了您的代码,使其不再有语法错误。
您唯一需要检查的是第68行的代码。我不明白您想要在此处执行的操作。

我评论了您的语法错误,因此您可以看到导致错误的原因。

希望对您有所帮助。

   LIBRARY ieee;
    USE ieee.std_logic_1164.all;
    USE ieee.numeric_std.all;

    entity bottlefill is
    port (  clk, reset: IN STD_LOGIC;
            b, p: in std_logic;
            m, v: out std_logic -- First mistake here
    );

    end bottlefill;

    ARCHITECTURE behavioral of bottlefill is
        type state is (stopped, posi, fill);
        signal current1, next1: state;
        signal c: integer range 0 to 15;
        signal full: std_logic; 
    begin

    process(clk, reset)
    begin
       if reset = '1' then
           current1 <= stopped;
       elsif clk'event and clk = '1' then -- Mistake with clk = 1 => clk = '1'
           current1 <= next1;
       end if;
    end process;

    process(current1, b, p) -- Stop is not declared here
    begin
       next1 <= current1;
     case current1 is
       when stopped =>
        if b = '1' then
                next1 <= posi;
                end if;
                m <= '1'; -- = is not <= signal assignment !!
                v <= '0'; -- = is not <= signal assignment !!
       when posi =>
        if p = '1' then 
                next1 <= fill;
                end if;
                m <= '0'; -- = is not <= signal assignment !!
                v <= '1'; -- = is not <= signal assignment !!
       when fill  =>
        if full = '1' then
                next1 <= stopped;
                end if;
                m <= '0'; -- = is not <= signal assignment !!
                v <= '0'; -- = is not <= signal assignment !!
        end case;
      end process;


     process(clk, reset) -- komma here
     begin
      if reset = '1' then 
        c <= 0;
        elsif clk'event and clk = '1' then 
            if current1 = fill then 
                c <= c + 1;
            else
                c <= 0;
            end if; -- forgot ;
        end if; -- forgot to close the upper is statement
      end process;

    -- i dont get what u want to do here. Take a look at " Select signal assigment" on  google
    -- I think you want to do that.
    --full <= '1' when c >= 5
                --else '0';

      end behavioral; -- forgot to end your architecture

关于syntax-error - 获取语​​法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56608903/

相关文章:

simulation - 通过modelsim进行vhdl模拟的VCD转储。如何?

VHDL 标识符的正则表达式

vhdl - vhdl 中输入向量导致的 Mod 错误

sql-server - 当IDENTITY_INSERT设置为ON时,必须为表中的标识列指定显式值

vhdl - std_logic : ='X' 的操作

JavaScript 递归练习 : Unexpected token else

syntax-error - 为什么在赋值语句的左值中出现语法错误?

c - microblaze 和 vhdl 之间如何通信?

python - Cherrypy 与 Python 3.4

php - SQL/PHP 语法错误