中北大学试题答案及评分标准硬件描述语言及器件课程(课程名称须与教学任务书相同)20xx/20xx 学年第一学期试题类别 A拟题日期拟题教师课程编号教师编号使用班级备注:试题答案要求按指定规格计算机打印,并将其文本与电子稿一并上交:①校级考试课程交评估与考试中心命题科;②院级考试课程交院教务科。
20xx/20xx 学年第一学期末考试试题答案及评分标准(A卷)硬件描述语言及器件使用班级: xxxx一、填空题(20分,每空格1分)1、VHDL语言中标识符通常分为短标识符,扩展标识符两种。
2、VHDL对象包含常量,信号,变量,文件 4个基本数据类型。
3、VHDL语言中,数据类型常量说明的一般格式为: CONSTANT常数名:数据类型:=表达式;。
4、VHDL中位矢量类型表达为 bit ,位向量类型表达为 bit_vector() 。
5、VHDL语言有类型标记法,函数转换法,常数转换法 3种不同类型的数据变换方法。
6、VHDL中,设D0为“1001”, D1为'0', D2为“0110”。
D0 & D1的运算结果是“10010”,D0 & D2的运算结果是“10010110”。
7、VHDL语言中包括四种运算操作符,分别是逻辑运算符,算术运算符,关系运算符,和并置运算符。
8、为了启动进程,VHDL语言中必须包含一个显示的敏感信号量表或者包含一个wait语句。
二、判断对错并给出判断依据(20分,每小题5分,判断对错2分,给出正确判断依据3分)1、进程之间的通信可以通过变量传递来实现。
(×)进程之间的通信需通过信号传递实现。
2、VHDL语言的高速性体现在其进程之内的带入语句都是并行执行的。
(×)进程之内的带入语句是顺序执行的。
3、语句y <= a when s=”00” elseb when s=”01” elsec when s=”10” elsed;中,s=”00”条件的优先级最高(√)4、com1:u1 PORT MAP(a => n1,b => n2,c => m);语句中采用了位置映射的信号端口映射方式。
(×)采用的是名称映射方式三、判断题(10分)use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;以上库和程序包声明是否完整?否,如果不完整请添加library ieee;entity rom isport(addr: in std_logic;ce: in std_logic;data:out std_logic_vector(7 to 0));end rom;以上实体定义有无错误?有,有的话请改正原语句 std_logic_vector(0 to 7)或std_logic_vector(7 downto 0)beginprocess(ce,addr)begin √if ce='0' × then case addr iswhen ‘0’=>data<="10001001";when others=>data<="10011000";elseif × elsif data<="00000000";end if×;end behave;× end process;以上architecture中划线各行有无错误?请在相应行划线位置判断并改正。
四、编程题(共50分)1、请补全以下2-4译码器VHDL程序实体及结构体部分(本题10分)entity de2_4 isport ( sel : in std_logic_vector(1 downto 0); input : in std_logic;a,b,c,d : out std_logic);end de2_4;architecture behavioral of de2_4 isbeginprocess ( sel,input )beginif sel = “00” thena <= input;elsif sel = “01” thenb <= input;elsif sel = “10” thenc <= input;elsed <= input;end if;end process;end Behavioral;2、试用case语句设计一个四——十六译码器,画出MaxplusⅡ生成的器件简图。
写出结构体中核心部分即可。
(本题10分)CASE sel ISWHEN "0000" => a <= input;WHEN "0010" => c <= input;WHEN "0011" => d <= input;WHEN "0100" => e <= input;WHEN "0101" => f <= input;……WHEN OTHERS => p <= input;END CASE;3、编写一个6分频器的VHDL程序,请写出库说明、实体、结构体语句,将端口定义为标准逻辑型数据结构,并画出正确仿真的波形示意图(本题15分)library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity fenpinqi isport (fosc,rst : in std_logic;outq : out std_logic);end fenpinqi;architecture decoder of fenpinqi is--Behavioralsignal count : std_logic_vector(7 DOWNTO 0);signal q : std_logic;beginoutq <= q;process ( fosc,rst)beginif rst = '0' thencount <= "00000000";q <= '0';elsif fosc'event and fosc='1' thenif count = "00000010" thencount <= "00000000";q <= not q;elsecount <= count +1;end if;end if;end process;end decoder;4、设计一个8进制计数器,要求采用异步复位进行初始化,请写出实体、结构体语句(15分)。
entity counter_8 isport ( clk : in std_logic;rs : in std_logic;count_out : out std_logic_vector(3 downto 0));end counter_8;architecture Behavioral of counter_8 issignal next_count : std_logic_vector(3 downto 0);signal d_count : std_logic_vector(3 downto 0);beginprocess ( clk,rs )beginif rs = '0' thennext_count <= "0000";elsif clk'event and clk='1' thenif next_count = "0111" thennext_count <= "0000";elsenext_count <= next_count + 1;end if;end if;end process;process ( clk,rs )beginif rs = '0' thend_count <= "0000";elsif clk'event and clk='1' thenif next_count = "0111" thend_count <= d_count + 1;end if;end if;end process;count_out <= d_count;end Behavioral;。