Converted MUX to use case statement

This commit is contained in:
WilliamMiceli
2019-02-15 14:46:08 -05:00
parent 337bf5cf13
commit cdb52f35bd

View File

@@ -41,19 +41,12 @@ module mux(input wire [1:0] switch,
output reg [8:0] out);
always @(A,B,C,D,switch) begin
if (switch == 2'b00) begin
out = A;
end
else if (switch == 2'b01) begin
out = B;
end
else if (switch == 2'b11) begin
out = C;
end
else begin
out = D;
end
case (switch)
2'b00 : out = A;
2'b01 : out = B;
2'b10 : out = C;
default: out = D;
endcase
end
endmodule