data/full_repos/permissive/500326609/a5/immgen.v
data/verilator_xmls/7ae530cc-9b53-4ba9-af9c-85f778510de2.xml
module immgen(
  input [31:0] idata,
  output [31:0] imm
);

wire [6:0] opcode;
wire [2:0] funct3;

assign funct3 = idata[14:12];
assign opcode = idata[6:0];





assign imm = (opcode == 7'b0100011) ? {{20{idata[31]}},idata[31:25],idata[11:7]} :
             (opcode == 7'b0000011 && (funct3 == 3'b100 || funct3 == 3'b101)) ?
                {{20{1'b0}},idata[31:20]} : {{20{idata[31]}},idata[31:20]};

endmodule
module immgen(
  input [31:0] idata,
  output [31:0] imm
);


wire [6:0] opcode;
wire [2:0] funct3;

assign funct3 = idata[14:12];
assign opcode = idata[6:0];





assign imm = (opcode == 7'b0100011) ? {{20{idata[31]}},idata[31:25],idata[11:7]} :
             (opcode == 7'b0000011 && (funct3 == 3'b100 || funct3 == 3'b101)) ?
                {{20{1'b0}},idata[31:20]} : {{20{idata[31]}},idata[31:20]};

endmodule