data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v
1: b'%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:2: Cannot find include file: Constants.v\n`include "Constants.v" \n         ^~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/100975158/MIPS32_Full/Processor,data/full_repos/permissive/100975158/Constants.v\n             data/full_repos/permissive/100975158/MIPS32_Full/Processor,data/full_repos/permissive/100975158/Constants.v.v\n             data/full_repos/permissive/100975158/MIPS32_Full/Processor,data/full_repos/permissive/100975158/Constants.v.sv\n             Constants.v\n             Constants.v.v\n             Constants.v.sv\n             obj_dir/Constants.v\n             obj_dir/Constants.v.v\n             obj_dir/Constants.v.sv\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:60: Define or directive not defined: \'`SIG_NOP\'\n        if (signals == `SIG_NOP)\n                       ^~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:60: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_NOP)\n                               ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:59: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n                  ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message.\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:63: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:65: Define or directive not defined: \'`OPCODE_TYPE_R\'\n        id_opcode = `OPCODE_TYPE_R;\n                    ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:65: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_TYPE_R;\n                                  ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:66: Define or directive not defined: \'`FUNCT_ADD\'\n        id_funct  = `FUNCT_ADD;\n                    ^~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:66: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_funct  = `FUNCT_ADD;\n                              ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:70: Define or directive not defined: \'`SIG_R_TYPE\'\n        if (signals == `SIG_R_TYPE)\n                       ^~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:70: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_R_TYPE)\n                                  ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:69: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:75: Define or directive not defined: \'`ALUOP_ADD\'\n        if (id_alu_op == `ALUOP_ADD)\n                         ^~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:75: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (id_alu_op == `ALUOP_ADD)\n                                   ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:80: Define or directive not defined: \'`HAZ_EX_RS__EX_RT\'\n        if (id_signal_forwarding == `HAZ_EX_RS__EX_RT)\n                                    ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:80: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (id_signal_forwarding == `HAZ_EX_RS__EX_RT)\n                                                     ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:91: Define or directive not defined: \'`OPCODE_SLTI\'\n        id_opcode = `OPCODE_SLTI;\n                    ^~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:91: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_SLTI;\n                                ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:90: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:93: Define or directive not defined: \'`SIG_I_TYPE\'\n        if (signals == `SIG_I_TYPE)\n                       ^~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:93: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_I_TYPE)\n                                  ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:92: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:98: Define or directive not defined: \'`ALUOP_SLT\'\n        if (id_alu_op == `ALUOP_SLT)\n                         ^~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:98: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (id_alu_op == `ALUOP_SLT)\n                                   ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:103: Define or directive not defined: \'`HAZ_EX_RS\'\n        if (id_signal_forwarding == `HAZ_EX_RS)\n                                    ^~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:103: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (id_signal_forwarding == `HAZ_EX_RS)\n                                              ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:114: Define or directive not defined: \'`OPCODE_BEQ\'\n        id_opcode = `OPCODE_BEQ;\n                    ^~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:114: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_BEQ;\n                               ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:113: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:118: Define or directive not defined: \'`SIG_BRANCH\'\n        if (signals == `SIG_BRANCH)\n                       ^~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:118: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_BRANCH)\n                                  ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:117: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:123: Define or directive not defined: \'`HAZ_ID_RS__ID_RT\'\n        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)\n                                    ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:123: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)\n                                                     ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:134: Define or directive not defined: \'`OPCODE_BNE\'\n        id_opcode = `OPCODE_BNE;\n                    ^~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:134: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_BNE;\n                               ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:133: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:138: Define or directive not defined: \'`SIG_BNE\'\n        if (signals == `SIG_BNE)\n                       ^~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:138: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_BNE)\n                               ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:137: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:143: Define or directive not defined: \'`HAZ_ID_RS__ID_RT\'\n        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)\n                                    ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:143: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)\n                                                     ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:154: Define or directive not defined: \'`OPCODE_BNE\'\n        id_opcode = `OPCODE_BNE;\n                    ^~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:154: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_BNE;\n                               ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:153: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:158: Define or directive not defined: \'`SIG_NOP\'\n        if (signals == `SIG_NOP)\n                       ^~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:158: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_NOP)\n                               ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:157: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:169: Define or directive not defined: \'`OPCODE_JAL\'\n        id_opcode = `OPCODE_JAL;\n                    ^~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:169: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_JAL;\n                               ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:168: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:172: Define or directive not defined: \'`SIG_JUMP_LINK\'\n        if (signals == `SIG_JUMP_LINK)\n                       ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:172: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_JUMP_LINK)\n                                     ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:171: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:183: Define or directive not defined: \'`OPCODE_TYPE_R\'\n        id_opcode = `OPCODE_TYPE_R;\n                    ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:183: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_TYPE_R;\n                                  ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:182: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:184: Define or directive not defined: \'`FUNCT_JR\'\n        id_funct  = `FUNCT_JR;\n                    ^~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:184: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_funct  = `FUNCT_JR;\n                             ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:187: Define or directive not defined: \'`SIG_JUMP_REG\'\n        if (signals == `SIG_JUMP_REG)\n                       ^~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:187: syntax error, unexpected \')\', expecting TYPE-IDENTIFIER\n        if (signals == `SIG_JUMP_REG)\n                                    ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:186: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:198: Define or directive not defined: \'`OPCODE_LW\'\n        id_opcode = `OPCODE_LW;\n                    ^~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:198: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        id_opcode = `OPCODE_LW;\n                              ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:197: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_ControlUnity.v:200: Define or directive not defined: \'`SIG_LOAD_WORD\'\n        if (signals == `SIG_LOAD_WORD)\n                       ^~~~~~~~~~~~~~\n%Error: Exiting due to too many errors encountered; --error-limit=50\n'
module TB_ControlUnity ();
    reg         id_stall;
    reg [5:0]   id_opcode;
    reg [5:0]   id_funct;
    reg         id_cmp_eq;

    wire        if_flush;
    wire [7:0]  id_signal_forwarding;
    wire [1:0]  id_pc_source_sel;
    wire        id_sign_extend;
    wire        id_jump_link;
    wire        id_reg_dst;
    wire        id_alu_src;
    wire        id_branch_delay_slot;
    wire [4:0]  id_alu_op;
    wire        id_mem_write;
    wire        id_mem_read;
    wire        id_mem_to_reg;
    wire        id_reg_write;

    ControlUnity Unity (
        .id_stall               (id_stall),
        .id_opcode              (id_opcode),
        .id_funct               (id_funct),
        .id_cmp_eq              (id_cmp_eq),
        .if_flush               (if_flush),
        .id_signal_forwarding   (id_signal_forwarding),
        .id_pc_source_sel       (id_pc_source_sel),
        .id_sign_extend         (id_sign_extend),
        .id_jump_link           (id_jump_link),
        .id_reg_dst             (id_reg_dst),
        .id_alu_src             (id_alu_src),
        .id_alu_op              (id_alu_op),
        .id_mem_read            (id_mem_read),
        .id_mem_write           (id_mem_write),
        .id_mem_to_reg          (id_mem_to_reg),
        .id_reg_write           (id_reg_write),
        .id_branch_delay_slot   (id_branch_delay_slot)
    );

    wire [8:0]  signals;
    assign signals[8] = id_pc_source_sel[1];
    assign signals[7] = id_pc_source_sel[0];
    assign signals[6] = id_jump_link;
    assign signals[5] = id_alu_src;
    assign signals[4] = id_reg_dst;
    assign signals[3] = id_mem_read;
    assign signals[2] = id_mem_write;
    assign signals[1] = id_mem_to_reg;
    assign signals[0] = id_reg_write;

    initial begin
        id_stall = 1;
        id_cmp_eq = 0;

        #10
        if (signals == `SIG_NOP)
            $display("Stall Signals Passed");

        #10
        id_stall  = 0;
        id_opcode = `OPCODE_TYPE_R;
        id_funct  = `FUNCT_ADD;
        id_cmp_eq = 0;

        #10
        if (signals == `SIG_R_TYPE)
            $display("R-Type Signals are OK");
        else
            $display("R-Type Signals Fail");

        if (id_alu_op == `ALUOP_ADD)
            $display("R-Type Alu Operation is OK");
        else
            $display("R-Type Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS__EX_RT)
            $display("R-Type Hazard Detection Signals OK");
        else
            $display("R-Type Hazard Detection Signals Fail");

        if (id_branch_delay_slot)
            $display("It detected that this instruction will change PC Register");
        else
            $display("It detected that this instruction will not change PC Register");

        #10
        id_opcode = `OPCODE_SLTI;
        #10
        if (signals == `SIG_I_TYPE)
            $display("I-Type Signals are OK");
        else
            $display("I-Type Signals Fail");

        if (id_alu_op == `ALUOP_SLT)
            $display("I-Type Alu Operation is OK");
        else
            $display("I-Type Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS)
            $display("I-Type Hazard Detection Signals OK");
        else
            $display("I-Type Hazard Detection Signals Fail");

        if (id_sign_extend)
            $display("Instruction requires Sign Extension - SUCCESS");
        else
            $display("Instruction doesn't require Sign Extension - FAIL");

        #10
        id_opcode = `OPCODE_BEQ;
        id_cmp_eq = 1;

        #10
        if (signals == `SIG_BRANCH)
            $display("Branch Signals are OK");
        else
            $display("Branch Signals Fail");

        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)
            $display("Branch Hazard Detection Signals OK");
        else
            $display("Branch Hazard Detection Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will branch to a defined Address - SUCCESS");
        else
            $display("Instruction won't branch to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_BNE;
        id_cmp_eq = 0;

        #10
        if (signals == `SIG_BNE)
            $display("Branch Signals are OK");
        else
            $display("Branch Signals Fail");

        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)
            $display("Branch Hazard Detection Signals OK");
        else
            $display("Branch Hazard Detection Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will branch to a defined Address - SUCCESS");
        else
            $display("Instruction won't branch to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_BNE;
        id_cmp_eq = 1;

        #10
        if (signals == `SIG_NOP)
            $display("Branch Signals are OK");
        else
            $display("Branch Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will branch to a defined Address - FAIL");
        else
            $display("Instruction won't branch to a defined Address - SUCCESS");

        #10
        id_opcode = `OPCODE_JAL;

        #10
        if (signals == `SIG_JUMP_LINK)
            $display("Jump Link Signals are OK");
        else
            $display("Jump Link Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will jump to a defined Address - SUCCESS");
        else
            $display("Instruction won't jump to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_TYPE_R;
        id_funct  = `FUNCT_JR;

        #10
        if (signals == `SIG_JUMP_REG)
            $display("Jump Register Signals are OK");
        else
            $display("Jump Register Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will jump to a defined Address - SUCCESS");
        else
            $display("Instruction won't jump to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_LW;
        #10
        if (signals == `SIG_LOAD_WORD)
            $display("Load Signals are OK");
        else
            $display("Load Signals Fail");

        if (id_alu_op == `ALUOP_ADDU)
            $display("Load Alu Operation is OK");
        else
            $display("Load Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS)
            $display("Load Hazard Detection Signals OK");
        else
            $display("Load Hazard Detection Signals Fail");

        #10
        id_opcode = `OPCODE_SW;
        #10
        if (signals == `SIG_STORE_WORD)
            $display("Store Signals are OK");
        else
            $display("Store Signals - Fail");

        if (id_alu_op == `ALUOP_ADDU)
            $display("Store Alu Operation is OK");
        else
            $display("Store Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS__WB_RT)
            $display("Store Hazard Detection Signals OK");
        else
            $display("Store Hazard Detection Signals Fail");



    end

endmodule
module TB_ControlUnity ();

    reg         id_stall;
    reg [5:0]   id_opcode;
    reg [5:0]   id_funct;
    reg         id_cmp_eq;

    wire        if_flush;
    wire [7:0]  id_signal_forwarding;
    wire [1:0]  id_pc_source_sel;
    wire        id_sign_extend;
    wire        id_jump_link;
    wire        id_reg_dst;
    wire        id_alu_src;
    wire        id_branch_delay_slot;
    wire [4:0]  id_alu_op;
    wire        id_mem_write;
    wire        id_mem_read;
    wire        id_mem_to_reg;
    wire        id_reg_write;

    ControlUnity Unity (
        .id_stall               (id_stall),
        .id_opcode              (id_opcode),
        .id_funct               (id_funct),
        .id_cmp_eq              (id_cmp_eq),
        .if_flush               (if_flush),
        .id_signal_forwarding   (id_signal_forwarding),
        .id_pc_source_sel       (id_pc_source_sel),
        .id_sign_extend         (id_sign_extend),
        .id_jump_link           (id_jump_link),
        .id_reg_dst             (id_reg_dst),
        .id_alu_src             (id_alu_src),
        .id_alu_op              (id_alu_op),
        .id_mem_read            (id_mem_read),
        .id_mem_write           (id_mem_write),
        .id_mem_to_reg          (id_mem_to_reg),
        .id_reg_write           (id_reg_write),
        .id_branch_delay_slot   (id_branch_delay_slot)
    );

    wire [8:0]  signals;
    assign signals[8] = id_pc_source_sel[1];
    assign signals[7] = id_pc_source_sel[0];
    assign signals[6] = id_jump_link;
    assign signals[5] = id_alu_src;
    assign signals[4] = id_reg_dst;
    assign signals[3] = id_mem_read;
    assign signals[2] = id_mem_write;
    assign signals[1] = id_mem_to_reg;
    assign signals[0] = id_reg_write;

    initial begin
        id_stall = 1;
        id_cmp_eq = 0;

        #10
        if (signals == `SIG_NOP)
            $display("Stall Signals Passed");

        #10
        id_stall  = 0;
        id_opcode = `OPCODE_TYPE_R;
        id_funct  = `FUNCT_ADD;
        id_cmp_eq = 0;

        #10
        if (signals == `SIG_R_TYPE)
            $display("R-Type Signals are OK");
        else
            $display("R-Type Signals Fail");

        if (id_alu_op == `ALUOP_ADD)
            $display("R-Type Alu Operation is OK");
        else
            $display("R-Type Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS__EX_RT)
            $display("R-Type Hazard Detection Signals OK");
        else
            $display("R-Type Hazard Detection Signals Fail");

        if (id_branch_delay_slot)
            $display("It detected that this instruction will change PC Register");
        else
            $display("It detected that this instruction will not change PC Register");

        #10
        id_opcode = `OPCODE_SLTI;
        #10
        if (signals == `SIG_I_TYPE)
            $display("I-Type Signals are OK");
        else
            $display("I-Type Signals Fail");

        if (id_alu_op == `ALUOP_SLT)
            $display("I-Type Alu Operation is OK");
        else
            $display("I-Type Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS)
            $display("I-Type Hazard Detection Signals OK");
        else
            $display("I-Type Hazard Detection Signals Fail");

        if (id_sign_extend)
            $display("Instruction requires Sign Extension - SUCCESS");
        else
            $display("Instruction doesn't require Sign Extension - FAIL");

        #10
        id_opcode = `OPCODE_BEQ;
        id_cmp_eq = 1;

        #10
        if (signals == `SIG_BRANCH)
            $display("Branch Signals are OK");
        else
            $display("Branch Signals Fail");

        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)
            $display("Branch Hazard Detection Signals OK");
        else
            $display("Branch Hazard Detection Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will branch to a defined Address - SUCCESS");
        else
            $display("Instruction won't branch to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_BNE;
        id_cmp_eq = 0;

        #10
        if (signals == `SIG_BNE)
            $display("Branch Signals are OK");
        else
            $display("Branch Signals Fail");

        if (id_signal_forwarding == `HAZ_ID_RS__ID_RT)
            $display("Branch Hazard Detection Signals OK");
        else
            $display("Branch Hazard Detection Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will branch to a defined Address - SUCCESS");
        else
            $display("Instruction won't branch to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_BNE;
        id_cmp_eq = 1;

        #10
        if (signals == `SIG_NOP)
            $display("Branch Signals are OK");
        else
            $display("Branch Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will branch to a defined Address - FAIL");
        else
            $display("Instruction won't branch to a defined Address - SUCCESS");

        #10
        id_opcode = `OPCODE_JAL;

        #10
        if (signals == `SIG_JUMP_LINK)
            $display("Jump Link Signals are OK");
        else
            $display("Jump Link Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will jump to a defined Address - SUCCESS");
        else
            $display("Instruction won't jump to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_TYPE_R;
        id_funct  = `FUNCT_JR;

        #10
        if (signals == `SIG_JUMP_REG)
            $display("Jump Register Signals are OK");
        else
            $display("Jump Register Signals Fail");

        if (id_branch_delay_slot)
            $display("Instruction will jump to a defined Address - SUCCESS");
        else
            $display("Instruction won't jump to a defined Address - FAIL");

        #10
        id_opcode = `OPCODE_LW;
        #10
        if (signals == `SIG_LOAD_WORD)
            $display("Load Signals are OK");
        else
            $display("Load Signals Fail");

        if (id_alu_op == `ALUOP_ADDU)
            $display("Load Alu Operation is OK");
        else
            $display("Load Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS)
            $display("Load Hazard Detection Signals OK");
        else
            $display("Load Hazard Detection Signals Fail");

        #10
        id_opcode = `OPCODE_SW;
        #10
        if (signals == `SIG_STORE_WORD)
            $display("Store Signals are OK");
        else
            $display("Store Signals - Fail");

        if (id_alu_op == `ALUOP_ADDU)
            $display("Store Alu Operation is OK");
        else
            $display("Store Alu Operation Fail");

        if (id_signal_forwarding == `HAZ_EX_RS__WB_RT)
            $display("Store Hazard Detection Signals OK");
        else
            $display("Store Hazard Detection Signals Fail");



    end

endmodule