data/full_repos/permissive/423412549/src/rtl/enc_btn.v
1: b'%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:10: 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/enc_btn.v:26: Define or directive not defined: \'`RST_BTN_TIME_MAX_CNT_BIT_LEN\'\n    reg [`RST_BTN_TIME_MAX_CNT_BIT_LEN-1:0] rst_btn_time_cnt;\n         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:33: Define or directive not defined: \'`DOWN\'\n                direct_o = `DOWN;\n                           ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:33: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n                direct_o = `DOWN;\n                                ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:37: Define or directive not defined: \'`UP\'\n                direct_o = `UP;\n                           ^~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:37: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n                direct_o = `UP;\n                              ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:41: Define or directive not defined: \'`RIGHT\'\n                direct_o = `RIGHT;\n                           ^~~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:41: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n                direct_o = `RIGHT;\n                                 ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:45: Define or directive not defined: \'`LEFT\'\n                direct_o = `LEFT;\n                           ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:45: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n                direct_o = `LEFT;\n                                ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:49: Define or directive not defined: \'`DOWN\'\n                direct_o = `DOWN;\n                           ^~~~~\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:49: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n                direct_o = `DOWN;\n                                ^\n%Error: data/full_repos/permissive/423412549/src/rtl/enc_btn.v:56: Define or directive not defined: \'`RST_BTN_TIME_MAX_CNT\'\n            if(rst_btn_time_cnt == `RST_BTN_TIME_MAX_CNT - 1) begin\n                                   ^~~~~~~~~~~~~~~~~~~~~\n%Error: Exiting due to 13 error(s)\n'
module enc_btn (
     input  wire       clk,
     
     input  wire       btn_l_pin_i,
     input  wire       btn_r_pin_i,
     input  wire       btn_u_pin_i,
     input  wire       btn_d_pin_i,
     input  wire       btn_c_pin_i,

     output reg        move_en_o,
     output reg [1:0]  direct_o,
     output reg        rst,
     output wire       press_vali_o
 );

    reg [`RST_BTN_TIME_MAX_CNT_BIT_LEN-1:0] rst_btn_time_cnt;
    assign press_vali_o = btn_l_pin_i | btn_r_pin_i | btn_u_pin_i | btn_d_pin_i | btn_c_pin_i;

    always @( *) begin
        case({btn_l_pin_i, btn_r_pin_i, btn_u_pin_i, btn_d_pin_i})
            4'b0001: begin
                move_en_o = 1'b1;
                direct_o = `DOWN;
            end
            4'b0010: begin
                move_en_o = 1'b1;
                direct_o = `UP;
            end
            4'b0100: begin
                move_en_o = 1'b1;
                direct_o = `RIGHT;
            end
            4'b1000: begin
                move_en_o = 1'b1;
                direct_o = `LEFT;
            end
            default: begin
                move_en_o = 1'b0;
                direct_o = `DOWN;
            end
        endcase
    end

    always @(posedge clk) begin
        if(btn_c_pin_i) begin
            if(rst_btn_time_cnt == `RST_BTN_TIME_MAX_CNT - 1) begin
                rst <= 1;
                rst_btn_time_cnt = rst_btn_time_cnt;
            end else begin
                rst_btn_time_cnt <= rst_btn_time_cnt + 1;
                rst <= 0;
            end
        end else begin
            rst_btn_time_cnt <= 0;
            rst <= 0;
        end
    end

 
 endmodule
module enc_btn (
     input  wire       clk,
     
     input  wire       btn_l_pin_i,
     input  wire       btn_r_pin_i,
     input  wire       btn_u_pin_i,
     input  wire       btn_d_pin_i,
     input  wire       btn_c_pin_i,

     output reg        move_en_o,
     output reg [1:0]  direct_o,
     output reg        rst,
     output wire       press_vali_o
 );


    reg [`RST_BTN_TIME_MAX_CNT_BIT_LEN-1:0] rst_btn_time_cnt;
    assign press_vali_o = btn_l_pin_i | btn_r_pin_i | btn_u_pin_i | btn_d_pin_i | btn_c_pin_i;

    always @( *) begin
        case({btn_l_pin_i, btn_r_pin_i, btn_u_pin_i, btn_d_pin_i})
            4'b0001: begin
                move_en_o = 1'b1;
                direct_o = `DOWN;
            end
            4'b0010: begin
                move_en_o = 1'b1;
                direct_o = `UP;
            end
            4'b0100: begin
                move_en_o = 1'b1;
                direct_o = `RIGHT;
            end
            4'b1000: begin
                move_en_o = 1'b1;
                direct_o = `LEFT;
            end
            default: begin
                move_en_o = 1'b0;
                direct_o = `DOWN;
            end
        endcase
    end

    always @(posedge clk) begin
        if(btn_c_pin_i) begin
            if(rst_btn_time_cnt == `RST_BTN_TIME_MAX_CNT - 1) begin
                rst <= 1;
                rst_btn_time_cnt = rst_btn_time_cnt;
            end else begin
                rst_btn_time_cnt <= rst_btn_time_cnt + 1;
                rst <= 0;
            end
        end else begin
            rst_btn_time_cnt <= 0;
            rst <= 0;
        end
    end

 
 endmodule