data/full_repos/permissive/423412549/src/rtl/enemy_base.v
1: b'%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.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/enemy_base.v:13: Define or directive not defined: \'`ENEMY_SPEED_LOW\'\n        parameter SPEED         = `ENEMY_SPEED_LOW,\n                                  ^~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:13: syntax error, unexpected \',\', expecting TYPE-IDENTIFIER\n        parameter SPEED         = `ENEMY_SPEED_LOW,\n                                                  ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:16: syntax error, unexpected parameter, expecting IDENTIFIER\n        parameter ENEMY_X_SIZE  = 100,\n        ^~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:17: syntax error, unexpected parameter, expecting IDENTIFIER\n        parameter ENEMY_Y_SIZE  = 100,\n        ^~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:18: syntax error, unexpected parameter, expecting IDENTIFIER\n        parameter RAND_POS_BIT_LEN = 9,\n        ^~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:19: syntax error, unexpected parameter, expecting IDENTIFIER\n        parameter RAND_OFFSET   = 0,\n        ^~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:20: syntax error, unexpected parameter, expecting IDENTIFIER\n        parameter BRAM_WIDTH    = 20,\n        ^~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:21: syntax error, unexpected parameter, expecting IDENTIFIER\n        parameter BRAM_DEPTH    = 10000,\n        ^~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:22: syntax error, unexpected parameter, expecting IDENTIFIER\n        parameter BRAM_DEPTH_BIT_LEN = 16\n        ^~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:23: syntax error, unexpected \')\', expecting \';\'\n    )\n    ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:26: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire                          clk_run,\n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:27: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire                          rst,\n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:28: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire                          en_i,\n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:29: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire                          v_sync_i,\n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:30: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire [       `H_DISP_LEN-1:0] req_x_addr_i,\n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:30: 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/enemy_base.v:31: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire [       `V_DISP_LEN-1:0] req_y_addr_i,\n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:31: 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/enemy_base.v:32: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire [     MAX_ENEMY_NUM-1:0] disappear_i,          \n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:33: syntax error, unexpected input, expecting IDENTIFIER or do or final\n        input  wire [       `RAND_WIDTH-1:0] rand_pos_i,\n        ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:33: Define or directive not defined: \'`RAND_WIDTH\'\n        input  wire [       `RAND_WIDTH-1:0] rand_pos_i,\n                            ^~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:35: syntax error, unexpected output, expecting IDENTIFIER or do or final\n        output wire [BRAM_DEPTH_BIT_LEN-1:0] bram_addr_o,\n        ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:36: syntax error, unexpected output, expecting IDENTIFIER or do or final\n        output wire                          enemy_vali_o,\n        ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:37: syntax error, unexpected output, expecting IDENTIFIER or do or final\n        output wire [MAX_ENEMY_NUM_BIT_LEN-1:0] curr_enemy_idx_o,\n        ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:38: syntax error, unexpected output, expecting IDENTIFIER or do or final\n        output wire                          trigger_o,\n        ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:39: syntax error, unexpected output, expecting IDENTIFIER or do or final\n        output wire [MAX_ENEMY_NUM_BIT_LEN-1:0] trigger_idx_o,\n        ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:40: syntax error, unexpected output, expecting IDENTIFIER or do or final\n        output reg  [ `ADD_SCORE_BIT_WIDTH-1:0] disappear_num_o\n        ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:40: Define or directive not defined: \'`ADD_SCORE_BIT_WIDTH\'\n        output reg  [ `ADD_SCORE_BIT_WIDTH-1:0] disappear_num_o\n                      ^~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:41: syntax error, unexpected \')\', expecting \',\' or \';\'\n    );\n    ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:46: Define or directive not defined: \'`OBJ_X_POS_BIT_LEN\'\n    reg  [           `OBJ_X_POS_BIT_LEN-1:0] x_pos_unit       [MAX_ENEMY_NUM-1:0];\n                     ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:51: Define or directive not defined: \'`OBJ_Y_POS_BIT_LEN\'\n    reg  [           `OBJ_Y_POS_BIT_LEN-1:0] fixed_y_pos_unit [MAX_ENEMY_NUM-1:0];\n                     ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:52: Define or directive not defined: \'`V_DISP\'\n    wire [                      `V_DISP-1:0] fixed_req_y_addr;\n                                ^~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:55: Define or directive not defined: \'`OBJ_Y_POS_BIT_LEN\'\n    reg  [           `OBJ_Y_POS_BIT_LEN-1:0] displocked_fixed_y_pos_unit [MAX_ENEMY_NUM-1:0];\n                     ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:60: Unsupported: wor\n    wor  [        MAX_ENEMY_NUM_BIT_LEN-1:0] curr_enemy_idx;\n    ^~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:64: Unsupported: wor\n    wor                                      enemy_vali;         \n    ^~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:66: syntax error, unexpected assign\n    assign fixed_req_y_addr = req_y_addr_i + ENEMY_Y_SIZE;  \n    ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:118: Define or directive not defined: \'`V_DISP\'\n                        if(disappear_i[i] || fixed_y_pos_unit[i] >= `V_DISP + ENEMY_Y_SIZE) begin\n                                                                    ^~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:175: syntax error, unexpected always\n    always@(*) begin\n    ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enemy_base.v:195: syntax error, unexpected endmodule\nendmodule  \n^~~~~~~~~\n%Error: Exiting due to 40 error(s)\n'
module enemy_base#(
        parameter MAX_ENEMY_NUM = 10,
        parameter MAX_ENEMY_NUM_BIT_LEN = 4,
        parameter SPEED         = `ENEMY_SPEED_LOW,

        parameter ENEMY_CNT_MAX_TRIGGER = 50,
        parameter ENEMY_X_SIZE  = 100,
        parameter ENEMY_Y_SIZE  = 100,
        parameter RAND_POS_BIT_LEN = 9,
        parameter RAND_OFFSET   = 0,
        parameter BRAM_WIDTH    = 20,
        parameter BRAM_DEPTH    = 10000,
        parameter BRAM_DEPTH_BIT_LEN = 16
    )
    (
        input  wire                          clk_vga,
        input  wire                          clk_run,
        input  wire                          rst,
        input  wire                          en_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 [     MAX_ENEMY_NUM-1:0] disappear_i,
        input  wire [       `RAND_WIDTH-1:0] rand_pos_i,

        output wire [BRAM_DEPTH_BIT_LEN-1:0] bram_addr_o,
        output wire                          enemy_vali_o,
        output wire [MAX_ENEMY_NUM_BIT_LEN-1:0] curr_enemy_idx_o,
        output wire                          trigger_o,
        output wire [MAX_ENEMY_NUM_BIT_LEN-1:0] trigger_idx_o,
        output reg  [ `ADD_SCORE_BIT_WIDTH-1:0] disappear_num_o
    );


    localparam ENEMY_CNT_MAX_TRIGGER_BIT_LEN = funclog2(ENEMY_CNT_MAX_TRIGGER);

    reg  [           `OBJ_X_POS_BIT_LEN-1:0] x_pos_unit       [MAX_ENEMY_NUM-1:0];

    reg  [           `OBJ_Y_POS_BIT_LEN-1:0] fixed_y_pos_unit [MAX_ENEMY_NUM-1:0];
    wire [                      `V_DISP-1:0] fixed_req_y_addr;


    reg  [           `OBJ_Y_POS_BIT_LEN-1:0] displocked_fixed_y_pos_unit [MAX_ENEMY_NUM-1:0];
    reg  [        MAX_ENEMY_NUM_BIT_LEN-1:0] trigger_idx;
    reg                                      trigger;
    reg                                      visible          [MAX_ENEMY_NUM-1:0];
    reg  [ENEMY_CNT_MAX_TRIGGER_BIT_LEN-1:0] cnt_trigger;
    wor  [        MAX_ENEMY_NUM_BIT_LEN-1:0] curr_enemy_idx;
    wire [           BRAM_DEPTH_BIT_LEN-1:0] bram_addr;
    reg  [           BRAM_DEPTH_BIT_LEN-1:0] bram_addr_unit   [MAX_ENEMY_NUM-1:0];
    wire                                     in_req_area      [MAX_ENEMY_NUM-1:0];
    wor                                      enemy_vali;

    assign fixed_req_y_addr = req_y_addr_i + ENEMY_Y_SIZE;
    assign trigger_o        = trigger;
    assign trigger_idx_o    = trigger_idx;
    assign curr_enemy_idx_o = curr_enemy_idx;

    always @(posedge clk_run or posedge rst)begin
        if(rst) begin
            cnt_trigger <= 0;
            trigger_idx <= 0;
            trigger     <= 0;
        end else begin
            if(cnt_trigger == ENEMY_CNT_MAX_TRIGGER - 1)begin
                cnt_trigger <= 0;
                trigger     <= 1;
                if(trigger_idx == MAX_ENEMY_NUM - 1) begin
                    trigger_idx <= 0;
                end else begin
                    trigger_idx <= trigger_idx + 1;
                end
            end else begin
                cnt_trigger <= cnt_trigger + 1;
                trigger     <= 0;
            end
        end
    end

    genvar i;
    generate
        for(i=0;i<MAX_ENEMY_NUM;i=i+1) begin: ENEMY_LOOP


            always @(posedge clk_vga or posedge rst)begin
                if(rst) begin
                    displocked_fixed_y_pos_unit[i] <= 0;
                end else begin
                    if(~v_sync_i) begin
                        displocked_fixed_y_pos_unit[i] <= fixed_y_pos_unit[i];
                    end else if(trigger && trigger_idx == i) begin
                        displocked_fixed_y_pos_unit[i] <= 0;
                    end else begin
                        displocked_fixed_y_pos_unit[i] <= displocked_fixed_y_pos_unit[i];
                    end
                end
            end

            always @(posedge clk_run or posedge rst)begin
                if(rst) begin
                    x_pos_unit[i]       <= 0;
                    fixed_y_pos_unit[i] <= 0;
                    visible[i]          <= 0;
                end else begin
                    if(visible[i]) begin
                        if(disappear_i[i] || fixed_y_pos_unit[i] >= `V_DISP + ENEMY_Y_SIZE) begin
                            visible[i] <= 0;
                            fixed_y_pos_unit[i] <= 0;
                        end else begin
                            visible[i] <= visible[i];
                            fixed_y_pos_unit[i] <= fixed_y_pos_unit[i] + SPEED;
                        end
                    end else begin
                        if(trigger && trigger_idx == i) begin
                            x_pos_unit[i] <= rand_pos_i[RAND_OFFSET+:RAND_POS_BIT_LEN];
                            fixed_y_pos_unit[i] <= 0;
                            visible[i] <= 1;
                        end else begin
                            fixed_y_pos_unit[i] <= fixed_y_pos_unit[i];
                        end
                    end
                end
            end


            always @(posedge clk_vga or posedge rst) begin
                if(rst) begin
                    bram_addr_unit[i] <= 0;
                end else begin
                    if(~v_sync_i) begin
                        if(displocked_fixed_y_pos_unit[i] < ENEMY_Y_SIZE) begin
                            bram_addr_unit[i] <= (ENEMY_Y_SIZE - displocked_fixed_y_pos_unit[i]) * ENEMY_X_SIZE;
                        end else begin
                            bram_addr_unit[i] <= 0;
                        end
                    end else begin
                        if(in_req_area[i]) begin
                            bram_addr_unit[i] <= bram_addr_unit[i] + 1;
                        end else begin
                            bram_addr_unit[i] <= bram_addr_unit[i];
                        end
                    end
                end
            end

            assign in_req_area[i] = visible[i]
                            && (req_x_addr_i >= x_pos_unit[i])
                            && (req_x_addr_i < x_pos_unit[i] + ENEMY_X_SIZE)
                            && (fixed_req_y_addr >= displocked_fixed_y_pos_unit[i])
                            && (fixed_req_y_addr < displocked_fixed_y_pos_unit[i] + ENEMY_Y_SIZE);

            assign curr_enemy_idx = in_req_area[i] ? i : 0;
            assign enemy_vali = in_req_area[i];
        end
    endgenerate

    assign enemy_vali_o = enemy_vali;
    assign bram_addr = bram_addr_unit[curr_enemy_idx];
    assign bram_addr_o = bram_addr;


    reg [MAX_ENEMY_NUM-1:0] temp_disappear_idx;
    always@(*) begin
        disappear_num_o = 0;
        for(temp_disappear_idx=0;temp_disappear_idx<MAX_ENEMY_NUM;temp_disappear_idx=temp_disappear_idx+1) begin
            if(disappear_i[temp_disappear_idx]) begin
                disappear_num_o = disappear_num_o + 1;
            end else begin
                disappear_num_o = disappear_num_o;
            end
        end
    end


    function integer funclog2;
        input integer value;
        begin
            value = value - 1;
            for (funclog2=0; value>0; funclog2=funclog2+1)
                value = value >> 1;
        end
    endfunction
endmodule
module enemy_base#(
        parameter MAX_ENEMY_NUM = 10,
        parameter MAX_ENEMY_NUM_BIT_LEN = 4,
        parameter SPEED         = `ENEMY_SPEED_LOW,

        parameter ENEMY_CNT_MAX_TRIGGER = 50,
        parameter ENEMY_X_SIZE  = 100,
        parameter ENEMY_Y_SIZE  = 100,
        parameter RAND_POS_BIT_LEN = 9,
        parameter RAND_OFFSET   = 0,
        parameter BRAM_WIDTH    = 20,
        parameter BRAM_DEPTH    = 10000,
        parameter BRAM_DEPTH_BIT_LEN = 16
    )
    (
        input  wire                          clk_vga,
        input  wire                          clk_run,
        input  wire                          rst,
        input  wire                          en_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 [     MAX_ENEMY_NUM-1:0] disappear_i,
        input  wire [       `RAND_WIDTH-1:0] rand_pos_i,

        output wire [BRAM_DEPTH_BIT_LEN-1:0] bram_addr_o,
        output wire                          enemy_vali_o,
        output wire [MAX_ENEMY_NUM_BIT_LEN-1:0] curr_enemy_idx_o,
        output wire                          trigger_o,
        output wire [MAX_ENEMY_NUM_BIT_LEN-1:0] trigger_idx_o,
        output reg  [ `ADD_SCORE_BIT_WIDTH-1:0] disappear_num_o
    );



    localparam ENEMY_CNT_MAX_TRIGGER_BIT_LEN = funclog2(ENEMY_CNT_MAX_TRIGGER);

    reg  [           `OBJ_X_POS_BIT_LEN-1:0] x_pos_unit       [MAX_ENEMY_NUM-1:0];

    reg  [           `OBJ_Y_POS_BIT_LEN-1:0] fixed_y_pos_unit [MAX_ENEMY_NUM-1:0];
    wire [                      `V_DISP-1:0] fixed_req_y_addr;


    reg  [           `OBJ_Y_POS_BIT_LEN-1:0] displocked_fixed_y_pos_unit [MAX_ENEMY_NUM-1:0];
    reg  [        MAX_ENEMY_NUM_BIT_LEN-1:0] trigger_idx;
    reg                                      trigger;
    reg                                      visible          [MAX_ENEMY_NUM-1:0];
    reg  [ENEMY_CNT_MAX_TRIGGER_BIT_LEN-1:0] cnt_trigger;
    wor  [        MAX_ENEMY_NUM_BIT_LEN-1:0] curr_enemy_idx;
    wire [           BRAM_DEPTH_BIT_LEN-1:0] bram_addr;
    reg  [           BRAM_DEPTH_BIT_LEN-1:0] bram_addr_unit   [MAX_ENEMY_NUM-1:0];
    wire                                     in_req_area      [MAX_ENEMY_NUM-1:0];
    wor                                      enemy_vali;

    assign fixed_req_y_addr = req_y_addr_i + ENEMY_Y_SIZE;
    assign trigger_o        = trigger;
    assign trigger_idx_o    = trigger_idx;
    assign curr_enemy_idx_o = curr_enemy_idx;

    always @(posedge clk_run or posedge rst)begin
        if(rst) begin
            cnt_trigger <= 0;
            trigger_idx <= 0;
            trigger     <= 0;
        end else begin
            if(cnt_trigger == ENEMY_CNT_MAX_TRIGGER - 1)begin
                cnt_trigger <= 0;
                trigger     <= 1;
                if(trigger_idx == MAX_ENEMY_NUM - 1) begin
                    trigger_idx <= 0;
                end else begin
                    trigger_idx <= trigger_idx + 1;
                end
            end else begin
                cnt_trigger <= cnt_trigger + 1;
                trigger     <= 0;
            end
        end
    end

    genvar i;
    generate
        for(i=0;i<MAX_ENEMY_NUM;i=i+1) begin: ENEMY_LOOP


            always @(posedge clk_vga or posedge rst)begin
                if(rst) begin
                    displocked_fixed_y_pos_unit[i] <= 0;
                end else begin
                    if(~v_sync_i) begin
                        displocked_fixed_y_pos_unit[i] <= fixed_y_pos_unit[i];
                    end else if(trigger && trigger_idx == i) begin
                        displocked_fixed_y_pos_unit[i] <= 0;
                    end else begin
                        displocked_fixed_y_pos_unit[i] <= displocked_fixed_y_pos_unit[i];
                    end
                end
            end

            always @(posedge clk_run or posedge rst)begin
                if(rst) begin
                    x_pos_unit[i]       <= 0;
                    fixed_y_pos_unit[i] <= 0;
                    visible[i]          <= 0;
                end else begin
                    if(visible[i]) begin
                        if(disappear_i[i] || fixed_y_pos_unit[i] >= `V_DISP + ENEMY_Y_SIZE) begin
                            visible[i] <= 0;
                            fixed_y_pos_unit[i] <= 0;
                        end else begin
                            visible[i] <= visible[i];
                            fixed_y_pos_unit[i] <= fixed_y_pos_unit[i] + SPEED;
                        end
                    end else begin
                        if(trigger && trigger_idx == i) begin
                            x_pos_unit[i] <= rand_pos_i[RAND_OFFSET+:RAND_POS_BIT_LEN];
                            fixed_y_pos_unit[i] <= 0;
                            visible[i] <= 1;
                        end else begin
                            fixed_y_pos_unit[i] <= fixed_y_pos_unit[i];
                        end
                    end
                end
            end


            always @(posedge clk_vga or posedge rst) begin
                if(rst) begin
                    bram_addr_unit[i] <= 0;
                end else begin
                    if(~v_sync_i) begin
                        if(displocked_fixed_y_pos_unit[i] < ENEMY_Y_SIZE) begin
                            bram_addr_unit[i] <= (ENEMY_Y_SIZE - displocked_fixed_y_pos_unit[i]) * ENEMY_X_SIZE;
                        end else begin
                            bram_addr_unit[i] <= 0;
                        end
                    end else begin
                        if(in_req_area[i]) begin
                            bram_addr_unit[i] <= bram_addr_unit[i] + 1;
                        end else begin
                            bram_addr_unit[i] <= bram_addr_unit[i];
                        end
                    end
                end
            end

            assign in_req_area[i] = visible[i]
                            && (req_x_addr_i >= x_pos_unit[i])
                            && (req_x_addr_i < x_pos_unit[i] + ENEMY_X_SIZE)
                            && (fixed_req_y_addr >= displocked_fixed_y_pos_unit[i])
                            && (fixed_req_y_addr < displocked_fixed_y_pos_unit[i] + ENEMY_Y_SIZE);

            assign curr_enemy_idx = in_req_area[i] ? i : 0;
            assign enemy_vali = in_req_area[i];
        end
    endgenerate

    assign enemy_vali_o = enemy_vali;
    assign bram_addr = bram_addr_unit[curr_enemy_idx];
    assign bram_addr_o = bram_addr;


    reg [MAX_ENEMY_NUM-1:0] temp_disappear_idx;
    always@(*) begin
        disappear_num_o = 0;
        for(temp_disappear_idx=0;temp_disappear_idx<MAX_ENEMY_NUM;temp_disappear_idx=temp_disappear_idx+1) begin
            if(disappear_i[temp_disappear_idx]) begin
                disappear_num_o = disappear_num_o + 1;
            end else begin
                disappear_num_o = disappear_num_o;
            end
        end
    end


    function integer funclog2;
        input integer value;
        begin
            value = value - 1;
            for (funclog2=0; value>0; funclog2=funclog2+1)
                value = value >> 1;
        end
    endfunction
endmodule