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

module HELPdecoder(din,dout);

input [1:0] din;

output [7:0] dout;

function [7:0] helpdec;

input [1:0] x;

begin

case (x)

2'b00 : helpdec = 8'b01101110;

2'b01 : helpdec = 8'b10011110;

2'b10 : helpdec = 8'b00011100;

2'b11 : helpdec = 8'b11001110;

endcase

end

endfunction

assign dout = helpdec(din);

endmodule

dout[7]

dout[6]

dout[0]

din[1]

din[0]

ここがfunction文

function内宣言 x

(局所変数的扱い)

x以外のものでもOK

ファンクションの詳細

  (ステートメント)

を記載する

beginで始まり

endで終わる