module mux4to1_2bit(s,in0,in1,in2,in3,out);
input [1:0] s;
input [1:0] in0,in1,in2,in3;
output [1:0] out;
function mymux;
input [1:0] sel ;
input [1:0] x0,x1,x2,x3;
begin
case (sel)
2'b00 : mymux=x0;
2'b01 : mymux=x1;
2'b10 : mymux=x2;
default : mymux=x3;
endcase
end
endfunction
assign out=mymux(s,in0,in1,in2,in3);
endmodule
functionの中で
case文を使った
2ビット入力が4組
入力は4組 in0,in1,in2,in3
仮引数はs と 4個
引数はsの他に4個
in0,in1,in2,in3