我正在尝试从 std_logic_vector 中获取两位数。我知道......这不是一种专业的方式(我制作的方式),但我正在学习。我真正的问题是'while'循环。我无法弄清楚为什么它是一个无限循环。有谁能帮忙吗?在测试台中,d 的值为“10010”;这是错误和代码:
[Synth 8-3380]loop condition does not converge after 2000 iterations [afisare.vhd:30]
第 30 行是while aux>noua loop
. 我正在合成并想在那之后进行模拟
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity bcd is
port( y0: out std_logic_vector(6 downto 0);
y1: out std_logic_vector(6 downto 0);
d: in std_logic_vector(4 downto 0);
anode: out std_logic_vector(7 downto 0));
end bcd;
architecture afis of bcd is
begin
process(d)
variable prima: integer;
variable aux: std_logic_vector(4 downto 0);
variable din: std_logic_vector(3 downto 0);
variable noua: std_logic_vector(4 downto 0);
variable unu: std_logic;
variable zero: std_logic;
begin
prima:=0;
noua:="01001";
aux:=d;
unu:='1';
zero:='0';
while aux>noua loop
if (aux(4)=unu and aux(3)=zero) then
aux(4):=zero;
end if;
if (aux(1)=unu and aux(0)=zero) then
aux(1):=zero;
end if;
aux:=aux xor noua;
prima:=prima+1;
end loop;
din:=aux(3 downto 0);
case din is
when "0000"=> y0<="0000001";
when "0001"=>y0<="1001111";
when "0010"=>y0<="0010010";
when "0011"=>y0<="0000110";
when "0100"=>y0<="1001100";
when "0101"=>y0<="0100100";
when "0110"=>y0<="0100000";
when "0111"=>y0<="0001111";
when "1000"=>y0<="0000000";
when "1001"=>y0<="0000100";
when others=>y0<="0110110";
end case;
case prima is
when 0=>y1<="0000001";
when 1=>y1<="1001111";
when 2=>y1<="0010010";
when 3=>y1<="0000110";
when others=>y1<="0110110";
end case;
anode<="11111100";
end process;
end afis;