data/full_repos/permissive/423412549/src/rtl/bullet_supply.v
1: b'%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.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/bullet_supply.v:15: Define or directive not defined: \'`RAND_WIDTH\'\n    input  wire [     `RAND_WIDTH-1:0] rand_i,\n                      ^~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:17: Define or directive not defined: \'`H_DISP_LEN\'\n    input  wire [     `H_DISP_LEN-1:0] req_x_addr_i,\n                      ^~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:18: Define or directive not defined: \'`V_DISP_LEN\'\n    input  wire [     `V_DISP_LEN-1:0] req_y_addr_i,\n                      ^~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:22: Define or directive not defined: \'`COLOR_RGB_DEPTH\'\n    output wire [`COLOR_RGB_DEPTH-1:0] vga_rgb_o\n                 ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:30: Define or directive not defined: \'`BULLET_SUP_NUM\'\n    wire [               `BULLET_SUP_NUM-1:0] disappear;\n                         ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:31: Define or directive not defined: \'`BULLET_SUP_BRAM_DEPTH_BIT_LEN\'\n    wire [`BULLET_SUP_BRAM_DEPTH_BIT_LEN-1:0] bram_addr;\n          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:32: Define or directive not defined: \'`COLOR_RGB_DEPTH\'\n    wire [              `COLOR_RGB_DEPTH-1:0] bram_color;\n                        ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:34: Define or directive not defined: \'`BULLET_SUP_BRAM_WIDTH\'\n    wire [        `BULLET_SUP_BRAM_WIDTH-1:0] bram_info;\n                  ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:36: Define or directive not defined: \'`BULLET_SUP_NUM_BIT_LEN\'\n    wire [       `BULLET_SUP_NUM_BIT_LEN-1:0] curr_enemy_idx;\n                 ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:38: Define or directive not defined: \'`BULLET_SUP_CNT_MAX_TRIGGER_BIT_LEN\'\n    reg  [`BULLET_SUP_CNT_MAX_TRIGGER_BIT_LEN-1:0] cnt_trigger;\n          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:39: Define or directive not defined: \'`ENEMY_CNT_MAX_DOWN_BIT_LEN\'\n    reg  [   `ENEMY_CNT_MAX_DOWN_BIT_LEN-1:0] cnt_down;\n             ^~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:42: Define or directive not defined: \'`BULLET_SUP_NUM_BIT_LEN\'\n    wire [       `BULLET_SUP_NUM_BIT_LEN-1:0] trigger_idx;\n                 ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:44: Define or directive not defined: \'`COLOR_RGB_DEPTH\'\n    reg  [              `COLOR_RGB_DEPTH-1:0] vga_rgb;\n                        ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:46: Define or directive not defined: \'`BULLET_SUP_NUM\'\n    reg  [               `BULLET_SUP_NUM-1:0] state_unit ;\n                         ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:47: Define or directive not defined: \'`BULLET_SUP_NUM\'\n    reg  [               `BULLET_SUP_NUM-1:0] n_state_unit;\n                         ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:51: Define or directive not defined: \'`BULLET_SUP_NUM\'\n        .MAX_ENEMY_NUM(`BULLET_SUP_NUM),\n                       ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:52: Define or directive not defined: \'`BULLET_SUP_NUM_BIT_LEN\'\n        .MAX_ENEMY_NUM_BIT_LEN(`BULLET_SUP_NUM_BIT_LEN),\n                               ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:53: Define or directive not defined: \'`BULLET_SUP_SPEED\'\n        .SPEED(`BULLET_SUP_SPEED),\n               ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:54: Define or directive not defined: \'`BULLET_SUP_CNT_MAX_TRIGGER\'\n        .ENEMY_CNT_MAX_TRIGGER(`BULLET_SUP_CNT_MAX_TRIGGER),\n                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:55: Define or directive not defined: \'`BULLET_SUP_X_SIZE\'\n        .ENEMY_X_SIZE(`BULLET_SUP_X_SIZE),\n                      ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:56: Define or directive not defined: \'`BULLET_SUP_Y_SIZE\'\n        .ENEMY_Y_SIZE(`BULLET_SUP_Y_SIZE),\n                      ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:57: Define or directive not defined: \'`OBJ_X_POS_BIT_LEN\'\n        .RAND_POS_BIT_LEN(`OBJ_X_POS_BIT_LEN-1),\n                          ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:58: Define or directive not defined: \'`BULLET_SUP_RAND_OFFSET\'\n        .RAND_OFFSET(`BULLET_SUP_RAND_OFFSET),\n                     ^~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:59: Define or directive not defined: \'`BULLET_SUP_BRAM_WIDTH\'\n        .BRAM_WIDTH(`BULLET_SUP_BRAM_WIDTH),\n                    ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:60: Define or directive not defined: \'`BULLET_SUP_BRAM_DEPTH\'\n        .BRAM_DEPTH(`BULLET_SUP_BRAM_DEPTH),\n                    ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:61: Define or directive not defined: \'`BULLET_SUP_BRAM_DEPTH_BIT_LEN\'\n        .BRAM_DEPTH_BIT_LEN(`BULLET_SUP_BRAM_DEPTH_BIT_LEN)\n                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:92: Define or directive not defined: \'`BULLET_SUP_NUM\'\n        for(i=0;i<`BULLET_SUP_NUM;i=i+1) begin:BULLET_SUP_LOOP\n                  ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:92: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        for(i=0;i<`BULLET_SUP_NUM;i=i+1) begin:BULLET_SUP_LOOP\n                                 ^\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:116: syntax error, unexpected end\n        end\n        ^~~\n%Error: data/full_repos/permissive/423412549/src/rtl/bullet_supply.v:123: syntax error, unexpected endmodule\nendmodule  \n^~~~~~~~~\n%Error: Cannot continue\n'
module bullet_supply (
    input  wire                        clk_run,
    input  wire                        clk_vga,
    input  wire                        rst,
    input  wire                        en_i,
    input  wire [     `RAND_WIDTH-1:0] rand_i,
    input  wire                        v_sync_i,
    input  wire [     `H_DISP_LEN-1:0] req_x_addr_i,
    input  wire [     `V_DISP_LEN-1:0] req_y_addr_i,
    input  wire                        crash_me_bonus_i,

    output wire                        vga_alpha_o,
    output wire [`COLOR_RGB_DEPTH-1:0] vga_rgb_o
);


    localparam STATE_VALI = 1'b1;
    localparam STATE_INVALI = 1'b0;


    wire [               `BULLET_SUP_NUM-1:0] disappear;
    wire [`BULLET_SUP_BRAM_DEPTH_BIT_LEN-1:0] bram_addr;
    wire [              `COLOR_RGB_DEPTH-1:0] bram_color;
    wire                                      bram_alpha;
    wire [        `BULLET_SUP_BRAM_WIDTH-1:0] bram_info;
    wire                                      enemy_vali;
    wire [       `BULLET_SUP_NUM_BIT_LEN-1:0] curr_enemy_idx;

    reg  [`BULLET_SUP_CNT_MAX_TRIGGER_BIT_LEN-1:0] cnt_trigger;
    reg  [   `ENEMY_CNT_MAX_DOWN_BIT_LEN-1:0] cnt_down;

    wire                                trigger;
    wire [       `BULLET_SUP_NUM_BIT_LEN-1:0] trigger_idx;
    reg                                       vga_alpha;
    reg  [              `COLOR_RGB_DEPTH-1:0] vga_rgb;

    reg  [               `BULLET_SUP_NUM-1:0] state_unit ;
    reg  [               `BULLET_SUP_NUM-1:0] n_state_unit;

    enemy_base
    #(
        .MAX_ENEMY_NUM(`BULLET_SUP_NUM),
        .MAX_ENEMY_NUM_BIT_LEN(`BULLET_SUP_NUM_BIT_LEN),
        .SPEED(`BULLET_SUP_SPEED),
        .ENEMY_CNT_MAX_TRIGGER(`BULLET_SUP_CNT_MAX_TRIGGER),
        .ENEMY_X_SIZE(`BULLET_SUP_X_SIZE),
        .ENEMY_Y_SIZE(`BULLET_SUP_Y_SIZE),
        .RAND_POS_BIT_LEN(`OBJ_X_POS_BIT_LEN-1),
        .RAND_OFFSET(`BULLET_SUP_RAND_OFFSET),
        .BRAM_WIDTH(`BULLET_SUP_BRAM_WIDTH),
        .BRAM_DEPTH(`BULLET_SUP_BRAM_DEPTH),
        .BRAM_DEPTH_BIT_LEN(`BULLET_SUP_BRAM_DEPTH_BIT_LEN)
    ) bomb
    (
        .clk_vga(clk_vga),
        .clk_run(clk_run),
        .rst(rst),
        .en_i(en_i),
        .v_sync_i(v_sync_i),
        .req_x_addr_i(req_x_addr_i),
        .req_y_addr_i(req_y_addr_i),
        .disappear_i(disappear),
        .rand_pos_i(rand_i),
        .bram_addr_o(bram_addr),
        .enemy_vali_o(enemy_vali),
        .curr_enemy_idx_o(curr_enemy_idx),
        .trigger_o(trigger),
        .trigger_idx_o(trigger_idx)
    );

    bram_bullet_supply bram_bullet_supply_dut
    (
        .clka(clk_vga),
        .ena(1'b1),
        .addra(bram_addr),
        .douta(bram_info)
    );

    assign {bram_alpha, bram_color} = bram_info;

    genvar i;
    generate
        for(i=0;i<`BULLET_SUP_NUM;i=i+1) begin:BULLET_SUP_LOOP

            always @(posedge clk_vga or posedge rst) begin
                if(rst) begin
                    state_unit[i] <= STATE_INVALI;
                end else begin
                    state_unit[i] <= n_state_unit[i];
                end
            end

            assign disappear[i] = state_unit[i] == STATE_INVALI;

            always @(*) begin
                case(state_unit[i])
                    STATE_INVALI:
                        n_state_unit[i] = (trigger && trigger_idx == i) ?
                                        STATE_VALI : STATE_INVALI;
                    STATE_VALI:
                        n_state_unit[i] = (crash_me_bonus_i && curr_enemy_idx == i)?
                                        STATE_INVALI : STATE_VALI;
                    default:
                        n_state_unit[i] = STATE_INVALI;
                endcase
            end
        end
    endgenerate

    assign vga_alpha_o = enemy_vali ? bram_alpha : 0;

    assign vga_rgb_o   = enemy_vali ? bram_color : 0;

endmodule
module bullet_supply (
    input  wire                        clk_run,
    input  wire                        clk_vga,
    input  wire                        rst,
    input  wire                        en_i,
    input  wire [     `RAND_WIDTH-1:0] rand_i,
    input  wire                        v_sync_i,
    input  wire [     `H_DISP_LEN-1:0] req_x_addr_i,
    input  wire [     `V_DISP_LEN-1:0] req_y_addr_i,
    input  wire                        crash_me_bonus_i,

    output wire                        vga_alpha_o,
    output wire [`COLOR_RGB_DEPTH-1:0] vga_rgb_o
);



    localparam STATE_VALI = 1'b1;
    localparam STATE_INVALI = 1'b0;


    wire [               `BULLET_SUP_NUM-1:0] disappear;
    wire [`BULLET_SUP_BRAM_DEPTH_BIT_LEN-1:0] bram_addr;
    wire [              `COLOR_RGB_DEPTH-1:0] bram_color;
    wire                                      bram_alpha;
    wire [        `BULLET_SUP_BRAM_WIDTH-1:0] bram_info;
    wire                                      enemy_vali;
    wire [       `BULLET_SUP_NUM_BIT_LEN-1:0] curr_enemy_idx;

    reg  [`BULLET_SUP_CNT_MAX_TRIGGER_BIT_LEN-1:0] cnt_trigger;
    reg  [   `ENEMY_CNT_MAX_DOWN_BIT_LEN-1:0] cnt_down;

    wire                                trigger;
    wire [       `BULLET_SUP_NUM_BIT_LEN-1:0] trigger_idx;
    reg                                       vga_alpha;
    reg  [              `COLOR_RGB_DEPTH-1:0] vga_rgb;

    reg  [               `BULLET_SUP_NUM-1:0] state_unit ;
    reg  [               `BULLET_SUP_NUM-1:0] n_state_unit;

    enemy_base
    #(
        .MAX_ENEMY_NUM(`BULLET_SUP_NUM),
        .MAX_ENEMY_NUM_BIT_LEN(`BULLET_SUP_NUM_BIT_LEN),
        .SPEED(`BULLET_SUP_SPEED),
        .ENEMY_CNT_MAX_TRIGGER(`BULLET_SUP_CNT_MAX_TRIGGER),
        .ENEMY_X_SIZE(`BULLET_SUP_X_SIZE),
        .ENEMY_Y_SIZE(`BULLET_SUP_Y_SIZE),
        .RAND_POS_BIT_LEN(`OBJ_X_POS_BIT_LEN-1),
        .RAND_OFFSET(`BULLET_SUP_RAND_OFFSET),
        .BRAM_WIDTH(`BULLET_SUP_BRAM_WIDTH),
        .BRAM_DEPTH(`BULLET_SUP_BRAM_DEPTH),
        .BRAM_DEPTH_BIT_LEN(`BULLET_SUP_BRAM_DEPTH_BIT_LEN)
    ) bomb
    (
        .clk_vga(clk_vga),
        .clk_run(clk_run),
        .rst(rst),
        .en_i(en_i),
        .v_sync_i(v_sync_i),
        .req_x_addr_i(req_x_addr_i),
        .req_y_addr_i(req_y_addr_i),
        .disappear_i(disappear),
        .rand_pos_i(rand_i),
        .bram_addr_o(bram_addr),
        .enemy_vali_o(enemy_vali),
        .curr_enemy_idx_o(curr_enemy_idx),
        .trigger_o(trigger),
        .trigger_idx_o(trigger_idx)
    );

    bram_bullet_supply bram_bullet_supply_dut
    (
        .clka(clk_vga),
        .ena(1'b1),
        .addra(bram_addr),
        .douta(bram_info)
    );

    assign {bram_alpha, bram_color} = bram_info;

    genvar i;
    generate
        for(i=0;i<`BULLET_SUP_NUM;i=i+1) begin:BULLET_SUP_LOOP

            always @(posedge clk_vga or posedge rst) begin
                if(rst) begin
                    state_unit[i] <= STATE_INVALI;
                end else begin
                    state_unit[i] <= n_state_unit[i];
                end
            end

            assign disappear[i] = state_unit[i] == STATE_INVALI;

            always @(*) begin
                case(state_unit[i])
                    STATE_INVALI:
                        n_state_unit[i] = (trigger && trigger_idx == i) ?
                                        STATE_VALI : STATE_INVALI;
                    STATE_VALI:
                        n_state_unit[i] = (crash_me_bonus_i && curr_enemy_idx == i)?
                                        STATE_INVALI : STATE_VALI;
                    default:
                        n_state_unit[i] = STATE_INVALI;
                endcase
            end
        end
    endgenerate

    assign vga_alpha_o = enemy_vali ? bram_alpha : 0;

    assign vga_rgb_o   = enemy_vali ? bram_color : 0;

endmodule