2016-11-30 43 views
0

我剛開始VHDL編碼,我用XILINX Artix-7/NEXYS 4來練習。 我只想設計七段顯示器,並讓它從0到9進行數字編碼。 我的英文不是很好,請原諒我,我試圖表達我的問題。VHDL。在這個設計中有2個無負載信號

在我的代碼中,我將體系結構分爲四個步驟。 首先,我下了clk(100MHZ)到1hz。其次,我使用計數器從0到9的數字進行計數,然後使用double dabble算法將數字分開。最後,我寫了一個BCD到7段解碼器並選擇第一個陽極。

問題是,當我實現電路時出現警告,即使合成很好(但RTL顯示信號沒有明顯連接)。 這個問題似乎在雙重涉獵算法和計數器之間? (因爲它添加此代碼後有錯誤) 我真的很想知道我該如何解決這個問題?什麼時候這個警告會出現?也許我的代碼有很大的錯誤?

警告:參數:288 - 信號clk_IBUF沒有負載。 PAR不會嘗試路由此信號。

完成初始時序分析。警告:參數:288 - 信號btnD_IBUF沒有負載。 PAR不會嘗試路由此信號。

警告:參數:283 - 本設計中有2個無負載信號。這種設計將導致Bitgen發佈DRC警告。

順便說一句,我知道有很多方法來實現我的目標,但我真的想知道這是什麼錯誤。 如果有人能幫助我,感謝您的幫助。

這裏是我的代碼:

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
USE ieee.std_logic_unsigned.all; 
use IEEE.numeric_std.all; 


-- Uncomment the following library declaration if using 
-- arithmetic functions with Signed or Unsigned values 
--use IEEE.NUMERIC_STD.ALL; 

-- Uncomment the following library declaration if instantiating 
-- any Xilinx primitives in this code. 
--library UNISIM; 
--use UNISIM.VComponents.all; 

entity top is 
    Port (clk : in STD_LOGIC; 
      btnD : in STD_LOGIC; 
      an : out STD_LOGIC_VECTOR (7 downto 0); 
      seg : out STD_LOGIC_VECTOR (6 downto 0)); 
end top; 

architecture Behavioral of top is 

signal clk_1hz_s : STD_LOGIC := '1'; 
signal clk_1hz : STD_LOGIC; 
signal counter_clock : integer range 0 to 5000000 := 0; 
signal sec_turth : STD_LOGIC_VECTOR (7 downto 0); 
signal sec_1 : STD_LOGIC_VECTOR (3 downto 0); 

begin 

--new clk-- 
process(clk,btnD) 
begin 

    if (clk' event and clk='1') then 
     if (btnD = '1') then 
      counter_clock <= 0; 
      clk_1hz_s <= '1'; 
     elsif (counter_clock = 5000000 - 1) then 
      counter_clock <= 0; 
      clk_1hz_s <= NOT(clk_1hz_s); 
     else 
      counter_clock <= counter_clock + 1; 
     end if; 
    end if; 

end process; 
clk_1hz <= clk_1hz_s; 

--counter-- 

process(clk_1hz) 

variable sec :integer range 0 to 9 :=0; 

begin 

    if (clk_1hz' event and clk_1hz='1') then 
     if sec > 8 then 
      sec := 0; 
     else 
      sec := sec + 1; 
     end if; 
    end if; 

sec_turth <= STD_LOGIC_VECTOR(to_unsigned(sec,8)(7 downto 0)); 
end process; 

--double dabble algorithm-- 

process(sec_turth) 

variable temp_sec : STD_LOGIC_VECTOR (7 downto 0); 
variable bcd_sec : unsigned (7 downto 0):= (others => '0'); 

begin 

temp_sec := sec_turth; 
bcd_sec := (others => '0'); 

    for i in 0 to 7 loop 

    if bcd_sec(3 downto 0) > 4 then 
     bcd_sec(3 downto 0) := bcd_sec(3 downto 0) + 3; 
    end if; 

-- if bcd_sec(7 downto 4) > 4 then 
--  bcd_sec(7 downto 4) := bcd_sec(7 downto 4) + 3; 
-- end if; 

    bcd_sec := bcd_sec(7 downto 1) & temp_sec(7); 
    temp_sec := temp_sec(7 downto 1) & '0'; 

    end loop; 

sec_1 <= STD_LOGIC_VECTOR(bcd_sec(3 downto 0)); 
--sec_2 <= STD_LOGIC_VECTOR(bcd_sec(7 downto 4)); 

end process; 

--decoder-- 

with sec_1 select 
    seg <= "1000000" when "0000",--0 
      "1111001" when "0001",--1 
      "0100100" when "0010",--2 
      "0110000" when "0011",--3 
      "0011001" when "0100",--4 
      "0010010" when "0101",--5 
      "0000010" when "0110",--6 
      "1011000" when "0111",--7 
      "0000000" when "1000",--8 
      "0011000" when "1001",--9 
      "0001110" when "1111",--F 
      "1111111" when others;--close all 

an <= "11111110";--choose the first anode 

end Behavioral; 

回答

0

的警告意味着,在你的代碼的兩個輸入不影響任何輸出,因此是不值得被連接到任何內部組件。

請更熟悉變量的概念。特別是對於sec計數器過程,您應該知道,您不能假定變量在兩次過程運行之間保留其值,即clk_1hz上的每個上升沿都會重置變量sec。與counter_clock一樣,最好將它聲明爲一個信號。然後,你會當然也需要計數處理內部復位程序:

-- In the architecture header: 
signal current_value: integer range 0 to 9; 

-- one-digit counter -- 
process(clk_1hz) 
begin 
    if (clk_1hz'event and clk_1hz='1') then 
     if (btnD = '1') then 
      current_value <= 0; 
     elsif current_value > 8 then 
      current_value <= 0; 
     else 
      current_value <= current_value + 1; 
     end if; 
    end if; 
end process; 
-- I assume, you really need 8 bits here: 
sec_turth <= STD_LOGIC_VECTOR(to_unsigned(current_value,8)); 

對於0到9之間的個位數的號碼,你的雙涉獵算法,它所有的變量是不必要的,因爲該值已經存在於BCD。如果刪除該進程和簡直sec_turth低4位連接到sec_1則警告消失,我可以查看示意圖:

sec_1 <= sec_turth(3 downto 0); 

其他一些問題:

你的時鐘分頻器過程被定義爲對clkbtnD輸入敏感。通常情況下,異步復位行爲在流程內部沒有實現。如果你想要一個異步復位,做這樣的事情:

clk_div: process(clk,btnD) 
begin 
    if btnD = '1' then 
     -- do the reset 
     counter_clock <= 0; 
     clk_1hz_s <= '1'; 
    elsif clk'event and clk = '1' then 
     -- do the synchronous operations 
     if (counter_clock = 5000000 - 1) then 
      counter_clock <= 0; 
      clk_1hz_s <= NOT(clk_1hz_s); 
     else 
      counter_clock <= counter_clock + 1; 
     end if; 
    end if; 
end process clk_div; 

如果這應該是一個時鐘同步復位,請從靈敏度列表中刪除btnD正如我在第一個代碼清單一樣。

此外,我已經看到,在clk'event屬性中的勾號'後面有一個空格,至少使代碼突出顯示的方式與沒有空格的方式不同。正確的,你可能會擺脫clk相關的警告。 編輯:沒有,如果被刪除的變量,然後空間沒有關係。

希望我能幫上忙,請讓我知道如果我能改善的答案!

+0

感謝您的回覆,並告知,這是me.After非常有幫助修改我的代碼,它看起來像比較合理的,但仍然unconnect.I具有可我把「STD_LOGIC_VECTOR」的靈敏度列表中的問題嗎?如果可以,我應該注意什麼?再次感謝你。 –

+0

@HankLin:是的,這是可能的。如果你把'STD_LOGIC_VECTOR'到敏感列表則該過程將在組合的方式作出反應,向量的每個元素上的每個變化(合成時,未使用的將被優化掉)。 – Sanyok

+0

現在我已經能夠合成你的代碼和重現的警告(這的確是爲錯誤嚴重) – Sanyok