data/full_repos/permissive/471766415/src/sphere.v
1: b'%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:19: Operator SUB expects 15 bits on the LHS, but LHS\'s VARREF \'compr_hrw\' generates 7 bits.\n                                                                    : ... In instance sphere_renderer\n    assign pmulvire2 = (compr_hrw - current_h);\n                                  ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:19: Operator SUB expects 15 bits on the RHS, but RHS\'s VARREF \'current_h\' generates 7 bits.\n                                                                    : ... In instance sphere_renderer\n    assign pmulvire2 = (compr_hrw - current_h);\n                                  ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:20: Operator SUB expects 15 bits on the LHS, but LHS\'s VARREF \'compr_vrw\' generates 7 bits.\n                                                                    : ... In instance sphere_renderer\n    assign pmulvire1 = (compr_vrw - current_v);\n                                  ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:20: Operator SUB expects 15 bits on the RHS, but RHS\'s VARREF \'current_v\' generates 7 bits.\n                                                                    : ... In instance sphere_renderer\n    assign pmulvire1 = (compr_vrw - current_v);\n                                  ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:26: Operator ASSIGNW expects 21 bits on the Assign RHS, but Assign RHS\'s CONST \'12\'h20\' generates 12 bits.\n                                                                    : ... In instance sphere_renderer\n    wire [20:0] ballsize = 12\'d32;\n                         ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:41: Operator LT expects 32 or 21 bits on the LHS, but LHS\'s VARREF \'acc\' generates 15 bits.\n                                                                    : ... In instance sphere_renderer\n            colorv <= ballsize + 16 > acc ? 4\'b1111 : acc < ballsize + 128 ? 16 - (acc - ballsize) / 8 : 4\'b0000;\n                                                          ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:41: Operator COND expects 32 or 21 bits on the Conditional True, but Conditional True\'s CONST \'4\'hf\' generates 4 bits.\n                                                                    : ... In instance sphere_renderer\n            colorv <= ballsize + 16 > acc ? 4\'b1111 : acc < ballsize + 128 ? 16 - (acc - ballsize) / 8 : 4\'b0000;\n                                          ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:41: Operator SUB expects 32 or 21 bits on the LHS, but LHS\'s VARREF \'acc\' generates 15 bits.\n                                                                    : ... In instance sphere_renderer\n            colorv <= ballsize + 16 > acc ? 4\'b1111 : acc < ballsize + 128 ? 16 - (acc - ballsize) / 8 : 4\'b0000;\n                                                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:41: Operator COND expects 32 or 21 bits on the Conditional False, but Conditional False\'s CONST \'4\'h0\' generates 4 bits.\n                                                                    : ... In instance sphere_renderer\n            colorv <= ballsize + 16 > acc ? 4\'b1111 : acc < ballsize + 128 ? 16 - (acc - ballsize) / 8 : 4\'b0000;\n                                                                           ^\n%Warning-WIDTH: data/full_repos/permissive/471766415/src/sphere.v:41: Operator ASSIGNDLY expects 4 bits on the Assign RHS, but Assign RHS\'s COND generates 32 or 21 bits.\n                                                                    : ... In instance sphere_renderer\n            colorv <= ballsize + 16 > acc ? 4\'b1111 : acc < ballsize + 128 ? 16 - (acc - ballsize) / 8 : 4\'b0000;\n                   ^~\n%Error: Exiting due to 10 warning(s)\n'
module sphere_renderer(
    input wire clk,
    input wire reset,
    input wire [6:0] compr_hrw,
    input wire [6:0] compr_vrw,
    output reg [3:0] colorv,
    input wire startv,
    input wire starth,
    input wire [20:0] top
);

    reg [6:0] current_h;
    reg [6:0] current_v;

    wire [14:0] pmulvire2;
    wire [14:0] pmulvire1;
        
    
    assign pmulvire2 = (compr_hrw - current_h);
    assign pmulvire1 = (compr_vrw - current_v);

    wire [14:0] acc;
    assign acc = pmulvire2 * pmulvire2 + pmulvire1 * pmulvire1;


    wire [20:0] ballsize = 12'd32;
    reg deltav;
    reg deltah;

    reg [20:0] spdcnt;
    

    always @(posedge clk) begin
        if (!reset) begin
            current_h <= 7'd32;
            current_v <= 7'd32;
            deltav <= startv;
            deltah <= starth;
            spdcnt <= 21'b0;
        end else begin
            colorv <= ballsize + 16 > acc ? 4'b1111 : acc < ballsize + 128 ? 16 - (acc - ballsize) / 8 : 4'b0000;
            if (spdcnt == top) begin
                spdcnt <= spdcnt + 1'b1;
                if (current_v < 10) begin
                    deltav <= 1'b1;
                end
                if (current_h < 10) begin
                    deltah <= 1'b1;
                end
                if (current_v > (60 - 10)) begin
                    deltav <= 1'b0;
                end
                if (current_h > (80 - 10)) begin
                    deltah <= 1'b0;
                end
            end else if (spdcnt > top) begin
                if (deltav) begin
                    current_v <= current_v + 1'b1;
                end else begin
                    current_v <= current_v - 1'b1;
                end

                if (deltah) begin
                    current_h <= current_h + 1'b1;
                end else begin
                    current_h <= current_h - 1'b1;
                end

                spdcnt <= 0;
            end else begin
                spdcnt <= spdcnt + 1'b1;
            end
        end
    end

endmodule
module sphere_renderer(
    input wire clk,
    input wire reset,
    input wire [6:0] compr_hrw,
    input wire [6:0] compr_vrw,
    output reg [3:0] colorv,
    input wire startv,
    input wire starth,
    input wire [20:0] top
);


    reg [6:0] current_h;
    reg [6:0] current_v;

    wire [14:0] pmulvire2;
    wire [14:0] pmulvire1;
        
    
    assign pmulvire2 = (compr_hrw - current_h);
    assign pmulvire1 = (compr_vrw - current_v);

    wire [14:0] acc;
    assign acc = pmulvire2 * pmulvire2 + pmulvire1 * pmulvire1;


    wire [20:0] ballsize = 12'd32;
    reg deltav;
    reg deltah;

    reg [20:0] spdcnt;
    

    always @(posedge clk) begin
        if (!reset) begin
            current_h <= 7'd32;
            current_v <= 7'd32;
            deltav <= startv;
            deltah <= starth;
            spdcnt <= 21'b0;
        end else begin
            colorv <= ballsize + 16 > acc ? 4'b1111 : acc < ballsize + 128 ? 16 - (acc - ballsize) / 8 : 4'b0000;
            if (spdcnt == top) begin
                spdcnt <= spdcnt + 1'b1;
                if (current_v < 10) begin
                    deltav <= 1'b1;
                end
                if (current_h < 10) begin
                    deltah <= 1'b1;
                end
                if (current_v > (60 - 10)) begin
                    deltav <= 1'b0;
                end
                if (current_h > (80 - 10)) begin
                    deltah <= 1'b0;
                end
            end else if (spdcnt > top) begin
                if (deltav) begin
                    current_v <= current_v + 1'b1;
                end else begin
                    current_v <= current_v - 1'b1;
                end

                if (deltah) begin
                    current_h <= current_h + 1'b1;
                end else begin
                    current_h <= current_h - 1'b1;
                end

                spdcnt <= 0;
            end else begin
                spdcnt <= spdcnt + 1'b1;
            end
        end
    end

endmodule