我一直在試圖調試這個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