《电子设计自动化模拟试题1》山东大学20春测试答案
电子设计自动化模拟试卷1填空题
在EDA设计中,仿真包括__________和__________,下述设计流程中,两种仿真分别在哪一步:原理图/HDL文本输入→__________→综合→适配→____________→编程下载→硬件测试。
在VHDL语言中,下列对进程(PROCESS)语句的语句结构及语法规则的描述中,正确的是_______。
PROCESS为一无限循环语句;敏感信号发生更新时启动进程,执行完成后,等待下一次进程启动。
敏感信号参数表中,应列出进程中使用的所有输入信号;
进程由说明部分、结构体部分、和敏感信号参数表三部分组成;
当前进程中声明的信号也可用于其他进程。
综合是EDA设计流程的关键步骤,综合是________________________________________的过程。
在一个VHDL设计中idata是一个信号,数据类型为integer,下面哪个赋值语句是不正确的________。
idata <= 16#20#;
idata <= 32;
idata <= 16#A#E1;
idata <= B#1010#;
5、 VHDL的PROCSS(进程)语句是由___________组成的,但其本身却是_____________。名词解释
CPLD
HDL
LUT
ASIC
SOC改错
LIBRARY IEEE; -- 1
USE IEEE.STD_LOGIC_1164.ALL; -- 2
ENTITY LED7SEG IS -- 3
PORT ( A : IN STD_LOGIC_VECTOR(3 DOWNTO 0); -- 4
CLK : IN STD_LOGIC; -- 5
LED7S : OUT STD_LOGIC_VECTOR(6 DOWNTO 0); -- 6
END LED7SEG; -- 7
ARCHITECTURE one OF SEG7 IS -- 8
SIGNAL TMP : STD_LOGIC; -- 9
BEGIN -- 10
SYNC : PROCESS(CLK, A) -- 11
BEGIN -- 12
IF CLK'EVENT AND CLK = '1' THEN -- 13
TMP <= A; -- 14
END IF; -- 15
END PROCESS; -- 16
OUTLED : PROCESS(TMP) -- 17
CASE TMP IS -- 18
WHEN "0000" => LED7S <= "0111111"; -- 19
WHEN "0001" => LED7S <= "0000110"; -- 20
WHEN "0010" => LED7S <= "1011011"; -- 21
WHEN "0011" => LED7S <= "1001111"; -- 22
WHEN "0100" => LED7S <= "1100110"; -- 23
WHEN "0101" => LED7S <= "1101101"; -- 24
WHEN "0110" => LED7S <= "1111101"; -- 25
WHEN "0111" => LED7S <= "0000111"; -- 26
WHEN "1000" => LED7S <= "1111111"; -- 27
WHEN "1001" => LED7S <= "1101111"; -- 28
END CASE; -- 29
END PROCESS; -- 30
END one;
1、修改相应行的程序(如果是缺少语句请指出大致的行数)
错误1 行号: 程序改为:
错误2 行号: 程序改为:
错误3 行号: 程序改为:
错误4 行号: 程序改为:
错误5 行号: 程序改为:设计题
1、下面程序是带异步复位、同步置数和移位使能的8位右移移位寄存器的VHDL描述,试补充完整。
library ieee;
use .all;entity sreg8b is
port ( clk, rst: in std_logic;
load,en : in std_logic;
din : in______________(7 downto 0);
qb : outstd_logic);
end sreg8b;architecture behav of is
reg8 : std_logic_vector( 7 downto 0);
begin
process ( , )
begin
if rst='1' then ――异步清零
reg8 <= ;
elsif then ――边沿检测
if load = '1' then ――同步置数
reg8 <= ;
en='1' then ――移位使能
reg8(6 downto 0) <= ;
end if;
______;
;
qb <= _______; ――输出最低位
end ;
2、设计一数据选择器MUX,其系统模块图和功能表如下图所示。试采用下面三种方式中的两种来描述该数据选择器MUX的结构体。
(a) 用if语句。 (b) 用case 语句。
已知状态机状态图如图所示,根据状态图写出VHDL有限状态机描述。
四 设计题参考答案
1、ieee.std_logic_1164
std_logic_vector
sreg8b
signal
rst
clk
“00000000”
Clk`event and clk=’1’
din
elsif
reg8(7 downto 1)
end if
end process
reg8(0)
behav
2、
方式(a)
Library ieee;
Use ieee.std_logic_1164.all;Entity mymux is
Port ( sel : in std_logic_vector(1 downto 0); -- 选择信号输入
Ain, Bin : in std_logic_vector(1 downto 0); -- 数据输入
Cout : out std_logic_vector(1 downto 0) );
End mymux;Architecture behav of mymux is
Begin
process(sel,ain,bin)
begin
if sel=”00” then cout<= ain xor bin;
elsif sel=”01” then cout<= ain or bin;
elsif sel=” 10” then cout<= ain nor bin;
elsif sel=” 11” then cout<= ain nand bin;
else cout<= “XX”;
end if;
end process;
End behav;方式(b)
Library ieee;
Use ieee.std_logic_1164.all;Entity mymux is
Port ( sel : in std_logic_vector(1 downto 0); -- 选择信号输入
Ain, Bin : in std_logic_vector(1 downto 0); -- 数据输入
Cout : out std_logic_vector(1 downto 0) );
end mymux;architecture behav of mymux is
begin
process(sel,ain,bin)
begin
case sel is
when”00” => cout<= ain xor bin;
when”01” => cout<= ain or bin;
when”10” => cout<= ain nor bin;
when”11” => cout<= ain nand bin;
when others => cout<= “XX”;
end case;
end process;
end behav;3、
Library ieee;
Use ieee.std_logic_1164.all;entity elev2 is
port ( rst,clk:in std_logic;
in_a: in std_logic_vector(1 downto 0);
out_a: out std_logic_vector(3 downto 0) );
end elev2;
architecture behav of elev2 is
type state_type is(st0,st1,st2,st3);
signal present_state,next_state : state_type;
begin
process1:
process (present_state,in_a)
begin
case present_state is
when st0=>out_a<=”0101”;
if(in_a=”00”)then next_state<=st0;
else next_state<=st0;
end if;
when st1=>out_a<=”1000”;
if(in_a=”01”)then next_state<=st1;
else next_state<=st2;
end if;
when st2=>out_a<=”1100”;
if(in_a=”11”)then next_state<=st0;
else next_state<=st3;
end if;
when st3=>out_a<=”1101”;
if(in_a=”11”)then next_state<=st0;
else next_state<=st3;
end if;
when others => out_a<=”0101”;
next_state<=st0;
end case;
end process; process2;
process(rst,clk)
begin
ifrst=`1`thenpresent_state<=st0;
elsif (clk’event and clk=’1’) then present_state<=next_state;
endif;
end process;
end behav;www.ap5u.com
页:
[1]