发布网友 发布时间:2024-10-23 16:55
共1个回答
热心网友 时间:2024-11-10 06:35
LIBRARY IEEE;
USE IEEE.std_logic_11.ALL;
USE IEEE.std_logic_unsigned.ALL;
ENTITY Multiplier IS
PORT(a:std_logic_vector(15 DOWNTO 0);
y :OUT std_logic_vector(10 DOWNTO 0));
END Multiplier;
ARCHITECTURE BEHAVE OF Multiplier IS
CONSTANT flag:std_logic_vector(8 DOWNTO 0):="101101000";
SIGNAL temp:std_logic_vector(24 DOWNTO 0);
BEGIN
temp <= a * flag;
y <= temp(24 downto 14);
END BEHAVE;
当a的变化比较小(小于45~46)时,输出y是看不出变化来的,因为16384/360≈45.5。