我一直在试图调试这个VHDL代码两天了,但我只是没有看到错误在哪里。下面是代码:发现信号和常量值警告的1位锁存
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity SSDDriver is
Port (cp : in std_logic;
iin : in std_logic;
an : buffer std_logic_vector (3 downto 0);
--7=a, 6=b ...
segments: out std_logic_vector (7 downto 0));
end SSDDriver;
architecture Behavioral of SSDDriver is
signal cpo : std_logic;
--broj BCD znamenki
constant BCD_NUMBERS : integer := 4;
--broj bitova ulaznog broja
constant BITS : integer := 14;
--broj kodiran BCD-om
signal BCDNumber : std_logic_vector (BCD_NUMBERS*4-1 downto 0) := (others => '0');
signal BCDForDecoder: std_logic_vector (3 downto 0);
signal number: integer range 0 to 9999;
begin
decoder: entity BCDToSSD port map (bcd => BCDForDecoder, segm => segments (7 downto 1));
counter: entity djelitelj generic map (COUNTTO => 25000) port map (cpIn => cp, CpOut=> cpo);
--tocka je uvijek ugasena
segments(0) <= '1';
process (iin)
begin
if iin='1' then
number<=3245;
else
number<=1111;
end if;
end process;
SwitchDisplay: process (cpo)
begin
if rising_edge(cpo) then
if an="0111" then
an<="1011";
BCDForDecoder<=BCDNumber(11 downto 8);
elsif an="1011" then
an<="1101";
BCDForDecoder<=BCDNumber(7 downto 4);
elsif an="1101" then
an<="1110";
BCDForDecoder<=BCDNumber(3 downto 0);
else
an<="0111";
BCDForDecoder<=BCDNumber(15 downto 12);
end if;
end if;
end process SwitchDisplay;
DoubleDabble: process (number)
variable num : std_logic_vector (BITS-1 downto 0);
variable bcd : std_logic_vector (BCD_NUMBERS*4-1 downto 0) := (others => '0');
variable old_number: integer range 0 to 9999;
begin
if number/= old_number then
num := conv_std_logic_vector(number, BITS);
for i in 0 to BITS-1 loop
bcd(BCD_NUMBERS*4-1 downto 1) := bcd(BCD_NUMBERS*4-2 downto 0);
bcd(0) := num(BITS-1);
num(BITS-1 downto 1) := num(BITS-2 downto 0);
num(0) :='0';
if(i < BITS-1 and bcd(3 downto 0) > "0100") then
bcd(3 downto 0) := bcd(3 downto 0) + "0011";
end if;
if(i < BITS-1 and bcd(7 downto 4) > "0100") then
bcd(7 downto 4) := bcd(7 downto 4) + "0011";
end if;
if(i < BITS-1 and bcd(11 downto 8) > "0100") then
bcd(11 downto 8) := bcd(11 downto 8) + "0011";
end if;
if(i < BITS-1 and bcd(15 downto 12) > "0100") then
bcd(15 downto 12) := bcd(15 downto 12) + "0011";
end if;
end loop;
BCDNumber <= bcd;
else
end if;
old_number := number;
end process DoubleDabble;
end Behavioral;
这里会产生警告:
警告:XST:2734 - 房产 “use_dsp48” 是不适用于此 技术。警告:从未使用Xst:1780 - 信号>或分配了 。警告:Xst:737 - 发现信号的1位锁存器。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的16位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:737 - 发现信号的1位锁存。 警告:Xst:2734 - 属性“use_dsp48”不适用于此 技术。警告:Xst:1426 - FF/Latch的初始值bcd_0 妨碍块SSDDriver中的持续清洗。警告:Xst:1293 - FF/Latch在块中的值为0。警告:Xst:1293 - FF/Latch的块的固定值为 。警告:Xst:1293 - FF/Latch在块中有一个 常量值为0。警告:Xst:1293 - FF/Latch 在块中具有恒定值0。 警告:在 块中,Xst:1293 - FF/Latch的常数值为0。警告:Xst:1293 - FF/Latch的块的值为0,常数为 。警告:Xst:1293 - FF/Latch 在块中具有恒定值0。警告:Xst:1293 - FF/Latch在块中的值为0。 警告:在 块中,Xst:1293 - FF/Latch的常数值为0。警告:Xst:1293 - FF/Latch的块的值为0,常数为 。警告:Xst:1293 - FF/Latch 在块中具有恒定值0。警告:Xst:1293 - FF/Latch在块中的值为0。 警告:在 块中,Xst:1293 - FF/Latch的常数值为0。警告:Xst:1293 - FF/Latch在块中有一个 常量值为0。警告:Xst:1293 - FF/Latch 在块中具有恒定值0。 警告:在 块中,Xst:1293 - FF/Latch的常数值为0。警告:XST:1710 - FF /锁存
等等...
由于这些警告的结果是,当我实现了模块,我只得到0000显示4 7段显示器。
该VHDL代码应采用整数变量(范围从0到9999),并使用4个7段显示器显示该数字...
好的,我已经删除了最外层的if语句,现在我可以实现它,它有点作品:)最后一位数字正确工作(代表一个),但其他3正在迅速变化。我也得到“下面的信号形成一个组合循环”警告,告诉我bcd信号处于组合循环。任何想法,为什么是这样以及我如何解决这个问题?谢谢:) – xx77aBs 2012-02-21 21:15:44
可能是因为你在开始for循环之前从未将它设置为已知值。合成器认为你想要继承前一个周期的结果。 OMG! – 2012-02-21 23:14:47
OMG!我不能相信这是问题:)现在你已经告诉我,这是有道理的:)我已经把这个:“bcd:=(others =>'0');”在for循环之前,它工作。非常感谢你 !!!! – xx77aBs 2012-02-21 23:38:11