集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 8057|回复: 17

求关于乘法器的vhdl设计设计范例

[复制链接]
ATA 发表于 2010-6-27 23:57:23 | 显示全部楼层 |阅读模式
求关于乘法器的vhdl设计设计范例
乘法器的vhdl设计,不知各位大侠是否有这方面的范例呢?主要是wt和MBA,不知道各位有什么好建议,谢谢啦
CHAN 发表于 2010-6-28 00:13:27 | 显示全部楼层
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity mul4x4 is
port(clk,load:in std_logic;
a,b:in std_logic_vector(3 downto 0);
pout
       
ut std_logic;
dout
       
ut std_logic_vector(7 downto 0));
end mul4x4;
architecture fun of mul4x4 is
component cnt2y
port(clk,load:std_logic;
   pout
       
ut std_logic);
end component;
component reg4b
port(clk,load:std_logic;
ain: in std_logic_vector(3 downto 0);
qut std_logic);
end component;
component switch
port(qin:std_logic;
bin:in std_logic_vector(3 downto 0 );
doutut std_logic_vector(3 downto 0));
end component;
component adder4
port(a,b: in std_logic_vector(3 downto 0);
p: out std_logic_vector(4 downto 0));
end component;
component reg8  
port(clk,load,qi: in std_logic;
din: in std_logic_vector(4 downto 0);
dout: out std_logic_vector(7 downto 0));
end component ;
component outp1  
port(din: in std_logic_vector(7 downto 0);
outp: out std_logic_vector(7 downto 0));
end component;
component dand  
port(al: in std_logic;cl: out std_logic);
end component;


signal r,s,t,z,x: std_logic;
signal ssss: std_logic_vector(7 downto 0);
signal ww: std_logic_vector(4 downto 0);
signal vv: std_logic_vector(3 downto 0);
begin
m1: cnt2y port map( clk=>clk, load=>load, pout=>x);
m2: reg4b port map( clk=>clk, load=>load, ain=>a,q=>r);
m3: switch port map( qin=>r, bin=>b, dout=>vv);
m4: adder4 port map( a=>ssss(7 downto 4),b=>vv, p=>ww);
m5: reg8 port map ( clk=>clk, load=>load, din=>ww, dout=>ssss, qi=>x);
m6: outp1 port map(din=>ssss, outp=>dout);
m7: dand port map(al=>x,cl=>pout);
Endfun;
----------------------------------------------------------adder4(m4)
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adder4 is
port(a,b: in std_logic_vector(3 downto 0);
p: out std_logic_vector(4 downto 0));
end adder4;
architecture bh of adder4 is
begin
process(a,b)
begin
p<=a+b;
end process;
End bh;
--------------------------------------------------------switch(m3)
library ieee;
use ieee.std_logic_1164.all;
entity switch is
port( qin:std_logic;
   bin: in std_logic_vector(3 downto 0);
   dout: out std_logic_vector(3 downto 0));
end switch;
architecture bh of switch is
begin
process(qin,bin)
begin
for I in 0 to 3 loop
dout(I)<=bin(I) and qin;
end loop;
end process;
end bh;
--------------------------------------------------------reg4b(m2)
library ieee;
use ieee.std_logic_1164.all;
entity reg4b is
port( clk,load:std_logic;
  ain: in std_logic_vector(3 downto 0);
   q: out std_logic);
end reg4b;
architecture bh of reg4b is
signal x: std_logic_vector(3 downto 0);
begin
process(clk,load)
begin
if clk'event and clk='1'then
if load='1'then x<=ain;
else x(2 downto 0)<=x(3 downto 1);
end if;
end if;
end process;
q<=x(0);
end bh;

-------------------------------------------------------reg8(m5)
library ieee;
use ieee.std_logic_1164.all;
entity reg8 is
port(clk,qi,load: in std_logic;
din: in std_logic_vector(4 downto 0);
dout: out std_logic_vector(7 downto 0));
end reg8;
architecture bh of reg8 is
signal w: std_logic_vector(7 downto 0);
begin
process(clk,load)
begin
if load='1'then w<="00000000";
elsif clk'event and clk='1'then
if qi='0'then
w(2 downto 0)<=w(3 downto 1);
w(7 downto 3)<=din;
else
w(2 downto 0)<=w(2 downto 0);
w(7 downto 3)<=w(7 downto 3);
end if;
end if;
end process;
dout<=w;
End bh;
-------------------------------------cnt2y(m1)
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity cnt2y is
port(clk,load:std_logic;
pout: out std_logic);
end cnt2y;
architecture bh of cnt2y is
signal M:std_logic_vector(2 downto 0);
begin
process(clk,load)
begin
if load='1'then M<="000";
elsif clk'event and clk='1'then
if M<4 then
M<=M+1;
end if;
end if;
end process;
process(load,M)
begin
if load='0' then
if M<4 then
pout<='0';
else
   pout<='1';
end if;
else
pout<='0';
end if;
end process;
end bh;
----------------------------------outp
library ieee;
use ieee.std_logic_1164.all;
entity outp1 is
port(din: in std_logic_vector(7 downto 0);
outp: out std_logic_vector(7 downto 0));
end outp1;
architecture bh of outp1 is
begin
outp<=din;
End bh;
---------------------------------------dand
library ieee;
use ieee.std_logic_1164.all;
entity dand is
port(al: in std_logic;
cl: out std_logic);
end dand;
architecture bh of dand is
begin
cl<=al;
End bh;
CHANG 发表于 2010-6-28 01:00:28 | 显示全部楼层
楼上的 能再给个32位的例子吗?
FFT 发表于 2010-6-28 01:56:10 | 显示全部楼层
都是vhdl实现的!!有没有用原理图实现的?
longtime 发表于 2010-6-28 02:44:30 | 显示全部楼层
有用verilog实现的吗
interige 发表于 2010-6-28 04:37:44 | 显示全部楼层
我毕业设计也是乘法器,做阵列乘法器,部分积产生用布思编码,累加用华莱士树。
longtim 发表于 2010-6-28 05:59:36 | 显示全部楼层
虽然对我没什么用,但还时谢谢了
CHANG 发表于 2010-6-28 06:08:00 | 显示全部楼层
仔细看过了
longtime 发表于 2010-6-28 07:31:45 | 显示全部楼层
乘法器是由加法器实现的,可以采用超前进位加法器<br>
对被乘数使用booth编码,部分积累加采用华莱士树可以很好的优化乘法器<br>
既可以得到面积优化又可以获得速度上的优化。
AAT 发表于 2010-6-28 08:35:03 | 显示全部楼层
华莱士树,恩,其实这些结构都可以上网好好看看,招聘面试很注重基础。<br>
大家以后粘代码的时候最好加上注视
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-6-26 19:03 , Processed in 0.081547 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表