资源描述
EDA课程设计报告
实验名称:八位乘法器
实验地点:@@@@
班级:@@@@@
学号:@@@@@
姓名:@@@@
目录
一.引言
1.1 EDA技术的概念•••••••••••••••••••••••••••••••••••••••••
1.2 EDA技术的特点•••••••••••••••••••••••••••••••••••••••••
1.3 EDA设计流程••••••••••••••••••••••••••••••••••••••••••••
1.4 VHDL介绍••••••••••••••••••••••••••••••••••••••••••••••••
二. 八位乘法器的设计要求与设计思路••••••••••••••••••
2.1 设计目的••••••••••••••••••••••••••••••••••••••••••••••••••
2.2 设计要求••••••••••••••••••••••••••••••••••••••••••••••••••
三. 八位乘法器的综合设计••••••••••••••••••••••••••••••••
3.1 八位乘法器功能•••••••••••••••••••••••••••••••••••••••••
3.2 八位乘法器设计方案•••••••••••••••••••••••••••••••••••
3.3 八位乘法器实体设计•••••••••••••••••••••••••••••••••••
3.4 八位乘法器VHDL设计•••••••••••••••••••••••••••
3. 5八位乘法器仿真图形•••••••••••••••••••••••••••••••••
心得体会•••••••••••••••••••••••••••••••••••••••••••••••••••••••
参考文献•••••••••••••••••••••••••••••••••••••••••••••••••••••••••
一、引言
1.1 EDA技术的概念
EDA是电子设计自动化(Electronic Design Automation)的缩写,在20世纪90年代初从计算机辅助设计(CAD)、计算机辅助制造(CAM)、计算机辅助测试(CAT)和计算机辅助工程(CAE)的概念发展而来的。EDA技术就是以计算机为工具,设计者在EDA软件平台上,用硬件描述语言HDL完成设计文件,然后由计算机自动地完成逻辑编译、化简、分割、综合、优化、布局、布线和仿真,直至对于特定目标芯片的适配编译、逻辑映射和编程下载等工作。
1.2 EDA技术的特点
利用EDA技术进行电子系统的设计,具有以下几个特点:① 用软件的方式设计硬件;② 用软件方式设计的系统到硬件系统的转换是由有关的开发软件自动完成的;③ 设计过程中可用有关软件进行各种仿真;④ 系统可现场编程,在线升级;⑤ 整个系统可集成在一个芯片上,体积小、功耗低、可靠性高。因此,EDA技术是现代电子设计的发展趋势。
1.3 EDA设计流程
典型的EDA设计流程如下:
1、文本/原理图编辑与修改。首先利用EDA工具的文本或图形编辑器将设计者的设计意图用文本或图形方式表达出来。
2、编译。完成设计描述后即可通过编译器进行排错编译,变成特定的文本格式,为下一步的综合做准备。
3、 综合。将软件设计与硬件的可实现性挂钩,是将软件转化为硬件电路的关键步骤。
4、 行为仿真和功能仿真。利用产生的网表文件进行功能仿真,以便了解设计描述与设计意图的一致性。
5、适配。利用FPGA/CPLD布局布线适配器将综合后的网表文件针对某一具体的目标器件进行逻辑映射操作,其中包括底层器件配置、逻辑分割、逻辑优化、布局布线。适配报告指明了芯片内资源的分配与利用、引脚锁定、设计的布尔方程描述情况。
6、 功能仿真和时序仿真。
7、 下载。如果以上的所有过程都没有发现问题,就可以将适配器产生的下载文件通过FPGA/CPLD下载电缆载入目标芯片中。
8、 硬件仿真与测试。
1.4硬件描述语言(VHDL)
VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)主要用于描述数字系统的结构,行为,功能和接口。除了含有许多具有硬件特征的语句外,VHDL的语言形式和描述风格与句法是十分类似于一般的计算机高级语言。VHDL的程序结构特点是将一项工程设计,或称设计实体(可以是一个元件,一个电路模块或一个系统)分成外部(或称可是部分,及端口)和内部(或称不可视部分),既涉及实体的内部功能和算法完成部分。在对一个设计实体定义了外部界面后,一旦其内部开发完成后,其他的设计就可以直接调用这个实体。这种将设计实体分成内外部分的概念是VHDL系统设计的基本。
1.用VHDL代码而不是用原理图进行设计,意味着整个电路板的模型及性能可用计算机模拟进行验证。
2.VHDL元件的设计与工艺无关,与工艺独立,方便工艺转换。
3.VHDL支持各种设计方法,自顶向下、自底向上或者混合的都可以。
4.可以进行从系统级到逻辑级的描述,即混合描述。
5.VHDL区别于其他的HDL,已形成标准,其代码在不同的系统中可交换建模。
二、八位乘法器的设计要求与设计思路
2.1 设计目的
本次设计的目的就是通过实践深入理解EDA技术并掌握VHDL硬件描述语言的设计方法和思想。通过学习的VHDL语言结合电子电路的设计知识理论联系实际,掌握所学的课程知识和基本单元电路的综合设计应用。通过对八位乘法器的设计,巩固和综合运用所学知识,提高设计能力,提高分析、解决计算机技术实际问题的独立工作能力。
2.2 设计要求。
设计一个乘法器的模块,接受实验系统上的连续脉冲,当给定启动/清零指令时,能自动发出CLK信号驱动乘法预算,当8个脉冲后自动停止。设计一个纯组合电路的8*8等于16位的乘法器(选择不同的流水线方式),具体说明并比较这几种乘法器的逻辑资源占用情况和运行速度情况。
通过独立的设计,能够完整的完成老师分配的课程设计任务。通过对电梯控制系统的设计,掌握所学EDA课程的基本知识和对VHDL语言的综合设计应用。通过课程设计,提高设计能力,提高分析解决实际问题的能力,并在设计中了解硬件编程的流程和思路,为以后工作和发挥技术打下基础。
三、八位乘法器的综合设计
3.1 八位乘法器功能
由8位加法器构成的以时序逻辑方式设计的8位乘法器,此乘法器具有一定的实用价值。其乘法原理是:乘法通过逐项位移相加原理来实现,从被乘数的最低位开始,若为1,则乘数左移后与上一次和相加;若为0,左移后以全零相加,直至被乘数的最高位。图中,ARICTL是乘法运算控制电路,它的START(可锁定于引脚I/O 49)信号的上跳沿与高电平有两个功能,即16位寄存器清零和被乘数A[7..0]向移位寄存器SREG8B加载:它的低电平则作为乘法使能信号。乘法时钟信号从ARICTL的CLK输入。当被乘数加载于8位右移寄存器SREG8B后,随着每一时钟节拍,最低位在前,由低位至高位逐位移出。当为1时,与门ANDARITH打开,8为乘数B[7..0]在同一节拍进入8位加法器,与上一次锁存在16位锁存器REG16B中的高8位进行相加,其和在下一时钟节拍的上升沿被锁进此锁存器。而当被乘数移出位为0时,与门全零输出。如此往复,直至8个时钟脉冲后,由ARICTL的控制,乘法运算过程自动中止。ARIEND输出高电平,以此可点亮一发光管,以示乘法结束。此时REG16B的输出值即为最后乘积。
3.2 八位乘法器设计方案
方案一:八位直接宽位加法器,它的速度较快,但十分耗费硬件资源,对于工业化设计是不合理的。
方案二:由两个四位加法器组合八位加法器,其中四位加法器是四位二进制并行加法器,它的原理简单,资源利用率和进位速度等方面较好,综合各方面的考虑,决定采用第二种方案。
3.3 八位加法器设计思路
纯组合逻辑构成的乘法器虽然工作速度较快,但过于占用硬件资源,难以实现宽位乘法器,由八位加法器构成的以时序逻辑方式设计的八位乘法器,具有一定的使用价值。而且由FPGA构成实验系统后,可以很容易的用ASIC大型集成芯片来完成,性价比高,可操作性强。其乘法原理是:乘法通过逐项移位相加原理来完成,从被乘数的最低位开始,若为1,则乘数左移后于上一次的和相加;若为0左移后以全零相加,直至被乘数的最高位。
3.5八位乘法器各功能模块VHDL描述
1.library ieee; --四位二进制并行加法器
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity add4b is
port( cin:in std_logic;
a,b:in std_logic_vector(3 downto 0);
s:out std_logic_vector(3 downto 0);
cout:out std_logic);
end;
architecture one of add4b is
signal sint,aa,bb:std_logic_vector(4 downto 0);
begin
aa<='0' & a;
bb<='0' & b;
sint<=aa+bb+cin;
s<=sint(3 downto 0);
cout<=sint(4);
end;
2.library ieee --由两个四位二进制并行加法器级联而成的八位二进制加法器;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity adder8b is
port( cin:in std_logic;
a,b:in std_logic_vector(7 downto 0);
s:out std_logic_vector(7 downto 0);
cout:out std_logic);
end;
architecture one of adder8b is
component add4b --对要调用的元件add4b的端口进行说明
port( cin:in std_logic;
a,b:in std_logic_vector(3 downto 0);
s:out std_logic_vector(3 downto 0);
cout:out std_logic);
end component;
signal carryout: std_logic;
begin
u1:add4b port map(cin,a(3 downto 0),b(3 downto 0),s(3 downto 0),carryout);
u2:add4b port map(carryout,a(7 downto 4),b(7 downto 4),s(7 downto 4),cout);
end;
3.library ieee --一位乘法器;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity andarith is
port( abin:in std_logic;
din:in std_logic_vector(7 downto 0);
dout:out std_logic_vector(7 downto 0));
end;
architecture one of andarith is
begin
process(abin,din)
begin
for i in 0 to 7 loop
dout(i)<=din(i) and abin;
end loop;
end process;
end;
4.library ieee; --乘法运算控制器
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity arictl is
port( clk,start:in std_logic;
clkout,rstall,ariend:out std_logic);
end;
architecture one of arictl is
signal cnt4b:std_logic_vector(3 downto 0);
begin
rstall<=start;
process(clk,start)
begin
if start='1' then cnt4b<="0000";
elsif clk'event and clk='1' then
if cnt4b<8 then --小于8则计数,等于8则表明乘法运算已经结束
cnt4b<=cnt4b+1;
end if;
end if;
end process;
process(clk,cnt4b,start)
begin
if start='0' then
if cnt4b<8 then
clkout<=clk; ariend<='0';
else clkout<='0'; ariend<='1';
end if;
else clkout<=clk; ariend<='0';
end if;
end process;
end;
5.library ieee; --16位锁存器
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity reg16b is
port( clk,clr:in std_logic;
d:in std_logic_vector(8 downto 0);
q:out std_logic_vector(15 downto 0));
end;
architecture one of reg16b is
signal r16s:std_logic_vector(15 downto 0);
begin
process(clk,clr)
begin
if clr='1' then r16s<="0000000000000000";
elsif clk'event and clk='1' then
r16s(6 downto 0)<=r16s(7 downto 1);
r16s(15 downto 7)<=d;
end if;
end process;
q<=r16s;
end;
6.library ieee; --8位右移寄存器
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity sreg8b is
port( clk,load:in std_logic;
din:in std_logic_vector(7 downto 0);
qb:out std_logic);
end;
architecture one of sreg8b is
signal reg8:std_logic_vector(7 downto 0);
begin
process(clk,load)
begin
if clk'event and clk='1' then
if load='1' then reg8<=din;
else reg8(6 downto 0)<=reg8(7 downto 1);
end if;
end if;
end process;
qb<=reg8(0);
end;
7.library ieee; --8位乘法器顶层设计
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity mult8x8 is
port( clk:in std_logic;
start:in std_logic;
a,b:in std_logic_vector(7 downto 0);
dout:out std_logic_vector(15 downto 0);
ariend:out std_logic);
end;
architecture struc of mult8x8 is
component adder8b is
port( cin:in std_logic;
a,b:in std_logic_vector(7 downto 0);
s:out std_logic_vector(7 downto 0);
cout:out std_logic);
end component;
component andarith is
port( abin:in std_logic;
din:in std_logic_vector(7 downto 0);
dout:out std_logic_vector(7 downto 0));
end component;
component arictl is
port( clk,start:in std_logic;
clkout,rstall,ariend:out std_logic);
end component;
component reg16b is
port( clk,clr:in std_logic;
d:in std_logic_vector(8 downto 0);
q:out std_logic_vector(15 downto 0));
end component;
component sreg8b is
port( clk,load:in std_logic;
din:in std_logic_vector(7 downto 0);
qb:out std_logic);
end component;
signal gndint :std_logic;
signal intclk :std_logic;
signal rstall :std_logic;
signal qb :std_logic;
signal andsd :std_logic_vector(7 downto 0);
signal dtbin :std_logic_vector(8 downto 0);
signal dtbout :std_logic_vector(15 downto 0);
begin
dout<=dtbout; gndint<='0';
u1:arictl port map( clk,start,intclk,rstall,ariend);
u2:sreg8b port map(intclk,rstall,b,qb);
u3:andarith port map(qb,a,andsd);
u4:adder8b port map(gndint,dtbout(15 downto 8),andsd,dtbin(7 downto 0),dtbin(8));
u5:reg16b port map(intclk,rstall,dtbin,dtbout);
end;
3.5八位乘法器仿真图形
输入波形图
输出波形图
时序RTL电路
心得体会
@@@@@这个自己编去吧 。。。
参考文献
⑴ 王爱英.计算机组成与结构.北京:清华大学出版社,2001.2
⑵ 黄仁欣.EDA技术实用教程.北京:清华大学出版社,2006
⑶ 曹昕燕,周凤臣,聂春燕.EDA技术实验与课程设计.北京:清华大学出版社,2006.5
⑷ 杨亦华,延明.数字电路EDA入门.北京:北京邮电大学出版社,2003
⑸ 邹彦,庄严,邹宁,王宇鸿《EDA技术与数字系统设计>北京:电子工业出版社,2008
⑹ 潘松 ,黄继业《EDA技术与VHDL》,北京,清华大学出版社,2006
(7) 潘松 ,黄继业《EDA技术实用教程》,北京,科学出版社,2006
17
展开阅读全文