参考答案 上机习二:组合逻辑电路设计.docVIP

  • 6
  • 0
  • 约6.19千字
  • 约 8页
  • 2016-08-23 发布于贵州
  • 举报

参考答案 上机习二:组合逻辑电路设计.doc

VHDL与复杂数字系统设计 上机实验2:组合逻辑电路的VHDL程序设计 实验目的: 掌握在Max+plusII中,使用硬件描述语言设计电路的基本操作步骤; 运用所学VHDL的描述语句完成组合逻辑电路的设计。 实验任务: 从下列各题中任选一题完成。 1. 试用两种描述方法,设计一个四位乘法运算器,并对两种方法所描述电路的性能进行比较。该乘法器有两个操作数输入端口,有一个乘积结果输出端口,采用标准逻辑位或位矢量数据类型。 2. 试用两种描述方法,设计一个四位全减器,并对两种方法所描述电路的性能进行比较。该减法器有两个操作数输入端口、一个借位输入端口、一个结果输出端口、一个借位输出端口,采用标准逻辑位或位矢量数据类型。 3. 设计一个四位十进制数显示器,每一个字码都由一个BCD码-7段译码显示器驱动,即该电路包括4个BCD码-7段译码显示器,要求该电路必须设计成能够自动去掉4位中高位上的零,比如十进制数0908,显示时应为908,故BCD码-7段译码显示器应具有灭零功能。该电路的端口包括:四个BCD码输入端口、四个7段译码输出端口。 实验报告要求: 给出完整的VHDL语言程序,程序应包括:库和包集合说明(必要时)、实体和结构体;若使用了元件,要给出底层元件的VHDL语言描述; 给出系统自动生成的引脚框图; 对所设计电路进行功能仿真; 进行适当分析。 参考答案: 1. 乘法器 方法一 利用算术运算符、包集合定义 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity mula is port( a,b :in std_logic_vector(3 downto 0); c :out std_logic_vector(7 downto 0)); end mula; architecture rtl of mula is begin c=a*b; end rtl; ** DEVICE SUMMARY ** Chip/ Input Output Bidir LCs POF Device Pins Pins Pins LCs % Utilized mula EPF6010ATC100-1 8 8 0 32 3 % User Pins: 8 8 0 方法二 利用部分积连加法 library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity mulb is port( a,b :in std_logic_vector(3 downto 0); c :out std_logic_vector(7 downto 0)); end mulb; architecture rtl of mulb is signal tmp1:std_logic_vector(3 downto 0); signal tmp2:std_logic_vector(4 downto 0); signal tmp3:std_logic_vector(5 downto 0); signal tmp4:std_logic_vector(6 downto 0); begin tmp1= a when b(0)=1 else 0000; tmp2= a 0 when b(1)=1 else 00000; tmp3= a 00 when b(2)=1 else 000000; tmp4= a 000 when b(3)=1 else 0000000; c=tmp1 +tmp2 +tmp3 +(0 tmp4); end rtl; ** DEVICE SUMMARY ** Chip/ Input Output Bidir LCs POF Device Pins Pins Pins LCs % Utilized mulb EPF6010ATC100-1 8 8 0 29 3 % User Pins

文档评论(0)

1亿VIP精品文档

相关文档