最初のページ 戻る 次へ 最後のページ

/* 4 to 1 mux (input 2bit,output 2bit)*/

module mux4to1_2bit(s,in,out);

input [1:0] s;

input [7:0] in;

output [1:0] out;

function [1:0] mymux;

input [1:0] sel;

input [7:0] x;

begin

case (sel)

2'b00 : mymux=x[1:0];

2'b01 : mymux=x[3:2];

2'b10 : mymux=x[5:4];

default : mymux=x[7:6];

endcase

end

endfunction

assign out=mymux(s,in);

endmodule

8ビット入力が1組

入力は1組 in

仮引数はs と 1個

引数はsの他に1個 in