data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v
 line:108: before: "("
1: b'%Error: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:34: Cannot find file containing module: \'vga640x480\'\n    vga640x480 display (\n    ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01,data/full_repos/permissive/183131088/vga640x480\n             data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01,data/full_repos/permissive/183131088/vga640x480.v\n             data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01,data/full_repos/permissive/183131088/vga640x480.sv\n             vga640x480\n             vga640x480.v\n             vga640x480.sv\n             obj_dir/vga640x480\n             obj_dir/vga640x480.v\n             obj_dir/vga640x480.sv\n%Error: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:50: Cannot find file containing module: \'square\'\n    square #(.IX(160), .IY(120), .H_SIZE(60)) sq_a_anim (\n    ^~~~~~\n%Error: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:61: Cannot find file containing module: \'square\'\n    square #(.IX(320), .IY(240), .IY_DIR(0)) sq_b_anim (\n    ^~~~~~\n%Error: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:72: Cannot find file containing module: \'square\'\n    square #(.IX(480), .IY(360), .H_SIZE(100)) sq_c_anim (\n    ^~~~~~\n%Warning-LITENDIAN: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:93: Little bit endian vector: MSB < LSB of bit range: 0:15\n    reg [0:15] block_exists;\n        ^\n                    ... Use "/* verilator lint_off LITENDIAN */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:99: Operator ADD expects 32 or 10 bits on the LHS, but LHS\'s VARREF \'counter1\' generates 4 bits.\n                                                                                                               : ... In instance top\n                        block_exists[counter1] <= ((x > ((SCREENSIZE_X/8)*counter1)) & (y > 0) & (x <= ((SCREENSIZE_X/8)*(counter1+1))) & (y < 480)) ? 1 : 0;\n                                                                                                                                  ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:110: Operator ADD expects 32 or 10 bits on the LHS, but LHS\'s VARREF \'counter1\' generates 4 bits.\n                                                                                                                : ... In instance top\n                        block_exists[counter1] <= ((x > ((SCREENSIZE_X/16)*counter1)) & (y > 0) & (x <= ((SCREENSIZE_X/16)*(counter1+1))) & (y < 480)) ? 1 : 0;\n                                                                                                                                    ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:118: Operator GT expects 12 bits on the LHS, but LHS\'s VARREF \'x\' generates 10 bits.\n                                                                                                                : ... In instance top\n                block_exists[0] <= ((x > sq_a_x1) & (y > sq_a_y1) & (x < sq_a_x2) & (y < sq_a_y2)) ? 1 : 0;\n                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:118: Operator GT expects 12 bits on the LHS, but LHS\'s VARREF \'y\' generates 9 bits.\n                                                                                                                : ... In instance top\n                block_exists[0] <= ((x > sq_a_x1) & (y > sq_a_y1) & (x < sq_a_x2) & (y < sq_a_y2)) ? 1 : 0;\n                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:118: Operator LT expects 12 bits on the LHS, but LHS\'s VARREF \'x\' generates 10 bits.\n                                                                                                                : ... In instance top\n                block_exists[0] <= ((x > sq_a_x1) & (y > sq_a_y1) & (x < sq_a_x2) & (y < sq_a_y2)) ? 1 : 0;\n                                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:118: Operator LT expects 12 bits on the LHS, but LHS\'s VARREF \'y\' generates 9 bits.\n                                                                                                                : ... In instance top\n                block_exists[0] <= ((x > sq_a_x1) & (y > sq_a_y1) & (x < sq_a_x2) & (y < sq_a_y2)) ? 1 : 0;\n                                                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:119: Operator GT expects 12 bits on the LHS, but LHS\'s VARREF \'x\' generates 10 bits.\n                                                                                                                : ... In instance top\n                block_exists[1] <= ((x > sq_b_x1) & (y > sq_b_y1) & (x < sq_b_x2) & (y < sq_b_y2)) ? 1 : 0;\n                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:119: Operator GT expects 12 bits on the LHS, but LHS\'s VARREF \'y\' generates 9 bits.\n                                                                                                                : ... In instance top\n                block_exists[1] <= ((x > sq_b_x1) & (y > sq_b_y1) & (x < sq_b_x2) & (y < sq_b_y2)) ? 1 : 0;\n                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:119: Operator LT expects 12 bits on the LHS, but LHS\'s VARREF \'x\' generates 10 bits.\n                                                                                                                : ... In instance top\n                block_exists[1] <= ((x > sq_b_x1) & (y > sq_b_y1) & (x < sq_b_x2) & (y < sq_b_y2)) ? 1 : 0;\n                                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:119: Operator LT expects 12 bits on the LHS, but LHS\'s VARREF \'y\' generates 9 bits.\n                                                                                                                : ... In instance top\n                block_exists[1] <= ((x > sq_b_x1) & (y > sq_b_y1) & (x < sq_b_x2) & (y < sq_b_y2)) ? 1 : 0;\n                                                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:120: Operator GT expects 12 bits on the LHS, but LHS\'s VARREF \'x\' generates 10 bits.\n                                                                                                                : ... In instance top\n                block_exists[2] <= ((x > sq_c_x1) & (y > sq_c_y1) & (x < sq_c_x2) & (y < sq_c_y2)) ? 1 : 0;\n                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:120: Operator GT expects 12 bits on the LHS, but LHS\'s VARREF \'y\' generates 9 bits.\n                                                                                                                : ... In instance top\n                block_exists[2] <= ((x > sq_c_x1) & (y > sq_c_y1) & (x < sq_c_x2) & (y < sq_c_y2)) ? 1 : 0;\n                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:120: Operator LT expects 12 bits on the LHS, but LHS\'s VARREF \'x\' generates 10 bits.\n                                                                                                                : ... In instance top\n                block_exists[2] <= ((x > sq_c_x1) & (y > sq_c_y1) & (x < sq_c_x2) & (y < sq_c_y2)) ? 1 : 0;\n                                                                       ^\n%Warning-WIDTH: data/full_repos/permissive/183131088/VGA_Testbench.srcs/sources_1/imports/vga01/top_static.v:120: Operator LT expects 12 bits on the LHS, but LHS\'s VARREF \'y\' generates 9 bits.\n                                                                                                                : ... In instance top\n                block_exists[2] <= ((x > sq_c_x1) & (y > sq_c_y1) & (x < sq_c_x2) & (y < sq_c_y2)) ? 1 : 0;\n                                                                                       ^\n%Error: Exiting due to 4 error(s), 15 warning(s)\n'
module top(
    input wire clk,
    input wire IO_BTN_C,
    input wire [1:0] IO_SWITCH,
    output wire VGA_Hsync,
    output wire VGA_Vsync,
    output reg [3:0] VGA_Red,
    output reg [3:0] VGA_Green,
    output reg [3:0] VGA_Blue
    );

    wire rst = IO_BTN_C;


    reg [15:0] cnt;
    reg pix_stb;
    always @(posedge clk)
        {pix_stb, cnt} <= cnt + 16'h4000;

    wire [9:0] x;
    wire [8:0] y;
    wire animate;
    
    localparam SCREENSIZE_X = 640;
    localparam SCREENSIZE_Y = 480;
    
    vga640x480 display (
        .i_clk(clk),
        .i_pix_stb(pix_stb),
        .i_rst(rst),
        .o_hs(VGA_Hsync),
        .o_vs(VGA_Vsync),
        .o_x(x),
        .o_y(y),
        .o_animate(animate)
    );
    

    wire [11:0] sq_a_x1, sq_a_x2, sq_a_y1, sq_a_y2;
    wire [11:0] sq_b_x1, sq_b_x2, sq_b_y1, sq_b_y2;
    wire [11:0] sq_c_x1, sq_c_x2, sq_c_y1, sq_c_y2;
    
    square #(.IX(160), .IY(120), .H_SIZE(60)) sq_a_anim (
        .i_clk(clk),
        .i_ani_stb(pix_stb),
        .i_rst(rst),
        .i_animate(animate),
        .o_x1(sq_a_x1),
        .o_x2(sq_a_x2),
        .o_y1(sq_a_y1),
        .o_y2(sq_a_y2)
    );

    square #(.IX(320), .IY(240), .IY_DIR(0)) sq_b_anim (
        .i_clk(clk),
        .i_ani_stb(pix_stb),
        .i_rst(rst),
        .i_animate(animate),
        .o_x1(sq_b_x1),
        .o_x2(sq_b_x2),
        .o_y1(sq_b_y1),
        .o_y2(sq_b_y2)
    );    

    square #(.IX(480), .IY(360), .H_SIZE(100)) sq_c_anim (
        .i_clk(clk),
        .i_ani_stb(pix_stb),
        .i_rst(rst),
        .i_animate(animate),
        .o_x1(sq_c_x1),
        .o_x2(sq_c_x2),
        .o_y1(sq_c_y1),
        .o_y2(sq_c_y2)
    );
    

    reg [11:0] sq_a_color = 12'b101001100010;
    reg [11:0] sq_b_color = 12'b110010100100;
    reg [11:0] sq_c_color = 12'b011000101010;
    
    
    reg [1:0] mode = 0;
    

    reg [3:0] counter1, counter2;
    reg [0:15] block_exists;
    always @(posedge clk) begin
        case (mode)
            0: begin
                for (counter1 = 0; counter1 < 8; counter1 = counter1 + 1) begin
                    if ((x < SCREENSIZE_X) & (x > 0) & (y < SCREENSIZE_Y) | (y > 0))
                        block_exists[counter1] <= ((x > ((SCREENSIZE_X/8)*counter1)) & (y > 0) & (x <= ((SCREENSIZE_X/8)*(counter1+1))) & (y < 480)) ? 1 : 0;
                    else 
                        block_exists[counter1] <= 0;
                end 
                block_exists[8:15] <= 0;
            end
            
            1: begin
                counter1 <= 0;
                repeat (16) begin
                    if ((x < SCREENSIZE_X) & (x > 0) & (y < SCREENSIZE_Y) | (y > 0))
                        block_exists[counter1] <= ((x > ((SCREENSIZE_X/16)*counter1)) & (y > 0) & (x <= ((SCREENSIZE_X/16)*(counter1+1))) & (y < 480)) ? 1 : 0;
                    else 
                        block_exists[counter1] <= 0;
                    counter1 <= counter1 + 1;
                end
            end
            
            2: begin
                block_exists[0] <= ((x > sq_a_x1) & (y > sq_a_y1) & (x < sq_a_x2) & (y < sq_a_y2)) ? 1 : 0;
                block_exists[1] <= ((x > sq_b_x1) & (y > sq_b_y1) & (x < sq_b_x2) & (y < sq_b_y2)) ? 1 : 0;
                block_exists[2] <= ((x > sq_c_x1) & (y > sq_c_y1) & (x < sq_c_x2) & (y < sq_c_y2)) ? 1 : 0;
                block_exists[3:15] <= 0;                
            end
            
            default: 
                block_exists <= 0;
        endcase
    end
    

    always @(posedge clk) begin
        mode <= IO_SWITCH;
        case(mode)
            0: begin
                if (block_exists[0]) begin
                    VGA_Red <= 15;
                    VGA_Green <= 15;
                    VGA_Blue <= 15;
                end
                if (block_exists[1]) begin
                    VGA_Red <= 14;
                    VGA_Green <= 14;
                    VGA_Blue <= 1;
                end
                if (block_exists[2]) begin
                    VGA_Red <= 6;
                    VGA_Green <= 12;
                    VGA_Blue <= 13;
                end
                if (block_exists[3]) begin
                    VGA_Red <= 6;
                    VGA_Green <= 11;
                    VGA_Blue <= 3;
                end
                if (block_exists[4]) begin
                    VGA_Red <= 11;
                    VGA_Green <= 4;
                    VGA_Blue <= 9;
                end
                if (block_exists[5]) begin
                    VGA_Red <= 14;
                    VGA_Green <= 1;
                    VGA_Blue <= 1;
                end
                if (block_exists[6]) begin
                    VGA_Red <= 3;
                    VGA_Green <= 4;
                    VGA_Blue <= 9;
                end
                if (block_exists[7]) begin
                    VGA_Red <= 0;
                    VGA_Green <= 0;
                    VGA_Blue <= 0;
                end
            end
            
            1: begin
                counter2 <= 0;
                repeat (16) begin
                    if (block_exists[counter2]) begin
                        VGA_Red <= counter2;
                        VGA_Green <= counter2;
                        VGA_Blue <= counter2;
                    end
                    counter2 <= counter2 + 1;
                end
            end
            
            2: begin
                  VGA_Red <= ({4{block_exists[0]}} & sq_a_color[11:8]);
                  VGA_Green <= ({4{block_exists[1]}} & sq_b_color[7:4]);
                  VGA_Blue <= ({4{block_exists[2]}} & sq_c_color[3:0]);
            end
            
            default: begin
                VGA_Red <= 15;
                VGA_Green <= 15;
                VGA_Blue <= 15;
            end
        endcase
        

        if ( (x <= 0) | (x >= SCREENSIZE_X) | (y <= 0) | (y >= SCREENSIZE_Y) ) begin
            VGA_Red <= 0;
            VGA_Green <= 0;
            VGA_Blue <= 0;
        end
    end 
endmodule
module top(
    input wire clk,
    input wire IO_BTN_C,
    input wire [1:0] IO_SWITCH,
    output wire VGA_Hsync,
    output wire VGA_Vsync,
    output reg [3:0] VGA_Red,
    output reg [3:0] VGA_Green,
    output reg [3:0] VGA_Blue
    );


    wire rst = IO_BTN_C;


    reg [15:0] cnt;
    reg pix_stb;
    always @(posedge clk)
        {pix_stb, cnt} <= cnt + 16'h4000;

    wire [9:0] x;
    wire [8:0] y;
    wire animate;
    
    localparam SCREENSIZE_X = 640;
    localparam SCREENSIZE_Y = 480;
    
    vga640x480 display (
        .i_clk(clk),
        .i_pix_stb(pix_stb),
        .i_rst(rst),
        .o_hs(VGA_Hsync),
        .o_vs(VGA_Vsync),
        .o_x(x),
        .o_y(y),
        .o_animate(animate)
    );
    

    wire [11:0] sq_a_x1, sq_a_x2, sq_a_y1, sq_a_y2;
    wire [11:0] sq_b_x1, sq_b_x2, sq_b_y1, sq_b_y2;
    wire [11:0] sq_c_x1, sq_c_x2, sq_c_y1, sq_c_y2;
    
    square #(.IX(160), .IY(120), .H_SIZE(60)) sq_a_anim (
        .i_clk(clk),
        .i_ani_stb(pix_stb),
        .i_rst(rst),
        .i_animate(animate),
        .o_x1(sq_a_x1),
        .o_x2(sq_a_x2),
        .o_y1(sq_a_y1),
        .o_y2(sq_a_y2)
    );

    square #(.IX(320), .IY(240), .IY_DIR(0)) sq_b_anim (
        .i_clk(clk),
        .i_ani_stb(pix_stb),
        .i_rst(rst),
        .i_animate(animate),
        .o_x1(sq_b_x1),
        .o_x2(sq_b_x2),
        .o_y1(sq_b_y1),
        .o_y2(sq_b_y2)
    );    

    square #(.IX(480), .IY(360), .H_SIZE(100)) sq_c_anim (
        .i_clk(clk),
        .i_ani_stb(pix_stb),
        .i_rst(rst),
        .i_animate(animate),
        .o_x1(sq_c_x1),
        .o_x2(sq_c_x2),
        .o_y1(sq_c_y1),
        .o_y2(sq_c_y2)
    );
    

    reg [11:0] sq_a_color = 12'b101001100010;
    reg [11:0] sq_b_color = 12'b110010100100;
    reg [11:0] sq_c_color = 12'b011000101010;
    
    
    reg [1:0] mode = 0;
    

    reg [3:0] counter1, counter2;
    reg [0:15] block_exists;
    always @(posedge clk) begin
        case (mode)
            0: begin
                for (counter1 = 0; counter1 < 8; counter1 = counter1 + 1) begin
                    if ((x < SCREENSIZE_X) & (x > 0) & (y < SCREENSIZE_Y) | (y > 0))
                        block_exists[counter1] <= ((x > ((SCREENSIZE_X/8)*counter1)) & (y > 0) & (x <= ((SCREENSIZE_X/8)*(counter1+1))) & (y < 480)) ? 1 : 0;
                    else 
                        block_exists[counter1] <= 0;
                end 
                block_exists[8:15] <= 0;
            end
            
            1: begin
                counter1 <= 0;
                repeat (16) begin
                    if ((x < SCREENSIZE_X) & (x > 0) & (y < SCREENSIZE_Y) | (y > 0))
                        block_exists[counter1] <= ((x > ((SCREENSIZE_X/16)*counter1)) & (y > 0) & (x <= ((SCREENSIZE_X/16)*(counter1+1))) & (y < 480)) ? 1 : 0;
                    else 
                        block_exists[counter1] <= 0;
                    counter1 <= counter1 + 1;
                end
            end
            
            2: begin
                block_exists[0] <= ((x > sq_a_x1) & (y > sq_a_y1) & (x < sq_a_x2) & (y < sq_a_y2)) ? 1 : 0;
                block_exists[1] <= ((x > sq_b_x1) & (y > sq_b_y1) & (x < sq_b_x2) & (y < sq_b_y2)) ? 1 : 0;
                block_exists[2] <= ((x > sq_c_x1) & (y > sq_c_y1) & (x < sq_c_x2) & (y < sq_c_y2)) ? 1 : 0;
                block_exists[3:15] <= 0;                
            end
            
            default: 
                block_exists <= 0;
        endcase
    end
    

    always @(posedge clk) begin
        mode <= IO_SWITCH;
        case(mode)
            0: begin
                if (block_exists[0]) begin
                    VGA_Red <= 15;
                    VGA_Green <= 15;
                    VGA_Blue <= 15;
                end
                if (block_exists[1]) begin
                    VGA_Red <= 14;
                    VGA_Green <= 14;
                    VGA_Blue <= 1;
                end
                if (block_exists[2]) begin
                    VGA_Red <= 6;
                    VGA_Green <= 12;
                    VGA_Blue <= 13;
                end
                if (block_exists[3]) begin
                    VGA_Red <= 6;
                    VGA_Green <= 11;
                    VGA_Blue <= 3;
                end
                if (block_exists[4]) begin
                    VGA_Red <= 11;
                    VGA_Green <= 4;
                    VGA_Blue <= 9;
                end
                if (block_exists[5]) begin
                    VGA_Red <= 14;
                    VGA_Green <= 1;
                    VGA_Blue <= 1;
                end
                if (block_exists[6]) begin
                    VGA_Red <= 3;
                    VGA_Green <= 4;
                    VGA_Blue <= 9;
                end
                if (block_exists[7]) begin
                    VGA_Red <= 0;
                    VGA_Green <= 0;
                    VGA_Blue <= 0;
                end
            end
            
            1: begin
                counter2 <= 0;
                repeat (16) begin
                    if (block_exists[counter2]) begin
                        VGA_Red <= counter2;
                        VGA_Green <= counter2;
                        VGA_Blue <= counter2;
                    end
                    counter2 <= counter2 + 1;
                end
            end
            
            2: begin
                  VGA_Red <= ({4{block_exists[0]}} & sq_a_color[11:8]);
                  VGA_Green <= ({4{block_exists[1]}} & sq_b_color[7:4]);
                  VGA_Blue <= ({4{block_exists[2]}} & sq_c_color[3:0]);
            end
            
            default: begin
                VGA_Red <= 15;
                VGA_Green <= 15;
                VGA_Blue <= 15;
            end
        endcase
        

        if ( (x <= 0) | (x >= SCREENSIZE_X) | (y <= 0) | (y >= SCREENSIZE_Y) ) begin
            VGA_Red <= 0;
            VGA_Green <= 0;
            VGA_Blue <= 0;
        end
    end 
endmodule