Converted MUX to use case statement
This commit is contained in:
@@ -41,19 +41,12 @@ module mux(input wire [1:0] switch,
|
|||||||
output reg [8:0] out);
|
output reg [8:0] out);
|
||||||
|
|
||||||
always @(A,B,C,D,switch) begin
|
always @(A,B,C,D,switch) begin
|
||||||
if (switch == 2'b00) begin
|
case (switch)
|
||||||
out = A;
|
2'b00 : out = A;
|
||||||
end
|
2'b01 : out = B;
|
||||||
else if (switch == 2'b01) begin
|
2'b10 : out = C;
|
||||||
out = B;
|
default: out = D;
|
||||||
end
|
endcase
|
||||||
else if (switch == 2'b11) begin
|
|
||||||
out = C;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
out = D;
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user