data/full_repos/permissive/119107706/Xilinx Project/SourceCode/Multication/floating_point/multiplier_float.v
[Errno 2] No such file or directory: 'preprocess.output'
1: b'%Error: Cannot find file containing module: Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706\n        ... Looked in:\n             data/full_repos/permissive/119107706/Xilinx/Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706\n             data/full_repos/permissive/119107706/Xilinx/Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706.v\n             data/full_repos/permissive/119107706/Xilinx/Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706.sv\n             Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706\n             Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706.v\n             Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706.sv\n             obj_dir/Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706\n             obj_dir/Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706.v\n             obj_dir/Project/SourceCode/Multication/floating_point,data/full_repos/permissive/119107706.sv\n%Error: Cannot find file containing module: data/full_repos/permissive/119107706/Xilinx\n%Error: Cannot find file containing module: Project/SourceCode/Multication/floating_point/multiplier_float.v\n%Error: Exiting due to 3 error(s)\n'
module multiplier_float
				#(parameter 		  WIDTH = 32,
										  WIDTH_exp = 8,
										  WIDTH_mat = 23)
				( input 				  CLK,
										  RST,
				  input [WIDTH-1:0] OP1,
										  OP2,
				  input 			 exce_in,
				  output reg 	exce_out,
				  output reg [WIDTH_mat+WIDTH_exp:0] result);


function integer log2;
	input integer n;
	begin
		log2 = 0;
		while (2**log2<n) begin
			log2 = log2 + 1;
		end
	end
endfunction





reg [WIDTH_exp:0]   sum_exp;
reg [WIDTH_exp-1:0] BIAS = (2**(WIDTH_exp-1))-1;


always @* begin
	sum_exp <= OP1[WIDTH-2:WIDTH-(WIDTH_exp+1)] + OP2[WIDTH-2:WIDTH-(WIDTH_exp+1)] - BIAS;
end




localparam WIDTH_mm  = (WIDTH_mat+1)*2;
localparam WIDTH_poi = log2(WIDTH_mm);
reg [WIDTH_mm-1 :0]  mul_mat;
reg [WIDTH_poi-1:0] 	pointer;
reg [WIDTH_exp  :0]  tmp_exp;
reg 						exception;
reg [WIDTH_mm-1 :0]  tmp_mat;
reg [WIDTH_mat  :0]  tmp_mat_r;

reg [WIDTH_exp-1:0]  tmp_exp_r;



always @* begin
	mul_mat = {1'b1, OP1[WIDTH_mat-1:0]} * {1'b1, OP2[WIDTH_mat-1:0]};



	if (mul_mat[WIDTH_mm-1] == 1'b1) begin
		tmp_exp = sum_exp[WIDTH_exp-1:0] + 1;
		tmp_mat = mul_mat;
		if(tmp_exp[WIDTH_exp]==1'b1)
			exception = 1;
		else
			exception = 0;
	end
	else begin
		tmp_exp = sum_exp[WIDTH_exp-1:0];
		tmp_mat = mul_mat << 1;	
		exception = 0;		
	end



	if (exception==1'b0) begin

		if (tmp_mat[WIDTH_mm-(WIDTH_mat+1)-1]==1'b1) begin
			if(tmp_mat[WIDTH_mm-(WIDTH_mat+1)-2:0]!=0) begin
				tmp_mat_r = tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)] + 1;

				if (tmp_mat_r<tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)]) begin
					tmp_exp_r = tmp_exp[WIDTH_exp-1:0] + 1;
					tmp_mat_r = 0;
					tmp_mat_r[WIDTH_mat] = 1'b1;

					if (tmp_exp_r==0) 
						exception = 1;
					else
						exception = 0;
				end
				else begin
					tmp_exp_r = tmp_exp[WIDTH_exp-1:0];
				end	
			end
			else begin
				tmp_mat_r = tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)];
				tmp_exp_r = tmp_exp[WIDTH_exp-1:0];
			end
		end
		else begin
			tmp_mat_r = tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)];
			tmp_exp_r = tmp_exp[WIDTH_exp-1:0];			
		end
	end

end




always @* begin
	if(exce_in||sum_exp[WIDTH_exp]||exception) 
		exce_out <= 1'b1;
	else
		exce_out <= 1'b0;
end



reg sign_L;


always @ * begin							
	if(OP1[WIDTH-1]^OP2[WIDTH-1])
		sign_L = 1'b1;
	else
		sign_L = 1'b0;
end




always @ * begin
	if(!RST)
		result <= 0;
	else if (exce_out) begin
		result <= 0;
	end
	else
		result <= {sign_L, tmp_exp_r, tmp_mat_r[WIDTH_mat-1:0]};
end


endmodule
module multiplier_float
				#(parameter 		  WIDTH = 32,
										  WIDTH_exp = 8,
										  WIDTH_mat = 23)
				( input 				  CLK,
										  RST,
				  input [WIDTH-1:0] OP1,
										  OP2,
				  input 			 exce_in,
				  output reg 	exce_out,
				  output reg [WIDTH_mat+WIDTH_exp:0] result);



function integer log2;
	input integer n;
	begin
		log2 = 0;
		while (2**log2<n) begin
			log2 = log2 + 1;
		end
	end
endfunction





reg [WIDTH_exp:0]   sum_exp;
reg [WIDTH_exp-1:0] BIAS = (2**(WIDTH_exp-1))-1;


always @* begin
	sum_exp <= OP1[WIDTH-2:WIDTH-(WIDTH_exp+1)] + OP2[WIDTH-2:WIDTH-(WIDTH_exp+1)] - BIAS;
end




localparam WIDTH_mm  = (WIDTH_mat+1)*2;
localparam WIDTH_poi = log2(WIDTH_mm);
reg [WIDTH_mm-1 :0]  mul_mat;
reg [WIDTH_poi-1:0] 	pointer;
reg [WIDTH_exp  :0]  tmp_exp;
reg 						exception;
reg [WIDTH_mm-1 :0]  tmp_mat;
reg [WIDTH_mat  :0]  tmp_mat_r;

reg [WIDTH_exp-1:0]  tmp_exp_r;



always @* begin
	mul_mat = {1'b1, OP1[WIDTH_mat-1:0]} * {1'b1, OP2[WIDTH_mat-1:0]};



	if (mul_mat[WIDTH_mm-1] == 1'b1) begin
		tmp_exp = sum_exp[WIDTH_exp-1:0] + 1;
		tmp_mat = mul_mat;
		if(tmp_exp[WIDTH_exp]==1'b1)
			exception = 1;
		else
			exception = 0;
	end
	else begin
		tmp_exp = sum_exp[WIDTH_exp-1:0];
		tmp_mat = mul_mat << 1;	
		exception = 0;		
	end



	if (exception==1'b0) begin

		if (tmp_mat[WIDTH_mm-(WIDTH_mat+1)-1]==1'b1) begin
			if(tmp_mat[WIDTH_mm-(WIDTH_mat+1)-2:0]!=0) begin
				tmp_mat_r = tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)] + 1;

				if (tmp_mat_r<tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)]) begin
					tmp_exp_r = tmp_exp[WIDTH_exp-1:0] + 1;
					tmp_mat_r = 0;
					tmp_mat_r[WIDTH_mat] = 1'b1;

					if (tmp_exp_r==0) 
						exception = 1;
					else
						exception = 0;
				end
				else begin
					tmp_exp_r = tmp_exp[WIDTH_exp-1:0];
				end	
			end
			else begin
				tmp_mat_r = tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)];
				tmp_exp_r = tmp_exp[WIDTH_exp-1:0];
			end
		end
		else begin
			tmp_mat_r = tmp_mat[WIDTH_mm-1:WIDTH_mm-(WIDTH_mat+1)];
			tmp_exp_r = tmp_exp[WIDTH_exp-1:0];			
		end
	end

end




always @* begin
	if(exce_in||sum_exp[WIDTH_exp]||exception) 
		exce_out <= 1'b1;
	else
		exce_out <= 1'b0;
end



reg sign_L;


always @ * begin							
	if(OP1[WIDTH-1]^OP2[WIDTH-1])
		sign_L = 1'b1;
	else
		sign_L = 1'b0;
end




always @ * begin
	if(!RST)
		result <= 0;
	else if (exce_out) begin
		result <= 0;
	end
	else
		result <= {sign_L, tmp_exp_r, tmp_mat_r[WIDTH_mat-1:0]};
end


endmodule