data/full_repos/permissive/175132042/tasks/test_tasks.v
None: at end of input
1: b'%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:11: Cannot find include file: timescale.v\n`include "timescale.v" \n         ^~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/175132042/tasks,data/full_repos/permissive/175132042/timescale.v\n             data/full_repos/permissive/175132042/tasks,data/full_repos/permissive/175132042/timescale.v.v\n             data/full_repos/permissive/175132042/tasks,data/full_repos/permissive/175132042/timescale.v.sv\n             timescale.v\n             timescale.v.v\n             timescale.v.sv\n             obj_dir/timescale.v\n             obj_dir/timescale.v.v\n             obj_dir/timescale.v.sv\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:12: Cannot find include file: simulation_includes.vh\n`include "simulation_includes.vh" \n         ^~~~~~~~~~~~~~~~~~~~~~~~\n%Warning-STMTDLY: data/full_repos/permissive/175132042/tasks/test_tasks.v:25: Unsupported: Ignoring delay on this delayed statement.\n      #10 $finish;      \n      ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/175132042/tasks/test_tasks.v:31: Unsupported: Ignoring delay on this delayed statement.\n      #100 $finish;      \n      ^\n%Warning-STMTDLY: data/full_repos/permissive/175132042/tasks/test_tasks.v:38: Unsupported: Ignoring delay on this delayed statement.\n      #50000000;\n      ^\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:54: Define or directive not defined: \'`NUMBER_OF_TESTS\'\n         if (`NUMBER_OF_TESTS == test_count) begin\n             ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:54: syntax error, unexpected ==, expecting TYPE-IDENTIFIER\n         if (`NUMBER_OF_TESTS == test_count) begin\n                              ^~\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:55: Define or directive not defined: \'`TEST_PASSED\'\n            `TEST_PASSED <= 1;            \n            ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:57: Define or directive not defined: \'`NUMBER_OF_TESTS\'\n            $display("INCORRECT NUMBER OF TESTS! Exp: %d  Ran: %d", `NUMBER_OF_TESTS, test_count);\n                                                                    ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:58: Define or directive not defined: \'`TEST_FAILED\'\n            `TEST_FAILED <= 1;            \n            ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:85: Define or directive not defined: \'`TEST_FAILED\'\n            `TEST_FAILED <= 1\'b1;            \n            ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:85: syntax error, unexpected <=\n            `TEST_FAILED <= 1\'b1;            \n                         ^~\n%Warning-STMTDLY: data/full_repos/permissive/175132042/tasks/test_tasks.v:90: Unsupported: Ignoring delay on this delayed statement.\n               #1 display_results(display_string, expected, measured);\n               ^\n%Warning-STMTDLY: data/full_repos/permissive/175132042/tasks/test_tasks.v:93: Unsupported: Ignoring delay on this delayed statement.\n               #1 display_results(display_string, expected, measured);\n               ^\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:121: Define or directive not defined: \'`TEST_FAILED\'\n            `TEST_FAILED <= 1;         \n            ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/175132042/tasks/test_tasks.v:121: syntax error, unexpected <=\n            `TEST_FAILED <= 1;         \n                         ^~\n%Error: Exiting due to 11 error(s), 5 warning(s)\n'
module test_tasks () ;

   reg test_case_fail = 1;
   
   reg test_passed = 1'b0;
   reg test_failed = 1'b0;
   integer test_count = 0;
   
   always @(posedge test_passed) begin
      $display("--------------------------------------------------------------------------------------------");
      $display("\n\n\033[1;32mTEST PASSED\033[0m  @ %d", $time);
      #10 $finish;      
   end

   always @(posedge test_failed) begin
      $display("--------------------------------------------------------------------------------------------");
      $display("\n\033[1;31m***** TEST FAILED *****\033[0m @ %d\n", $time);
      #100 $finish;      
   end




   initial begin
      #50000000;
      $display("TEST CASE TIMEOUT @ %d", $time);      
      test_failed <= 1'b1;      
   end
   

   task all_tests_completed;
      begin
         if (`NUMBER_OF_TESTS == test_count) begin
            `TEST_PASSED <= 1;            
         end else begin
            $display("INCORRECT NUMBER OF TESTS! Exp: %d  Ran: %d", `NUMBER_OF_TESTS, test_count);
            `TEST_FAILED <= 1;            
         end
      end
   endtask


   task compare_values;
      input [8*32:1] display_string;
      input [31:0]   expected;
      input [31:0]   measured;

      begin

         if (|measured == 1'bX) begin
            display_results("Data is X", expected, measured);
            `TEST_FAILED <= 1'b1;            
         end else begin
            if (expected !== measured) begin
               test_case_fail <= 1;               

               #1 display_results(display_string, expected, measured);
            end else begin
               test_case_fail <= 0;               
               #1 display_results(display_string, expected, measured);
            end
         end
      end      
   endtask 
   

   task display_results;
      input [8*80:1] display_string;
      input [31:0]   expected;
      input [31:0]   measured;

      reg [17*8-1:0]     pass_fail;
      
      begin
         if (test_case_fail) begin
            pass_fail = "\033[1;31mFAIL\033[0m";
            `TEST_FAILED <= 1;         
         end else begin
            pass_fail = "\033[1;32mPASS\033[0m";
         end


         while (display_string[8*35:8*35-7] == 8'h00)begin            
            display_string = {display_string," "};
         end
         
         if (test_count == 0) begin
            $display("--------------------------------------------------------------------------------------------");
            $display("|TIME     |Test|Test Case  \t\t\t\t|Expected   |\tMeasured   | State |"); 
            $display("--------------------------------------------------------------------------------------------");
         end
         
         test_count <= test_count + 1;         
         $display("|%8d |%4d|%0s \t|0x%8h |\t0x%8h |%s |", $time-1, test_count, display_string, expected, measured, pass_fail);
         if (((test_count %10) == 0) && test_count >0) begin
            $display("--------------------------------------------------------------------------------------------");
         end

         
      end
      
   endtask
   
   
endmodule
module test_tasks () ;


   reg test_case_fail = 1;
   
   reg test_passed = 1'b0;
   reg test_failed = 1'b0;
   integer test_count = 0;
   
   always @(posedge test_passed) begin
      $display("--------------------------------------------------------------------------------------------");
      $display("\n\n\033[1;32mTEST PASSED\033[0m  @ %d", $time);
      #10 $finish;      
   end

   always @(posedge test_failed) begin
      $display("--------------------------------------------------------------------------------------------");
      $display("\n\033[1;31m***** TEST FAILED *****\033[0m @ %d\n", $time);
      #100 $finish;      
   end




   initial begin
      #50000000;
      $display("TEST CASE TIMEOUT @ %d", $time);      
      test_failed <= 1'b1;      
   end
   

   task all_tests_completed;
      begin
         if (`NUMBER_OF_TESTS == test_count) begin
            `TEST_PASSED <= 1;            
         end else begin
            $display("INCORRECT NUMBER OF TESTS! Exp: %d  Ran: %d", `NUMBER_OF_TESTS, test_count);
            `TEST_FAILED <= 1;            
         end
      end
   endtask


   task compare_values;
      input [8*32:1] display_string;
      input [31:0]   expected;
      input [31:0]   measured;

      begin

         if (|measured == 1'bX) begin
            display_results("Data is X", expected, measured);
            `TEST_FAILED <= 1'b1;            
         end else begin
            if (expected !== measured) begin
               test_case_fail <= 1;               

               #1 display_results(display_string, expected, measured);
            end else begin
               test_case_fail <= 0;               
               #1 display_results(display_string, expected, measured);
            end
         end
      end      
   endtask 
   

   task display_results;
      input [8*80:1] display_string;
      input [31:0]   expected;
      input [31:0]   measured;

      reg [17*8-1:0]     pass_fail;
      
      begin
         if (test_case_fail) begin
            pass_fail = "\033[1;31mFAIL\033[0m";
            `TEST_FAILED <= 1;         
         end else begin
            pass_fail = "\033[1;32mPASS\033[0m";
         end


         while (display_string[8*35:8*35-7] == 8'h00)begin            
            display_string = {display_string," "};
         end
         
         if (test_count == 0) begin
            $display("--------------------------------------------------------------------------------------------");
            $display("|TIME     |Test|Test Case  \t\t\t\t|Expected   |\tMeasured   | State |"); 
            $display("--------------------------------------------------------------------------------------------");
         end
         
         test_count <= test_count + 1;         
         $display("|%8d |%4d|%0s \t|0x%8h |\t0x%8h |%s |", $time-1, test_count, display_string, expected, measured, pass_fail);
         if (((test_count %10) == 0) && test_count >0) begin
            $display("--------------------------------------------------------------------------------------------");
         end

         
      end
      
   endtask
   
   
endmodule