Exemple #1
0
    return


if __name__ == '__main__':

    CLA.run_error_check()  #DEBUG
    isForwarding = (sys.argv[1] == "F")
    make_pipeline(sys.argv[2])
    control = Control(isForwarding)
    print("START OF SIMULATION (" + ("no " if not isForwarding else "") +
          "forwarding)")
    print("-" * 82)

    pipeline_registers = make_pipereg()
    while cycle_count < max_cycle_count:
        temp = control.CheckBranch(pipeline_registers, branch_labels)
        if temp != -1:
            next_instruction_index = temp
            pipeline_registers[-1].output.update(cycle_count, "WB")
            for register in pipeline_registers:
                if (register.input != None):
                    register.input.till_dead = 1
        else:
            next_instruction_index += 1

        if pipeline_registers[-1].output is not None:
            ALU(
                pipeline_registers[-1].output
            )  #output is the current instruction in the wb pipreg object. Varable can chance based on chosen object varable.
            pipeline_registers[-1].output.update(cycle_count, "WB")