用 ISE 合成全加器

Synthesizing full adder with ISE

我写了一个简单的全加器,它使用 2 个半加器和一个或门。 VHDL代码非常简单

library ieee;
use ieee.std_logic_1164.all;

entity ha is
  port( x: in std_logic;
      y: in std_logic;
      s: out std_logic;
      c: out std_logic);
end;
architecture x of ha is
begin
  s <= x xor y;
  c <= x and y;
end;

library ieee;
use ieee.std_logic_1164.all;

entity fa is
  port( a: in std_logic;  b: in std_logic;  cin: in std_logic;
      sum: out std_logic;  cout: out std_logic);
end;
architecture y of fa is
  component ha port( x: in std_logic; y: in std_logic;
                   s: out std_logic; c: out std_logic);
  end component;
  signal im1, im2, im3: std_logic;
begin
  ha1: ha port map( x=>a, y=>b, s=>im1, c=>im2 );
  ha2: ha port map( x=>im1, y=>cin, s=>sum, c=>im3 );
  cout <= im3 or im2;
end; 

然而,合成器的输出显示有两个异或门。半加器的或门和其他门在哪里?

=========================================================================
*                       Advanced HDL Synthesis                          *
=========================================================================
Advanced HDL Synthesis Report

Macro Statistics
# Xors                                                 : 2
1-bit xor2                                            : 2

=========================================================================

另外,FA的RTL原理图是正确的,但是半加器的RTL原理图很奇怪! y 端口不存在,但有数据 [1:0]。这是什么意思?

FA:

哈:

我已经看到 Vivado 合成器经常从宏统计数据中删除一些东西。宏报告对于 FPGA 设计没有真正意义,因为您的所有逻辑实际上都将映射到 LUT。在这种情况下,您的基本 and/or 门似乎不被视为宏,但 XOR 是(如示意图中的方框所示,而不是逻辑符号)。

就您的半加器原理图而言,这些工具已将您的两个单位输入端口组合成一个两位总线。 and 门之前的三角形是该总线上的抽头,用于拉出两位中的一位。这只是表示同一事物的另一种方式。