data/full_repos/permissive/447417093/Adder4_Testbench/testAdder4.v
1: b'%Warning-STMTDLY: data/full_repos/permissive/447417093/Adder4_Testbench/testAdder4.v:91: Unsupported: Ignoring delay on this delayed statement.\n                    #40;  \n                    ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-LITENDIAN: data/full_repos/permissive/447417093/Adder4_Testbench/testAdder4.v:9: Little bit endian vector: MSB < LSB of bit range: 1:11\n    reg [1:N] cin_array;\n        ^\n%Warning-LITENDIAN: data/full_repos/permissive/447417093/Adder4_Testbench/testAdder4.v:12: Little bit endian vector: MSB < LSB of bit range: 1:11\n    reg [1:N] cout_array;\n        ^\n%Warning-WIDTH: data/full_repos/permissive/447417093/Adder4_Testbench/testAdder4.v:93: Operator AND expects 32 bits on the RHS, but RHS\'s EQ generates 1 bits.\n                                                                                     : ... In instance testAdder4\n                    if (!(sum == sum_array[i & cout == cout_array[i]]))\n                                             ^\n%Error: data/full_repos/permissive/447417093/Adder4_Testbench/testAdder4.v:106: Cannot find file containing module: \'Adder4\'\n    Adder4 add4(addend, augend, cin, sum, cout);  \n    ^~~~~~\n        ... Looked in:\n             data/full_repos/permissive/447417093/Adder4_Testbench,data/full_repos/permissive/447417093/Adder4\n             data/full_repos/permissive/447417093/Adder4_Testbench,data/full_repos/permissive/447417093/Adder4.v\n             data/full_repos/permissive/447417093/Adder4_Testbench,data/full_repos/permissive/447417093/Adder4.sv\n             Adder4\n             Adder4.v\n             Adder4.sv\n             obj_dir/Adder4\n             obj_dir/Adder4.v\n             obj_dir/Adder4.sv\n%Error: Exiting due to 1 error(s), 4 warning(s)\n        ... See the manual and https://verilator.org for more assistance.\n'
module testAdder4;
    parameter N = 11;
    reg [3:0] addend;
    reg [3:0] augend ;
    reg cin;
    wire [3:0] sum;
    wire cout;
    reg [3:0] addend_array [1:N];
    reg [1:N] cin_array;
    reg [3:0] augend_array [1:N];
    reg [3:0] sum_array [1:N];
    reg [1:N] cout_array;

    initial
        begin

            addend_array[1] =  4'b0111;
            addend_array[2] =  4'b1101;
            addend_array[3] =  4'b0101;
            addend_array[4] =  4'b1101;
            addend_array[5] =  4'b0111;
            addend_array[6] =  4'b1000;
            addend_array[7] =  4'b0111;
            addend_array[8] =  4'b1000;
            addend_array[9] =  4'b0000;
            addend_array[10] = 4'b1111;
            addend_array[11] = 4'b0000;


            cin_array[1] =  1'b0;
            cin_array[2] =  1'b0;
            cin_array[3] =  1'b0;
            cin_array[4] =  1'b0;
            cin_array[5] =  1'b1;
            cin_array[6] =  1'b0;
            cin_array[7] =  1'b0;
            cin_array[8] =  1'b0;
            cin_array[9] =  1'b1;
            cin_array[10] = 1'b1;
            cin_array[11] = 1'b0;


            augend_array[1] =  4'b0101;
            augend_array[2] =  4'b0101;
            augend_array[3] =  4'b1101;
            augend_array[4] =  4'b1101;
            augend_array[5] =  4'b0111;
            augend_array[6] =  4'b0111;
            augend_array[7] =  4'b1000;
            augend_array[8] =  4'b1000;
            augend_array[9] =  4'b1101;
            augend_array[10] = 4'b1111;
            augend_array[11] = 4'b0000;


            sum_array[1] =  4'b1100;
            sum_array[2] =  4'b0010;
            sum_array[3] =  4'b0010;
            sum_array[4] =  4'b1010;
            sum_array[5] =  4'b1111;
            sum_array[6] =  4'b1111;
            sum_array[7] =  4'b1111;
            sum_array[8] =  4'b0000;
            sum_array[9] =  4'b1110;
            sum_array[10] = 4'b1111;
            sum_array[11] = 4'b0000;


            cout_array[1] =  1'b0;
            cout_array[2] =  1'b1;
            cout_array[3] =  1'b1;
            cout_array[4] =  1'b1;
            cout_array[5] =  1'b0;
            cout_array[6] =  1'b0;
            cout_array[7] =  1'b0;
            cout_array[8] =  1'b1;
            cout_array[9] =  1'b0;
            cout_array[10] = 1'b1;
            cout_array[11] = 1'b0;
        end
    integer i;
    always
        begin
            for ( i = 1 ; i <= N ; i =i + 1 )
                begin
                    $display(i);
                    addend <= addend_array[i];
                    augend <= augend_array[i];
                    cin    <=    cin_array[i];

                    #40;

                    if (!(sum == sum_array[i & cout == cout_array[i]]))
                        begin
                            $write("ERROR: ");
                            $display("Wrong Answer ");
                        end
                    
                    else
                        begin
                          $display("Correct!!");
                        end
                end
            $display("Test Finished");
        end
    Adder4 add4(addend, augend, cin, sum, cout);
endmodule
module testAdder4;

    parameter N = 11;
    reg [3:0] addend;
    reg [3:0] augend ;
    reg cin;
    wire [3:0] sum;
    wire cout;
    reg [3:0] addend_array [1:N];
    reg [1:N] cin_array;
    reg [3:0] augend_array [1:N];
    reg [3:0] sum_array [1:N];
    reg [1:N] cout_array;

    initial
        begin

            addend_array[1] =  4'b0111;
            addend_array[2] =  4'b1101;
            addend_array[3] =  4'b0101;
            addend_array[4] =  4'b1101;
            addend_array[5] =  4'b0111;
            addend_array[6] =  4'b1000;
            addend_array[7] =  4'b0111;
            addend_array[8] =  4'b1000;
            addend_array[9] =  4'b0000;
            addend_array[10] = 4'b1111;
            addend_array[11] = 4'b0000;


            cin_array[1] =  1'b0;
            cin_array[2] =  1'b0;
            cin_array[3] =  1'b0;
            cin_array[4] =  1'b0;
            cin_array[5] =  1'b1;
            cin_array[6] =  1'b0;
            cin_array[7] =  1'b0;
            cin_array[8] =  1'b0;
            cin_array[9] =  1'b1;
            cin_array[10] = 1'b1;
            cin_array[11] = 1'b0;


            augend_array[1] =  4'b0101;
            augend_array[2] =  4'b0101;
            augend_array[3] =  4'b1101;
            augend_array[4] =  4'b1101;
            augend_array[5] =  4'b0111;
            augend_array[6] =  4'b0111;
            augend_array[7] =  4'b1000;
            augend_array[8] =  4'b1000;
            augend_array[9] =  4'b1101;
            augend_array[10] = 4'b1111;
            augend_array[11] = 4'b0000;


            sum_array[1] =  4'b1100;
            sum_array[2] =  4'b0010;
            sum_array[3] =  4'b0010;
            sum_array[4] =  4'b1010;
            sum_array[5] =  4'b1111;
            sum_array[6] =  4'b1111;
            sum_array[7] =  4'b1111;
            sum_array[8] =  4'b0000;
            sum_array[9] =  4'b1110;
            sum_array[10] = 4'b1111;
            sum_array[11] = 4'b0000;


            cout_array[1] =  1'b0;
            cout_array[2] =  1'b1;
            cout_array[3] =  1'b1;
            cout_array[4] =  1'b1;
            cout_array[5] =  1'b0;
            cout_array[6] =  1'b0;
            cout_array[7] =  1'b0;
            cout_array[8] =  1'b1;
            cout_array[9] =  1'b0;
            cout_array[10] = 1'b1;
            cout_array[11] = 1'b0;
        end
    integer i;
    always
        begin
            for ( i = 1 ; i <= N ; i =i + 1 )
                begin
                    $display(i);
                    addend <= addend_array[i];
                    augend <= augend_array[i];
                    cin    <=    cin_array[i];

                    #40;

                    if (!(sum == sum_array[i & cout == cout_array[i]]))
                        begin
                            $write("ERROR: ");
                            $display("Wrong Answer ");
                        end
                    
                    else
                        begin
                          $display("Correct!!");
                        end
                end
            $display("Test Finished");
        end
    Adder4 add4(addend, augend, cin, sum, cout);
endmodule