data/full_repos/permissive/470392519/rtl/ImmGen.v
1: b'%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:1: Cannot find include file: types.vh\n`include "types.vh" \n         ^~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/470392519/rtl,data/full_repos/permissive/470392519/types.vh\n             data/full_repos/permissive/470392519/rtl,data/full_repos/permissive/470392519/types.vh.v\n             data/full_repos/permissive/470392519/rtl,data/full_repos/permissive/470392519/types.vh.sv\n             types.vh\n             types.vh.v\n             types.vh.sv\n             obj_dir/types.vh\n             obj_dir/types.vh.v\n             obj_dir/types.vh.sv\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:10: Define or directive not defined: \'`OPCODE\'\n        case (`OPCODE(i_instr))\n              ^~~~~~~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:13: Define or directive not defined: \'`I_JUMP\'\n            `I_JUMP  ,\n            ^~~~~~~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:13: syntax error, unexpected \',\', expecting endcase\n            `I_JUMP  ,\n                     ^\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:14: Define or directive not defined: \'`I_LOAD\'\n            `I_LOAD  : o_imm = {{21{i_instr[31]}}, i_instr[30:20]};\n            ^~~~~~~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:15: Define or directive not defined: \'`I_ARITH\'\n            `I_ARITH : o_imm = `IS_SHIFT_IMM(i_instr) ?\n            ^~~~~~~~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:15: Define or directive not defined: \'`IS_SHIFT_IMM\'\n            `I_ARITH : o_imm = `IS_SHIFT_IMM(i_instr) ?\n                               ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:17: Define or directive not defined: \'`S\'\n            `S       : o_imm = {{21{i_instr[31]}}, i_instr[30:25], i_instr[11:8], i_instr[7]};\n            ^~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:18: Define or directive not defined: \'`B\'\n            `B       : o_imm = {{20{i_instr[31]}}, i_instr[7], i_instr[30:25], i_instr[11:8], 1\'d0};\n            ^~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:19: Define or directive not defined: \'`U_LUI\'\n            `U_LUI   ,\n            ^~~~~~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:20: Define or directive not defined: \'`U_AUIPC\'\n            `U_AUIPC : o_imm = {i_instr[31], i_instr[30:20], i_instr[19:12], 12\'d0};\n            ^~~~~~~~\n%Error: data/full_repos/permissive/470392519/rtl/ImmGen.v:21: Define or directive not defined: \'`J\'\n            `J       : o_imm = {{12{i_instr[31]}}, i_instr[19:12], i_instr[20], i_instr[30:25], i_instr[24:21], 1\'d0};\n            ^~\n%Error: Cannot continue\n'
module ImmGen (
    input       [31:0]      i_instr,
    output reg  [XLEN-1:0]  o_imm
);
    parameter XLEN = 32;

    always @* begin
        case (`OPCODE(i_instr))
            default  : o_imm = 32'hffffffff;

            `I_JUMP  ,
            `I_LOAD  : o_imm = {{21{i_instr[31]}}, i_instr[30:20]};
            `I_ARITH : o_imm = `IS_SHIFT_IMM(i_instr) ?
                        {{27{i_instr[31]}}, i_instr[24:20]} : {{21{i_instr[31]}}, i_instr[30:20]};
            `S       : o_imm = {{21{i_instr[31]}}, i_instr[30:25], i_instr[11:8], i_instr[7]};
            `B       : o_imm = {{20{i_instr[31]}}, i_instr[7], i_instr[30:25], i_instr[11:8], 1'd0};
            `U_LUI   ,
            `U_AUIPC : o_imm = {i_instr[31], i_instr[30:20], i_instr[19:12], 12'd0};
            `J       : o_imm = {{12{i_instr[31]}}, i_instr[19:12], i_instr[20], i_instr[30:25], i_instr[24:21], 1'd0};
        endcase
    end
endmodule
module ImmGen (
    input       [31:0]      i_instr,
    output reg  [XLEN-1:0]  o_imm
);

    parameter XLEN = 32;

    always @* begin
        case (`OPCODE(i_instr))
            default  : o_imm = 32'hffffffff;

            `I_JUMP  ,
            `I_LOAD  : o_imm = {{21{i_instr[31]}}, i_instr[30:20]};
            `I_ARITH : o_imm = `IS_SHIFT_IMM(i_instr) ?
                        {{27{i_instr[31]}}, i_instr[24:20]} : {{21{i_instr[31]}}, i_instr[30:20]};
            `S       : o_imm = {{21{i_instr[31]}}, i_instr[30:25], i_instr[11:8], i_instr[7]};
            `B       : o_imm = {{20{i_instr[31]}}, i_instr[7], i_instr[30:25], i_instr[11:8], 1'd0};
            `U_LUI   ,
            `U_AUIPC : o_imm = {i_instr[31], i_instr[30:20], i_instr[19:12], 12'd0};
            `J       : o_imm = {{12{i_instr[31]}}, i_instr[19:12], i_instr[20], i_instr[30:25], i_instr[24:21], 1'd0};
        endcase
    end
endmodule