从VHDL中的输入值倒计时

从VHDL中的输入值倒计时,vhdl,Vhdl,我试图将输入值aa分配给下面代码中的信号t。它已成功编译,但有一个警告: 警告[9]:C:/Modeltech_5.7f/examples/hassan1.vhd(14):(vcom-1013)t的初始值取决于信号“aa”的值。 代码如下: library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all ; use ieee.numeric_std.all; entity counter is port(c

我试图将输入值
aa
分配给下面代码中的信号
t
。它已成功编译,但有一个警告:

警告[9]:C:/Modeltech_5.7f/examples/hassan1.vhd(14):(vcom-1013)t的初始值取决于信号“aa”的值。

代码如下:

library IEEE;
use IEEE.std_logic_1164.all; 
use IEEE.std_logic_unsigned.all ;
use ieee.numeric_std.all; 
entity counter is
port(clk :in std_logic;
 reset : in std_logic;
 aa: in std_logic_vector(3 downto 0);
 check : out std_logic_vector(3 downto 0));
end counter;     

architecture imp of counter is 
signal i:std_logic_vector(3 downto 0):="0000"; 
signal t:std_logic_vector(3 downto 0):=aa;
begin
 process(clk)
  begin
  if rising_edge(clk) and (t>0) then
      t<=t-1;
      i<=i+1;
  end if;
 end process;
check<=i;
end  imp;  
IEEE库;
使用IEEE.std_logic_1164.all;
使用IEEE.std_logic_unsigned.all;
使用ieee.numeric_std.all;
实体计数器为
端口(时钟:在标准逻辑中;
复位:在标准逻辑中;
aa:标准逻辑向量(3到0);
检查:输出标准逻辑向量(3到0);
末端计数器;
计数器的结构重要性是
信号i:std_逻辑_向量(3到0):=“0000”;
信号t:std_逻辑_向量(3到0):=aa;
开始
过程(clk)
开始
如果上升沿(clk)和(t>0),则

t看起来您正试图用负载输入实现一个下行计数器。在这种计数器中,当
load\u enable='1'
时,应将负载输入值(
aa
在您的情况下)注册到内部信号中。当
load\u enable='0'
时,您将减少此计数值。下面是这样做的代码示例:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std_unsigned.all;

entity down_counter is
  port (
    clock: in std_logic;
    reset: in std_logic;
    load_enable: in std_logic;
    load_data: in std_logic_vector(3 downto 0);
    output: out std_logic_vector(3 downto 0)
  );
end;

architecture rtl of down_counter is
    signal count: std_logic_vector(3 downto 0);
begin
    process (clock, reset) begin
        if reset then
            count <= (others => '0');
        elsif rising_edge(clock) then
            if load_enable then
                count <= load_data;
            else
                count <= count - 1;
            end if;
        end if;
    end process;

    output <= count;
end;
ieee库;
使用ieee.std_logic_1164.all;
使用ieee.numeric\u std\u unsigned.all;
实体向下的计数器是
港口(
时钟:标准逻辑;
复位:在标准逻辑中;
load_enable:在标准_逻辑中;
加载数据:在标准逻辑向量中(3到0);
输出:输出标准逻辑向量(3到0)
);
结束;
下行计数器的体系结构rtl为
信号计数:标准逻辑向量(3到0);
开始
过程(时钟、复位)开始
如果重置,则
计数“0”);
elsif上升沿(时钟),然后
如果load_启用,则

那么你问的实际问题是什么呢?我怎样才能消除这个警告呢?我认为这可能是个错误的问题,但答案是;始终确保您的信号初始值设定项是常量。那么我应该做些什么来减少过程中的输入“aa”?由于该程序旨在将输入端的值减为0。我们可以使用load_enable作为信号而不是输入吗?因为我想在加载数据后将其设为零。如何将此代码更改为十进制计数器?