? 4-1 画出与下例实体描述对应的原理图符号元件: ? ENTITY buf3s IS -- 实体 1:三态缓冲器? PORT (input : IN STD_LOGIC ; -- 输入端? enable : IN STD_LOGIC ; -- 使能端? output : OUT STD_LOGIC ) ; -- 输出端? END buf3x ; ? ENTITY mux21 IS -- 实体 2: 2 选1多路选择器? PORT (in0, in1, sel : IN STD_LOGIC; ? output : OUT STD_LOGIC); 4-2. 图 4-17 所示的是 4选1多路选择器,试分别用 IF_THEN 语句和 CASE 语句的表达方式写出此电路的 VHDL 程序。选择控制的信号 s1和 s0的数据类型为 STD_LOGIC_VECTOR ; 当 s1='0' , s0='0' ; s1='0' , s0='1' ; s1='1' , s0='0' 和 s1='1' , s0='1' 分别执行 y<=a 、 y<=b 、 y<=c 、 y<=d 。图 4-17 4 选1多路选择器?使用 IF… THEN 语句: ? Library ieee; use ; ? Entity mux41 is ? Port(s0,s1,a,b,c,d:in std_logic; ? y:out std_logic); ? End mux41; ? Architecture one of mux41 is ? Signal s10:std_logic_vector(1 downto 0); ? Begin s10<=s1 &s0; ? process(s10,a,b,c,d) ? begin if s10= “ 00 ” then y<=a; ? elsif s10= “ 01 then y<=b; ? elsif s10= “ 10 ” then y<=c; ? else y<=d; ? end if ; ? end process; ? End one; ?使用 CASE 语句: ? Library ieee; use ; ? Entity mux41 is ? Port(s0,s1,a,b,c,d:in std_logic; ? y:out std_logic); ? End mux41; ? Architecture one of mux41 is ? Signal s10:std_logic_vector(1 downto 0); ? Begin s10<=s1 &s0; ? process(s10,a,b,c,d) ? begin case s10 is ? when “ 00 ”=>y<=a; when “ 01 ”=>y<=b; ? when “ 10 ”=>y<=c; when others=>y<=a; ? end case; ? end process; ? End one; KX 康芯科技 4-3. 图 4-18 所示的是双 2选1多路选择器构成的电路 MUXK ,对于其中 MUX21A ,当 s='0' 和'1'时,分别有 y<='a' 和 y<='b' 。试在一个结构体中用两个进程来表达此电路,每个进程中用 CASE 语句描述一个 2选1多路选择器 MUX21A 。图 4-18 双2选1多路选择器? Library ieee; use ; ? Entity muxk is ? Port(s0,s1,a1,a2,a3:in std_logic; ? outy:out std_logic); ? End muxk; ? Architecture one of muxk is ? Signal tm
EDA课后作业 来自淘豆网www.taodocs.com转载请标明出处.