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
ここがfunction文
xが00のとき 戻り値は01101110
2進数表示
2ビット 2'b00
8ビット 8'b01101110
16進数で表示してもOK
8ビット 8'h6E