data/full_repos/permissive/517427004/CA1 - Linear Regression/Verilog/Linear_regression_TB.v
1: b'%Error: Invalid Option: -\n'
module Linear_regression_TB();
    wire [19:0] b0, b1, err;
    wire ready, errDone;

    reg [19:0] x, y;
    reg start = 1'b0, clk = 1'b0, rst = 1'b0;

    reg [19:0] memX [0:149];
    reg [19:0] memY [0:149];
    reg [19:0] errs [0:149];

    integer i;
    integer xFile, errFile;

    Linear_regression linear_regression(x, y, start, clk, rst, b0, b1, err, ready, errDone);

    always #5 clk = ~clk;

    initial begin




        $readmemb("x_value.txt", memX);
        $readmemb("y_value.txt", memY);

        #5 start = 1'b1;
        #10 while (~ready) #10;
        start = 1'b0;

        for (i = 0; i < 150; i = i + 1) begin: SendData
            x = memX[i];
            y = memY[i];
            #20;
        end

        for (i = 0; i < 150; i = i + 1) begin: GetErrors
            while (~errDone) #10;
            errs[i] = err;
            #10;
        end


        errFile = $fopen("error_value.txt", "wb");
        for (i = 0; i < 150; i = i + 1) begin: SaveErrors

            $fdisplayb(errFile, errs[i]);
        end
        $fclose(errFile);

        $finish;
    end
endmodule
module Linear_regression_TB();

    wire [19:0] b0, b1, err;
    wire ready, errDone;

    reg [19:0] x, y;
    reg start = 1'b0, clk = 1'b0, rst = 1'b0;

    reg [19:0] memX [0:149];
    reg [19:0] memY [0:149];
    reg [19:0] errs [0:149];

    integer i;
    integer xFile, errFile;

    Linear_regression linear_regression(x, y, start, clk, rst, b0, b1, err, ready, errDone);

    always #5 clk = ~clk;

    initial begin




        $readmemb("x_value.txt", memX);
        $readmemb("y_value.txt", memY);

        #5 start = 1'b1;
        #10 while (~ready) #10;
        start = 1'b0;

        for (i = 0; i < 150; i = i + 1) begin: SendData
            x = memX[i];
            y = memY[i];
            #20;
        end

        for (i = 0; i < 150; i = i + 1) begin: GetErrors
            while (~errDone) #10;
            errs[i] = err;
            #10;
        end


        errFile = $fopen("error_value.txt", "wb");
        for (i = 0; i < 150; i = i + 1) begin: SaveErrors

            $fdisplayb(errFile, errs[i]);
        end
        $fclose(errFile);

        $finish;
    end
endmodule