VHDL。在这个设计中有2个无负载信号
我刚开始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;
的警告意味着,在你的代码的两个输入不影响任何输出,因此是不值得被连接到任何内部组件。
请更熟悉变量的概念。特别是对于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);
其他一些问题:
你的时钟分频器过程被定义为对clk
和btnD
输入敏感。通常情况下,异步复位行为在流程内部没有实现。如果你想要一个异步复位,做这样的事情:
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
相关的警告。 编辑:没有,如果被删除的变量,然后空间没有关系。
希望我能帮上忙,请让我知道如果我能改善的答案!
感谢您的回复,并告知,这是me.After非常有帮助修改我的代码,它看起来像比较合理的,但仍然unconnect.I具有可我把“STD_LOGIC_VECTOR”的灵敏度列表中的问题吗?如果可以,我应该注意什么?再次感谢你。 –
@HankLin:是的,这是可能的。如果你把'STD_LOGIC_VECTOR'到敏感列表则该过程将在组合的方式作出反应,向量的每个元素上的每个变化(合成时,未使用的将被优化掉)。 – Sanyok
现在我已经能够合成你的代码和重现的警告(这的确是为错误严重) – Sanyok