data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v
None: at end of input
1: b'%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:3: Cannot find include file: bus.v\n`include "bus.v" \n         ^~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/201275379/src/cpu/core/stage/id,data/full_repos/permissive/201275379/bus.v\n             data/full_repos/permissive/201275379/src/cpu/core/stage/id,data/full_repos/permissive/201275379/bus.v.v\n             data/full_repos/permissive/201275379/src/cpu/core/stage/id,data/full_repos/permissive/201275379/bus.v.sv\n             bus.v\n             bus.v.v\n             bus.v.sv\n             obj_dir/bus.v\n             obj_dir/bus.v.v\n             obj_dir/bus.v.sv\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:4: Cannot find include file: opcode.v\n`include "opcode.v" \n         ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:5: Cannot find include file: funct.v\n`include "funct.v" \n         ^~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:6: Cannot find include file: regimm.v\n`include "regimm.v" \n         ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:7: Cannot find include file: cp0.v\n`include "cp0.v" \n         ^~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:12: Define or directive not defined: \'`INST_OP_BUS\'\n  input   [`INST_OP_BUS]  op,\n           ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:12: syntax error, unexpected \']\', expecting TYPE-IDENTIFIER\n  input   [`INST_OP_BUS]  op,\n                       ^\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:13: Define or directive not defined: \'`REG_ADDR_BUS\'\n  input   [`REG_ADDR_BUS] rs,\n           ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:14: Define or directive not defined: \'`REG_ADDR_BUS\'\n  input   [`REG_ADDR_BUS] rt,\n           ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:15: Define or directive not defined: \'`FUNCT_BUS\'\n  input   [`FUNCT_BUS]    funct,\n           ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:18: Define or directive not defined: \'`EXC_TYPE_BUS\'\n  output  [`EXC_TYPE_BUS] exception_type\n           ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:25: syntax error, unexpected assign\n  assign exception_type = rst ? {\n  ^~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:49: Define or directive not defined: \'`OP_SPECIAL\'\n          `OP_SPECIAL: begin\n          ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:51: Define or directive not defined: \'`FUNCT_SLL\'\n              `FUNCT_SLL, `FUNCT_SRL, `FUNCT_SRA, `FUNCT_SLLV,\n              ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:51: Define or directive not defined: \'`FUNCT_SRL\'\n              `FUNCT_SLL, `FUNCT_SRL, `FUNCT_SRA, `FUNCT_SLLV,\n                          ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:51: Define or directive not defined: \'`FUNCT_SRA\'\n              `FUNCT_SLL, `FUNCT_SRL, `FUNCT_SRA, `FUNCT_SLLV,\n                                      ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:51: Define or directive not defined: \'`FUNCT_SLLV\'\n              `FUNCT_SLL, `FUNCT_SRL, `FUNCT_SRA, `FUNCT_SLLV,\n                                                  ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:52: Define or directive not defined: \'`FUNCT_SRLV\'\n              `FUNCT_SRLV, `FUNCT_SRAV, `FUNCT_JR, `FUNCT_JALR,\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:52: Define or directive not defined: \'`FUNCT_SRAV\'\n              `FUNCT_SRLV, `FUNCT_SRAV, `FUNCT_JR, `FUNCT_JALR,\n                           ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:52: Define or directive not defined: \'`FUNCT_JR\'\n              `FUNCT_SRLV, `FUNCT_SRAV, `FUNCT_JR, `FUNCT_JALR,\n                                        ^~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:52: Define or directive not defined: \'`FUNCT_JALR\'\n              `FUNCT_SRLV, `FUNCT_SRAV, `FUNCT_JR, `FUNCT_JALR,\n                                                   ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:53: Define or directive not defined: \'`FUNCT_MOVN\'\n              `FUNCT_MOVN, `FUNCT_MOVZ,\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:53: Define or directive not defined: \'`FUNCT_MOVZ\'\n              `FUNCT_MOVN, `FUNCT_MOVZ,\n                           ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:54: Define or directive not defined: \'`FUNCT_MFHI\'\n              `FUNCT_MFHI, `FUNCT_MTHI, `FUNCT_MFLO, `FUNCT_MTLO,\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:54: Define or directive not defined: \'`FUNCT_MTHI\'\n              `FUNCT_MFHI, `FUNCT_MTHI, `FUNCT_MFLO, `FUNCT_MTLO,\n                           ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:54: Define or directive not defined: \'`FUNCT_MFLO\'\n              `FUNCT_MFHI, `FUNCT_MTHI, `FUNCT_MFLO, `FUNCT_MTLO,\n                                        ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:54: Define or directive not defined: \'`FUNCT_MTLO\'\n              `FUNCT_MFHI, `FUNCT_MTHI, `FUNCT_MFLO, `FUNCT_MTLO,\n                                                     ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:55: Define or directive not defined: \'`FUNCT_MULT\'\n              `FUNCT_MULT, `FUNCT_MULTU, `FUNCT_DIV, `FUNCT_DIVU,\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:55: Define or directive not defined: \'`FUNCT_MULTU\'\n              `FUNCT_MULT, `FUNCT_MULTU, `FUNCT_DIV, `FUNCT_DIVU,\n                           ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:55: Define or directive not defined: \'`FUNCT_DIV\'\n              `FUNCT_MULT, `FUNCT_MULTU, `FUNCT_DIV, `FUNCT_DIVU,\n                                         ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:55: Define or directive not defined: \'`FUNCT_DIVU\'\n              `FUNCT_MULT, `FUNCT_MULTU, `FUNCT_DIV, `FUNCT_DIVU,\n                                                     ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:56: Define or directive not defined: \'`FUNCT_ADDU\'\n              `FUNCT_ADDU, `FUNCT_SUBU, `FUNCT_AND, `FUNCT_OR,\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:56: Define or directive not defined: \'`FUNCT_SUBU\'\n              `FUNCT_ADDU, `FUNCT_SUBU, `FUNCT_AND, `FUNCT_OR,\n                           ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:56: Define or directive not defined: \'`FUNCT_AND\'\n              `FUNCT_ADDU, `FUNCT_SUBU, `FUNCT_AND, `FUNCT_OR,\n                                        ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:56: Define or directive not defined: \'`FUNCT_OR\'\n              `FUNCT_ADDU, `FUNCT_SUBU, `FUNCT_AND, `FUNCT_OR,\n                                                    ^~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:57: Define or directive not defined: \'`FUNCT_XOR\'\n              `FUNCT_XOR, `FUNCT_NOR, `FUNCT_SLT, `FUNCT_SLTU: begin\n              ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:57: Define or directive not defined: \'`FUNCT_NOR\'\n              `FUNCT_XOR, `FUNCT_NOR, `FUNCT_SLT, `FUNCT_SLTU: begin\n                          ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:57: Define or directive not defined: \'`FUNCT_SLT\'\n              `FUNCT_XOR, `FUNCT_NOR, `FUNCT_SLT, `FUNCT_SLTU: begin\n                                      ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:57: Define or directive not defined: \'`FUNCT_SLTU\'\n              `FUNCT_XOR, `FUNCT_NOR, `FUNCT_SLT, `FUNCT_SLTU: begin\n                                                  ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:64: Define or directive not defined: \'`FUNCT_ADD\'\n              `FUNCT_ADD, `FUNCT_SUB: begin\n              ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:64: Define or directive not defined: \'`FUNCT_SUB\'\n              `FUNCT_ADD, `FUNCT_SUB: begin\n                          ^~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:71: Define or directive not defined: \'`FUNCT_SYSCALL\'\n              `FUNCT_SYSCALL: begin\n              ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:78: Define or directive not defined: \'`FUNCT_BREAK\'\n              `FUNCT_BREAK: begin\n              ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:94: Define or directive not defined: \'`OP_SPECIAL2\'\n          `OP_SPECIAL2: begin\n          ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:96: Define or directive not defined: \'`FUNCT2_CLZ\'\n              `FUNCT2_CLZ, `FUNCT2_CLO,\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:96: Define or directive not defined: \'`FUNCT2_CLO\'\n              `FUNCT2_CLZ, `FUNCT2_CLO,\n                           ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:97: Define or directive not defined: \'`FUNCT2_MUL\'\n              `FUNCT2_MUL,\n              ^~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:98: Define or directive not defined: \'`FUNCT2_MADD\'\n              `FUNCT2_MADD, `FUNCT2_MADDU,\n              ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:98: Define or directive not defined: \'`FUNCT2_MADDU\'\n              `FUNCT2_MADD, `FUNCT2_MADDU,\n                            ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/201275379/src/cpu/core/stage/id/ExceptGen.v:99: Define or directive not defined: \'`FUNCT2_MSUB\'\n              `FUNCT2_MSUB, `FUNCT2_MSUBU: begin\n              ^~~~~~~~~~~~\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
module ExceptGen(
  input                   rst,

  input   [`INST_OP_BUS]  op,
  input   [`REG_ADDR_BUS] rs,
  input   [`REG_ADDR_BUS] rt,
  input   [`FUNCT_BUS]    funct,
  input                   is_eret,

  output  [`EXC_TYPE_BUS] exception_type
);


  reg invalid_inst_flag, overflow_inst_flag;
  reg syscall_flag, break_flag, eret_flag;

  assign exception_type = rst ? {
    eret_flag,1'b0,
    syscall_flag, break_flag,1'b0,
    overflow_inst_flag, invalid_inst_flag,1'b0
  } : 0;

  always @(*) begin
    if (!rst) begin
      invalid_inst_flag <= 0;
      overflow_inst_flag <= 0;
      syscall_flag <= 0;
      break_flag <= 0;
      eret_flag <= 0;
    end
    else begin
      if (is_eret) begin
        invalid_inst_flag <= 0;
        overflow_inst_flag <= 0;
        syscall_flag <= 0;
        break_flag <= 0;
        eret_flag <= 1;
      end
      else begin
        case (op)
          `OP_SPECIAL: begin
            case (funct)
              `FUNCT_SLL, `FUNCT_SRL, `FUNCT_SRA, `FUNCT_SLLV,
              `FUNCT_SRLV, `FUNCT_SRAV, `FUNCT_JR, `FUNCT_JALR,
              `FUNCT_MOVN, `FUNCT_MOVZ,
              `FUNCT_MFHI, `FUNCT_MTHI, `FUNCT_MFLO, `FUNCT_MTLO,
              `FUNCT_MULT, `FUNCT_MULTU, `FUNCT_DIV, `FUNCT_DIVU,
              `FUNCT_ADDU, `FUNCT_SUBU, `FUNCT_AND, `FUNCT_OR,
              `FUNCT_XOR, `FUNCT_NOR, `FUNCT_SLT, `FUNCT_SLTU: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              `FUNCT_ADD, `FUNCT_SUB: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 1;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              `FUNCT_SYSCALL: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 1;
                break_flag <= 0;
                eret_flag <= 0;
              end
              `FUNCT_BREAK: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 1;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_SPECIAL2: begin
            case (funct)
              `FUNCT2_CLZ, `FUNCT2_CLO,
              `FUNCT2_MUL,
              `FUNCT2_MADD, `FUNCT2_MADDU,
              `FUNCT2_MSUB, `FUNCT2_MSUBU: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_REGIMM: begin
            case (rt)
              `REGIMM_BLTZ, `REGIMM_BLTZAL, `REGIMM_BGEZ,
              `REGIMM_BGEZAL: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_CP0: begin
            case (rs)
              `CP0_MFC0, `CP0_MTC0: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_J, `OP_JAL, `OP_BEQ, `OP_BNE, `OP_BLEZ, `OP_BGTZ,
          `OP_ADDIU, `OP_SLTI, `OP_SLTIU, `OP_ANDI, `OP_ORI,
          `OP_XORI, `OP_LUI, `OP_LB, `OP_LH, `OP_LW, `OP_LBU,
          `OP_LHU, `OP_SB, `OP_SH, `OP_SW: begin
            invalid_inst_flag <= 0;
            overflow_inst_flag <= 0;
            syscall_flag <= 0;
            break_flag <= 0;
            eret_flag <= 0;
          end
          `OP_ADDI: begin
            invalid_inst_flag <= 0;
            overflow_inst_flag <= 1;
            syscall_flag <= 0;
            break_flag <= 0;
            eret_flag <= 0;
          end
          default: begin
            invalid_inst_flag <= 1;
            overflow_inst_flag <= 0;
            syscall_flag <= 0;
            break_flag <= 0;
            eret_flag <= 0;
          end
        endcase
      end
    end
  end

endmodule
module ExceptGen(
  input                   rst,

  input   [`INST_OP_BUS]  op,
  input   [`REG_ADDR_BUS] rs,
  input   [`REG_ADDR_BUS] rt,
  input   [`FUNCT_BUS]    funct,
  input                   is_eret,

  output  [`EXC_TYPE_BUS] exception_type
);



  reg invalid_inst_flag, overflow_inst_flag;
  reg syscall_flag, break_flag, eret_flag;

  assign exception_type = rst ? {
    eret_flag,1'b0,
    syscall_flag, break_flag,1'b0,
    overflow_inst_flag, invalid_inst_flag,1'b0
  } : 0;

  always @(*) begin
    if (!rst) begin
      invalid_inst_flag <= 0;
      overflow_inst_flag <= 0;
      syscall_flag <= 0;
      break_flag <= 0;
      eret_flag <= 0;
    end
    else begin
      if (is_eret) begin
        invalid_inst_flag <= 0;
        overflow_inst_flag <= 0;
        syscall_flag <= 0;
        break_flag <= 0;
        eret_flag <= 1;
      end
      else begin
        case (op)
          `OP_SPECIAL: begin
            case (funct)
              `FUNCT_SLL, `FUNCT_SRL, `FUNCT_SRA, `FUNCT_SLLV,
              `FUNCT_SRLV, `FUNCT_SRAV, `FUNCT_JR, `FUNCT_JALR,
              `FUNCT_MOVN, `FUNCT_MOVZ,
              `FUNCT_MFHI, `FUNCT_MTHI, `FUNCT_MFLO, `FUNCT_MTLO,
              `FUNCT_MULT, `FUNCT_MULTU, `FUNCT_DIV, `FUNCT_DIVU,
              `FUNCT_ADDU, `FUNCT_SUBU, `FUNCT_AND, `FUNCT_OR,
              `FUNCT_XOR, `FUNCT_NOR, `FUNCT_SLT, `FUNCT_SLTU: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              `FUNCT_ADD, `FUNCT_SUB: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 1;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              `FUNCT_SYSCALL: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 1;
                break_flag <= 0;
                eret_flag <= 0;
              end
              `FUNCT_BREAK: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 1;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_SPECIAL2: begin
            case (funct)
              `FUNCT2_CLZ, `FUNCT2_CLO,
              `FUNCT2_MUL,
              `FUNCT2_MADD, `FUNCT2_MADDU,
              `FUNCT2_MSUB, `FUNCT2_MSUBU: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_REGIMM: begin
            case (rt)
              `REGIMM_BLTZ, `REGIMM_BLTZAL, `REGIMM_BGEZ,
              `REGIMM_BGEZAL: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_CP0: begin
            case (rs)
              `CP0_MFC0, `CP0_MTC0: begin
                invalid_inst_flag <= 0;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
              default: begin
                invalid_inst_flag <= 1;
                overflow_inst_flag <= 0;
                syscall_flag <= 0;
                break_flag <= 0;
                eret_flag <= 0;
              end
            endcase
          end
          `OP_J, `OP_JAL, `OP_BEQ, `OP_BNE, `OP_BLEZ, `OP_BGTZ,
          `OP_ADDIU, `OP_SLTI, `OP_SLTIU, `OP_ANDI, `OP_ORI,
          `OP_XORI, `OP_LUI, `OP_LB, `OP_LH, `OP_LW, `OP_LBU,
          `OP_LHU, `OP_SB, `OP_SH, `OP_SW: begin
            invalid_inst_flag <= 0;
            overflow_inst_flag <= 0;
            syscall_flag <= 0;
            break_flag <= 0;
            eret_flag <= 0;
          end
          `OP_ADDI: begin
            invalid_inst_flag <= 0;
            overflow_inst_flag <= 1;
            syscall_flag <= 0;
            break_flag <= 0;
            eret_flag <= 0;
          end
          default: begin
            invalid_inst_flag <= 1;
            overflow_inst_flag <= 0;
            syscall_flag <= 0;
            break_flag <= 0;
            eret_flag <= 0;
          end
        endcase
      end
    end
  end

endmodule