data/full_repos/permissive/137261528/vga02/top.v
1: b'%Error: data/full_repos/permissive/137261528/vga02/top.v:33: Cannot find file containing module: \'vga640x360\'\n    vga640x360 display (\n    ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/137261528/vga02,data/full_repos/permissive/137261528/vga640x360\n             data/full_repos/permissive/137261528/vga02,data/full_repos/permissive/137261528/vga640x360.v\n             data/full_repos/permissive/137261528/vga02,data/full_repos/permissive/137261528/vga640x360.sv\n             vga640x360\n             vga640x360.v\n             vga640x360.sv\n             obj_dir/vga640x360\n             obj_dir/vga640x360.v\n             obj_dir/vga640x360.sv\n%Error: data/full_repos/permissive/137261528/vga02/top.v:54: Cannot find file containing module: \'sram\'\n    sram #(\n    ^~~~\n%Warning-WIDTH: data/full_repos/permissive/137261528/vga02/top.v:76: Operator ADD expects 32 or 18 bits on the RHS, but RHS\'s VARREF \'x\' generates 10 bits.\n                                                                   : ... In instance top\n        address <= y * SCREEN_WIDTH + x;\n                                    ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Error: Exiting due to 2 error(s), 1 warning(s)\n'
module top(
    input wire CLK,
    input wire RST_BTN,
    output wire VGA_HS_O,
    output wire VGA_VS_O,
    output reg [3:0] VGA_R,
    output reg [3:0] VGA_G,
    output reg [3:0] VGA_B
    );

    wire rst = ~RST_BTN;



    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 active;

    vga640x360 display (
        .i_clk(CLK), 
        .i_pix_stb(pix_stb),
        .i_rst(rst),
        .o_hs(VGA_HS_O), 
        .o_vs(VGA_VS_O), 
        .o_x(x), 
        .o_y(y),
        .o_active(active)
    );


    localparam SCREEN_WIDTH = 640;
    localparam SCREEN_HEIGHT = 360;
    localparam VRAM_DEPTH = SCREEN_WIDTH * SCREEN_HEIGHT; 
    localparam VRAM_A_WIDTH = 18;
    localparam VRAM_D_WIDTH = 6;

    reg [VRAM_A_WIDTH-1:0] address;
    wire [VRAM_D_WIDTH-1:0] dataout;

    sram #(
        .ADDR_WIDTH(VRAM_A_WIDTH), 
        .DATA_WIDTH(VRAM_D_WIDTH), 
        .DEPTH(VRAM_DEPTH), 
        .MEMFILE("game.mem"))
        vram (
        .i_addr(address), 
        .i_clk(CLK), 
        .i_write(0),
        .i_data(0), 
        .o_data(dataout)
    );

    reg [11:0] palette [0:63];
    reg [11:0] colour;
    initial begin
        $display("Loading palette.");
        $readmemh("game_palette.mem", palette);
    end

    always @ (posedge CLK)
    begin
        address <= y * SCREEN_WIDTH + x;

        if (active)
            colour <= palette[dataout];
        else    
            colour <= 0;

        VGA_R <= colour[11:8];
        VGA_G <= colour[7:4];
        VGA_B <= colour[3:0];
    end
endmodule
module top(
    input wire CLK,
    input wire RST_BTN,
    output wire VGA_HS_O,
    output wire VGA_VS_O,
    output reg [3:0] VGA_R,
    output reg [3:0] VGA_G,
    output reg [3:0] VGA_B
    );


    wire rst = ~RST_BTN;



    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 active;

    vga640x360 display (
        .i_clk(CLK), 
        .i_pix_stb(pix_stb),
        .i_rst(rst),
        .o_hs(VGA_HS_O), 
        .o_vs(VGA_VS_O), 
        .o_x(x), 
        .o_y(y),
        .o_active(active)
    );


    localparam SCREEN_WIDTH = 640;
    localparam SCREEN_HEIGHT = 360;
    localparam VRAM_DEPTH = SCREEN_WIDTH * SCREEN_HEIGHT; 
    localparam VRAM_A_WIDTH = 18;
    localparam VRAM_D_WIDTH = 6;

    reg [VRAM_A_WIDTH-1:0] address;
    wire [VRAM_D_WIDTH-1:0] dataout;

    sram #(
        .ADDR_WIDTH(VRAM_A_WIDTH), 
        .DATA_WIDTH(VRAM_D_WIDTH), 
        .DEPTH(VRAM_DEPTH), 
        .MEMFILE("game.mem"))
        vram (
        .i_addr(address), 
        .i_clk(CLK), 
        .i_write(0),
        .i_data(0), 
        .o_data(dataout)
    );

    reg [11:0] palette [0:63];
    reg [11:0] colour;
    initial begin
        $display("Loading palette.");
        $readmemh("game_palette.mem", palette);
    end

    always @ (posedge CLK)
    begin
        address <= y * SCREEN_WIDTH + x;

        if (active)
            colour <= palette[dataout];
        else    
            colour <= 0;

        VGA_R <= colour[11:8];
        VGA_G <= colour[7:4];
        VGA_B <= colour[3:0];
    end
endmodule