module max_of_three_func;
input [7:0] a, b, c; // 假设输入数据为8位
output [7:0] result;
function [7:0] max_of_three;
input [7:0] a, b, c;
max_of_three = a > b ? (a > c ? a : c) : (b > c ? b : c);
endfunction
always @* begin
result = max_of_three(a, b, c);
end
endmodule
module max_of_three_func;
input [7:0] a, b, c; // 假设输入数据为8位
output [7:0] result;
function [7:0] max_of_three;
input [7:0] a, b, c;
max_of_three = a > b ? (a > c ? a : c) : (b > c ? b : c);
endfunction
always @* begin
result = max_of_three(a, b, c);
end
endmodule