1
我試圖實現一個比普通RCA更快的加法器。因此我使用了XILINX庫,並找到了一個名爲adsu8的簡單加法器。我想將它嵌入到我最近的VHDL代碼中。但是因此我必須堅持數據類型BIT和BIT_VECTOR。現在每當我綜合出現這樣的一堆警告:如何在vhdl代碼中實現原理圖並將數據類型從std_logic轉換爲位
: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,但也不能少。但是這個問題讓我感到困惑,並導致頭痛。我很感激任何解決方案或信息朝着正確的方向發展。
提前感謝和問候
託比
這不是一個答案,但你真的需要使用一個簡單的加/減單元的原理圖模塊嗎?根據我的經驗,使用原理圖模式的任何優勢都遠遠勝過您在使用由其創建的實體時似乎必須解決的問題。 –
Xilinx器件中包含的簡單RCA加法器速度非常快。因此賽靈思實施了支持鏈以加速RCA和其他邏輯。其他解決方案可能比傳統的RCA更快,但盈虧平衡點超過了幾十位。 – Paebbels
在我的應用程序中,速度是關鍵,加法器被確定爲瓶頸。我寧願要實現一個可用的模塊,而不是實現一個複雜的進位鏈。有沒有辦法重新分配數據類型?歡迎任何其他解決方法。 –