《VHDL语言 四选一数据选择器 多种描述.doc》由会员分享,可在线阅读,更多相关《VHDL语言 四选一数据选择器 多种描述.doc(3页珍藏版)》请在金锄头文库上搜索。
1、使用if_then语句来描述四选一数据选择器library ieee;use ieee.std_logic_1164.all;entity ze isport(s0,s1 : in std_logic; a,b,c,d : in std_logic; y:out std_logic);end ze;architecture ab of ze issignal s: std_logic_vector(1 downto 0);begins=s1&s0;process(s)beginif s=00 then y=a;elsif s=01 then y=b;elsif s=10 then y=c;el
2、se y=d;end if;end process; end ab; 使用case语句来描述四选一数据选择器library ieee;use ieee.std_logic_1164.all;entity xuan isport(s0,s1 : in std_logic; a,b,c,d : in std_logic; y:out std_logic);end xuan;architecture ab of xuan issignal s: std_logic_vector(1 downto 0);begins y y y ynull; end case;end process; end ab;
3、 使用when_else语句来描述四选一数据选择器library ieee;use ieee.std_logic_1164.all;entity xuan isport(s0,s1 : in std_logic; a,b,c,d : in std_logic; y:out std_logic);end xuan;architecture ab of xuan issignal s: std_logic_vector(1 downto 0);begins=s1&s0;y=a when s=00 else b when s=01 else c when s=10 else d ; end ab;