data/full_repos/permissive/107757225/vga/ball.sv
 line:24: before: ","
1: b'%Warning-WIDTH: data/full_repos/permissive/107757225/vga/ball.sv:25: Operator SUB expects 32 bits on the LHS, but LHS\'s VARREF \'DrawX\' generates 10 bits.\n                                                                   : ... In instance ball\n    assign DistX = DrawX - Ball_X_Pos;\n                         ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/107757225/vga/ball.sv:25: Operator SUB expects 32 bits on the RHS, but RHS\'s VARREF \'Ball_X_Pos\' generates 10 bits.\n                                                                   : ... In instance ball\n    assign DistX = DrawX - Ball_X_Pos;\n                         ^\n%Warning-WIDTH: data/full_repos/permissive/107757225/vga/ball.sv:26: Operator SUB expects 32 bits on the LHS, but LHS\'s VARREF \'DrawY\' generates 10 bits.\n                                                                   : ... In instance ball\n    assign DistY = DrawY - Ball_Y_Pos;\n                         ^\n%Warning-WIDTH: data/full_repos/permissive/107757225/vga/ball.sv:26: Operator SUB expects 32 bits on the RHS, but RHS\'s VARREF \'Ball_Y_Pos\' generates 10 bits.\n                                                                   : ... In instance ball\n    assign DistY = DrawY - Ball_Y_Pos;\n                         ^\n%Warning-WIDTH: data/full_repos/permissive/107757225/vga/ball.sv:27: Operator ASSIGNW expects 32 bits on the Assign RHS, but Assign RHS\'s VARREF \'Ball_Size\' generates 10 bits.\n                                                                   : ... In instance ball\n    assign Size = Ball_Size;\n                ^\n%Error: Exiting due to 5 warning(s)\n'
module  ball ( input         Clk, Reset,
                             frame_clk,
               input [9:0]   DrawX, DrawY,
               input [7:0]   keycode,
               output logic  is_ball
              );

    parameter [9:0] Ball_X_Center=320;
    parameter [9:0] Ball_Y_Center=240;
    parameter [9:0] Ball_X_Min=0;
    parameter [9:0] Ball_X_Max=639;
    parameter [9:0] Ball_Y_Min=0;
    parameter [9:0] Ball_Y_Max=479;
    parameter [9:0] Ball_X_Step=1;
    parameter [9:0] Ball_Y_Step=1;
    parameter [9:0] Ball_Size=4;
    
    logic [9:0] Ball_X_Pos, Ball_X_Motion, Ball_Y_Pos, Ball_Y_Motion;
    logic [9:0] Ball_X_Pos_in, Ball_X_Motion_in, Ball_Y_Pos_in, Ball_Y_Motion_in;
    

    int DistX, DistY, Size;
    assign DistX = DrawX - Ball_X_Pos;
    assign DistY = DrawY - Ball_Y_Pos;
    assign Size = Ball_Size;
    


    logic frame_clk_delayed;
    logic frame_clk_rising_edge;
    always_ff @ (posedge Clk) begin
        frame_clk_delayed <= frame_clk;
    end
    assign frame_clk_rising_edge = (frame_clk == 1'b1) && (frame_clk_delayed == 1'b0);

    always_ff @ (posedge Clk)
    begin
        if (Reset)
        begin
            Ball_X_Pos <= Ball_X_Center;
            Ball_Y_Pos <= Ball_Y_Center;
            Ball_X_Motion <= 10'd0;
            Ball_Y_Motion <= Ball_Y_Step;
        end
        else if (frame_clk_rising_edge)
        begin
            Ball_X_Pos <= Ball_X_Pos_in;
            Ball_Y_Pos <= Ball_Y_Pos_in;
            Ball_X_Motion <= Ball_X_Motion_in;
            Ball_Y_Motion <= Ball_Y_Motion_in;
        end

    end
    

    always_comb
    begin

        Ball_X_Pos_in = Ball_X_Pos + Ball_X_Motion;
        Ball_Y_Pos_in = Ball_Y_Pos + Ball_Y_Motion;
    

        Ball_X_Motion_in = Ball_X_Motion;
        Ball_Y_Motion_in = Ball_Y_Motion;









        if( Ball_X_Pos + Ball_Size >= Ball_X_Max )
        begin
            Ball_Y_Motion_in = 10'b0;
            Ball_X_Motion_in = (~(Ball_X_Step) + 1'b1);
        end
        else if ( Ball_X_Pos <= Ball_X_Min + Ball_Size )
        begin
            Ball_Y_Motion_in = 10'b0;
            Ball_X_Motion_in = Ball_X_Step;
        end






        if( Ball_Y_Pos - Ball_Size >= Ball_Y_Max )
        begin
            Ball_X_Motion_in = 10'b0;
            Ball_Y_Motion_in = (~(Ball_Y_Step) + 1'b1);
        end
        else if ( Ball_Y_Pos <= Ball_Y_Min + Ball_Size )
        begin
            Ball_X_Motion_in = 10'b0;
            Ball_Y_Motion_in = Ball_Y_Step;
        end
   

        if ( ( DistX*DistX + DistY*DistY) <= (Size * Size) ) 
            is_ball = 1'b0;
        else
            is_ball = 1'b0;
    end
    
endmodule
module  ball ( input         Clk, Reset,
                             frame_clk,
               input [9:0]   DrawX, DrawY,
               input [7:0]   keycode,
               output logic  is_ball
              );


    parameter [9:0] Ball_X_Center=320;
    parameter [9:0] Ball_Y_Center=240;
    parameter [9:0] Ball_X_Min=0;
    parameter [9:0] Ball_X_Max=639;
    parameter [9:0] Ball_Y_Min=0;
    parameter [9:0] Ball_Y_Max=479;
    parameter [9:0] Ball_X_Step=1;
    parameter [9:0] Ball_Y_Step=1;
    parameter [9:0] Ball_Size=4;
    
    logic [9:0] Ball_X_Pos, Ball_X_Motion, Ball_Y_Pos, Ball_Y_Motion;
    logic [9:0] Ball_X_Pos_in, Ball_X_Motion_in, Ball_Y_Pos_in, Ball_Y_Motion_in;
    

    int DistX, DistY, Size;
    assign DistX = DrawX - Ball_X_Pos;
    assign DistY = DrawY - Ball_Y_Pos;
    assign Size = Ball_Size;
    


    logic frame_clk_delayed;
    logic frame_clk_rising_edge;
    always_ff @ (posedge Clk) begin
        frame_clk_delayed <= frame_clk;
    end
    assign frame_clk_rising_edge = (frame_clk == 1'b1) && (frame_clk_delayed == 1'b0);

    always_ff @ (posedge Clk)
    begin
        if (Reset)
        begin
            Ball_X_Pos <= Ball_X_Center;
            Ball_Y_Pos <= Ball_Y_Center;
            Ball_X_Motion <= 10'd0;
            Ball_Y_Motion <= Ball_Y_Step;
        end
        else if (frame_clk_rising_edge)
        begin
            Ball_X_Pos <= Ball_X_Pos_in;
            Ball_Y_Pos <= Ball_Y_Pos_in;
            Ball_X_Motion <= Ball_X_Motion_in;
            Ball_Y_Motion <= Ball_Y_Motion_in;
        end

    end
    

    always_comb
    begin

        Ball_X_Pos_in = Ball_X_Pos + Ball_X_Motion;
        Ball_Y_Pos_in = Ball_Y_Pos + Ball_Y_Motion;
    

        Ball_X_Motion_in = Ball_X_Motion;
        Ball_Y_Motion_in = Ball_Y_Motion;









        if( Ball_X_Pos + Ball_Size >= Ball_X_Max )
        begin
            Ball_Y_Motion_in = 10'b0;
            Ball_X_Motion_in = (~(Ball_X_Step) + 1'b1);
        end
        else if ( Ball_X_Pos <= Ball_X_Min + Ball_Size )
        begin
            Ball_Y_Motion_in = 10'b0;
            Ball_X_Motion_in = Ball_X_Step;
        end






        if( Ball_Y_Pos - Ball_Size >= Ball_Y_Max )
        begin
            Ball_X_Motion_in = 10'b0;
            Ball_Y_Motion_in = (~(Ball_Y_Step) + 1'b1);
        end
        else if ( Ball_Y_Pos <= Ball_Y_Min + Ball_Size )
        begin
            Ball_X_Motion_in = 10'b0;
            Ball_Y_Motion_in = Ball_Y_Step;
        end
   

        if ( ( DistX*DistX + DistY*DistY) <= (Size * Size) ) 
            is_ball = 1'b0;
        else
            is_ball = 1'b0;
    end
    
endmodule