data/full_repos/permissive/113654920/hdl/CheckDNA.v
1: b'%Error: data/full_repos/permissive/113654920/hdl/CheckDNA.v:94: Cannot find file containing module: \'multi_16\'\nmulti_16 inst_multi_16 (\n^~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/113654920/hdl,data/full_repos/permissive/113654920/multi_16\n             data/full_repos/permissive/113654920/hdl,data/full_repos/permissive/113654920/multi_16.v\n             data/full_repos/permissive/113654920/hdl,data/full_repos/permissive/113654920/multi_16.sv\n             multi_16\n             multi_16.v\n             multi_16.sv\n             obj_dir/multi_16\n             obj_dir/multi_16.v\n             obj_dir/multi_16.sv\n%Warning-WIDTH: data/full_repos/permissive/113654920/hdl/CheckDNA.v:119: Operator XOR expects 17 bits on the LHS, but LHS\'s SEL generates 16 bits.\n                                                                       : ... In instance CheckDNA\nassign mb[15:0] = ROM_Data[15:0] ^ dna[20:4];   \n                                 ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/113654920/hdl/CheckDNA.v:119: Operator ASSIGNW expects 16 bits on the Assign RHS, but Assign RHS\'s XOR generates 17 bits.\n                                                                       : ... In instance CheckDNA\nassign mb[15:0] = ROM_Data[15:0] ^ dna[20:4];   \n                ^\n%Error: Exiting due to 1 error(s), 2 warning(s)\n'
module CheckDNA(
input				clk4,
input				reset,
input [63:0] 	DNA_64,
input 			dna_valid,

input [15:0]	ROM_Data,
input				IDE_CS,
output reg		DNA_ENA,
output reg		DNA_REG,
output reg [9:0]	DNA_Addr,

output			dna_pass,
output [3:0]	KILL
);







parameter no_of_ran_no = 1016;

reg	[15:0]	xor_check;
reg	[63:0]	dna;
reg	[9:0]		L_Addr;
reg	[15:0]	check;
reg	multi_ce;
reg [4:0]  dna_gen_st;
reg	[3:0]		DNA_FailR;

parameter DcIdle	= 5'b00000;
parameter Dc01		= 5'b00001;
parameter Dc02		= 5'b00010;
parameter Dc03		= 5'b00011;
parameter Dc04		= 5'b00100;
parameter Dc10		= 5'b00101;
parameter Dc11		= 5'b00110;
parameter Dc12		= 5'b00111;
parameter Dc13		= 5'b01000;
parameter Dc14		= 5'b01001;
parameter Dc20		= 5'b01010;
parameter Dc21		= 5'b01011;
parameter Dc22		= 5'b01100;
parameter Dc23		= 5'b01101;
parameter Dc24		= 5'b01110;
parameter Dc25		= 5'b01111;
parameter Dc26		= 5'b10000;
parameter Dc27		= 5'b10001;
parameter Dc28		= 5'b10010;
parameter Dc29		= 5'b10011;
parameter Dc30		= 5'b10100;
parameter Dc31		= 5'b10101;
parameter Dc32		= 5'b10110;
parameter Dc33		= 5'b10111;
parameter Dc34		= 5'b11000;
parameter Dc35		= 5'b11001;
parameter Dc90		= 5'b11010;
parameter Dc91		= 5'b11011;
parameter Dc92		= 5'b11100;

reg	[15:0] multi_a;
reg	[15:0] multi_b;
reg	[15:0] Simp_XOR;
reg	FinishCheck;
wire	[15:0] multi_p;
wire	[15:0] ma;
wire	[15:0] mb;
wire	K_WINDOW;



multi_16 inst_multi_16 (
	.ce(multi_ce),
	.clk(clk4),
	.a(multi_a),
	.b(multi_b),
	.p(multi_p));















assign ma[15:10]	= multi_p[15:10]	^ dna[47:42];
assign ma[9:8]		= multi_p[7:6]		^ dna[37:36];
assign ma[7:6]		= multi_p[9:8]		^ dna[33:32];
assign ma[5:0]		= multi_p[5:0]		^ dna[30:25];
assign mb[15:0]	= ROM_Data[15:0]	^ dna[20:4];


assign	KILL[0]	=  DNA_FailR[0];
assign	KILL[1]	= ~DNA_FailR[0] & DNA_FailR[1] & K_WINDOW & Simp_XOR[2];
assign	KILL[2]	= ~DNA_FailR[0] & ~DNA_FailR[1] & DNA_FailR[2] & K_WINDOW & ~Simp_XOR[2];
assign	KILL[3]	= ~DNA_FailR[0] & ~DNA_FailR[1] & DNA_FailR[3] & K_WINDOW &  Simp_XOR[2];
assign	K_WINDOW	= Simp_XOR[9] & Simp_XOR[8] & ~Simp_XOR[7] & Simp_XOR[6] & ~Simp_XOR[5] & ~Simp_XOR[3];
assign	dna_pass	= FinishCheck & ~DNA_FailR[3] & ~DNA_FailR[2] & ~DNA_FailR[1] & ~DNA_FailR[0];

always @(posedge clk4) begin
	if(reset) begin
		DNA_Addr		<= 10'b00_0000_0000;
		L_Addr	<= 10'b00_0000_0000;
		xor_check 	<= 16'b0000_0000_0000_0000;
		multi_a	 	<= 16'b0000_0000_0000_0000;
		multi_b	 	<= 16'b0000_0000_0000_0000;
		Simp_XOR		<= 16'b0000_0000_0000_0000;
		DNA_FailR	<= 4'b0000;
		FinishCheck	<= 1'b0;
		DNA_ENA		<= 1'b0;
		DNA_REG		<= 1'b0;
		multi_ce		<= 1'b0;
		dna_gen_st	<= DcIdle;
	end else begin
		case(dna_gen_st)


		DcIdle	: begin
			if(dna_valid == 1'b1) begin
				dna_gen_st	<= Dc01;
			end
		end
		Dc01	: begin
			DNA_ENA		<= 1'b1;
			multi_ce	<= 1'b1;
			dna		<= DNA_64;
			dna_gen_st	<= Dc02;
		end
		Dc02	: begin
			DNA_ENA		<= 1'b0;
			DNA_REG		<= 1'b1;
			dna_gen_st	<= Dc03;
		end
		Dc03	: begin
			DNA_REG		<= 1'b0;
			dna_gen_st	<= Dc04;
		end
		Dc04	: begin
			multi_ce				<=  1'b0;
			multi_a[15:0]		<=  ma[15:0];
			multi_b[15:0]		<=  mb[15:0];
			L_Addr[9]		<= ~mb[10];
			L_Addr[8:0]	<=  mb[10:2];
			dna_gen_st			<=  Dc10;
		end

	Dc10: begin
		DNA_REG		<= 1'b0;
		dna_gen_st	<= Dc11;
	end	
	Dc11: begin
		multi_ce			<= 1'b1;
		multi_a[15:0]	<= ma[15:0];
		multi_b[15:0]	<= mb[15:0];
		dna_gen_st		<= Dc12;
	end	
	Dc12:	begin
		dna[63:1]		<= dna[62:0];
		dna[0]			<= dna[63] ^ ROM_Data[1];
		DNA_ENA			<= 1'b0;
		if (DNA_Addr == L_Addr)	check <= multi_a;
		DNA_Addr			<= DNA_Addr + 1;
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		xor_check		<= xor_check ^ multi_b;
		dna_gen_st		<= Dc13;
	end
	Dc13:	begin
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc14;
	end
	Dc14:	begin
		DNA_ENA			<= 1'b0;
		DNA_REG			<= 1'b1;
		if (DNA_Addr == no_of_ran_no) begin
			DNA_Addr			<= DNA_Addr + 1;
			dna_gen_st 	<= Dc20;
		end else begin
			dna_gen_st	<= Dc10;
		end
	end

	Dc20	: begin
		multi_ce			<= 1'b0;
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc21;
	end
	Dc21	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (multi_a != ROM_Data) begin
			DNA_FailR[3]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc22;
	end
	Dc22	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc23;
	end
	Dc23	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (xor_check != ROM_Data) begin
			DNA_FailR[2]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc24;
	end

	Dc24	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc25;
	end
	Dc25	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (check != ROM_Data) begin
			DNA_FailR[1]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr			<= DNA_Addr+1;
		dna_gen_st		<= Dc26;
	end

	Dc26	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc27;
	end
	Dc27	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[63:48] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc28;
	end

	Dc28	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc29;
	end
	Dc29	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[47:32] != ROM_Data[15:0]) begin
			DNA_FailR[0]		<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc30;
	end

	Dc30	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc31;
	end
	Dc31	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[31:16] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc32;
	end

	Dc32	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc33;
	end
	Dc33	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[15:0] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;

		dna_gen_st		<= Dc34;
	end

	Dc34	: begin
		DNA_REG			<= 1'b0;

		dna_gen_st		<= Dc35;
	end
	Dc35	: begin
		if (Simp_XOR[15:0] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end



		FinishCheck		<= 1'b1;
		dna_gen_st		<= Dc90;
	end

	Dc90:	begin
		if	(IDE_CS == 1'b0) begin
			dna_gen_st	<= Dc91;
		end else begin
			dna_gen_st	<= Dc90;
		end
	end

	Dc91:	begin
		Simp_XOR			<= Simp_XOR + 1;
		dna_gen_st		<= Dc92;
	end

	Dc92:	begin
		if	(IDE_CS == 1'b1) begin
			dna_gen_st	<= Dc90;
		end else begin
			dna_gen_st	<= Dc92;
		end
	end


	default : begin
		dna_gen_st		<= DcIdle;
	end

	endcase
	end
end
endmodule
module CheckDNA(
input				clk4,
input				reset,
input [63:0] 	DNA_64,
input 			dna_valid,

input [15:0]	ROM_Data,
input				IDE_CS,
output reg		DNA_ENA,
output reg		DNA_REG,
output reg [9:0]	DNA_Addr,

output			dna_pass,
output [3:0]	KILL
);








parameter no_of_ran_no = 1016;

reg	[15:0]	xor_check;
reg	[63:0]	dna;
reg	[9:0]		L_Addr;
reg	[15:0]	check;
reg	multi_ce;
reg [4:0]  dna_gen_st;
reg	[3:0]		DNA_FailR;

parameter DcIdle	= 5'b00000;
parameter Dc01		= 5'b00001;
parameter Dc02		= 5'b00010;
parameter Dc03		= 5'b00011;
parameter Dc04		= 5'b00100;
parameter Dc10		= 5'b00101;
parameter Dc11		= 5'b00110;
parameter Dc12		= 5'b00111;
parameter Dc13		= 5'b01000;
parameter Dc14		= 5'b01001;
parameter Dc20		= 5'b01010;
parameter Dc21		= 5'b01011;
parameter Dc22		= 5'b01100;
parameter Dc23		= 5'b01101;
parameter Dc24		= 5'b01110;
parameter Dc25		= 5'b01111;
parameter Dc26		= 5'b10000;
parameter Dc27		= 5'b10001;
parameter Dc28		= 5'b10010;
parameter Dc29		= 5'b10011;
parameter Dc30		= 5'b10100;
parameter Dc31		= 5'b10101;
parameter Dc32		= 5'b10110;
parameter Dc33		= 5'b10111;
parameter Dc34		= 5'b11000;
parameter Dc35		= 5'b11001;
parameter Dc90		= 5'b11010;
parameter Dc91		= 5'b11011;
parameter Dc92		= 5'b11100;

reg	[15:0] multi_a;
reg	[15:0] multi_b;
reg	[15:0] Simp_XOR;
reg	FinishCheck;
wire	[15:0] multi_p;
wire	[15:0] ma;
wire	[15:0] mb;
wire	K_WINDOW;



multi_16 inst_multi_16 (
	.ce(multi_ce),
	.clk(clk4),
	.a(multi_a),
	.b(multi_b),
	.p(multi_p));















assign ma[15:10]	= multi_p[15:10]	^ dna[47:42];
assign ma[9:8]		= multi_p[7:6]		^ dna[37:36];
assign ma[7:6]		= multi_p[9:8]		^ dna[33:32];
assign ma[5:0]		= multi_p[5:0]		^ dna[30:25];
assign mb[15:0]	= ROM_Data[15:0]	^ dna[20:4];


assign	KILL[0]	=  DNA_FailR[0];
assign	KILL[1]	= ~DNA_FailR[0] & DNA_FailR[1] & K_WINDOW & Simp_XOR[2];
assign	KILL[2]	= ~DNA_FailR[0] & ~DNA_FailR[1] & DNA_FailR[2] & K_WINDOW & ~Simp_XOR[2];
assign	KILL[3]	= ~DNA_FailR[0] & ~DNA_FailR[1] & DNA_FailR[3] & K_WINDOW &  Simp_XOR[2];
assign	K_WINDOW	= Simp_XOR[9] & Simp_XOR[8] & ~Simp_XOR[7] & Simp_XOR[6] & ~Simp_XOR[5] & ~Simp_XOR[3];
assign	dna_pass	= FinishCheck & ~DNA_FailR[3] & ~DNA_FailR[2] & ~DNA_FailR[1] & ~DNA_FailR[0];

always @(posedge clk4) begin
	if(reset) begin
		DNA_Addr		<= 10'b00_0000_0000;
		L_Addr	<= 10'b00_0000_0000;
		xor_check 	<= 16'b0000_0000_0000_0000;
		multi_a	 	<= 16'b0000_0000_0000_0000;
		multi_b	 	<= 16'b0000_0000_0000_0000;
		Simp_XOR		<= 16'b0000_0000_0000_0000;
		DNA_FailR	<= 4'b0000;
		FinishCheck	<= 1'b0;
		DNA_ENA		<= 1'b0;
		DNA_REG		<= 1'b0;
		multi_ce		<= 1'b0;
		dna_gen_st	<= DcIdle;
	end else begin
		case(dna_gen_st)


		DcIdle	: begin
			if(dna_valid == 1'b1) begin
				dna_gen_st	<= Dc01;
			end
		end
		Dc01	: begin
			DNA_ENA		<= 1'b1;
			multi_ce	<= 1'b1;
			dna		<= DNA_64;
			dna_gen_st	<= Dc02;
		end
		Dc02	: begin
			DNA_ENA		<= 1'b0;
			DNA_REG		<= 1'b1;
			dna_gen_st	<= Dc03;
		end
		Dc03	: begin
			DNA_REG		<= 1'b0;
			dna_gen_st	<= Dc04;
		end
		Dc04	: begin
			multi_ce				<=  1'b0;
			multi_a[15:0]		<=  ma[15:0];
			multi_b[15:0]		<=  mb[15:0];
			L_Addr[9]		<= ~mb[10];
			L_Addr[8:0]	<=  mb[10:2];
			dna_gen_st			<=  Dc10;
		end

	Dc10: begin
		DNA_REG		<= 1'b0;
		dna_gen_st	<= Dc11;
	end	
	Dc11: begin
		multi_ce			<= 1'b1;
		multi_a[15:0]	<= ma[15:0];
		multi_b[15:0]	<= mb[15:0];
		dna_gen_st		<= Dc12;
	end	
	Dc12:	begin
		dna[63:1]		<= dna[62:0];
		dna[0]			<= dna[63] ^ ROM_Data[1];
		DNA_ENA			<= 1'b0;
		if (DNA_Addr == L_Addr)	check <= multi_a;
		DNA_Addr			<= DNA_Addr + 1;
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		xor_check		<= xor_check ^ multi_b;
		dna_gen_st		<= Dc13;
	end
	Dc13:	begin
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc14;
	end
	Dc14:	begin
		DNA_ENA			<= 1'b0;
		DNA_REG			<= 1'b1;
		if (DNA_Addr == no_of_ran_no) begin
			DNA_Addr			<= DNA_Addr + 1;
			dna_gen_st 	<= Dc20;
		end else begin
			dna_gen_st	<= Dc10;
		end
	end

	Dc20	: begin
		multi_ce			<= 1'b0;
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc21;
	end
	Dc21	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (multi_a != ROM_Data) begin
			DNA_FailR[3]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc22;
	end
	Dc22	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc23;
	end
	Dc23	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (xor_check != ROM_Data) begin
			DNA_FailR[2]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc24;
	end

	Dc24	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc25;
	end
	Dc25	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (check != ROM_Data) begin
			DNA_FailR[1]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr			<= DNA_Addr+1;
		dna_gen_st		<= Dc26;
	end

	Dc26	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc27;
	end
	Dc27	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[63:48] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc28;
	end

	Dc28	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc29;
	end
	Dc29	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[47:32] != ROM_Data[15:0]) begin
			DNA_FailR[0]		<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc30;
	end

	Dc30	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc31;
	end
	Dc31	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[31:16] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;
		DNA_Addr				<= DNA_Addr+1;
		dna_gen_st		<= Dc32;
	end

	Dc32	: begin
		DNA_REG			<= 1'b0;
		DNA_ENA			<= 1'b1;
		dna_gen_st		<= Dc33;
	end
	Dc33	: begin
		Simp_XOR[15:0]	<= Simp_XOR[15:0] ^ ROM_Data[15:0];
		if (DNA_64[15:0] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end
		DNA_REG			<= 1'b1;
		DNA_ENA			<= 1'b0;

		dna_gen_st		<= Dc34;
	end

	Dc34	: begin
		DNA_REG			<= 1'b0;

		dna_gen_st		<= Dc35;
	end
	Dc35	: begin
		if (Simp_XOR[15:0] != ROM_Data[15:0]) begin
			DNA_FailR[0]	<= 1'b1;
		end



		FinishCheck		<= 1'b1;
		dna_gen_st		<= Dc90;
	end

	Dc90:	begin
		if	(IDE_CS == 1'b0) begin
			dna_gen_st	<= Dc91;
		end else begin
			dna_gen_st	<= Dc90;
		end
	end

	Dc91:	begin
		Simp_XOR			<= Simp_XOR + 1;
		dna_gen_st		<= Dc92;
	end

	Dc92:	begin
		if	(IDE_CS == 1'b1) begin
			dna_gen_st	<= Dc90;
		end else begin
			dna_gen_st	<= Dc92;
		end
	end


	default : begin
		dna_gen_st		<= DcIdle;
	end

	endcase
	end
end
endmodule