0
在這段代碼中,我試圖乘以16位數並得到32位輸出。代碼有錯誤。在行16位數字乘法
c<=c+a;
編譯器提供了一個錯誤:?「着讀的方式輸出端口‘C’什麼是我的錯誤,謝謝
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity circ is
port ( a :in std_logic_vector (15 downto 0);
b :in std_logic_vector (15 downto 0);
c :out std_logic_vector (31 downto 0)
);
end entity;
architecture data of circ is
begin
process(a,b)
begin
c<= '0';
for i in 15 to 0 loop
if (b(i) = '1') then
c<=c+a;
end if;
END LOOP;
end process;
end data;
在線 處使用Max plus II c <='0'; 編譯器給出的錯誤: '波形元素的類型必須是「std_logic_vector」' – redlogic
'c <='0''應該是'c <=(others =>'0')'因爲它是std_logic_vector而不是std_logic –
我沒有注意到那只是從OP的代碼中剪切和粘貼而已。我會解決的。 –