2012-02-21 91 views
2

我一直在试图调试这个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段显示器显示该数字...

回答

4

转换为同步设计的替代方法是让您的逻辑真正异步。

在DoubleDabble过程中,只需评论最外层的if语句,以便您的BCD转换逻辑始终运行,并查看得到您的位置。您的逻辑不需要先前的整数值(old_number),它是使得合成器适合的“if number/= old_number”比较(不使用时钟信号和同步逻辑)。

+0

好的,我已经删除了最外层的if语句,现在我可以实现它,它有点作品:)最后一位数字正确工作(代表一个),但其他3正在迅速变化。我也得到“下面的信号形成一个组合循环”警告,告诉我bcd信号处于组合循环。任何想法,为什么是这样以及我如何解决这个问题?谢谢:) – xx77aBs 2012-02-21 21:15:44

+2

可能是因为你在开始for循环之前从未将它设置为已知值。合成器认为你想要继承前一个周期的结果。 OMG! – 2012-02-21 23:14:47

+0

OMG!我不能相信这是问题:)现在你已经告诉我,这是有道理的:)我已经把这个:“bcd:=(others =>'0');”在for循环之前,它工作。非常感谢你 !!!! – xx77aBs 2012-02-21 23:38:11

4

是否有任何理由决定以异步方式完成整个BCD转换过程?这就是所有锁存问题都来自(Double Dabble Process)的地方。

我几乎肯定的是,如果你把它转换为同步过程,你应该摆脱“持续清理”和“闩锁”警告。

“持续清洗”警告会将您的所有锁存器调整为其初始值,因此为什么您始终看到零。

当您需要注册事件或实例时,您应该几乎总是使用时钟。从信号变为真的时间开始,当时钟变高但相信我时,你可能会有一个纳秒的时间差,在时间和时间的同步将在未来为你节省很多问题。

+0

谢谢:)你能告诉我该怎么做才能将这个过程转换为同步?我只是一个初学者,所以我不知道我该怎么做。 – xx77aBs 2012-02-21 20:16:41

+1

不确定您是否仍想要同步答案。你找到你的解决方案吗? – 2012-02-23 20:59:10

+0

我得到它异步工作。但如果可以的话,请告诉我如何我可以同步。我这样做只是为了学习更多,所以一切都是有价值的:) – xx77aBs 2012-02-23 21:13:05