1、中北大学硬件描述语言0809A卷标准答案剖析中 北 大 学试题答案及评分标准硬件描述语言及器件 课程(课程名称须与教学任务书相同)2008/2009 学年 第 一 学期试题类别 A 拟题日期 2008-12-1 拟题教师 李圣昆 课程编号 06060408 教师编号 1180011 使用班级 06060241/06060242 备注:试题答案要求按指定规格计算机打印,并将其文本与电子稿一并上交: 校级考试课程交评估与考试中心命题科; 院级考试课程交院教务科。2008/2009 学年第 一 学期末考试试题答案及评分标准(A卷)硬件描述语言及器件使用班级:06060241/06060242总分得分
2、一、 填空题(20分,每空格1分)1、试举出两种可编程逻辑器件 CPLD 、 FPGA 。2、VHDL程序的基本结构包括 库 、 程序包 、 实体 和 结构体 。3、more_ _11标识符合法吗? 不合法 。8bit标识符合法吗? 不合法 。variable标识符合法吗? 不合法 。4、信号的代入通常用 = ,变量用 := 。5、表示01;两值逻辑的数据类型是 bit(位) ,表示01Z等九值逻辑的数据类型是 std_logic(标准逻辑),表示空操作的数据类型是 NULL 。6、定义一个信号a,数据类型为4位标准逻辑向量 signal a : std_logic_vector(3 down
3、to 0 定义一个变量b,数据类型为2位位向量 variable b : bit_vector(1 downto 0 。7、datadatadatadatadatadatadatadatadatadatadatadatadatadatadatadata=10011000;end case; elsedata:=00000000; -data = “00000000”; (8end if; (10end process;end behave;以上architecture中有哪些错误?请在原程序相应位置改正。得分四、 编程题(共50分)1、根据一下四选一程序的结构体部分,完成实体程序部分(本题8分
4、)entity MUX4 is port( (2s: in std_logic_vector(1 downto 0; (4d: in std_logic_vector(3 downto 0; (6y: out std_logic (8; end MUX4; architecture behave of MUX4 isbeginprocess(sbeginif (s=00 then y=d(0; elsif (s=01 theny=d(1; elsif (s=10 theny=d(2; elsif (s=11 theny=d(3; elsenull; end if;end process;end
5、 behave; 2、编写一个数值比较器VHDL程序的进程(不必写整个结构框架),要求使能信号g低电平时比较器开始工作,输入信号p = q,输出equ为0,否则为1。(本题10分)process(p,q (2beginif g=0 then (4if p = q thenequ = 0; (6else equ = 1; (8end if;else equ = 1; (10end if;end process;3、填写完成一个8-3线编码器的VHDL程序(16分)。Library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.
6、all;use ieee.std_logic_unsigned.all;entity eight_tri is port(b: in std_logic_vector(7 downto 0; (2)en: in std_logic;y: out std_logic_vector(2 downto 0 (4);end eight_tri;architecture a of eight_tri is (6)signal sel: std_logic_vector(8 downto 0;beginsel=en & b; (8)y= “000” when (sel=”100000001”else“00
7、1” when (sel=”100000010”else (10)“010” when (sel=”100000100”else“011” when (sel=”100001000”else“100” when (sel=”100010000”else (12) “101” when (sel=”100100000”else“110” when (sel=”101000000”else (14)“111” when (sel=”110000000”else (16)“zzz”;end a;4、图中给出了4位逐位进位全加器,请完成其VHDL程序。(本题16分)library IEEE;use I
8、EEE.std_logic_1164.all;use IEEE.std_logic_arith.all;use IEEE.std_logic_unsigned.all;entity full_add isport (a,b: in std_logic_vector (3 downto 0; (2)carr: inout std_logic_vector (4 downto 0;sum: out std_logic_vector (3 downto 0;end full_add;architecture full_add_arch of full_add iscomponent adder (4
9、)port (a,b,c: in std_logic;carr: inout std_logic;sum: out std_logic (6);end component;begincarr(0=0;u0:adder port map(a(0,b(0,carr(0,carr(1,sum(0;u1:adder port map(a(1,b(1,carr(1,carr(2,sum(1; (8)(10)u2:adder port map(a(2,b(2,carr(2,carr(3,sum(2; (12)u3:adder port map(a(3,b(3,carr(3,carr(4,sum(3; (14)(16)end full_add_arch;
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2