if语句2-4译码器程序
发布网友
发布时间:2022-04-30 02:18
我来回答
共1个回答
热心网友
时间:2022-06-29 00:53
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY y139 IS
PORT(A2,A1:IN STD_LOGIC;
G1BAR:IN STD_LOGIC;
Y:OUT BIT_VECTOR(3 DOWNTO 0));
END ENTITY y139;
ARCHITECTURE ART OF y139 IS
SIGNAL SS:STD_LOGIC_VECTOR(1 DOWNTO 0);
BEGIN
SS<=A2&A1;
PROCESS(SS,G1BAR)IS
BEGIN
IF G1BAR='0' THEN Y<="0000";
ELSIF SS="00" THEN Y<="0001";
ELSIF SS="01" THEN Y<="0010";
ELSIF SS="10" THEN Y<="0100";
ELSIF SS="11" THEN Y<="1000";
ELSE Y<="0000";
END IF;
END PROCESS;
END ART;这是我写的,我的G1BAR相当于使能端,高电平有效。