Prev Problem
Next Problem

58. Maximum of Two Numbers

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

module max2_func (
    input  [7:0] a,
    input  [7:0] b,
    output [7:0] max
);
    // ---------- Predefined function (complete the body) ----------
    function [7:0] max2;
        input [7:0] x, y;
        begin

            max2=(x>y)?x:y;
        end
    endfunction
    // -------------------------------------------------------------

    assign max =max2(a,b);

endmodule

 

Was this helpful?
Upvote
Downvote