超高密度语言。此设计中有 2 个无负载信号
VHDL. There are 2 loadless signals in this design
我刚开始 VHDL 编码,我使用 XILINX Artix-7/NEXYS 4 进行练习。
我只想设计七段显示器,让它显示0到9的数字。
我的英文不是很好,请见谅,我试着表达了我的问题。
在我的代码中,我将架构分为四个步骤。
首先,我将 clk(100MHZ) 降低到 1hz。其次,我用计数器来计算从 0 到 9 的数字,然后使用双水滴算法将 number.Last 分开,我写了一个 BCD 到 7 段解码器并选择第一个阳极。
问题是当我实现电路时出现警告,即使合成很好(但RTL显示信号没有明显连接)。
问题好像在double dabble algorithm和counter之间?
(因为添加这段代码后出错了)
我真的很想知道我该如何解决这个问题?什么时候会出现这个警告?也许我的代码有很大错误?
WARNING:Par:288 - The signal clk_IBUF has no load. PAR will not attempt to route this signal.
Finished initial Timing Analysis. WARNING:Par:288 - The signal btnD_IBUF has no load. PAR will not attempt to route this signal.
WARNING:Par:283 - There are 2 loadless signals in this design. This design will cause Bitgen to issue DRC warnings.
顺便说一句,我知道有很多方法可以实现我的目标,但我真的很想知道这有什么问题。
如果有人可以帮助我,非常感谢。
这是我的代码:
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
-counter 进程,您应该知道您不能假设变量在两次进程运行之间保存其值,即 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
属性中的勾号 '
之后有一个 space,这至少使代码突出显示与没有 space.更正它,您可能会摆脱与 clk
相关的警告。
编辑:不,如果删除变量,则 space 无关紧要。
希望能帮到你,如果我能改进答案,请告诉我!
我刚开始 VHDL 编码,我使用 XILINX Artix-7/NEXYS 4 进行练习。 我只想设计七段显示器,让它显示0到9的数字。 我的英文不是很好,请见谅,我试着表达了我的问题。
在我的代码中,我将架构分为四个步骤。 首先,我将 clk(100MHZ) 降低到 1hz。其次,我用计数器来计算从 0 到 9 的数字,然后使用双水滴算法将 number.Last 分开,我写了一个 BCD 到 7 段解码器并选择第一个阳极。
问题是当我实现电路时出现警告,即使合成很好(但RTL显示信号没有明显连接)。 问题好像在double dabble algorithm和counter之间? (因为添加这段代码后出错了) 我真的很想知道我该如何解决这个问题?什么时候会出现这个警告?也许我的代码有很大错误?
WARNING:Par:288 - The signal clk_IBUF has no load. PAR will not attempt to route this signal.
Finished initial Timing Analysis. WARNING:Par:288 - The signal btnD_IBUF has no load. PAR will not attempt to route this signal.
WARNING:Par:283 - There are 2 loadless signals in this design. This design will cause Bitgen to issue DRC warnings.
顺便说一句,我知道有很多方法可以实现我的目标,但我真的很想知道这有什么问题。 如果有人可以帮助我,非常感谢。
这是我的代码:
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
-counter 进程,您应该知道您不能假设变量在两次进程运行之间保存其值,即 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
属性中的勾号 '
之后有一个 space,这至少使代码突出显示与没有 space.更正它,您可能会摆脱与 clk
相关的警告。
编辑:不,如果删除变量,则 space 无关紧要。
希望能帮到你,如果我能改进答案,请告诉我!