data/full_repos/permissive/463395574/imm.v
1: b'%Error: data/full_repos/permissive/463395574/imm.v:3: Cannot find include file: defines.v\n`include "defines.v" \n         ^~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/463395574,data/full_repos/permissive/463395574/defines.v\n             data/full_repos/permissive/463395574,data/full_repos/permissive/463395574/defines.v.v\n             data/full_repos/permissive/463395574,data/full_repos/permissive/463395574/defines.v.sv\n             defines.v\n             defines.v.v\n             defines.v.sv\n             obj_dir/defines.v\n             obj_dir/defines.v.v\n             obj_dir/defines.v.sv\n%Error: data/full_repos/permissive/463395574/imm.v:6: Define or directive not defined: \'`INSTR_SIZE\'\n    input [`INSTR_SIZE-1:0] instr,\n           ^~~~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:9: Define or directive not defined: \'`WORD_LEN\'\n    output reg [`WORD_LEN-1:0]  immout\n                ^~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:19: Define or directive not defined: \'`IMM_CTRL_ITYPE\'\n        `IMM_CTRL_ITYPE:\n        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:19: syntax error, unexpected \':\', expecting endcase\n        `IMM_CTRL_ITYPE:\n                       ^\n%Error: data/full_repos/permissive/463395574/imm.v:20: Define or directive not defined: \'`WORD_LEN\'\n            immout <= {{{`WORD_LEN-12}{iimm[11]}}, iimm[11:0]};\n                         ^~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:21: Define or directive not defined: \'`IMM_CTRL_STYPE\'\n        `IMM_CTRL_STYPE:\n        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:22: Define or directive not defined: \'`WORD_LEN\'\n            immout <= {{{`WORD_LEN-12}{simm[11]}}, simm[11:0]};\n                         ^~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:23: Define or directive not defined: \'`IMM_CTRL_BTYPE\'\n        `IMM_CTRL_BTYPE:\n        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:24: Define or directive not defined: \'`WORD_LEN\'\n            immout <= {{{`WORD_LEN-13}{bimm[11]}}, bimm[11:0], 1\'b0};\n                         ^~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:25: Define or directive not defined: \'`IMM_CTRL_UTYPE\'\n        `IMM_CTRL_UTYPE:\n        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:26: Define or directive not defined: \'`WORD_LEN\'\n            immout <= {{{`WORD_LEN-32}{uimm[19]}}, uimm[19:0], 12\'b0};\n                         ^~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:27: Define or directive not defined: \'`IMM_CTRL_JTYPE\'\n        `IMM_CTRL_JTYPE:\n        ^~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:28: Define or directive not defined: \'`WORD_LEN\'\n            immout <= {{{`WORD_LEN-21}{jimm[19]}}, jimm[19:0], 1\'b0};\n                         ^~~~~~~~~\n%Error: data/full_repos/permissive/463395574/imm.v:30: Define or directive not defined: \'`WORD_LEN\'\n            immout <= `WORD_LEN\'b0;\n                      ^~~~~~~~~\n%Error: Cannot continue\n'
module ImmGen (
    input [`INSTR_SIZE-1:0] instr,
    input [4:0]  immctrl,

    output reg [`WORD_LEN-1:0]  immout
);
    wire [11:0] iimm = instr[31:20];
    wire [11:0] simm = {instr[31:25], instr[11:7]};
    wire [11:0] bimm = {instr[31], instr[7], instr[30:25], instr[11:8]};
    wire [19:0] uimm = instr[31:12];
    wire [19:0] jimm = {instr[31], instr[19:12], instr[20], instr[30:21]};

    always @(*)
    case (immctrl)
        `IMM_CTRL_ITYPE:
            immout <= {{{`WORD_LEN-12}{iimm[11]}}, iimm[11:0]};
        `IMM_CTRL_STYPE:
            immout <= {{{`WORD_LEN-12}{simm[11]}}, simm[11:0]};
        `IMM_CTRL_BTYPE:
            immout <= {{{`WORD_LEN-13}{bimm[11]}}, bimm[11:0], 1'b0};
        `IMM_CTRL_UTYPE:
            immout <= {{{`WORD_LEN-32}{uimm[19]}}, uimm[19:0], 12'b0};
        `IMM_CTRL_JTYPE:
            immout <= {{{`WORD_LEN-21}{jimm[19]}}, jimm[19:0], 1'b0};
        default:
            immout <= `WORD_LEN'b0;
    endcase
endmodule
module ImmGen (
    input [`INSTR_SIZE-1:0] instr,
    input [4:0]  immctrl,

    output reg [`WORD_LEN-1:0]  immout
);

    wire [11:0] iimm = instr[31:20];
    wire [11:0] simm = {instr[31:25], instr[11:7]};
    wire [11:0] bimm = {instr[31], instr[7], instr[30:25], instr[11:8]};
    wire [19:0] uimm = instr[31:12];
    wire [19:0] jimm = {instr[31], instr[19:12], instr[20], instr[30:21]};

    always @(*)
    case (immctrl)
        `IMM_CTRL_ITYPE:
            immout <= {{{`WORD_LEN-12}{iimm[11]}}, iimm[11:0]};
        `IMM_CTRL_STYPE:
            immout <= {{{`WORD_LEN-12}{simm[11]}}, simm[11:0]};
        `IMM_CTRL_BTYPE:
            immout <= {{{`WORD_LEN-13}{bimm[11]}}, bimm[11:0], 1'b0};
        `IMM_CTRL_UTYPE:
            immout <= {{{`WORD_LEN-32}{uimm[19]}}, uimm[19:0], 12'b0};
        `IMM_CTRL_JTYPE:
            immout <= {{{`WORD_LEN-21}{jimm[19]}}, jimm[19:0], 1'b0};
        default:
            immout <= `WORD_LEN'b0;
    endcase
endmodule