How do you plan to solve it?
/*Write your code here*/
module maxmin4(
input [3:0]a,
input [3:0]b,
input [3:0]c,
input [3:0]d,
output [3:0]max,
output [3:0]min
);
wire [7:0] min01, max01;
wire [7:0] min23, max23;
// Pairwise compare (a,b)
// TODO: set max01 as the larger of a and b
assign max01 = (a > b) ? a : b;
// TODO: set min01 as the smaller of a and b
assign min01 = (a < b) ? a : b;
// Pairwise compare (c,d)
// TODO: set max23 as the larger of c and d
assign max23 = (c > d) ? c : d;
// TODO: set min23 as the smaller of c and d
assign min23 = (c < d) ? c : d;
// Final reduce across pairs
// TODO: set max_o as the larger of max01 and max23
assign max = (max01 > max23) ? max01 : max23;
// TODO: set min_o as the smaller of min01 and min23
assign min = (min01 < min23) ? min01 : min23;
endmodule