找到了用于信号和常量值警告的 1 位锁存器

发布于 2025-01-07 09:26:10 字数 4771 浏览 1 评论 0原文

我已经尝试调试这个 VHDL 代码两天了,但我就是不知道错误在哪里。这是代码:

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 的 init 值 阻碍SSDDriver块的不断清理。警告:Xst:1293 - FF/Latch 在块中的常数值为 0。警告:Xst:1293 - FF/Latch 具有恒定值 块中的 0 个。警告:Xst:1293 - FF/Latch 有一个 块中的常数值为 0。警告:Xst:1293 - FF/锁存器 block 中的常量值为 0。 警告:Xst:1293 - FF/Latch 的常量值为 0 堵塞 。警告:Xst:1293 - FF/Latch 有一个常量 块中的值为 0。警告:Xst:1293 - FF/锁存器 block 中的常量值为 0。警告:Xst:1293 - FF/Latch 在块 中的常数值为 0。 警告:Xst:1293 - FF/Latch 的常量值为 0 堵塞 。警告:Xst:1293 - FF/Latch 有一个常量 块中的值为 0。警告:Xst:1293 - FF/锁存器 block 中的常量值为 0。警告:Xst:1293 - FF/Latch 在块 中的常数值为 0。 警告:Xst:1293 - FF/Latch 的常量值为 0 堵塞 。警告:Xst:1293 - FF/Latch 有一个 块中的常数值为 0。警告:Xst:1293 - FF/锁存器 block 中的常量值为 0。 警告:Xst:1293 - FF/Latch 的常量值为 0 堵塞 。警告:Xst:1710 - FF/锁存器

等等...

由于这些警告,当我实现该模块时,我只在 4 个 7 段显示器上显示 0000。

此 VHDL 代码应采用整数变量(范围从 0 到 9999)并使用 4 个 7 段显示器显示该数字...

I've been trying to debug this VHDL code for two days now, but I just don't see where's the error. Here is the code:

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;

And here are generated warnings:

WARNING:Xst:2734 - Property "use_dsp48" is not applicable for this
technology. WARNING:Xst:1780 - Signal > is never used or
assigned. WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 16-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:737 - Found 1-bit latch for signal .
WARNING:Xst:2734 - Property "use_dsp48" is not applicable for this
technology. WARNING:Xst:1426 - The value init of the FF/Latch bcd_0
hinder the constant cleaning in the block SSDDriver. WARNING:Xst:1293
- FF/Latch has a constant value of 0 in block . WARNING:Xst:1293 - FF/Latch has a constant value
of 0 in block . WARNING:Xst:1293 - FF/Latch has a
constant value of 0 in block . WARNING:Xst:1293 - FF/Latch
has a constant value of 0 in block .
WARNING:Xst:1293 - FF/Latch has a constant value of 0 in
block . WARNING:Xst:1293 - FF/Latch has a constant
value of 0 in block . WARNING:Xst:1293 - FF/Latch
has a constant value of 0 in block . WARNING:Xst:1293 -
FF/Latch has a constant value of 0 in block .
WARNING:Xst:1293 - FF/Latch has a constant value of 0 in
block . WARNING:Xst:1293 - FF/Latch has a constant
value of 0 in block . WARNING:Xst:1293 - FF/Latch
has a constant value of 0 in block . WARNING:Xst:1293 -
FF/Latch has a constant value of 0 in block .
WARNING:Xst:1293 - FF/Latch has a constant value of 0 in
block . WARNING:Xst:1293 - FF/Latch has a
constant value of 0 in block . WARNING:Xst:1293 - FF/Latch
has a constant value of 0 in block .
WARNING:Xst:1293 - FF/Latch has a constant value of 0 in
block . WARNING:Xst:1710 - FF/Latch

and so on ...

As result of these warnings, when I implement that module, I get only 0000 displayed on 4 7-segment displays.

This VHDL code should take integer variable (range from 0 to 9999) and display that number using 4 7-segment displays ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

拔了角的鹿 2025-01-14 09:26:10

转换为同步设计的另一种方法是使逻辑真正异步。

在 DoubleDabble 流程中,只需注释最外面的 if 语句,以便您的 BCD 转换逻辑始终运行,然后看看它会带来什么结果。您的逻辑不需要先前的整数值(old_number),并且“if number/= old_number”比较(不使用时钟信号和同步逻辑)使合成器适合。

An alternative to converting to a synchronous design is to make your logic truly asynchronous.

In the DoubleDabble process, just comment the outermost if statement so your BCD conversion logic runs all the time, and see where that gets you. Your logic has no need for the previous integer value (old_number), and it is the "if number/= old_number" comparison (without using a clock signal and synchronous logic) that is giving the synthesizer fits.

甜扑 2025-01-14 09:26:10

您决定异步执行整个 BCD 转换过程有什么原因吗?这就是所有闭锁问题的根源(双重涉水过程)。

我几乎肯定,如果您将其转换为同步过程,您应该摆脱“持续清洁”和“闩锁”警告。

“持续清洁”警告会将所有锁存器修剪为其初始值,这就是为什么您始终看到零。

当您需要在事件或实例中注册某些内容时,您几乎应该始终使用时钟。当信号变为真时和时钟变高时,您可能会有纳秒的时间差,但相信我,与时钟保持同步将在未来为您节省很多问题。

Is there any reason you have decided to do you entire BCD conversion process asynchronously? This is where all of your latching issues are coming from (Double Dabble Process).

I am almost positive that if you convert that to a synchronous process you should get rid of the "constant cleaning" and "latch" warnings.

The "constant cleaning" warning will trim all your latches to their initial values hence why you see zero all the time.

When you need something to register at an event or instance your should almost ALWAYS use a clock. You might have a nanosecond time difference from when that signal becomes true and when the clock goes high but believe me, having it in time with the clock will save you so many problems in the future.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文