data/full_repos/permissive/486954482/TinyGarble/circuit_synthesis/syn_lib/DIV.v
1: b"%Error: data/full_repos/permissive/486954482/TinyGarble/circuit_synthesis/syn_lib/DIV.v:20: Cannot find file containing module: 'ADD'\n  ADD #(.N(N+M)) SUB(\n  ^~~\n        ... Looked in:\n             data/full_repos/permissive/486954482/TinyGarble/circuit_synthesis/syn_lib,data/full_repos/permissive/486954482/ADD\n             data/full_repos/permissive/486954482/TinyGarble/circuit_synthesis/syn_lib,data/full_repos/permissive/486954482/ADD.v\n             data/full_repos/permissive/486954482/TinyGarble/circuit_synthesis/syn_lib,data/full_repos/permissive/486954482/ADD.sv\n             ADD\n             ADD.v\n             ADD.sv\n             obj_dir/ADD\n             obj_dir/ADD.v\n             obj_dir/ADD.sv\n%Error: data/full_repos/permissive/486954482/TinyGarble/circuit_synthesis/syn_lib/DIV.v:35: Cannot find file containing module: 'MUX'\n  MUX #(.N(N+M)) MUX(\n  ^~~\n%Error: data/full_repos/permissive/486954482/TinyGarble/circuit_synthesis/syn_lib/DIV.v:28: Cannot find file containing module: 'ADD'\n  ADD #(.N(N+M)) SUB(\n  ^~~\n%Error: Exiting due to 3 error(s)\n"
module DIV #( parameter N = 8, M = N )( 
	input  [N-1:0] A,
	input  [M-1:0] B,
	output [N-1:0] O
);

	wire	[N+M-1:0] A_[N:0];
	wire	[N+M-1:0] D[N-1:0];
	
	assign	A_[N] = {{M{1'b0}}, A};
	
	genvar g;
	
	generate
	for(g = N-1; g >= 0;g = g - 1)
	begin:DIV_UNIT
		if (g > 0)
		ADD #(.N(N+M)) SUB(
			.A(A_[g+1]),
			.B({{(N-g){1'b1}}, ~B, {g{1'b1}}}),
			.CI(1'b1),
			.S(D[g]), 
			.CO(O[g])
		);
		else 
		ADD #(.N(N+M)) SUB(
			.A(A_[g+1]),
			.B({{(N-g){1'b1}}, ~B}),
			.CI(1'b1),
			.S(D[g]), 
			.CO(O[g])
		);
		MUX #(.N(N+M)) MUX(
			.A(A_[g+1]),
			.B(D[g]),
			.S(O[g]),
			.O(A_[g])
		);
	end
	endgenerate

endmodule
module DIV #( parameter N = 8, M = N )( 
	input  [N-1:0] A,
	input  [M-1:0] B,
	output [N-1:0] O
);


	wire	[N+M-1:0] A_[N:0];
	wire	[N+M-1:0] D[N-1:0];
	
	assign	A_[N] = {{M{1'b0}}, A};
	
	genvar g;
	
	generate
	for(g = N-1; g >= 0;g = g - 1)
	begin:DIV_UNIT
		if (g > 0)
		ADD #(.N(N+M)) SUB(
			.A(A_[g+1]),
			.B({{(N-g){1'b1}}, ~B, {g{1'b1}}}),
			.CI(1'b1),
			.S(D[g]), 
			.CO(O[g])
		);
		else 
		ADD #(.N(N+M)) SUB(
			.A(A_[g+1]),
			.B({{(N-g){1'b1}}, ~B}),
			.CI(1'b1),
			.S(D[g]), 
			.CO(O[g])
		);
		MUX #(.N(N+M)) MUX(
			.A(A_[g+1]),
			.B(D[g]),
			.S(O[g]),
			.O(A_[g])
		);
	end
	endgenerate

endmodule