双向端口设计

双向端口的VHDL程序如下:

library ieee;
use ieee.std_logic_1164.all;

entity in_out is
port(en    :in    std_logic;
     data  :in    std_logic;
     q     :inout std_logic;
     result:out   std_logic
     );
end in_out;

architecture behave of in_out is
begin
  process(en,data,q)
  begin
  if (en = '1') then
    q <= data;
  else
    q <= 'Z';
     result <= q;
  end if;
 end process;

end behave;

生成的RTL图如下:

结论:完整的if-else语句也会产生寄存器

原文地址:https://www.cnblogs.com/amanlikethis/p/3086297.html