资源描述:
《海大_EDA实验1参考答案.docx》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、LaboratoryExercise1Switches,Lights,andMultiplexersED实验参与答案Part1libraryieee;useieee.std_logic_1164.all;entitypart1isport(SW:instd_logic_vector(17downto0);LEDR:outstd_logic_vector(17downto0));endpart1;architectureBehaviorofpart1isbeginLEDR<=SW;endBehavior;part2libraryieee;useieee.std_logic
2、_1164.all;--a2to1multiplexerentityentitymux21isport(in_x,in_y,in_s:instd_logic;out_m:outstd_logic);endmux21;--a2to1multiplexerarchitecturearchitecturestructuralofmux21issignalu,v:std_logic;beginu<=in_xand(notin_s);v<=in_yandin_s;out_m<=uorv;endstructural;--aeight-bitwide2to1multiplexerli
3、braryieee;useieee.std_logic_1164.all;--eight-bitwide2to1multiplexerentityentitymux21_8bitisport(SW:instd_logic_vector(17downto0);--SW:instd_logic_vector(15downto8);--SW:instd_logic_vector(17downto17);LEDR:outstd_logic_vector(7downto0));endmux21_8bit;--eight-bitwide2to1multiplexerarchitec
4、turearchitectureStructuralofmux21_8bitiscomponentmux21port(in_x,in_y,in_s:instd_logic;out_m:outstd_logic);endcomponent;beginU1:mux21portmap(in_x=>SW(0),in_y=>SW(8),in_s=>SW(17),out_m=>LEDR(0));U2:mux21portmap(in_x=>SW(1),in_y=>SW(9),in_s=>SW(17),out_m=>LEDR(1));U3:mux21portmap(in_x=>SW(2
5、),in_y=>SW(10),in_s=>SW(17),out_m=>LEDR(2));U4:mux21portmap(in_x=>SW(3),in_y=>SW(11),in_s=>SW(17),out_m=>LEDR(3));U5:mux21portmap(in_x=>SW(4),in_y=>SW(12),in_s=>SW(17),out_m=>LEDR(4));U6:mux21portmap(in_x=>SW(5),in_y=>SW(13),in_s=>SW(17),out_m=>LEDR(5));U7:mux21portmap(in_x=>SW(6),in_y=>
6、SW(14),in_s=>SW(17),out_m=>LEDR(6));U8:mux21portmap(in_x=>SW(7),in_y=>SW(15),in_s=>SW(17),out_m=>LEDR(7));endStructural;part3libraryieee;useieee.std_logic_1164.all;--a2to1multiplexerentityentitymux21isport(in_x,in_y,in_s:instd_logic;out_m:outstd_logic);endmux21;--a2to1multiplexerarchitec
7、turearchitecturestructuralofmux21issignalsignal_u,signal_v:std_logic;beginsignal_u<=in_xand(notin_s);signal_v<=in_yandin_s;out_m<=signal_uorsignal_v;endstructural;libraryieee;useieee.std_logic_1164.all;--a5to1multiplexerentityentitymux51isport(in5_u,in5_v,in5_w,in5_x,in5_