1

我试图实现一个比普通 RCA 更快的加法器。因此,我使用了 XILINX 库并找到了一个名为 adsu8 的简单加法器。我想将它嵌入到我最近的 VHDL 代码中。但因此我必须坚持使用数据类型 BIT 和 BIT_VECTOR。现在每次我合成时都会弹出一堆这样的警告:

:Xst:2036 - 在端口上插入 OBUF > 由黑盒驱动。可能的模拟不匹配。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- entity of module
entity rca_8bit is
Port ( OP_A : in  BIT_VECTOR (7 downto 0);
       OP_B : in  BIT_VECTOR (7 downto 0);
       ADDSUB : in  BIT;
       SUM : out  BIT_VECTOR (7 downto 0);
          FLAGS : out BIT_VECTOR (4 downto 0));
end rca_8bit;

-- architecture describes behavior of module
architecture behavioral of rca_8bit is
-- sub-module is declared
component adsu8
    port ( A : in  STD_LOGIC_VECTOR (7 downto 0);
             B : in  STD_LOGIC_VECTOR (7 downto 0);
             CI : in BIT;
             S : out  STD_LOGIC_VECTOR (7 downto 0); 
             CO : out  BIT;
             OFL : out BIT);
end component;
-- some code to avoid the blackbox warning message of 
--  component adsu8 which is implemented from schematics  
attribute box_type : string; 
attribute box_type of adsu8 : component is "black_box"; 

-- additional wires std_logic
signal SIG_A,SIG_B,SIG_S : STD_LOGIC_VECTOR (7 downto 0); 

-- additional wires bit
signal  SIG_SUM : BIT_VECTOR (7 downto 0);
signal  SIG_FLAGS :  BIT_VECTOR (4 downto 0);
signal  SIG_CO,SIG_OFL : BIT;


begin
-- instantiate and do port map
AS8 : adsu8 port map (SIG_A,SIG_B,ADDSUB,SIG_S,SIG_CO,SIG_OFL);

-- convert and forward std_logic to bit
SIG_A <= to_stdlogicvector(OP_A);
SIG_B <= to_stdlogicvector(OP_B);
SIG_SUM <= to_bitvector(SIG_S);

-- assign result
SUM <= SIG_SUM;
-- generate flags
SIG_FLAGS(0) <= SIG_SUM(7) xor SIG_FLAGS(1);            -- S (N xor V)
SIG_FLAGS(1) <= SIG_OFL;                                -- V
SIG_FLAGS(2) <= SIG_SUM(7);                             -- N (MSB = 0)
SIG_FLAGS(3) <= '1' when SIG_SUM = "00000000" else '0'; -- Z
SIG_FLAGS(4) <= SIG_CO;                                 -- C
-- assign flags
FLAGS <= SIG_FLAGS;

end behavioral;

我在 VHDL 方面没有这种经验,但也没有那么少。但是这个问题让我感到困惑并导致头痛。我很感激任何正确方向的解决方案或信息。

提前致谢并致以最诚挚的问候

托比

4

0 回答 0