data/full_repos/permissive/423012938/ReisenCoreRVCPU.src/Modules/CentralCore/InstructionDecode/ImmediateDecoder.v
data/verilator_xmls/3c3fe6d7-0156-45ad-8a32-748f99835f35.xml
module ImmediateDecoder (
    input [31:7] dinstTop,
    input [2:0] immType,

    output [63:0] imm64
);

    reg [30:0] decodedImmediate;



    assign imm64 = {{33{dinstTop[31]}}, decodedImmediate};

    always @(*) begin
        case (immType)
            3'b000:
                decodedImmediate = {
                    {20{dinstTop[31]}},
                    dinstTop[30:20]
                };
            3'b001:
                decodedImmediate = {
                    {20{dinstTop[31]}},
                    dinstTop[30:25],
                    dinstTop[11:7]
                };
            3'b010:
                decodedImmediate = {
                    {19{dinstTop[31]}},
                    dinstTop[7],
                    dinstTop[30:25],
                    dinstTop[11:8],
                    1'b0
                };
            3'b011:
                decodedImmediate = {
                    dinstTop[30:20],
                    dinstTop[19:12],
                    12'b0
                };
            3'b100:
                decodedImmediate = {
                    {11{dinstTop[31]}},
                    dinstTop[19:12],
                    dinstTop[20],
                    dinstTop[30:21],
                    1'b0
                };
            default:
                decodedImmediate = 31'hx;
        endcase
    end

endmodule
module ImmediateDecoder (
    input [31:7] dinstTop,
    input [2:0] immType,

    output [63:0] imm64
);


    reg [30:0] decodedImmediate;



    assign imm64 = {{33{dinstTop[31]}}, decodedImmediate};

    always @(*) begin
        case (immType)
            3'b000:
                decodedImmediate = {
                    {20{dinstTop[31]}},
                    dinstTop[30:20]
                };
            3'b001:
                decodedImmediate = {
                    {20{dinstTop[31]}},
                    dinstTop[30:25],
                    dinstTop[11:7]
                };
            3'b010:
                decodedImmediate = {
                    {19{dinstTop[31]}},
                    dinstTop[7],
                    dinstTop[30:25],
                    dinstTop[11:8],
                    1'b0
                };
            3'b011:
                decodedImmediate = {
                    dinstTop[30:20],
                    dinstTop[19:12],
                    12'b0
                };
            3'b100:
                decodedImmediate = {
                    {11{dinstTop[31]}},
                    dinstTop[19:12],
                    dinstTop[20],
                    dinstTop[30:21],
                    1'b0
                };
            default:
                decodedImmediate = 31'hx;
        endcase
    end

endmodule