实验五 基于VHDL语言的全加器设计与实现
一、实验目的
1、进一步掌握VHDL语言的几本结构及设计的输入方法。 2、掌握VHDL语言的组合逻辑电路的设计方法。 3、掌握全加器原理,并能进行多位加法器的设计。
4、掌握VHDL语言的基本描述语句特别是元件例化语句的使用方法。
二、实验原理
参考《EDA技术教程》 三、实验内容
1、编写VHDL语言程序实现1位加法器设计,给出程序设计、软件编译、仿真分析及详细实验过程。
2、设计并实现由8个1位二进制加法器级联而成的8位二进制加法器。8位加法器的顶层文件设计要求采用元件例化语句进行实现,并利用Max+PlusII开发软件对其进行编译和仿真。 四、程序 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 adder8b;
architecture behav of adder8b is
signal sint,aa,bb:std_logic_vector(8 downto 0); begin
aa<='0'&a; bb<='0'&b; sint<=aa+bb+cin; s<=sint(7 downto 0); cout<=sint(8); end behav;
library ieee;
use ieee.std_logic_1164.all; entity f_adder is
port (ain,bin,cin:in std_logic; cout,sum:out std_logic); end entity f_adder;
architecture fd1 of f_adder is component h_adder port(a,b:in std_logic; co,so:out std_logic); end component; component or2a port(a,b:in std_logic;
c:out std_logic); end component;
signal d,e,f:std_logic; begin
u1:h_adder port map(a=>ain,b=>bin,co=>d,so=>e); u2:h_adder port map(a=>e,b=>cin,co=>f,so=>sum); u3:or2a port map(a=>d,b=>f,c=>cout); end architecture fd1;
library ieee;
use ieee.std_logic_1164.all; entity h_adder is port(a,b:in std_logic; co,so:out std_logic); end entity h_adder;
architecture fh1 of h_adder is begin
so<=not(a xor(not b)); co<=a and b;
end architecture fh1;
library ieee;
use ieee.std_logic_1164.all; entity or2a is
port(a,b:in std_logic; c:out std_logic); end entity or2a;
architecture one of or2a is begin c<=a or b;
end architecture one; 五、仿真图
心得体会:本次试验让我们掌握了全加器的原理,最重要的是我们掌握了由8个1位二进制加法器级联成8位二进制加法器的方法。同时学会了VHDL语言的基本描述语句特别是元件例化语句的使用方法。本次试验还算顺利,中间出了点小问题,最后还是在全组的努力下解决了问题。让我们更加懂得合作精神。
实验六 基于VHDL语言的分频设计与实现
一、实验目的
1、进一步掌握VHDL语言的基本结构及设计的输入方法
2、掌握VHDL基本逻辑电路的综合设计应用
二、实验原理