data/full_repos/permissive/506081587/quartus/src/i2c/I2C_HDMI_Config.v
1: b'%Error: data/full_repos/permissive/506081587/quartus/src/i2c/I2C_HDMI_Config.v:15: Cannot find include file: I2C_Controller.v\n`include "I2C_Controller.v" \n         ^~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/506081587/quartus/src/i2c,data/full_repos/permissive/506081587/I2C_Controller.v\n             data/full_repos/permissive/506081587/quartus/src/i2c,data/full_repos/permissive/506081587/I2C_Controller.v.v\n             data/full_repos/permissive/506081587/quartus/src/i2c,data/full_repos/permissive/506081587/I2C_Controller.v.sv\n             I2C_Controller.v\n             I2C_Controller.v.v\n             I2C_Controller.v.sv\n             obj_dir/I2C_Controller.v\n             obj_dir/I2C_Controller.v.v\n             obj_dir/I2C_Controller.v.sv\n%Error: Exiting due to 1 error(s)\n'
module I2C_HDMI_Config (
					iCLK,
					iRST_N,

					I2C_SCLK,
					I2C_SDAT,
					HDMI_TX_INT,
					READY
					 );

input				iCLK;
input				iRST_N;

output			I2C_SCLK;
inout				I2C_SDAT;
input				HDMI_TX_INT;
output READY ; 


reg	[15:0]	mI2C_CLK_DIV;
reg	[23:0]	mI2C_DATA;
reg				mI2C_CTRL_CLK;
reg				mI2C_GO;
wire				mI2C_END;
wire				mI2C_ACK;
reg	[15:0]	LUT_DATA;
reg	[5:0]		LUT_INDEX;
reg	[3:0]		mSetup_ST;
reg READY ; 


parameter	CLK_Freq	=	50000000;
parameter	I2C_Freq	=	20000;

parameter	LUT_SIZE	=	31;


always@(posedge iCLK or negedge iRST_N)
begin
	if(!iRST_N)
	begin
		mI2C_CTRL_CLK	<=	0;
		mI2C_CLK_DIV	<=	0;
	end
	else
	begin
		if( mI2C_CLK_DIV	< (CLK_Freq/I2C_Freq) )
			mI2C_CLK_DIV	<=	mI2C_CLK_DIV+1'b1;
		else
		begin
			mI2C_CLK_DIV	<=	0;
			mI2C_CTRL_CLK	<=	~mI2C_CTRL_CLK;
		end
	end
end

I2C_Controller 	u0	(	.CLOCK(mI2C_CTRL_CLK),
						.I2C_SCLK(I2C_SCLK),
 	 	 	 	 	 	.I2C_SDAT(I2C_SDAT),
						.I2C_DATA(mI2C_DATA),
						.GO(mI2C_GO),
						.END(mI2C_END),
						.ACK(mI2C_ACK),
						.RESET(iRST_N)	);


always@(posedge mI2C_CTRL_CLK or negedge iRST_N)
begin
	if(!iRST_N)
	begin
	READY<=0;
		LUT_INDEX	<=	0;
		mSetup_ST	<=	0;
		mI2C_GO		<=	0;
	end
	else
	begin
		if(LUT_INDEX<LUT_SIZE)
		begin
		READY<=0;
			case(mSetup_ST)
			0:	begin
					mI2C_DATA	<=	{8'h72,LUT_DATA};
					mI2C_GO		<=	1;
					mSetup_ST	<=	1;
				end
			1:	begin
					if(mI2C_END)
					begin
						if(!mI2C_ACK)
						mSetup_ST	<=	2;
						else
						mSetup_ST	<=	0;							
						mI2C_GO		<=	0;
					end
				end
			2:	begin
					LUT_INDEX	<=	LUT_INDEX+1'b1;
					mSetup_ST	<=	0;
				end
			endcase
		end
		else
		begin
		  READY<=1; 
		  if(!HDMI_TX_INT)
		  begin
		    LUT_INDEX <= 0;
		  end
		  else
		    LUT_INDEX <= LUT_INDEX;
		end
	end
end


always
begin
	case(LUT_INDEX)
	

	0	:	LUT_DATA	<=	16'h9803;
	1	:	LUT_DATA	<=	16'h0100;
	2	:	LUT_DATA	<=	16'h0218;
	3	:	LUT_DATA	<=	16'h0300;
	4	:	LUT_DATA	<=	16'h1470;
	5	:	LUT_DATA	<=	16'h1520;
	6	:	LUT_DATA	<=	16'h1630;
	7	:	LUT_DATA	<=	16'h1846;
	8	:	LUT_DATA	<=	16'h4080;
	9	:	LUT_DATA	<=	16'h4110;
	10	:	LUT_DATA	<=	16'h49A8;
	11	:	LUT_DATA	<=	16'h5510;
	12	:	LUT_DATA	<=	16'h5608;
	13	:	LUT_DATA	<=	16'h96F6;
	14	:	LUT_DATA	<=	16'h7307;
	15	:	LUT_DATA	<=	16'h761f;
	16	:	LUT_DATA	<=	16'h9803;
	17	:	LUT_DATA	<=	16'h9902;
	18	:	LUT_DATA	<=	16'h9ae0;
	19	:	LUT_DATA	<=	16'h9c30;
	20	:	LUT_DATA	<=	16'h9d61;
	21	:	LUT_DATA	<=	16'ha2a4;
	22	:	LUT_DATA	<=	16'ha3a4;
	23	:	LUT_DATA	<=	16'ha504;
	24	:	LUT_DATA	<=	16'hab40;
	25	:	LUT_DATA	<=	16'haf16;
	26	:	LUT_DATA	<=	16'hba60;
	27	:	LUT_DATA	<=	16'hd1ff;
	28	:	LUT_DATA	<=	16'hde10;
	29	:	LUT_DATA	<=	16'he460;
	30	:	LUT_DATA	<=	16'hfa7d;

	default:		LUT_DATA	<=	16'h9803;
	endcase
end

endmodule
module I2C_HDMI_Config (
					iCLK,
					iRST_N,

					I2C_SCLK,
					I2C_SDAT,
					HDMI_TX_INT,
					READY
					 );


input				iCLK;
input				iRST_N;

output			I2C_SCLK;
inout				I2C_SDAT;
input				HDMI_TX_INT;
output READY ; 


reg	[15:0]	mI2C_CLK_DIV;
reg	[23:0]	mI2C_DATA;
reg				mI2C_CTRL_CLK;
reg				mI2C_GO;
wire				mI2C_END;
wire				mI2C_ACK;
reg	[15:0]	LUT_DATA;
reg	[5:0]		LUT_INDEX;
reg	[3:0]		mSetup_ST;
reg READY ; 


parameter	CLK_Freq	=	50000000;
parameter	I2C_Freq	=	20000;

parameter	LUT_SIZE	=	31;


always@(posedge iCLK or negedge iRST_N)
begin
	if(!iRST_N)
	begin
		mI2C_CTRL_CLK	<=	0;
		mI2C_CLK_DIV	<=	0;
	end
	else
	begin
		if( mI2C_CLK_DIV	< (CLK_Freq/I2C_Freq) )
			mI2C_CLK_DIV	<=	mI2C_CLK_DIV+1'b1;
		else
		begin
			mI2C_CLK_DIV	<=	0;
			mI2C_CTRL_CLK	<=	~mI2C_CTRL_CLK;
		end
	end
end

I2C_Controller 	u0	(	.CLOCK(mI2C_CTRL_CLK),
						.I2C_SCLK(I2C_SCLK),
 	 	 	 	 	 	.I2C_SDAT(I2C_SDAT),
						.I2C_DATA(mI2C_DATA),
						.GO(mI2C_GO),
						.END(mI2C_END),
						.ACK(mI2C_ACK),
						.RESET(iRST_N)	);


always@(posedge mI2C_CTRL_CLK or negedge iRST_N)
begin
	if(!iRST_N)
	begin
	READY<=0;
		LUT_INDEX	<=	0;
		mSetup_ST	<=	0;
		mI2C_GO		<=	0;
	end
	else
	begin
		if(LUT_INDEX<LUT_SIZE)
		begin
		READY<=0;
			case(mSetup_ST)
			0:	begin
					mI2C_DATA	<=	{8'h72,LUT_DATA};
					mI2C_GO		<=	1;
					mSetup_ST	<=	1;
				end
			1:	begin
					if(mI2C_END)
					begin
						if(!mI2C_ACK)
						mSetup_ST	<=	2;
						else
						mSetup_ST	<=	0;							
						mI2C_GO		<=	0;
					end
				end
			2:	begin
					LUT_INDEX	<=	LUT_INDEX+1'b1;
					mSetup_ST	<=	0;
				end
			endcase
		end
		else
		begin
		  READY<=1; 
		  if(!HDMI_TX_INT)
		  begin
		    LUT_INDEX <= 0;
		  end
		  else
		    LUT_INDEX <= LUT_INDEX;
		end
	end
end


always
begin
	case(LUT_INDEX)
	

	0	:	LUT_DATA	<=	16'h9803;
	1	:	LUT_DATA	<=	16'h0100;
	2	:	LUT_DATA	<=	16'h0218;
	3	:	LUT_DATA	<=	16'h0300;
	4	:	LUT_DATA	<=	16'h1470;
	5	:	LUT_DATA	<=	16'h1520;
	6	:	LUT_DATA	<=	16'h1630;
	7	:	LUT_DATA	<=	16'h1846;
	8	:	LUT_DATA	<=	16'h4080;
	9	:	LUT_DATA	<=	16'h4110;
	10	:	LUT_DATA	<=	16'h49A8;
	11	:	LUT_DATA	<=	16'h5510;
	12	:	LUT_DATA	<=	16'h5608;
	13	:	LUT_DATA	<=	16'h96F6;
	14	:	LUT_DATA	<=	16'h7307;
	15	:	LUT_DATA	<=	16'h761f;
	16	:	LUT_DATA	<=	16'h9803;
	17	:	LUT_DATA	<=	16'h9902;
	18	:	LUT_DATA	<=	16'h9ae0;
	19	:	LUT_DATA	<=	16'h9c30;
	20	:	LUT_DATA	<=	16'h9d61;
	21	:	LUT_DATA	<=	16'ha2a4;
	22	:	LUT_DATA	<=	16'ha3a4;
	23	:	LUT_DATA	<=	16'ha504;
	24	:	LUT_DATA	<=	16'hab40;
	25	:	LUT_DATA	<=	16'haf16;
	26	:	LUT_DATA	<=	16'hba60;
	27	:	LUT_DATA	<=	16'hd1ff;
	28	:	LUT_DATA	<=	16'hde10;
	29	:	LUT_DATA	<=	16'he460;
	30	:	LUT_DATA	<=	16'hfa7d;

	default:		LUT_DATA	<=	16'h9803;
	endcase
end

endmodule