data/full_repos/permissive/489994352/Image-Part/conv1_verify.sv
1: b'%Warning-STMTDLY: data/full_repos/permissive/489994352/Image-Part/conv1_verify.sv:92: Unsupported: Ignoring delay on this delayed statement.\n                    #10ns;\n                    ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/489994352/Image-Part/conv1_verify.sv:121: Unsupported: Ignoring delay on this delayed statement.\n                    #10ns;\n                    ^\n%Warning-STMTDLY: data/full_repos/permissive/489994352/Image-Part/conv1_verify.sv:147: Unsupported: Ignoring delay on this delayed statement.\n                #10ns;\n                ^\n%Error: data/full_repos/permissive/489994352/Image-Part/conv1_verify.sv:7: Cannot find file containing module: \'mul_signed\'\nmul_signed mul1 (a,b,z);\n^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/489994352/Image-Part,data/full_repos/permissive/489994352/mul_signed\n             data/full_repos/permissive/489994352/Image-Part,data/full_repos/permissive/489994352/mul_signed.v\n             data/full_repos/permissive/489994352/Image-Part,data/full_repos/permissive/489994352/mul_signed.sv\n             mul_signed\n             mul_signed.v\n             mul_signed.sv\n             obj_dir/mul_signed\n             obj_dir/mul_signed.v\n             obj_dir/mul_signed.sv\n%Error: data/full_repos/permissive/489994352/Image-Part/conv1_verify.sv:10: Cannot find file containing module: \'getmax\'\ngetmax max1 (x,y,c);\n^~~~~~\n%Error: Exiting due to 2 error(s), 3 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module conv1_verify();

logic [15:0] img [0:224*224*3-1];

logic [15:0] a,b;
logic [31:0] z;
mul_signed mul1 (a,b,z);
logic [15:0] x,y;
logic [15:0] c;
getmax max1 (x,y,c);

logic [15:0] filter [0:3*3*3-1];
logic [31:0] conv1biases [0:63];
logic [31:0] bias;
logic [15:0] conv1out [0:111*111-1];
string filename;
int outfile;

logic [15:0] maxpoolout [0:55*55-1];

logic [15:0] inpsqueeze [0:64*55*55-1];
logic [15:0] squeezeweight [0:64*1*1-1];
logic [15:0] sqbias;
logic [15:0] sqbiases [0:15];
logic [15:0] sqout [0:55*55-1];

initial begin






























outfile = $fopen("./sqnetparams/squeeze1/output/sq1outall.txt","a");
$readmemh("sqnetparams/squeeze1/biases.txt",sqbiases);
$readmemh("sqnetparams/maxpool1/output/maxpoolopall.txt",inpsqueeze);
for (int i=1; i<=16; i++) begin

    filename = $sformatf("sqnetparams/squeeze1/sq1wf%0d.txt",i);         
    $readmemh(filename,squeezeweight);

    filename = $sformatf("sqnetparams/maxpool1/output/maxpool1op%0d.txt",i);         
    $readmemh(filename,maxpoolout);

    sqbias = sqbiases[i-1];

    fire1_squeeze1x1();

    filename = $sformatf("sqnetparams/squeeze1/output/sq1op%0d.txt",i);         
    $writememh(filename,sqout);
    for(int j=0; j<55*55; j++)
        $fdisplay(outfile,"%h",sqout[j]);
end
$fclose(outfile);

end

task conv2d3x3;
logic [31:0] tmp;
for (int i=0;i < 111; i++) begin
    for (int j=0; j < 111; j++) begin
        tmp=bias;
        for (int k=0; k<3; k++) begin
            for (int l=0; l<3; l++) begin
                for (int m=0; m<3; m++) begin
                    a=img[k * 224 * 224 + (i * 2 + l - 0) * 224 + j * 2 + m - 0];
                    b=filter[9*k+3*l+m];
                    #10ns;
                    tmp = tmp + z;
                end
            end
        end
        conv1out[i*111+j] = {tmp[23:16],tmp[15:8]};
    end
end
endtask

task maxpool2d3x3;
reg [15:0] tmp;
reg [15:0] value;


	for(int i = 0; i < 55; i++)
	begin
		for(int j = 0; j < 55; j++)
		begin
            tmp=0;


			for(int k = 0; k < 3; k++)
			begin
				for(int l = 0; l < 3; l++)
				begin
					value = conv1out[(i * 2 + k) * 111  + j * 2 + l ];
                    x = value;
                    y = tmp;
                    #10ns;
                    tmp = c;
                end
            end

            maxpoolout[i*55+j] = tmp;
        end
    end

endtask
task fire1_squeeze1x1;
reg [15:0] tmp1;




	for(int i = 0; i < 55; i++)
	begin
		for(int j = 0; j < 55; j++)
		begin
			tmp1 = sqbias;

			for(int k = 0; k < 64; k++)
			begin
				a = inpsqueeze[k * 55 * 55 + i * 55 + j];
                b = squeezeweight[k];
                #10ns;
                tmp1 = {z[23:16],z[15:8]} + tmp1;
            end



            sqout[i*55 + j] = tmp1;
        end
    end
endtask
endmodule
module conv1_verify();


logic [15:0] img [0:224*224*3-1];

logic [15:0] a,b;
logic [31:0] z;
mul_signed mul1 (a,b,z);
logic [15:0] x,y;
logic [15:0] c;
getmax max1 (x,y,c);

logic [15:0] filter [0:3*3*3-1];
logic [31:0] conv1biases [0:63];
logic [31:0] bias;
logic [15:0] conv1out [0:111*111-1];
string filename;
int outfile;

logic [15:0] maxpoolout [0:55*55-1];

logic [15:0] inpsqueeze [0:64*55*55-1];
logic [15:0] squeezeweight [0:64*1*1-1];
logic [15:0] sqbias;
logic [15:0] sqbiases [0:15];
logic [15:0] sqout [0:55*55-1];

initial begin






























outfile = $fopen("./sqnetparams/squeeze1/output/sq1outall.txt","a");
$readmemh("sqnetparams/squeeze1/biases.txt",sqbiases);
$readmemh("sqnetparams/maxpool1/output/maxpoolopall.txt",inpsqueeze);
for (int i=1; i<=16; i++) begin

    filename = $sformatf("sqnetparams/squeeze1/sq1wf%0d.txt",i);         
    $readmemh(filename,squeezeweight);

    filename = $sformatf("sqnetparams/maxpool1/output/maxpool1op%0d.txt",i);         
    $readmemh(filename,maxpoolout);

    sqbias = sqbiases[i-1];

    fire1_squeeze1x1();

    filename = $sformatf("sqnetparams/squeeze1/output/sq1op%0d.txt",i);         
    $writememh(filename,sqout);
    for(int j=0; j<55*55; j++)
        $fdisplay(outfile,"%h",sqout[j]);
end
$fclose(outfile);

end

task conv2d3x3;
logic [31:0] tmp;
for (int i=0;i < 111; i++) begin
    for (int j=0; j < 111; j++) begin
        tmp=bias;
        for (int k=0; k<3; k++) begin
            for (int l=0; l<3; l++) begin
                for (int m=0; m<3; m++) begin
                    a=img[k * 224 * 224 + (i * 2 + l - 0) * 224 + j * 2 + m - 0];
                    b=filter[9*k+3*l+m];
                    #10ns;
                    tmp = tmp + z;
                end
            end
        end
        conv1out[i*111+j] = {tmp[23:16],tmp[15:8]};
    end
end
endtask

task maxpool2d3x3;
reg [15:0] tmp;
reg [15:0] value;


	for(int i = 0; i < 55; i++)
	begin
		for(int j = 0; j < 55; j++)
		begin
            tmp=0;


			for(int k = 0; k < 3; k++)
			begin
				for(int l = 0; l < 3; l++)
				begin
					value = conv1out[(i * 2 + k) * 111  + j * 2 + l ];
                    x = value;
                    y = tmp;
                    #10ns;
                    tmp = c;
                end
            end

            maxpoolout[i*55+j] = tmp;
        end
    end

endtask
task fire1_squeeze1x1;
reg [15:0] tmp1;




	for(int i = 0; i < 55; i++)
	begin
		for(int j = 0; j < 55; j++)
		begin
			tmp1 = sqbias;

			for(int k = 0; k < 64; k++)
			begin
				a = inpsqueeze[k * 55 * 55 + i * 55 + j];
                b = squeezeweight[k];
                #10ns;
                tmp1 = {z[23:16],z[15:8]} + tmp1;
            end



            sqout[i*55 + j] = tmp1;
        end
    end
endtask
endmodule