Prev Problem
Next Problem

68. 4-bit Comparator

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

/*Write your code here*/
module maxmin4(
    input [3:0]a,b,c,d,
    output [3:0]max,min
);
wire [3:0]w1,w2,w3,w4;
assign w1 = (a > b)? a : b;
assign w2 = (c > d)? c : d;
assign max = (w1 > w2)? w1:w2;

assign w3 = (a > b)? b : a;
assign w4 = (c > d)? d : c;
assign min = (w3 > w4)? w4:w3;
endmodule

 

Was this helpful?
Upvote
Downvote