资源预览内容
第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
亲,该文档总共3页全部预览完了,如果喜欢就下载吧!
资源描述
使用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;else 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; 使用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;
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号