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); 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