设计一个Verilog HDL模块,实现一个可配置的多路选择器,支持任意数量的输入和输出端口。

Verilog HDL模块: 可配置的多路选择器

module mux #(parameter N = 2, parameter M = 1) (
	input wire [N-1:0] data_in,
	input wire [M-1:0] sel,
	output reg out
);
	always @*
	begin
		case(sel)
			0: out = data_in[0];
			1: out = data_in[1];
			// ... 更多选择器配置
		endcase
	end
endmodule