data/full_repos/permissive/423412549/src/rtl/game_ctrl.v
1: b'%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:9: Cannot find include file: ../header/define.v\n`include "../header/define.v" \n         ^~~~~~~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/423412549/src/rtl,data/full_repos/permissive/423412549/../header/define.v\n             data/full_repos/permissive/423412549/src/rtl,data/full_repos/permissive/423412549/../header/define.v.v\n             data/full_repos/permissive/423412549/src/rtl,data/full_repos/permissive/423412549/../header/define.v.sv\n             ../header/define.v\n             ../header/define.v.v\n             ../header/define.v.sv\n             obj_dir/../header/define.v\n             obj_dir/../header/define.v.v\n             obj_dir/../header/define.v.sv\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:22: Define or directive not defined: \'`GAME_STATUS_BIT_LEN\'\n    output wire [`GAME_STATUS_BIT_LEN-1:0] game_status_o,\n                 ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:30: Define or directive not defined: \'`GAME_STATUS_BIT_LEN\'\n    reg  [`GAME_STATUS_BIT_LEN-1:0] game_status;\n          ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:31: Define or directive not defined: \'`GAME_STATUS_BIT_LEN\'\n    reg  [`GAME_STATUS_BIT_LEN-1:0] n_game_status;\n          ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:44: Define or directive not defined: \'`GAME_STATUS_PRERUN\'\n            game_status <= `GAME_STATUS_PRERUN;\n                           ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:44: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n            game_status <= `GAME_STATUS_PRERUN;\n                                              ^\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:52: Define or directive not defined: \'`GAME_STATUS_OVER\'\n            n_game_status = `GAME_STATUS_OVER;\n                            ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:52: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n            n_game_status = `GAME_STATUS_OVER;\n                                             ^\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:53: Define or directive not defined: \'`GAME_STATUS_PRERUN\'\n        end else if((game_status == `GAME_STATUS_PRERUN) && press_vali_i) begin\n                                    ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:53: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        end else if((game_status == `GAME_STATUS_PRERUN) && press_vali_i) begin\n                                                       ^\n%Error: data/full_repos/permissive/423412549/src/rtl/game_ctrl.v:54: Define or directive not defined: \'`GAME_STATUS_RUN\'\n            n_game_status = `GAME_STATUS_RUN;\n                            ^~~~~~~~~~~~~~~~\n%Error: Cannot continue\n'
module game_ctrl (
    input  wire                            clk_vga,
    input  wire                            rst,
    
    input  wire                            me_alpha_i,
    input  wire                            bullet_alpha_i,
    input  wire                            enemy_alpha_i,
    input  wire                            bonus_alpha_i,
    input  wire                            disp_i,
    input  wire                            press_vali_i,


    output wire [`GAME_STATUS_BIT_LEN-1:0] game_status_o,


    output wire                            crash_me_enemy_o,
    output wire                            crash_enemy_bullet_o,
    output wire                            crash_me_bonus_o
);

    reg  [`GAME_STATUS_BIT_LEN-1:0] game_status;
    reg  [`GAME_STATUS_BIT_LEN-1:0] n_game_status;
    wire                            gameover;

    assign crash_enemy_bullet_o = ~rst ? enemy_alpha_i & bullet_alpha_i & disp_i : 0;
    assign crash_me_enemy_o = ~rst ? me_alpha_i & enemy_alpha_i & disp_i : 0;

    assign crash_me_bonus_o = me_alpha_i & bonus_alpha_i;
    assign gameover = crash_me_enemy_o;

    assign game_status_o = game_status;

    always @(posedge clk_vga or posedge rst) begin
        if(rst) begin
            game_status <= `GAME_STATUS_PRERUN;
        end else begin
            game_status <= n_game_status;
        end
    end

    always @(*) begin
        if(gameover) begin
            n_game_status = `GAME_STATUS_OVER;
        end else if((game_status == `GAME_STATUS_PRERUN) && press_vali_i) begin
            n_game_status = `GAME_STATUS_RUN;
        end else begin
            n_game_status = game_status;
        end
    end

endmodule
module game_ctrl (
    input  wire                            clk_vga,
    input  wire                            rst,
    
    input  wire                            me_alpha_i,
    input  wire                            bullet_alpha_i,
    input  wire                            enemy_alpha_i,
    input  wire                            bonus_alpha_i,
    input  wire                            disp_i,
    input  wire                            press_vali_i,


    output wire [`GAME_STATUS_BIT_LEN-1:0] game_status_o,


    output wire                            crash_me_enemy_o,
    output wire                            crash_enemy_bullet_o,
    output wire                            crash_me_bonus_o
);


    reg  [`GAME_STATUS_BIT_LEN-1:0] game_status;
    reg  [`GAME_STATUS_BIT_LEN-1:0] n_game_status;
    wire                            gameover;

    assign crash_enemy_bullet_o = ~rst ? enemy_alpha_i & bullet_alpha_i & disp_i : 0;
    assign crash_me_enemy_o = ~rst ? me_alpha_i & enemy_alpha_i & disp_i : 0;

    assign crash_me_bonus_o = me_alpha_i & bonus_alpha_i;
    assign gameover = crash_me_enemy_o;

    assign game_status_o = game_status;

    always @(posedge clk_vga or posedge rst) begin
        if(rst) begin
            game_status <= `GAME_STATUS_PRERUN;
        end else begin
            game_status <= n_game_status;
        end
    end

    always @(*) begin
        if(gameover) begin
            n_game_status = `GAME_STATUS_OVER;
        end else if((game_status == `GAME_STATUS_PRERUN) && press_vali_i) begin
            n_game_status = `GAME_STATUS_RUN;
        end else begin
            n_game_status = game_status;
        end
    end

endmodule