data/full_repos/permissive/109936328/pipe_util/id_decoder.v
None: at end of input
1: b'%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:1: Cannot find include file: config.vh\n`include "config.vh" \n         ^~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/109936328/pipe_util,data/full_repos/permissive/109936328/config.vh\n             data/full_repos/permissive/109936328/pipe_util,data/full_repos/permissive/109936328/config.vh.v\n             data/full_repos/permissive/109936328/pipe_util,data/full_repos/permissive/109936328/config.vh.sv\n             config.vh\n             config.vh.v\n             config.vh.sv\n             obj_dir/config.vh\n             obj_dir/config.vh.v\n             obj_dir/config.vh.sv\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:2: Cannot find include file: alu_op.vh\n`include "alu_op.vh" \n         ^~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:3: Cannot find include file: mem_codes.vh\n`include "mem_codes.vh" \n         ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:4: Cannot find include file: opcodes.vh\n`include "opcodes.vh" \n         ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:30: Define or directive not defined: \'`INSTR_W\'\n  parameter INSTR_W = `INSTR_W;\n                      ^~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:30: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n  parameter INSTR_W = `INSTR_W;\n                              ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:31: Define or directive not defined: \'`ALU_OP_W\'\n  parameter ALU_OP_W = `ALU_OP_W;\n                       ^~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:31: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n  parameter ALU_OP_W = `ALU_OP_W;\n                                ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:32: Define or directive not defined: \'`WORD_W\'\n  parameter WORD_W = `WORD_W;\n                     ^~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:32: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n  parameter WORD_W = `WORD_W;\n                            ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:39: Define or directive not defined: \'`ALU_SRC_A_W\'\n  output reg [`ALU_SRC_A_W - 1:0] alu_a_src;\n              ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:40: Define or directive not defined: \'`ALU_SRC_B_W\'\n  output reg [`ALU_SRC_B_W - 1:0] alu_b_src;\n              ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:42: Define or directive not defined: \'`MEM_OP_W\'\n  output reg [`MEM_OP_W - 1:0] mem_op;\n              ^~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:46: Define or directive not defined: \'`DEST_SRC_W\'\n  output reg [`DEST_SRC_W - 1:0] dest_src;\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:48: Define or directive not defined: \'`OPCODE\'\n  wire [6:0] opcode = `OPCODE(instr);\n                      ^~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:49: Define or directive not defined: \'`FUNCT3\'\n  wire [2:0] funct3 = `FUNCT3(instr);\n                      ^~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:50: Define or directive not defined: \'`FUNCT7\'\n  wire [6:0] funct7 = `FUNCT7(instr);\n                      ^~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:52: Define or directive not defined: \'`OPCODE_COMPLETE_RTYPE\'\n  wire [16:0] opcode_rtype = `OPCODE_COMPLETE_RTYPE(instr);\n                             ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:53: Define or directive not defined: \'`OPCODE_COMPLETE_ITYPE\'\n  wire [16:0] opcode_itype = `OPCODE_COMPLETE_ITYPE(instr);\n                             ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:54: Define or directive not defined: \'`OPCODE_COMPLETE_STYPE\'\n  wire [16:0] opcode_stype = `OPCODE_COMPLETE_STYPE(instr);\n                             ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:55: Define or directive not defined: \'`OPCODE_COMPLETE_BTYPE\'\n  wire [16:0] opcode_btype = `OPCODE_COMPLETE_BTYPE(instr);\n                             ^~~~~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:59: Define or directive not defined: \'`ITYPE_IMM12\'\n  wire [11:0] itype_imm12 = `ITYPE_IMM12(instr);\n                            ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:60: Define or directive not defined: \'`STYPE_IMM12\'\n  wire [11:0] stype_imm12 = `STYPE_IMM12(instr);\n                            ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:61: Define or directive not defined: \'`BTYPE_IMM12\'\n  wire [11:0] btype_imm12 = `BTYPE_IMM12(instr);\n                            ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:65: Define or directive not defined: \'`OPCODE_RTYPE\'\n      `OPCODE_RTYPE: opcode_complete = opcode_rtype;\n      ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:65: syntax error, unexpected \':\', expecting endcase\n      `OPCODE_RTYPE: opcode_complete = opcode_rtype;\n                   ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:66: Define or directive not defined: \'`OPCODE_ITYPE\'\n      `OPCODE_ITYPE: opcode_complete = opcode_itype;\n      ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:68: Define or directive not defined: \'`OPCODE_STYPE_LOAD\'\n      `OPCODE_STYPE_LOAD: opcode_complete = opcode_stype;\n      ^~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:69: Define or directive not defined: \'`OPCODE_STYPE_STORE\'\n      `OPCODE_STYPE_STORE: opcode_complete = opcode_stype;\n      ^~~~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:70: Define or directive not defined: \'`OPCODE_BTYPE\'\n      `OPCODE_BTYPE: opcode_complete = opcode_btype;\n      ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:71: Define or directive not defined: \'`OPCODE_LUI\'\n      `OPCODE_LUI: opcode_complete = `OPC_LUI;\n      ^~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:71: Define or directive not defined: \'`OPC_LUI\'\n      `OPCODE_LUI: opcode_complete = `OPC_LUI;\n                                     ^~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:72: Define or directive not defined: \'`OPCODE_AUIPC\'\n      `OPCODE_AUIPC: opcode_complete = `OPC_AUIPC;\n      ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:72: Define or directive not defined: \'`OPC_AUIPC\'\n      `OPCODE_AUIPC: opcode_complete = `OPC_AUIPC;\n                                       ^~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:73: Define or directive not defined: \'`OPCODE_JAL\'\n      `OPCODE_JAL: opcode_complete = `OPC_JAL;\n      ^~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:73: Define or directive not defined: \'`OPC_JAL\'\n      `OPCODE_JAL: opcode_complete = `OPC_JAL;\n                                     ^~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:74: Define or directive not defined: \'`OPCODE_JALR\'\n      `OPCODE_JALR: opcode_complete = `OPC_JALR;\n      ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:74: Define or directive not defined: \'`OPC_JALR\'\n      `OPCODE_JALR: opcode_complete = `OPC_JALR;\n                                      ^~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:81: Define or directive not defined: \'`MEM_OP_NOP\'\n    mem_op = `MEM_OP_NOP;\n             ^~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:84: Define or directive not defined: \'`OPCODE_RTYPE\'\n      `OPCODE_RTYPE: begin\n      ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:84: syntax error, unexpected \':\', expecting endcase\n      `OPCODE_RTYPE: begin\n                   ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:85: Define or directive not defined: \'`WORD_W\'\n        imm = {`WORD_W{1\'b0}};\n               ^~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:87: Define or directive not defined: \'`ALU_SRC_A_XPR\'\n        alu_a_src = `ALU_SRC_A_XPR;\n                    ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:87: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        alu_a_src = `ALU_SRC_A_XPR;\n                                  ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:88: Define or directive not defined: \'`ALU_SRC_B_XPR\'\n        alu_b_src = `ALU_SRC_B_XPR;\n                    ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:88: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        alu_b_src = `ALU_SRC_B_XPR;\n                                  ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:90: Define or directive not defined: \'`DEST_SRC_ALU\'\n        dest_src = `DEST_SRC_ALU;\n                   ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:90: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        dest_src = `DEST_SRC_ALU;\n                                ^\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:93: Define or directive not defined: \'`OPCODE_ITYPE\'\n      `OPCODE_ITYPE: begin\n      ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/109936328/pipe_util/id_decoder.v:93: syntax error, unexpected begin, expecting IDENTIFIER or PACKAGE-IDENTIFIER or TYPE-IDENTIFIER or new\n      `OPCODE_ITYPE: begin\n                     ^~~~~\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
module id_decoder(

  instr,


  alu_op,

  imm,


  alu_a_src,
  alu_b_src,


  mem_op,


  branch_op,


  dest_src
);

  parameter INSTR_W = `INSTR_W;
  parameter ALU_OP_W = `ALU_OP_W;
  parameter WORD_W = `WORD_W;

  input [INSTR_W - 1:0] instr;

  output reg [ALU_OP_W - 1:0] alu_op;
  output reg [WORD_W - 1:0] imm;

  output reg [`ALU_SRC_A_W - 1:0] alu_a_src;
  output reg [`ALU_SRC_B_W - 1:0] alu_b_src;

  output reg [`MEM_OP_W - 1:0] mem_op;

  output reg branch_op;

  output reg [`DEST_SRC_W - 1:0] dest_src;

  wire [6:0] opcode = `OPCODE(instr);
  wire [2:0] funct3 = `FUNCT3(instr);
  wire [6:0] funct7 = `FUNCT7(instr);

  wire [16:0] opcode_rtype = `OPCODE_COMPLETE_RTYPE(instr);
  wire [16:0] opcode_itype = `OPCODE_COMPLETE_ITYPE(instr);
  wire [16:0] opcode_stype = `OPCODE_COMPLETE_STYPE(instr);
  wire [16:0] opcode_btype = `OPCODE_COMPLETE_BTYPE(instr);

  reg [16:0] opcode_complete;

  wire [11:0] itype_imm12 = `ITYPE_IMM12(instr);
  wire [11:0] stype_imm12 = `STYPE_IMM12(instr);
  wire [11:0] btype_imm12 = `BTYPE_IMM12(instr);

  always@(*) begin
    case(opcode)
      `OPCODE_RTYPE: opcode_complete = opcode_rtype;
      `OPCODE_ITYPE: opcode_complete = opcode_itype;

      `OPCODE_STYPE_LOAD: opcode_complete = opcode_stype;
      `OPCODE_STYPE_STORE: opcode_complete = opcode_stype;
      `OPCODE_BTYPE: opcode_complete = opcode_btype;
      `OPCODE_LUI: opcode_complete = `OPC_LUI;
      `OPCODE_AUIPC: opcode_complete = `OPC_AUIPC;
      `OPCODE_JAL: opcode_complete = `OPC_JAL;
      `OPCODE_JALR: opcode_complete = `OPC_JALR;
      default: opcode_complete = 0;
    endcase
  end

  always@(*) begin

    mem_op = `MEM_OP_NOP;
    branch_op = 0;
    case(opcode)
      `OPCODE_RTYPE: begin
        imm = {`WORD_W{1'b0}};

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;
        
        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_ITYPE: begin
        imm = $signed(itype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_IMM;
        
        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_STYPE_LOAD: begin
        imm = $signed(itype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_IMM;
        
        dest_src = `DEST_SRC_MEM;

        case(funct3)
          `FUNCT3_LB: mem_op = `MEM_OP_RD_BYTE;
          `FUNCT3_LH: mem_op = `MEM_OP_RD_HALF;
          `FUNCT3_LW: mem_op = `MEM_OP_RD_WORD;
          `FUNCT3_LBU: mem_op = `MEM_OP_RD_UBYTE;
          `FUNCT3_LHU: mem_op = `MEM_OP_RD_UHALF;
          default: mem_op = `MEM_OP_NOP;
        endcase
      end

      `OPCODE_STYPE_STORE: begin
        imm = $signed(stype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;

        dest_src = `DEST_SRC_NONE;


        case(funct3)
          `FUNCT3_SB: mem_op = `MEM_OP_WR_BYTE;
          `FUNCT3_SH: mem_op = `MEM_OP_WR_HALF;
          `FUNCT3_SW: mem_op = `MEM_OP_WR_WORD;
          default: mem_op = `MEM_OP_NOP;
        endcase
      end

      `OPCODE_BTYPE: begin
        imm = $signed(btype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;

        dest_src = `DEST_SRC_NONE;

        branch_op = 1;
      end

      `OPCODE_LUI: begin
        imm = `LUI_IMM20(instr);

        alu_a_src = `ALU_SRC_A_NONE;
        alu_b_src = `ALU_SRC_B_IMM;

        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_AUIPC: begin
        imm = `AUIPC_IMM20(instr);

        alu_a_src = `ALU_SRC_A_PC;
        alu_b_src = `ALU_SRC_B_IMM;

        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_JAL: begin
        imm = `JAL_IMM20(instr);

        alu_a_src = `ALU_SRC_A_NONE;
        alu_b_src = `ALU_SRC_B_NONE;

        dest_src = `DEST_SRC_NONE;

        branch_op = 1;
      end

      `OPCODE_JALR: begin
        imm = `JALR_IMM12(instr);

        alu_a_src = `ALU_SRC_A_NONE;
        alu_b_src = `ALU_SRC_B_NONE;

        dest_src = `DEST_SRC_PC4;

        branch_op = 1;
      end

      default: begin
        imm = 0;

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;
        dest_src = `DEST_SRC_NONE;
      end
    endcase
  end


  always@(*) begin
    case(opcode_complete)
      `OPC_ADD, `OPC_ADDI: alu_op = `ALU_ADD;
      `OPC_SUB: alu_op = `ALU_SUB;
      `OPC_SLT, `OPC_SLTI: alu_op = `ALU_SLT;
      `OPC_SLTU, `OPC_SLTIU: alu_op = `ALU_SLTU;
      `OPC_XOR, `OPC_XORI: alu_op = `ALU_XOR;
      `OPC_OR, `OPC_ORI: alu_op = `ALU_OR;
      `OPC_AND, `OPC_ANDI: alu_op = `ALU_AND;
      `OPC_BEQ: alu_op = `ALU_XOR;
      `OPC_BNE: alu_op = `ALU_SNE;
      `OPC_BLT: alu_op = `ALU_SGE;
      `OPC_BGE: alu_op = `ALU_SLT;
      `OPC_BLTU: alu_op = `ALU_SGE;
      `OPC_BGEU: alu_op = `ALU_SGEU;
      `OPC_LUI: alu_op = `ALU_ADD;
      `OPC_AUIPC: alu_op = `ALU_ADD;
      `OPC_JAL: alu_op = `ALU_ADD;
      `OPC_JALR: alu_op = `ALU_ADD;
      default: alu_op = `ALU_ADD;
    endcase
  end

endmodule
module id_decoder(

  instr,


  alu_op,

  imm,


  alu_a_src,
  alu_b_src,


  mem_op,


  branch_op,


  dest_src
);


  parameter INSTR_W = `INSTR_W;
  parameter ALU_OP_W = `ALU_OP_W;
  parameter WORD_W = `WORD_W;

  input [INSTR_W - 1:0] instr;

  output reg [ALU_OP_W - 1:0] alu_op;
  output reg [WORD_W - 1:0] imm;

  output reg [`ALU_SRC_A_W - 1:0] alu_a_src;
  output reg [`ALU_SRC_B_W - 1:0] alu_b_src;

  output reg [`MEM_OP_W - 1:0] mem_op;

  output reg branch_op;

  output reg [`DEST_SRC_W - 1:0] dest_src;

  wire [6:0] opcode = `OPCODE(instr);
  wire [2:0] funct3 = `FUNCT3(instr);
  wire [6:0] funct7 = `FUNCT7(instr);

  wire [16:0] opcode_rtype = `OPCODE_COMPLETE_RTYPE(instr);
  wire [16:0] opcode_itype = `OPCODE_COMPLETE_ITYPE(instr);
  wire [16:0] opcode_stype = `OPCODE_COMPLETE_STYPE(instr);
  wire [16:0] opcode_btype = `OPCODE_COMPLETE_BTYPE(instr);

  reg [16:0] opcode_complete;

  wire [11:0] itype_imm12 = `ITYPE_IMM12(instr);
  wire [11:0] stype_imm12 = `STYPE_IMM12(instr);
  wire [11:0] btype_imm12 = `BTYPE_IMM12(instr);

  always@(*) begin
    case(opcode)
      `OPCODE_RTYPE: opcode_complete = opcode_rtype;
      `OPCODE_ITYPE: opcode_complete = opcode_itype;

      `OPCODE_STYPE_LOAD: opcode_complete = opcode_stype;
      `OPCODE_STYPE_STORE: opcode_complete = opcode_stype;
      `OPCODE_BTYPE: opcode_complete = opcode_btype;
      `OPCODE_LUI: opcode_complete = `OPC_LUI;
      `OPCODE_AUIPC: opcode_complete = `OPC_AUIPC;
      `OPCODE_JAL: opcode_complete = `OPC_JAL;
      `OPCODE_JALR: opcode_complete = `OPC_JALR;
      default: opcode_complete = 0;
    endcase
  end

  always@(*) begin

    mem_op = `MEM_OP_NOP;
    branch_op = 0;
    case(opcode)
      `OPCODE_RTYPE: begin
        imm = {`WORD_W{1'b0}};

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;
        
        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_ITYPE: begin
        imm = $signed(itype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_IMM;
        
        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_STYPE_LOAD: begin
        imm = $signed(itype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_IMM;
        
        dest_src = `DEST_SRC_MEM;

        case(funct3)
          `FUNCT3_LB: mem_op = `MEM_OP_RD_BYTE;
          `FUNCT3_LH: mem_op = `MEM_OP_RD_HALF;
          `FUNCT3_LW: mem_op = `MEM_OP_RD_WORD;
          `FUNCT3_LBU: mem_op = `MEM_OP_RD_UBYTE;
          `FUNCT3_LHU: mem_op = `MEM_OP_RD_UHALF;
          default: mem_op = `MEM_OP_NOP;
        endcase
      end

      `OPCODE_STYPE_STORE: begin
        imm = $signed(stype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;

        dest_src = `DEST_SRC_NONE;


        case(funct3)
          `FUNCT3_SB: mem_op = `MEM_OP_WR_BYTE;
          `FUNCT3_SH: mem_op = `MEM_OP_WR_HALF;
          `FUNCT3_SW: mem_op = `MEM_OP_WR_WORD;
          default: mem_op = `MEM_OP_NOP;
        endcase
      end

      `OPCODE_BTYPE: begin
        imm = $signed(btype_imm12);

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;

        dest_src = `DEST_SRC_NONE;

        branch_op = 1;
      end

      `OPCODE_LUI: begin
        imm = `LUI_IMM20(instr);

        alu_a_src = `ALU_SRC_A_NONE;
        alu_b_src = `ALU_SRC_B_IMM;

        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_AUIPC: begin
        imm = `AUIPC_IMM20(instr);

        alu_a_src = `ALU_SRC_A_PC;
        alu_b_src = `ALU_SRC_B_IMM;

        dest_src = `DEST_SRC_ALU;
      end

      `OPCODE_JAL: begin
        imm = `JAL_IMM20(instr);

        alu_a_src = `ALU_SRC_A_NONE;
        alu_b_src = `ALU_SRC_B_NONE;

        dest_src = `DEST_SRC_NONE;

        branch_op = 1;
      end

      `OPCODE_JALR: begin
        imm = `JALR_IMM12(instr);

        alu_a_src = `ALU_SRC_A_NONE;
        alu_b_src = `ALU_SRC_B_NONE;

        dest_src = `DEST_SRC_PC4;

        branch_op = 1;
      end

      default: begin
        imm = 0;

        alu_a_src = `ALU_SRC_A_XPR;
        alu_b_src = `ALU_SRC_B_XPR;
        dest_src = `DEST_SRC_NONE;
      end
    endcase
  end


  always@(*) begin
    case(opcode_complete)
      `OPC_ADD, `OPC_ADDI: alu_op = `ALU_ADD;
      `OPC_SUB: alu_op = `ALU_SUB;
      `OPC_SLT, `OPC_SLTI: alu_op = `ALU_SLT;
      `OPC_SLTU, `OPC_SLTIU: alu_op = `ALU_SLTU;
      `OPC_XOR, `OPC_XORI: alu_op = `ALU_XOR;
      `OPC_OR, `OPC_ORI: alu_op = `ALU_OR;
      `OPC_AND, `OPC_ANDI: alu_op = `ALU_AND;
      `OPC_BEQ: alu_op = `ALU_XOR;
      `OPC_BNE: alu_op = `ALU_SNE;
      `OPC_BLT: alu_op = `ALU_SGE;
      `OPC_BGE: alu_op = `ALU_SLT;
      `OPC_BLTU: alu_op = `ALU_SGE;
      `OPC_BGEU: alu_op = `ALU_SGEU;
      `OPC_LUI: alu_op = `ALU_ADD;
      `OPC_AUIPC: alu_op = `ALU_ADD;
      `OPC_JAL: alu_op = `ALU_ADD;
      `OPC_JALR: alu_op = `ALU_ADD;
      default: alu_op = `ALU_ADD;
    endcase
  end

endmodule