首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何解决Vivado中“寄存器/锁存器引脚没有被根时钟引脚驱动的时钟”错误?

如何解决Vivado中“寄存器/锁存器引脚没有被根时钟引脚驱动的时钟”错误?
EN

Stack Overflow用户
提问于 2018-01-08 04:46:18
回答 2查看 3.5K关注 0票数 2

作为学习练习,我使用VHDL在FPGA上做了一些HDMI实验。在Vivado (2017.1)中实现它时,我在计时报告中遇到以下警告:

代码语言:javascript
运行
复制
There are 11 register/latch pins with no clock driven by root clock pin: Hsync_i_reg/Q (HIGH)

我已经打开了实现的原理图,并查找了有问题的引脚。它似乎连接到了其他所有东西都连接到的同一个时钟(而这些都没有在计时报告中标记出来),所以我搞不清上面的错误是指什么。以下是示意图中的一些截图:

下面是这个违规设计的VHDL代码:

代码语言:javascript
运行
复制
library ieee;
use ieee.std_logic_1164.all;

entity ctrl_gen is
    generic (
        ha: integer := 96; --hpulse
        hb: integer := 144; --hpulse+hbp
        hc: integer := 784; --hpulse+hbp+hactive
        hd: integer := 800; --hpulse+hbp+hactive+hfp
        va: integer := 2; --vpulse
        vb: integer := 35; --vpulse+vbp
        vc: integer := 515; --vpulse+vbp+vactive
        vd: integer := 525 --vpulse+vbp+vactive+vfp
    );
    port (
        clk25: in std_logic; --tmds clock (25mhz)
        hsync: out std_logic; --horizontal sync
        vsync: out std_logic; --vertical sync
        hactive: out std_logic; --active portion of hsync
        vactive: out std_logic; --active portion of vsync
        dena: out std_logic --display enable
    );
end entity;

architecture behavioral of ctrl_gen is
    signal hsync_i, hactive_i, vactive_i, vsync_i : std_logic;
begin
    -- horizontal signals generation
    hproc : process (clk25)
        variable hcount: integer range 0 to hd := 0;
    begin
        if rising_edge(clk25) then
            hcount := hcount + 1;

            if (hcount=ha) then
                hsync_i <= '1';
            elsif (hcount=hb) then
                hactive_i <= '1';
            elsif (hcount=hc) then
                hactive_i <= '0';
            elsif (hcount=hd) then
                hsync_i <= '0';
                hcount := 0;
            end if;
        end if;
    end process;

    -- vertical signals generation
    vproc : process (hsync_i)
        variable vcount: integer range 0 to vd := 0;
    begin
        if falling_edge(hsync_i) then
            vcount := vcount + 1;

            if (vcount=va) then
                vsync_i <= '1';
            elsif (vcount=vb) then
                vactive_i <= '1';
            elsif (vcount=vc) then
                vactive_i <= '0';
            elsif (vcount=vd) then
                vsync_i <= '0';
                vcount    := 0;
            end if;
        end if;
    end process;

    dena <= hactive_i and vactive_i;
    hsync <= hsync_i;
    vactive <= vactive_i;
    hactive <= hactive_i;
end behavioral;

经过思考,我认为该警告是在告诉我Hsync_i_reg/Q是用于Vcount寄存器的时钟,而不是Hsync_i_reg本身(如果没有连接到根时钟引脚)?

我使用的方法是不是很糟糕,不太可能奏效?整体设计不起作用,我正在尝试理解这是否是原因。

谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-01-11 01:31:10

我看到了潜在的设计问题。首先是对实际上是时钟信号的对象使用variable。其次,您正在使用生成的信号作为时钟输入。这也不好。

我会将您的代码修改为以下代码(如果它完全执行您的代码之前所做的工作,则不会进行测试)

代码语言:javascript
运行
复制
library ieee;
use ieee.std_logic_1164.all;

entity ctrl_gen is
    generic (
        ha: integer := 96; --hpulse
        hb: integer := 144; --hpulse+hbp
        hc: integer := 784; --hpulse+hbp+hactive
        hd: integer := 800; --hpulse+hbp+hactive+hfp
        va: integer := 2; --vpulse
        vb: integer := 35; --vpulse+vbp
        vc: integer := 515; --vpulse+vbp+vactive
        vd: integer := 525 --vpulse+vbp+vactive+vfp
    );
    port (
        clk25: in std_logic; --tmds clock (25mhz)
        hsync: out std_logic; --horizontal sync
        vsync: out std_logic; --vertical sync
        hactive: out std_logic; --active portion of hsync
        vactive: out std_logic; --active portion of vsync
        dena: out std_logic --display enable
    );
end entity;

architecture behavioral of ctrl_gen is
    signal hsync_i, hactive_i, vactive_i, vsync_i : std_logic;

    signal hcount: integer range 0 to hd-1 := 0;
    signal vcount: integer range 0 to vd-1 := 0;
begin
    -- horizontal signals generation
    hproc : process (clk25)
    begin
        if rising_edge(clk25) then
            if hcount < hd-1 then
                hcount <= hcount + 1;
            else
                hcount <= 0;
            end if;

            if (hcount=ha-1) then
                hsync <= '1';
            end if;
            if (hcount=hb-1) then
                hactive_i <= '1';
            end if;
            if (hcount=hc-1) then
                hactive_i <= '0';
            end if;
            if (hcount=hd-1) then
                hsync <= '0';
            end if;
        end if;
    end process;

    -- vertical signals generation
    vproc : process (clk25)
    begin
        if rising_edge(clk25) then
            if hcount = hd-1 then -- moment of falling_edge hsync.
                if vcount < vd-1 then
                    vcount <= vcount + 1;
                else
                    vcount <= 0;
                end if;

                if (vcount=va-1) then
                    vsync <= '1';
                end if;
                if (vcount=vb-1) then
                    vactive_i <= '1';
                end if;
                if (vcount=vc-1) then
                    vactive_i <= '0';
                end if;
                if (vcount=vd-1) then
                    vsync <= '0';
                end if;
            end if;
        end if;
    end process;

    dena <= hactive_i and vactive_i;
    vactive <= vactive_i;
    hactive <= hactive_i;
end behavioral;
票数 3
EN

Stack Overflow用户

发布于 2018-06-21 18:31:43

我认为:

代码语言:javascript
运行
复制
signal hcount: integer range 0 to hd-1 := 0;
signal vcount: integer range 0 to vd-1 := 0;

不是hcount的有效合成类型,vcount:它应为std_logic_vector

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48141356

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档