public void commit() {
        
        // if you haven't committed anything in 10,000 cycles, simulator is probably deadlocked --> kill
        SimAssert.check(((currCycle - lastCommitCycle) < 10000), "Deadlock! no commits in 10K cycles", currCycle);
        
        for (int i = 0; i < machineWidth; i++) {
            if (ROB.isEmpty()) // nothing to commit. bye!
                break;
            ROB_entry head = ROB.head(); 
            Uop headUop = head.theUop;
            if (head.doneCycle <= currCycle && (head.doneCycle != -1)) {
                head.commitCycle = currCycle;
                if (debug_f) {
                    head.printCycles();
                    head.printInputRegisters();
                    head.printOutputRegisters();
                    headUop.print_macro_micro_names();
                }
                
                // at commit, free the overwritten register
                for (int out = 0; out < Uop.MAX_OUTPUTS; out++) {
                    if (headUop.outputRegs[out] != -1) {
                        FreeList.addLast(head.overwrittenRegs[out]);
                    }
                }
                
                ROB.dequeue();
                totalUops++;
                lastCommitCycle = currCycle;
            }
        }
    }