data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v
1: b'%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.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_Forwarding_Hazard_Unity.v:59: Define or directive not defined: \'`HAZ_ID_RS__ID_RT\'\n        sig_hazards <= `HAZ_ID_RS__ID_RT;\n                       ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:59: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        sig_hazards <= `HAZ_ID_RS__ID_RT;\n                                        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:58: 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_Forwarding_Hazard_Unity.v:77: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:81: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:92: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:102: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:106: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:117: Define or directive not defined: \'`HAZ_EX_RS__EX_RT\'\n        sig_hazards <= `HAZ_EX_RS__EX_RT;\n                       ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:117: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        sig_hazards <= `HAZ_EX_RS__EX_RT;\n                                        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:116: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:133: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:143: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:147: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:158: Define or directive not defined: \'`HAZ_EX_RS__WB_RT\'\n        sig_hazards <= `HAZ_EX_RS__WB_RT;\n                       ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:158: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        sig_hazards <= `HAZ_EX_RS__WB_RT;\n                                        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:157: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:163: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:170: Define or directive not defined: \'`HAZ_EX_RS__EX_RT\'\n        sig_hazards <= `HAZ_EX_RS__EX_RT;\n                       ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:170: syntax error, unexpected \';\', expecting TYPE-IDENTIFIER\n        sig_hazards <= `HAZ_EX_RS__EX_RT;\n                                        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:169: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:180: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:186: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:191: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:197: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Warning-STMTDLY: data/full_repos/permissive/100975158/MIPS32_Full/Processor/TB_Forwarding_Hazard_Unity.v:200: Unsupported: Ignoring delay on this delayed statement.\n        #10\n        ^\n%Error: Exiting due to 9 error(s), 18 warning(s)\n'
module TB_Forwarding_Hazard_Unity ();
    reg [7:0]     sig_hazards;
    reg [4:0]     id_rs;
    reg [4:0]     id_rt;
    reg [4:0]     ex_rs;
    reg [4:0]     ex_rt;
    reg [4:0]     ex_rt_rd;
    reg [4:0]     me_rt_rd;
    reg [4:0]     wb_rt_rd;
    reg           ex_jump_link;
    reg           ex_reg_write;
    reg           me_reg_write;
    reg           wb_reg_write;
    reg           me_mem_read;
    reg           me_mem_write;
    reg           me_mem_to_reg;


    wire          id_stall;
    wire          ex_stall;
    wire [1:0]    id_fwd_rs_sel;
    wire [1:0]    id_fwd_rt_sel;
    wire [1:0]    ex_fwd_rs_sel;
    wire [1:0]    ex_fwd_rt_sel;
    wire          me_write_data_fwd_sel;


    Forwarding_Hazard_Unity ForwardingHazardControl (
        .sig_hazards    (sig_hazards),
        .id_rs          (id_rs),
        .id_rt          (id_rt),
        .ex_rs          (ex_rs),
        .ex_rt          (ex_rt),
        .ex_rt_rd       (ex_rt_rd),
        .me_rt_rd       (me_rt_rd),
        .wb_rt_rd       (wb_rt_rd),
        .ex_jump_link   (ex_jump_link),
        .ex_reg_write   (ex_reg_write),
        .me_reg_write   (me_reg_write),
        .wb_reg_write   (wb_reg_write),
        .me_mem_read    (me_mem_read),
        .me_mem_write   (me_mem_write),
        .me_mem_to_reg  (me_mem_to_reg),
        .id_stall       (id_stall),
        .ex_stall       (ex_stall),
        .id_fwd_rs_sel  (id_fwd_rs_sel),
        .id_fwd_rt_sel  (id_fwd_rt_sel),
        .ex_fwd_rs_sel  (ex_fwd_rs_sel),
        .ex_fwd_rt_sel  (ex_fwd_rt_sel),
        .me_write_data_fwd_sel  (me_write_data_fwd_sel)
    );


    initial begin
        #10
        sig_hazards <= `HAZ_ID_RS__ID_RT;
        id_rs = 5'd1;
        id_rt = 5'd2;

        ex_rs = 5'd3;
        ex_rt = 5'd4;

        ex_rt_rd = 5'd1;
        me_rt_rd = 5'd2;
        wb_rt_rd = 5'd3;

        ex_reg_write = 1;
        me_reg_write = 1;
        wb_reg_write = 1;

        me_mem_read  = 0;
        me_mem_write = 0;

        #10
        if (id_stall == 1)
            $display ("Stall when need value Branch - OK");

        #10
        id_rs = 5'd1;
        id_rt = 5'd2;

        ex_rs = 5'd3;
        ex_rt = 5'd4;

        ex_rt_rd = 5'd3;
        me_rt_rd = 5'd1;
        wb_rt_rd = 5'd2;

        #10
        if (id_fwd_rs_sel == 2'b01)
            $display ("Forwarding ME/ID RS - OK");
        else
            $display ("Forwarding ME/ID RS - FAIL");
        if (id_fwd_rt_sel == 2'b10)
            $display ("Forwarding WB/ID RT - OK");
        else
            $display ("Forwarding WB/ID RS - FAIL");

        #10
        me_rt_rd = 5'd2;
        wb_rt_rd = 5'd1;

        #10
        if (id_fwd_rs_sel == 2'b10)
            $display ("Forwarding WB/ID RS - OK");
        else
            $display ("Forwarding WB/ID RS - FAIL");
        if (id_fwd_rt_sel == 2'b01)
            $display ("Forwarding ME/ID RT - OK");
        else
            $display ("Forwarding ME/ID RT - FAIL");

        #10
        sig_hazards <= `HAZ_EX_RS__EX_RT;
        ex_rs = 5'd1;
        ex_rt = 5'd2;

        ex_rt_rd = 5'd6;
        me_rt_rd = 5'd1;
        wb_rt_rd = 5'd2;

        ex_reg_write = 1;
        me_reg_write = 1;
        wb_reg_write = 1;

        me_mem_read  = 0;
        me_mem_write = 0;
        ex_jump_link = 0;

        #10
        if (ex_fwd_rs_sel == 2'b01)
            $display ("Forwarding ME/EX RS - OK");
        else
            $display ("Forwarding ME/EX RS - FAIL");
        if (ex_fwd_rt_sel == 2'b10)
            $display ("Forwarding WB/EX RT - OK");
        else
            $display ("Forwarding WB/EX RT - FAIL");

        #10
        me_rt_rd = 5'd2;
        wb_rt_rd = 5'd1;

        #10
        if (ex_fwd_rs_sel == 2'b10)
            $display ("Forwarding WB/EX RS - OK");
        else
            $display ("Forwarding WB/EX RS - FAIL");
        if (ex_fwd_rt_sel == 2'b01)
            $display ("Forwarding ME/EX RT - OK");
        else
            $display ("Forwarding ME/EX RT - FAIL");

        #10
        sig_hazards <= `HAZ_EX_RS__WB_RT;
        me_rt_rd = 5'd1;
        wb_rt_rd = 5'd1;
        me_reg_write = 0;

        #10
        if (me_write_data_fwd_sel == 1)
            $display ("Forwarding WB/ME RT - OK");
        else
            $display ("Forwarding WB/ME RT - FAIL");

        #10
        sig_hazards <= `HAZ_EX_RS__EX_RT;
        ex_rs = 5'd1;
        ex_rt = 5'd2;

        me_rt_rd = 5'd1;
        me_mem_read  = 1;
        me_reg_write = 1;

        ex_jump_link = 0;

        #10
        if (ex_stall == 1)
            $display ("Stall EX when need value Load Value - OK");
        else
            $display ("Stall EX when need value Load Value - FAIL");

        #10
        me_mem_read  = 0;
        me_mem_write = 1;
        me_reg_write = 0;

        #10
        if (ex_stall == 0)
            $display ("Stall EX when need value Only on Load Value - OK");
        else
            $display ("Stall EX when need value Only on Load Value - FAIL");

        #10
        ex_jump_link = 1;

        #10
        if (ex_fwd_rs_sel == 2'b11)
            $display ("Jump Link RS - OK");
        else
            $display ("Jump Link RS - FAIL");
        if (ex_fwd_rt_sel == 2'b11)
            $display ("Jump Link RT - OK");
        else
            $display ("Jump Link RT - FAIL");

    end

endmodule
module TB_Forwarding_Hazard_Unity ();

    reg [7:0]     sig_hazards;
    reg [4:0]     id_rs;
    reg [4:0]     id_rt;
    reg [4:0]     ex_rs;
    reg [4:0]     ex_rt;
    reg [4:0]     ex_rt_rd;
    reg [4:0]     me_rt_rd;
    reg [4:0]     wb_rt_rd;
    reg           ex_jump_link;
    reg           ex_reg_write;
    reg           me_reg_write;
    reg           wb_reg_write;
    reg           me_mem_read;
    reg           me_mem_write;
    reg           me_mem_to_reg;


    wire          id_stall;
    wire          ex_stall;
    wire [1:0]    id_fwd_rs_sel;
    wire [1:0]    id_fwd_rt_sel;
    wire [1:0]    ex_fwd_rs_sel;
    wire [1:0]    ex_fwd_rt_sel;
    wire          me_write_data_fwd_sel;


    Forwarding_Hazard_Unity ForwardingHazardControl (
        .sig_hazards    (sig_hazards),
        .id_rs          (id_rs),
        .id_rt          (id_rt),
        .ex_rs          (ex_rs),
        .ex_rt          (ex_rt),
        .ex_rt_rd       (ex_rt_rd),
        .me_rt_rd       (me_rt_rd),
        .wb_rt_rd       (wb_rt_rd),
        .ex_jump_link   (ex_jump_link),
        .ex_reg_write   (ex_reg_write),
        .me_reg_write   (me_reg_write),
        .wb_reg_write   (wb_reg_write),
        .me_mem_read    (me_mem_read),
        .me_mem_write   (me_mem_write),
        .me_mem_to_reg  (me_mem_to_reg),
        .id_stall       (id_stall),
        .ex_stall       (ex_stall),
        .id_fwd_rs_sel  (id_fwd_rs_sel),
        .id_fwd_rt_sel  (id_fwd_rt_sel),
        .ex_fwd_rs_sel  (ex_fwd_rs_sel),
        .ex_fwd_rt_sel  (ex_fwd_rt_sel),
        .me_write_data_fwd_sel  (me_write_data_fwd_sel)
    );


    initial begin
        #10
        sig_hazards <= `HAZ_ID_RS__ID_RT;
        id_rs = 5'd1;
        id_rt = 5'd2;

        ex_rs = 5'd3;
        ex_rt = 5'd4;

        ex_rt_rd = 5'd1;
        me_rt_rd = 5'd2;
        wb_rt_rd = 5'd3;

        ex_reg_write = 1;
        me_reg_write = 1;
        wb_reg_write = 1;

        me_mem_read  = 0;
        me_mem_write = 0;

        #10
        if (id_stall == 1)
            $display ("Stall when need value Branch - OK");

        #10
        id_rs = 5'd1;
        id_rt = 5'd2;

        ex_rs = 5'd3;
        ex_rt = 5'd4;

        ex_rt_rd = 5'd3;
        me_rt_rd = 5'd1;
        wb_rt_rd = 5'd2;

        #10
        if (id_fwd_rs_sel == 2'b01)
            $display ("Forwarding ME/ID RS - OK");
        else
            $display ("Forwarding ME/ID RS - FAIL");
        if (id_fwd_rt_sel == 2'b10)
            $display ("Forwarding WB/ID RT - OK");
        else
            $display ("Forwarding WB/ID RS - FAIL");

        #10
        me_rt_rd = 5'd2;
        wb_rt_rd = 5'd1;

        #10
        if (id_fwd_rs_sel == 2'b10)
            $display ("Forwarding WB/ID RS - OK");
        else
            $display ("Forwarding WB/ID RS - FAIL");
        if (id_fwd_rt_sel == 2'b01)
            $display ("Forwarding ME/ID RT - OK");
        else
            $display ("Forwarding ME/ID RT - FAIL");

        #10
        sig_hazards <= `HAZ_EX_RS__EX_RT;
        ex_rs = 5'd1;
        ex_rt = 5'd2;

        ex_rt_rd = 5'd6;
        me_rt_rd = 5'd1;
        wb_rt_rd = 5'd2;

        ex_reg_write = 1;
        me_reg_write = 1;
        wb_reg_write = 1;

        me_mem_read  = 0;
        me_mem_write = 0;
        ex_jump_link = 0;

        #10
        if (ex_fwd_rs_sel == 2'b01)
            $display ("Forwarding ME/EX RS - OK");
        else
            $display ("Forwarding ME/EX RS - FAIL");
        if (ex_fwd_rt_sel == 2'b10)
            $display ("Forwarding WB/EX RT - OK");
        else
            $display ("Forwarding WB/EX RT - FAIL");

        #10
        me_rt_rd = 5'd2;
        wb_rt_rd = 5'd1;

        #10
        if (ex_fwd_rs_sel == 2'b10)
            $display ("Forwarding WB/EX RS - OK");
        else
            $display ("Forwarding WB/EX RS - FAIL");
        if (ex_fwd_rt_sel == 2'b01)
            $display ("Forwarding ME/EX RT - OK");
        else
            $display ("Forwarding ME/EX RT - FAIL");

        #10
        sig_hazards <= `HAZ_EX_RS__WB_RT;
        me_rt_rd = 5'd1;
        wb_rt_rd = 5'd1;
        me_reg_write = 0;

        #10
        if (me_write_data_fwd_sel == 1)
            $display ("Forwarding WB/ME RT - OK");
        else
            $display ("Forwarding WB/ME RT - FAIL");

        #10
        sig_hazards <= `HAZ_EX_RS__EX_RT;
        ex_rs = 5'd1;
        ex_rt = 5'd2;

        me_rt_rd = 5'd1;
        me_mem_read  = 1;
        me_reg_write = 1;

        ex_jump_link = 0;

        #10
        if (ex_stall == 1)
            $display ("Stall EX when need value Load Value - OK");
        else
            $display ("Stall EX when need value Load Value - FAIL");

        #10
        me_mem_read  = 0;
        me_mem_write = 1;
        me_reg_write = 0;

        #10
        if (ex_stall == 0)
            $display ("Stall EX when need value Only on Load Value - OK");
        else
            $display ("Stall EX when need value Only on Load Value - FAIL");

        #10
        ex_jump_link = 1;

        #10
        if (ex_fwd_rs_sel == 2'b11)
            $display ("Jump Link RS - OK");
        else
            $display ("Jump Link RS - FAIL");
        if (ex_fwd_rt_sel == 2'b11)
            $display ("Jump Link RT - OK");
        else
            $display ("Jump Link RT - FAIL");

    end

endmodule