用持续赋值语句描述一个4选1数据选择器???

如题所述

module mux4_1(out,in0,in1,in2,in3,sel) ;
input in0,in1,in2,in3;
input[1:0] sel;
output out;
assign out=sel[1]?(sel[0]?in3:in2):(sel[0]?in1:in0);
endmodule
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-06-30
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;

ENTITY DATA IS
PORT(
a,b,c: IN STD_LOGIC;
c: OUT STD_LOGIC);
END DATA;
ARCHITECTURE Behave OF DATA IS
BEGIN
LABEL:BLOCK
VARRIBLE tmp1,tmp2,tmp3:STD_LOGIC;
BEGIN
tmp1:=a and b;
tmp2:=c and (not b);
tmp3:=tmp1 or tmp2;
y<=tmp3;
END BLOCK LABEL;

END Behave;
本回答被网友采纳
相似回答