|
//
// Title : (153) DUAL 4-LINE TO 1LINE DATA SELECTORS/MULTIPLEXERS
// File name : 153.v
// Date : 2000/12/08 Ver1.0
// Company : Future Technology Ltd.
//
//----------------------------------------------------------
// Module
//----------------------------------------------------------
module U153(
A,
B,
C1,
C2,
XG1,
XG2,
Y1,
Y2
);
input A;
input B;
input [3:0] C1;
input [3:0] C2;
input XG1;
input XG2;
output Y1;
output Y2;
//----------------------------------------------------------
// Using register
//----------------------------------------------------------
reg Y1;
reg Y2;
//----------------------------------------------------------
// Using wire
//----------------------------------------------------------
wire [1:0] s_ba;
assign s_ba = {B,A};
always@(s_ba or C1 or XG1)begin
if(XG1==1'b1)begin // G = 1
Y1 = 1'b0;
end else begin // G != 1
case(s_ba[1:0])
2'b00 : Y1 = C1[0];
2'b01 : Y1 = C1[1];
2'b10 : Y1 = C1[2];
2'b11 : Y1 = C1[3];
default : Y1 = 1'bx;
endcase
end
end
always@(s_ba or C2 or XG2)begin
if(XG2==1'b1)begin // G = 1
Y2 = 1'b0;
end else begin // G != 1
case(s_ba[1:0])
2'b00 : Y2 = C2[0];
2'b01 : Y2 = C2[1];
2'b10 : Y2 = C2[2];
2'b11 : Y2 = C2[3];
default : Y2 = 1'bx;
endcase
end
end
endmodule
|