方向不匹配,并且在Vivado中没有驱动程序警告

时间:2018-05-05 18:33:25

标签: vhdl warnings

您好我收到了这些警告,并且由于这些警告,我的代码无法正常工作。具体来说,下面是完整的警告。顺便说一下,由于这两个警告彼此密切相关,我问这个问题包括这两个警告,而不是问两个单独的问题。

[Synth 8-547] port direction mismatch for port 'douta' 
[Synth 8-3848] Net data_out_ram in module/entity top_mod does not have 
driver.

但是,不需要这些警告。据我所知,驱动器意味着连接,下面的信号有连接。我的意思是我不明白这些警告背后的原因。

signal data_out_ram : std_logic_vector(11 downto 0); --declared in top_module

U4: Block_Ram port map(addra => address_ram,
                       clka => clk,
                       dina => data_in_ram,
                       douta => data_out_ram, -- here
                       wea => write_enable);

U5: Brightness_Contrast port map(clk_in => clk,
                                 operation => operation,
                                 pos_x => pos_x,
                                 pos_y => pos_y,
                                 data_in => data_out_ram, --here
                                 cursor_pos_x => cursor_pos_x,
                                 cursor_pos_y => cursor_pos_y,
                                 length => length,
                                 output_of_operation => output_of_operation,
                                 mode => mode);

U6: Display port map(clk_in => clk,
                     rst => rst,
                     visible => visible,
                     data_r => data_r,
                     data_g => data_g,
                     data_b => data_b,
                     pos_x => pos_x,
                     pos_y => pos_y,
                     data_out_ram => data_out_ram, --here
                     length => length,
                     cursor_pos_x => cursor_pos_x,
                     cursor_pos_y => cursor_pos_y);

component Display
port(clk_in : in  std_logic ;
rst     : in  std_logic;
visible: in std_logic;
data_r  : out std_logic_vector(COLOR_BIT-1 downto 0);
data_g  : out std_logic_vector(COLOR_BIT-1 downto 0);
data_b  : out std_logic_vector(COLOR_BIT-1 downto 0);
pos_x  : in integer range 0 to 2047;
pos_y  : in integer range 0 to 2047;
display_data: in std_logic_vector(11 downto 0);
length: in integer range 0 to PICTURE_WIDTH_HEIGHT;
cursor_pos_x: in integer range 0 to PICTURE_WIDTH_HEIGHT;
cursor_pos_y: in integer range 0 to PICTURE_WIDTH_HEIGHT
);
end component;

component Block_Ram
port(addra :in std_logic_vector(15 downto 0);
 clka : in std_logic;
 dina : in std_logic_vector(11 downto 0);
 douta: in std_logic_vector(11 downto 0);
 wea: in std_logic);
 end component;

component Brightness_Contrast
port (
clk_in : in  std_logic;
operation : in std_logic_vector(1 downto 0);
pos_x: in integer range 0 to 2047 ;  
pos_y: in integer range 0 to 2047 ; 
data_in: in std_logic_vector(11 downto 0);
cursor_pos_x: in integer range 0 to PICTURE_WIDTH_HEIGHT;
cursor_pos_y: in integer range 0 to PICTURE_WIDTH_HEIGHT;
length: in integer range 0 to PICTURE_WIDTH_HEIGHT;
output_of_operation: out std_logic_vector(11 downto 0);
mode: in std_logic
);

Ram由块存储器生成器

构成

我真的需要帮助。我怎么能在这里解决这个问题?

1 个答案:

答案 0 :(得分:1)

好。

douta: in std_logic_vector(11 downto 0);上显然不正确的端口模式外,还有一个教训可以在这里学习。

VHDL是在一个非常不同的时代设计的,当时计算机功能强大得多,而编译则是一个相当缓慢而昂贵的操作;因此,它允许单独编译和检查模块,而无需读取和编译大量其他模块。

Component语句是此机制的一部分:它告诉编译器您的设计意图是将此模块连接到具有一堆输入端口且没有输出的component Block_Ram,即{{{ 3}}

它忠实地遵守这一设计意图,提醒您一路上遇到的任何问题;例如这些错误消息:没有驱动程序的信号。您可以通过添加驱动程序data_out_ram <= something_else;来消除该错误,以任何方式解决错误。

稍后,设计将被详细描述&#34;,将一堆成功编译的模块连接在一起,在适当的库中搜索与组件声明匹配的只写存储器。但是在这个阶段,你可以在没有编写任何模块的情况下进行编译。

如果找到一个,一切都很好,你的设计将合成,成功实现你所说的设计意图。

然而,更有可能的是,详细说明将失败,因为库中最接近的匹配类似于

entity Block_Ram
port(addra :in std_logic_vector(15 downto 0);
 clka : in std_logic;
 dina : in std_logic_vector(11 downto 0);
 douta: out std_logic_vector(11 downto 0);
 wea: in std_logic);
end entity;

一个完全正常的RAM,out端口doutain端口应该是U4: entity Work.Block_Ram port map(addra => address_ram, clka => clk, dina => data_in_ram, douta => data_out_ram, wea => write_enable); 端口。显然,您的编译器正在编译时执行该检查而不是详细说明,以便为您提供&#34;端口方向不匹配&#34;错误。那么为何不?编制比20世纪80年代快了几个数量级。

真正令人遗憾的是,VHDL仍然被教导,好像它应该被用于20世纪80年代机器上编制的20世纪80年代的设计。

现在完全没有必要进行单独编译。

所以删除所有组件声明,并使用直接实体实例化。那就是:

BlockRam

它将直接实例化您已编译到库Work中的BlockRam。 (当然,这要求所有这些实体已经被编写,并且它将编译它们以交叉检查端口接口)。如果Component在其他库中,只需在实例化中更改库名称。

在你真的想要一个带有实际输出端口的RAM的情况下,这可能没有错误,因为没有{{1}}声明可以犯一个愚蠢的错误。

这是VHDL教学在良好的VHDL实践方面落后数十年的几个领域之一,鼓励大型且容易出错的设计,其中更小,更简单的形式可以减少错误。