`timescale 1ns/1ns
module main_mod(
	input clk,
	input rst_n,
	input [7:0]a,
	input [7:0]b,
	input [7:0]c,
	
	output [7:0]d
);



wire [7:0] min1;
wire [7:0] min2;
wire [7:0] min3;





min u_min1(
.clk	(clk	),
.rst_n 	(rst_n	),
.a 		(a	),
.b		(b 	),
.c 		(min1 	)
);

min u_min2(
.clk	(clk	),
.rst_n 	(rst_n	),
.a 		(b	),
.b		(c 	),
.c 		(min2 	)
);

min u_min3(
.clk	(clk	),
.rst_n 	(rst_n	),
.a 		(min1	),
.b		(min2 	),
.c 		(min3 	)
);

assign d = min3 ;






endmodule

module min(
	input clk,
	input rst_n,
	input [7:0]a,
	input [7:0]b,
	output reg [7:0]c

);
wire [7:0] comp ;
assign comp = (a > b) ? b : a ;

always@(posedge clk or negedge rst_n) 
if(~rst_n) c <= 0;
else 	   c <= comp ;


endmodule 

三个数里面找最小的值 , 两两互相比较 , 一共比较几次 ? 三次 !