我剛開始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;
感謝您的回覆,並告知,這是me.After非常有幫助修改我的代碼,它看起來像比較合理的,但仍然unconnect.I具有可我把「STD_LOGIC_VECTOR」的靈敏度列表中的問題嗎?如果可以,我應該注意什麼?再次感謝你。 –
@HankLin:是的,這是可能的。如果你把'STD_LOGIC_VECTOR'到敏感列表則該過程將在組合的方式作出反應,向量的每個元素上的每個變化(合成時,未使用的將被優化掉)。 – Sanyok
現在我已經能夠合成你的代碼和重現的警告(這的確是爲錯誤嚴重) – Sanyok