实验5 用VHDL语言进行多位减法器的设计
一、实验目的
学习在QuartusⅡ下用VHDL语言设计复杂组合电路与功能仿真的方法。 二、实验仪器设备 1、PC机一台 2、QuartusⅡ。 三、实验要求
1、预习教材中的相关内容,编写出多位减法器的VHDL源程序。
2、用VHDL语言输入方式完成电路设计,编译、仿真后,在试验箱上实现。 四、实验内容及参考实验步骤
1、用VHDL语言设计一个半减器。并进行编译仿真。
2、在半减器的基础上,利用元件例化语句,设计一个一位的全减器,并编译仿真。
3、在一位全减器的基础上,利用元件例化语句,设计一个8位的全减器,并编译仿真。 五、实验报告
1、根据实验过程写出试验报告 2、总结用VHDL语言的设计流程 1、总结复杂组合电路的设计方法。 附录
1、半减器程序 library ieee;
use ieee.std_logic_1164.all;
entity h_suber is port(x,y:in std_logic;
diff,s_out:out std_logic); end entity h_suber;
architecture bhv of h_suber is begin
process(x,y) begin
diff<=x xor y;
s_out<=(not x) and y; end process;
end architecture bhv;
2、一位全减器程序 library ieee;
use ieee.std_logic_1164.all;
entity suber is
port(x,y,sub_in:in std_logic;
diffr,sub_out:out std_logic); end entity suber;
architecture bhv of suber is component h_suber port(x,y:in std_logic;
diff,s_out:out std_logic); end component;
signal t0,t1,t2:std_logic; begin
u1:h_suber port map(x=>x,y=>y,diff=>t0,s_out=>t1);
u2:h_suber port map(x=>t0,y=>sub_in,diff=>diffr,s_out=>t2); sub_out<=t1 or t2; end architecture bhv;
3、8位全减器程序 library ieee;
use ieee.std_logic_1164.all;
entity sub8 is
port(a,b: in std_logic_vector(7 downto 0); sin: in std_logic; sout: out std_logic;
c: out std_logic_vector(7 downto 0)); end entity sub8;
architecture bhv of sub8 is component suber
port(x,y,sub_in:in std_logic;
diffr,sub_out:out std_logic); end component;
signal t:std_logic_vector(6 downto 0); begin
u0:suber port map(x=>a(0),y=>b(0),sub_in=>sin,diffr=>c(0),sub_out=>t(0)); u1:suber port map(x=>a(1),y=>b(1),sub_in=>t(0),diffr=>c(1),sub_out=>t(1)); u2:suber port map(x=>a(2),y=>b(2),sub_in=>t(1),diffr=>c(2),sub_out=>t(2)); u3:suber port map(x=>a(3),y=>b(3),sub_in=>t(2),diffr=>c(3),sub_out=>t(3)); u4:suber port map(x=>a(4),y=>b(4),sub_in=>t(3),diffr=>c(4),sub_out=>t(4)); u5:suber port map(x=>a(5),y=>b(5),sub_in=>t(4),diffr=>c(5),sub_out=>t(5)); u6:suber port map(x=>a(6),y=>b(6),sub_in=>t(5),diffr=>c(6),sub_out=>t(6)); u7:suber port map(x=>a(7),y=>b(7),sub_in=>t(6),diffr=>c(7),sub_out=>sout); end architecture bhv;
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新幼儿教育实验五 用VHDL语言进行多位减法器的设计 全文阅读和word下载服务。
相关推荐: