⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boothsmul.vhd.bak

📁 Booths Multiplier using Behavioral Model
💻 BAK
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

Entity Boothsmul is
 generic (N : integer := 24; NN : integer := 48);
 port(a,b : in signed(N-1 downto 0); 
	en : in std_logic;
	c: out signed(NN-1 downto 0));
end Boothsmul;

Architecture beh of Boothsmul is
begin
 process(en)
 variable acc : signed(NN-1 downto 0):=(others=>'0');
 variable ltwolsb : signed(1 downto 0) := "00";
 --variable count:integer := 8;
 begin
   if en = '1' and en'event then
    acc(N-1 downto 0) := acc(N-1 downto 0) + b;
    
    for i in 0 to N-1 loop
--	 wait until clk = '1' and clk'event; 
      ltwolsb := acc(0) & ltwolsb(1);
      
      if ltwolsb(0) = '1' and ltwolsb(1) = '0' then
		acc(NN-1 downto N) := acc(NN-1 downto N) + a;
	  elsif ltwolsb(0) = '0' and ltwolsb(1) = '1' then
		acc(NN-1 downto N) := acc(NN-1 downto N) - a;
	  end if;
 
      acc := acc(NN-1) & acc(NN-1 downto 1);
 --     count := count - 1; 	
	 end loop;
   end if;
   c <= acc;
  end process; 
end beh;

 
 
 
  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -