VHDL:无法推断“ c [0]”的寄存器,因为其行为与任何受支持的寄存器模型都不匹配

问题描述 投票:0回答:1

嗨,我对此有疑问。这应该是一个计数器,它从两个端口接收信号,将其增加一个,最大值为30,将b减小一个,最大值为0,如果计数器为30,则输出应为x <= 0且y <= 1,否则x <= 1且y <= 0。我究竟做错了什么?使用整数作为可计算对象是个好主意吗?这是我的代码,很抱歉,如果这看起来很愚蠢,这是我上VHDL的第一学期

Library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;

entity contador is
    port (a, b : in std_logic;
          x, y : out std_logic);

end entity;

architecture func of contador is

begin
    process(a,b)
        variable c : integer := 0;
    begin
        if rising_edge(a) then
            if c<31 then    
                c := c+1;
            end if;
        end if;
        if rising_edge(b) then
            if c>0 then
                c := c-1;
            end if;
        end if;

        if c = 30 then
            x <= '0';
            y <= '1';
        else
            x <= '1';
            y <= '0';
        end if;

    end process;

end func;

错误消息:

错误(10821):contador.vhd(22)的HDL错误:由于其行为与任何受支持的寄存器模型都不匹配,因此无法推断“ c [0]”的寄存器

错误(10821):contador.vhd(22)的HDL错误:由于其行为与任何受支持的寄存器模型都不匹配,因此无法推断“ c [1]”的寄存器]

错误(10821):contador.vhd(22)的HDL错误:无法推断“ c [18]”的寄存器,因为它的行为与任何受支持的寄存器模型都不匹配

错误(12153):无法阐述顶级用户层次结构

错误:Quartus II 64位分析和合成失败。 20个错误,4个警告错误:虚拟内存峰值:4629 MB错误:处理已结束:2020年6月1日星期一17:16:02错误:经过时间:00:00:02错误:CPU总时间(在所有处理器上):00:00:02错误(293001):Quartus II完全编译失败。 22个错误,4个警告

嗨,我对此有疑问。如果...

vhdl counter
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.