⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datasort.v

📁 FPGA内
💻 V
📖 第 1 页 / 共 3 页
字号:
		11: begin dout11 <= d7_f; end
		12: begin dout12 <= d7_f; end
		13: begin dout13 <= d7_f; end
		14: begin dout14 <= d7_f; end
		15: begin dout15 <= d7_f; end
	endcase

	case (flg8_e)
		0: begin dout00 <= d8_f; end
		1: begin dout01 <= d8_f; end
		2: begin dout02 <= d8_f; end
		3: begin dout03 <= d8_f; end
		4: begin dout04 <= d8_f; end
		5: begin dout05 <= d8_f; end
		6: begin dout06 <= d8_f; end
		7: begin dout07 <= d8_f; end
		8: begin dout08 <= d8_f; end
		9: begin dout09 <= d8_f; end
		10: begin dout10 <= d8_f; end
		11: begin dout11 <= d8_f; end
		12: begin dout12 <= d8_f; end
		13: begin dout13 <= d8_f; end
		14: begin dout14 <= d8_f; end
		15: begin dout15 <= d8_f; end
	endcase

	case (flg9_e)
		0: begin dout00 <= d9_f; end
		1: begin dout01 <= d9_f; end
		2: begin dout02 <= d9_f; end
		3: begin dout03 <= d9_f; end
		4: begin dout04 <= d9_f; end
		5: begin dout05 <= d9_f; end
		6: begin dout06 <= d9_f; end
		7: begin dout07 <= d9_f; end
		8: begin dout08 <= d9_f; end
		9: begin dout09 <= d9_f; end
		10: begin dout10 <= d9_f; end
		11: begin dout11 <= d9_f; end
		12: begin dout12 <= d9_f; end
		13: begin dout13 <= d9_f; end
		14: begin dout14 <= d9_f; end
		15: begin dout15 <= d9_f; end
	endcase

	case (flga_e)
		0: begin dout00 <= da_f; end
		1: begin dout01 <= da_f; end
		2: begin dout02 <= da_f; end
		3: begin dout03 <= da_f; end
		4: begin dout04 <= da_f; end
		5: begin dout05 <= da_f; end
		6: begin dout06 <= da_f; end
		7: begin dout07 <= da_f; end
		8: begin dout08 <= da_f; end
		9: begin dout09 <= da_f; end
		10: begin dout10 <= da_f; end
		11: begin dout11 <= da_f; end
		12: begin dout12 <= da_f; end
		13: begin dout13 <= da_f; end
		14: begin dout14 <= da_f; end
		15: begin dout15 <= da_f; end
	endcase

	case (flgb_e)
		0: begin dout00 <= db_f; end
		1: begin dout01 <= db_f; end
		2: begin dout02 <= db_f; end
		3: begin dout03 <= db_f; end
		4: begin dout04 <= db_f; end
		5: begin dout05 <= db_f; end
		6: begin dout06 <= db_f; end
		7: begin dout07 <= db_f; end
		8: begin dout08 <= db_f; end
		9: begin dout09 <= db_f; end
		10: begin dout10 <= db_f; end
		11: begin dout11 <= db_f; end
		12: begin dout12 <= db_f; end
		13: begin dout13 <= db_f; end
		14: begin dout14 <= db_f; end
		15: begin dout15 <= db_f; end
	endcase

	case (flgc_e)
		0: begin dout00 <= dc_f; end
		1: begin dout01 <= dc_f; end
		2: begin dout02 <= dc_f; end
		3: begin dout03 <= dc_f; end
		4: begin dout04 <= dc_f; end
		5: begin dout05 <= dc_f; end
		6: begin dout06 <= dc_f; end
		7: begin dout07 <= dc_f; end
		8: begin dout08 <= dc_f; end
		9: begin dout09 <= dc_f; end
		10: begin dout10 <= dc_f; end
		11: begin dout11 <= dc_f; end
		12: begin dout12 <= dc_f; end
		13: begin dout13 <= dc_f; end
		14: begin dout14 <= dc_f; end
		15: begin dout15 <= dc_f; end
	endcase

	case (flgd_e)
		0: begin dout00 <= dd_f; end
		1: begin dout01 <= dd_f; end
		2: begin dout02 <= dd_f; end
		3: begin dout03 <= dd_f; end
		4: begin dout04 <= dd_f; end
		5: begin dout05 <= dd_f; end
		6: begin dout06 <= dd_f; end
		7: begin dout07 <= dd_f; end
		8: begin dout08 <= dd_f; end
		9: begin dout09 <= dd_f; end
		10: begin dout10 <= dd_f; end
		11: begin dout11 <= dd_f; end
		12: begin dout12 <= dd_f; end
		13: begin dout13 <= dd_f; end
		14: begin dout14 <= dd_f; end
		15: begin dout15 <= dd_f; end
	endcase

	case (flge_e)
		0: begin dout00 <= de_f; end
		1: begin dout01 <= de_f; end
		2: begin dout02 <= de_f; end
		3: begin dout03 <= de_f; end
		4: begin dout04 <= de_f; end
		5: begin dout05 <= de_f; end
		6: begin dout06 <= de_f; end
		7: begin dout07 <= de_f; end
		8: begin dout08 <= de_f; end
		9: begin dout09 <= de_f; end
		10: begin dout10 <= de_f; end
		11: begin dout11 <= de_f; end
		12: begin dout12 <= de_f; end
		13: begin dout13 <= de_f; end
		14: begin dout14 <= de_f; end
		15: begin dout15 <= de_f; end
	endcase

	case (flgf_e)
		0: begin dout00 <= df_f; end
		1: begin dout01 <= df_f; end
		2: begin dout02 <= df_f; end
		3: begin dout03 <= df_f; end
		4: begin dout04 <= df_f; end
		5: begin dout05 <= df_f; end
		6: begin dout06 <= df_f; end
		7: begin dout07 <= df_f; end
		8: begin dout08 <= df_f; end
		9: begin dout09 <= df_f; end
		10: begin dout10 <= df_f; end
		11: begin dout11 <= df_f; end
		12: begin dout12 <= df_f; end
		13: begin dout13 <= df_f; end
		14: begin dout14 <= df_f; end
		15: begin dout15 <= df_f; end
	endcase
end
//======================================================================================
//======================================================================================
reg [6:0] dcon00_0,dcon01_0,dcon02_0,dcon03_0,dcon04_0,dcon05_0,dcon06_0,dcon07_0;
reg [6:0] dcon08_0,dcon09_0,dcon0a_0,dcon0b_0,dcon0c_0,dcon0d_0,dcon0e_0,dcon0f_0;

reg [6:0] sub01,sub12,sub23,sub34,sub45,sub56,sub67,sub78,sub89,sub9a,subab,subbc,subcd,subde,subef;

reg [11:0] doutcomb01,doutcomb12,doutcomb23,doutcomb34,doutcomb45,doutcomb56,doutcomb67,doutcomb78;
reg [11:0] doutcomb89,doutcomb9a,doutcombab,doutcombbc,doutcombcd,doutcombde,doutcombef;

//======================================================================================
always @ (posedge clk)
begin
	dcon00_0 <= dout00; dcon01_0 <= dout01; dcon02_0 <= dout02; dcon03_0 <= dout03; 
	dcon04_0 <= dout04; dcon05_0 <= dout05; dcon06_0 <= dout06; dcon07_0 <= dout07;
	dcon08_0 <= dout08; dcon09_0 <= dout09; dcon0a_0 <= dout10; dcon0b_0 <= dout11; 
	dcon0c_0 <= dout12; dcon0d_0 <= dout13; dcon0e_0 <= dout14; dcon0f_0 <= dout15;
end

always @ (posedge clk)
begin
	sub01 <= dout01 - dout00;
	sub12 <= dout02 - dout01;
	sub23 <= dout03 - dout02;
	sub34 <= dout04 - dout03;
	sub45 <= dout05 - dout04;
	sub56 <= dout06 - dout05;
	sub67 <= dout07 - dout06;
	sub78 <= dout08 - dout07;
	sub89 <= dout09 - dout08;
	sub9a <= dout10 - dout09;
	subab <= dout11 - dout10;
	subbc <= dout12 - dout11;
	subcd <= dout13 - dout12;
	subde <= dout14 - dout13;
	subef <= dout15 - dout14;
end

always @ (posedge clk)
begin
	if ((sub01 < sixnsref)&&(sub12 > sixnsref))
		doutcomb01 <= {dcon00_0,dcon01_0};
	else
		doutcomb01 <= 12'h000;
	
	if ((sub01 > sixnsref)&&(sub12 < sixnsref)&&(sub23 > sixnsref))
		doutcomb12 <= {dcon01_0,dcon02_0};
	else
		doutcomb12 <= 12'h000;

	if ((sub12 > sixnsref)&&(sub23 < sixnsref)&&(sub34 > sixnsref))
		doutcomb23 <= {dcon02_0,dcon03_0};
	else
		doutcomb23 <= 12'h000;

	if ((sub23 > sixnsref)&&(sub34 < sixnsref)&&(sub45 > sixnsref))
		doutcomb34 <= {dcon03_0,dcon04_0};
	else
		doutcomb34 <= 12'h000;

	if ((sub34 > sixnsref)&&(sub45 < sixnsref)&&(sub56 > sixnsref))
		doutcomb45 <= {dcon04_0,dcon05_0};
	else
		doutcomb45 <= 12'h000;

	if ((sub45 > sixnsref)&&(sub56 < sixnsref)&&(sub67 > sixnsref))
		doutcomb56 <= {dcon05_0,dcon06_0};
	else
		doutcomb56 <= 12'h000;

	if ((sub56 > sixnsref)&&(sub67 < sixnsref)&&(sub78 > sixnsref))
		doutcomb67 <= {dcon06_0,dcon07_0};
	else
		doutcomb67 <= 12'h000;

	if ((sub67 > sixnsref)&&(sub78 < sixnsref)&&(sub89 > sixnsref))
		doutcomb78 <= {dcon07_0,dcon08_0};
	else
		doutcomb78 <= 12'h000;

	if ((sub78 > sixnsref)&&(sub89 < sixnsref)&&(sub9a > sixnsref))
		doutcomb89 <= {dcon08_0,dcon09_0};
	else
		doutcomb89 <= 12'h000;

	if ((sub89 > sixnsref)&&(sub9a < sixnsref)&&(subab > sixnsref))
		doutcomb9a <= {dcon09_0,dcon0a_0};
	else
		doutcomb9a <= 12'h000;

	if ((sub9a > sixnsref)&&(subab < sixnsref)&&(subbc > sixnsref))
		doutcombab <= {dcon0a_0,dcon0b_0};
	else
		doutcombab <= 12'h000;
		
	if ((subab > sixnsref)&&(subbc < sixnsref)&&(subcd > sixnsref))
		doutcombbc <= {dcon0b_0,dcon0c_0};
	else
		doutcombbc <= 12'h000;

	if ((subbc > sixnsref)&&(subcd < sixnsref)&&(subde > sixnsref))
		doutcombcd <= {dcon0c_0,dcon0d_0};
	else
		doutcombcd <= 12'h000;

	if ((subcd > sixnsref)&&(subde < sixnsref)&&(subef > sixnsref))
		doutcombde <= {dcon0d_0,dcon0e_0};
	else
		doutcombde <= 12'h000;

	if ((subde > sixnsref)&&(subef < sixnsref))
		doutcombef <= {dcon0e_0,dcon0f_0};
	else
		doutcombef <= 12'h000;
 
end


endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -