VHDL语言 四选一数据选择器 多种描述

更新时间:2024-06-03 00:33:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

使用if_then语句来描述四选一数据选择器 library ieee;

use ieee.std_logic_1164.all; entity ze is

port(s0,s1 : in std_logic; a,b,c,d : in std_logic; y:out std_logic); end ze;

architecture ab of ze is

signal s: std_logic_vector(1 downto 0); begin

s<=s1&s0; process(s) begin

if s<=\elsif s<=\elsif s<=\else y<=d; end if;

end process; end ab;

使用case语句来描述四选一数据选择器 library ieee;

use ieee.std_logic_1164.all; entity xuan is

port(s0,s1 : in std_logic; a,b,c,d : in std_logic; y:out std_logic); end xuan;

architecture ab of xuan is

signal s: std_logic_vector(1 downto 0); begin

s<=s1&s0; process(s) begin case s is

when \ when \ when \ when \ when others=>null; end case; end process; end ab;

使用when_else语句来描述四选一数据选择器

library ieee;

use ieee.std_logic_1164.all; entity xuan is

port(s0,s1 : in std_logic; a,b,c,d : in std_logic; y:out std_logic); end xuan;

architecture ab of xuan is

signal s: std_logic_vector(1 downto 0); begin

s<=s1&s0;

y<=a when s<=\ b when s<=\

c when s<=\ d ;

end ab;

本文来源:https://www.bwwdw.com/article/7ke6.html

Top