data/full_repos/permissive/503578084/pipeline/sext.v
1: b'%Error: data/full_repos/permissive/503578084/pipeline/sext.v:21: Cannot find include file: param.v\n`include    "param.v" \n            ^~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/503578084/pipeline,data/full_repos/permissive/503578084/param.v\n             data/full_repos/permissive/503578084/pipeline,data/full_repos/permissive/503578084/param.v.v\n             data/full_repos/permissive/503578084/pipeline,data/full_repos/permissive/503578084/param.v.sv\n             param.v\n             param.v.v\n             param.v.sv\n             obj_dir/param.v\n             obj_dir/param.v.v\n             obj_dir/param.v.sv\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:32: Define or directive not defined: \'`I\'\n            `I:begin\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:32: syntax error, unexpected \':\', expecting endcase\n            `I:begin\n              ^\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:36: Define or directive not defined: \'`S\'\n            `S:ext={20\'b0,inst[31:25],inst[11:7]};\n            ^~\n%Warning-ENDLABEL: data/full_repos/permissive/503578084/pipeline/sext.v:36: End label \'ext\' does not match begin label \'\'\n            `S:ext={20\'b0,inst[31:25],inst[11:7]};\n               ^~~\n                   ... Use "/* verilator lint_off ENDLABEL */" and lint_on around source to disable this message.\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:36: syntax error, unexpected \'=\'\n            `S:ext={20\'b0,inst[31:25],inst[11:7]};\n                  ^\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:37: Define or directive not defined: \'`B\'\n            `B:ext={19\'b0,inst[31],inst[7],inst[30:25],inst[11:8],1\'b0};\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:38: Define or directive not defined: \'`U\'\n            `U:ext={inst[31:12],12\'b0};\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:39: Define or directive not defined: \'`J\'\n            `J:ext={11\'b0,inst[31],inst[19:12],inst[20],inst[30:21],1\'b0};\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:44: Define or directive not defined: \'`I\'\n            `I:begin\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:48: Define or directive not defined: \'`S\'\n            `S:ext={20\'b11111111111111111111,inst[31:25],inst[11:7]};\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:49: Define or directive not defined: \'`B\'\n            `B:ext={19\'b1111111111111111111,inst[31],inst[7],inst[30:25],inst[11:8],1\'b0};\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:50: Define or directive not defined: \'`U\'\n            `U:ext={inst[31:12],12\'b0};\n            ^~\n%Error: data/full_repos/permissive/503578084/pipeline/sext.v:51: Define or directive not defined: \'`J\'\n            `J:ext={11\'b11111111111,inst[31],inst[19:12],inst[20],inst[30:21],1\'b0};\n            ^~\n%Error: Cannot continue\n'
module sext(
    input   [2:0]   sext_op,
    input   [31:0]  inst,
    output  reg [31:0]  ext
    );
    
always @ (*) begin
    if(inst[31]=='b0)
        case(sext_op)
            `I:begin
                if(inst[14:12]=='b001 || inst[14:12]=='b101) ext={27'b0,inst[24:20]};
                else ext={20'b0,inst[31:20]};
            end
            `S:ext={20'b0,inst[31:25],inst[11:7]};
            `B:ext={19'b0,inst[31],inst[7],inst[30:25],inst[11:8],1'b0};
            `U:ext={inst[31:12],12'b0};
            `J:ext={11'b0,inst[31],inst[19:12],inst[20],inst[30:21],1'b0};
            default:ext=32'b0;
        endcase
    else
        case(sext_op)
            `I:begin
                if(inst[14:12]=='b001 || inst[14:12]=='b101) ext={27'b0,inst[24:20]};
                else ext={20'b11111111111111111111,inst[31:20]};
            end
            `S:ext={20'b11111111111111111111,inst[31:25],inst[11:7]};
            `B:ext={19'b1111111111111111111,inst[31],inst[7],inst[30:25],inst[11:8],1'b0};
            `U:ext={inst[31:12],12'b0};
            `J:ext={11'b11111111111,inst[31],inst[19:12],inst[20],inst[30:21],1'b0};
            default:ext=32'b11111111111111111111111111111111;
        endcase
end
    
endmodule
module sext(
    input   [2:0]   sext_op,
    input   [31:0]  inst,
    output  reg [31:0]  ext
    );

    
always @ (*) begin
    if(inst[31]=='b0)
        case(sext_op)
            `I:begin
                if(inst[14:12]=='b001 || inst[14:12]=='b101) ext={27'b0,inst[24:20]};
                else ext={20'b0,inst[31:20]};
            end
            `S:ext={20'b0,inst[31:25],inst[11:7]};
            `B:ext={19'b0,inst[31],inst[7],inst[30:25],inst[11:8],1'b0};
            `U:ext={inst[31:12],12'b0};
            `J:ext={11'b0,inst[31],inst[19:12],inst[20],inst[30:21],1'b0};
            default:ext=32'b0;
        endcase
    else
        case(sext_op)
            `I:begin
                if(inst[14:12]=='b001 || inst[14:12]=='b101) ext={27'b0,inst[24:20]};
                else ext={20'b11111111111111111111,inst[31:20]};
            end
            `S:ext={20'b11111111111111111111,inst[31:25],inst[11:7]};
            `B:ext={19'b1111111111111111111,inst[31],inst[7],inst[30:25],inst[11:8],1'b0};
            `U:ext={inst[31:12],12'b0};
            `J:ext={11'b11111111111,inst[31],inst[19:12],inst[20],inst[30:21],1'b0};
            default:ext=32'b11111111111111111111111111111111;
        endcase
end
    
endmodule