data/full_repos/permissive/142990562/FPGA Image Process.v/TestBench.v
[Errno 2] No such file or directory: 'preprocess.output'
1: b'%Error: Cannot find file containing module: Image\n        ... Looked in:\n             data/full_repos/permissive/142990562/FPGA/Image\n             data/full_repos/permissive/142990562/FPGA/Image.v\n             data/full_repos/permissive/142990562/FPGA/Image.sv\n             Image\n             Image.v\n             Image.sv\n             obj_dir/Image\n             obj_dir/Image.v\n             obj_dir/Image.sv\n%Error: Cannot find file containing module: Process.v,data/full_repos/permissive/142990562\n%Error: Cannot find file containing module: data/full_repos/permissive/142990562/FPGA\n%Error: Cannot find file containing module: Process.v/TestBench.v\n%Error: Exiting due to 4 error(s)\n'
module TestBench(

    );
    reg clk   ;          
    reg Vsync ;
    reg Hsync ;
    reg DataEn;
    reg [7:0] R,G,B,GS,Dilation,Erosion,InBetween;                                                      
    reg [7:0] PicMem[0:`S-1];
    integer h,l;
    integer PicFile1,PicFile2,PicFile3,PicFile4,PicFile5,PicFile6;
    integer i1 = 0,i2 = 0, n = 0;
    
    GrayOperator3x3 iGrayOperator3x3
    (
     .clk      (clk),         
     .DataEn   (DataEn),
     .PixelData(G),
     .DataOutEn()    
    );
    
    BinaryOperator9x9 iBinaryOperator9x9
    (
     .clk      (clk   ),         
     .DataEn   (DataEn),
     .PixelData(G<128 ),
     .DataOutEn()    
    );
    
    CCAL iCCAL
    (
     .clk       (clk   ),
     .Vsync     (Vsync ),
     .DataEn    (DataEn),
     .BinaryData(G<255 && R<255 && B<255),
     .OtherData (0),
     .DataOutEn (),
     .SumO      (),
     .XMaxO     (),
     .YMaxO     (),
     .XMinO     (),
     .YMinO     ()     
    );         
    
    always #5 clk = ~clk;
    
    initial begin
      clk   = 0;   
      Vsync = 0;
      Hsync = 0;
      DataEn= 0;
      R     = 0;
      G     = 0;
      B     = 0;
    	$readmemh("tb1.txt",PicMem);
    	PicFile6 = $fopen("CCAL.txt","w");
    	SimInput;
    	SimInput;
    	
    	$fclose(PicFile1);              
    	$fclose(PicFile2);
    	$fclose(PicFile3);              
    	$fclose(PicFile4);
    	$fclose(PicFile5);
    	$fclose(PicFile6);
    	$finish; 
    end
    
    task SimInput;
    begin
    	#777; 
      @(posedge clk);
      #1;
	  	Vsync = 1;
	  	repeat(6) @(posedge clk);
	  	for(l=0;l<`H;l=l+1)
	  	begin	  		
	  		Hsync = 1;
	  		repeat(5) @(posedge clk);             
	  		for(h=0;h<`W;h=h+1)  
	  		begin 
	  			#1;
	  			DataEn = 1;
	  			R = PicMem[l*`W*3 + h*3]; G = PicMem[l*`W*3 + h*3 + 1]; B = PicMem[l*`W*3 + h*3 + 2];
	  			@(posedge clk);
	  		end  
	  		#1;                  
	  		DataEn = 0;
	  		R = 0; G = 0; B = 0;  
	  		repeat(7) @(posedge clk); 
	  		Hsync = 0;
	  		if(l<`H-1)
	  		  repeat(152) @(posedge clk);
	  		else
	  		  repeat(6) @(posedge clk);
	  	end 
	  	Vsync = 0;
      #111;
      
    end
    endtask
    
    always@(posedge Vsync)                     
      n <= n + 1;
    
    always@(negedge iCCAL.DataOutEn)
      if(n == 1)
      begin
        $display("FPGA: Sum: %d XYmax: [%d,%d] XYmin: [%d,%d]\n",iCCAL.SumO,iCCAL.XMaxO,iCCAL.YMaxO,iCCAL.XMinO,iCCAL.YMinO); 
        $fwrite(PicFile6,"FPGA: Sum: %d XYmax: [%d,%d] XYmin: [%d,%d]\n",iCCAL.SumO,iCCAL.XMaxO,iCCAL.YMaxO,iCCAL.XMinO,iCCAL.YMinO);
      end
                                                               

    initial                                                    
    begin                                                      
      PicFile1 = $fopen("GaussianBlur.txt","w");
      PicFile2 = $fopen("Sobel.txt","w");
      $fwrite(PicFile1,"%h %h\n",`W,`H);
      $fwrite(PicFile2,"%h %h\n",`W,`H);
      @(posedge iGrayOperator3x3.DataOutEn);
      for(i1 = 0; i1 < `H; i1 = i1 + 1)
      begin
        @(posedge iGrayOperator3x3.DataOutEn)
        while(iGrayOperator3x3.DataOutEn == 1)
        begin
        	@(posedge clk); 
        	GS = iGrayOperator3x3.GaussianBlur;
        	$fwrite(PicFile1,"%H %H %H  ",GS, GS, GS); 
        	if(iGrayOperator3x3.Sobel == 0)
        	  $fwrite(PicFile2,"%H %H %H  ", GS, GS, GS);
        	else        
        	  $fwrite(PicFile2,"%H %H %H  ", 8'h0, 8'h0, 8'hff);
        end     
          $fwrite(PicFile1,"\n");  
          $fwrite(PicFile2,"\n");
      end   
    end
    

    initial 
    begin 
      PicFile3 = $fopen("Dilation.txt" ,"w");  
      PicFile4 = $fopen("Erosion.txt"  ,"w");    
      PicFile5 = $fopen("InBetween.txt","w");      
      $fwrite(PicFile3,"%h %h\n",`W,`H);
      $fwrite(PicFile4,"%h %h\n",`W,`H);
      $fwrite(PicFile5,"%h %h\n",`W,`H);
      repeat(4) @(posedge iBinaryOperator9x9.DataOutEn);
      for(i2 = 0; i2 < `H; i2 = i2 + 1)
      begin
        @(posedge iBinaryOperator9x9.DataOutEn)
        while(iBinaryOperator9x9.DataOutEn == 1)
        begin
        	@(posedge clk); 
        	Dilation  = iBinaryOperator9x9.Dilation  ? 8'h0 : 8'hff; 
        	Erosion   = iBinaryOperator9x9.Erosion   ? 8'h0 : 8'hff;
        	InBetween = iBinaryOperator9x9.InBetween ? 8'h0 : 8'hff;
        	$fwrite(PicFile3,"%H %H %H  ",Dilation , Dilation , Dilation ); 
        	$fwrite(PicFile4,"%H %H %H  ",Erosion  , Erosion  , Erosion  ); 
        	$fwrite(PicFile5,"%H %H %H  ",InBetween, InBetween, InBetween);  		
        end     
          $fwrite(PicFile3,"\n");  
          $fwrite(PicFile4,"\n");
          $fwrite(PicFile5,"\n");
      end 
    end  
    
endmodule
module TestBench(

    );

    reg clk   ;          
    reg Vsync ;
    reg Hsync ;
    reg DataEn;
    reg [7:0] R,G,B,GS,Dilation,Erosion,InBetween;                                                      
    reg [7:0] PicMem[0:`S-1];
    integer h,l;
    integer PicFile1,PicFile2,PicFile3,PicFile4,PicFile5,PicFile6;
    integer i1 = 0,i2 = 0, n = 0;
    
    GrayOperator3x3 iGrayOperator3x3
    (
     .clk      (clk),         
     .DataEn   (DataEn),
     .PixelData(G),
     .DataOutEn()    
    );
    
    BinaryOperator9x9 iBinaryOperator9x9
    (
     .clk      (clk   ),         
     .DataEn   (DataEn),
     .PixelData(G<128 ),
     .DataOutEn()    
    );
    
    CCAL iCCAL
    (
     .clk       (clk   ),
     .Vsync     (Vsync ),
     .DataEn    (DataEn),
     .BinaryData(G<255 && R<255 && B<255),
     .OtherData (0),
     .DataOutEn (),
     .SumO      (),
     .XMaxO     (),
     .YMaxO     (),
     .XMinO     (),
     .YMinO     ()     
    );         
    
    always #5 clk = ~clk;
    
    initial begin
      clk   = 0;   
      Vsync = 0;
      Hsync = 0;
      DataEn= 0;
      R     = 0;
      G     = 0;
      B     = 0;
    	$readmemh("tb1.txt",PicMem);
    	PicFile6 = $fopen("CCAL.txt","w");
    	SimInput;
    	SimInput;
    	
    	$fclose(PicFile1);              
    	$fclose(PicFile2);
    	$fclose(PicFile3);              
    	$fclose(PicFile4);
    	$fclose(PicFile5);
    	$fclose(PicFile6);
    	$finish; 
    end
    
    task SimInput;
    begin
    	#777; 
      @(posedge clk);
      #1;
	  	Vsync = 1;
	  	repeat(6) @(posedge clk);
	  	for(l=0;l<`H;l=l+1)
	  	begin	  		
	  		Hsync = 1;
	  		repeat(5) @(posedge clk);             
	  		for(h=0;h<`W;h=h+1)  
	  		begin 
	  			#1;
	  			DataEn = 1;
	  			R = PicMem[l*`W*3 + h*3]; G = PicMem[l*`W*3 + h*3 + 1]; B = PicMem[l*`W*3 + h*3 + 2];
	  			@(posedge clk);
	  		end  
	  		#1;                  
	  		DataEn = 0;
	  		R = 0; G = 0; B = 0;  
	  		repeat(7) @(posedge clk); 
	  		Hsync = 0;
	  		if(l<`H-1)
	  		  repeat(152) @(posedge clk);
	  		else
	  		  repeat(6) @(posedge clk);
	  	end 
	  	Vsync = 0;
      #111;
      
    end
    endtask
    
    always@(posedge Vsync)                     
      n <= n + 1;
    
    always@(negedge iCCAL.DataOutEn)
      if(n == 1)
      begin
        $display("FPGA: Sum: %d XYmax: [%d,%d] XYmin: [%d,%d]\n",iCCAL.SumO,iCCAL.XMaxO,iCCAL.YMaxO,iCCAL.XMinO,iCCAL.YMinO); 
        $fwrite(PicFile6,"FPGA: Sum: %d XYmax: [%d,%d] XYmin: [%d,%d]\n",iCCAL.SumO,iCCAL.XMaxO,iCCAL.YMaxO,iCCAL.XMinO,iCCAL.YMinO);
      end
                                                               

    initial                                                    
    begin                                                      
      PicFile1 = $fopen("GaussianBlur.txt","w");
      PicFile2 = $fopen("Sobel.txt","w");
      $fwrite(PicFile1,"%h %h\n",`W,`H);
      $fwrite(PicFile2,"%h %h\n",`W,`H);
      @(posedge iGrayOperator3x3.DataOutEn);
      for(i1 = 0; i1 < `H; i1 = i1 + 1)
      begin
        @(posedge iGrayOperator3x3.DataOutEn)
        while(iGrayOperator3x3.DataOutEn == 1)
        begin
        	@(posedge clk); 
        	GS = iGrayOperator3x3.GaussianBlur;
        	$fwrite(PicFile1,"%H %H %H  ",GS, GS, GS); 
        	if(iGrayOperator3x3.Sobel == 0)
        	  $fwrite(PicFile2,"%H %H %H  ", GS, GS, GS);
        	else        
        	  $fwrite(PicFile2,"%H %H %H  ", 8'h0, 8'h0, 8'hff);
        end     
          $fwrite(PicFile1,"\n");  
          $fwrite(PicFile2,"\n");
      end   
    end
    

    initial 
    begin 
      PicFile3 = $fopen("Dilation.txt" ,"w");  
      PicFile4 = $fopen("Erosion.txt"  ,"w");    
      PicFile5 = $fopen("InBetween.txt","w");      
      $fwrite(PicFile3,"%h %h\n",`W,`H);
      $fwrite(PicFile4,"%h %h\n",`W,`H);
      $fwrite(PicFile5,"%h %h\n",`W,`H);
      repeat(4) @(posedge iBinaryOperator9x9.DataOutEn);
      for(i2 = 0; i2 < `H; i2 = i2 + 1)
      begin
        @(posedge iBinaryOperator9x9.DataOutEn)
        while(iBinaryOperator9x9.DataOutEn == 1)
        begin
        	@(posedge clk); 
        	Dilation  = iBinaryOperator9x9.Dilation  ? 8'h0 : 8'hff; 
        	Erosion   = iBinaryOperator9x9.Erosion   ? 8'h0 : 8'hff;
        	InBetween = iBinaryOperator9x9.InBetween ? 8'h0 : 8'hff;
        	$fwrite(PicFile3,"%H %H %H  ",Dilation , Dilation , Dilation ); 
        	$fwrite(PicFile4,"%H %H %H  ",Erosion  , Erosion  , Erosion  ); 
        	$fwrite(PicFile5,"%H %H %H  ",InBetween, InBetween, InBetween);  		
        end     
          $fwrite(PicFile3,"\n");  
          $fwrite(PicFile4,"\n");
          $fwrite(PicFile5,"\n");
      end 
    end  
    
endmodule