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);
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user