fn end_pipeline(cpu: &mut CpuState, pipe: &mut Pipe) -> bool {
    if let Some(instr) = &pipe.executing {
        let instr_type = instr.instruction_type;
        let succeeded = execute_instr(&Rc::clone(instr), cpu, pipe);
        if succeeded && (instr_type == InstructionType::BRANCH) {
            // executed a branch instruction which succeeded, so no longer terminating
            return false;
        }
        cpu.increment_pc();
        pipe.clear_decoding();
    } else {
        if let Some(instr) = &pipe.decoding {
            let instr_type = instr.instruction_type;
            let succeeded = execute_instr(&Rc::clone(instr), cpu, pipe);
            if succeeded && (instr_type == InstructionType::BRANCH) {
                // executed a branch instruction which succeeded, so no longer terminating
                return false;
            }
        }
        pipe.clear_decoding();
    }

    cpu.increment_pc();
    true
}
/// Function that tries to end the pipeline and returns whether it did actually
/// succeed in ending it
Function that tries to end the pipeline and returns whether it did actually
succeed in ending it
Function that tries to end the pipeline and returns whether it did actually succeed in ending it
fn end_pipeline(cpu: &mut CpuState, pipe: &mut Pipe) -> bool {
    if let Some(instr) = &pipe.executing {
        let instr_type = instr.instruction_type;
        let succeeded = execute_instr(&Rc::clone(instr), cpu, pipe);
        if succeeded && (instr_type == InstructionType::BRANCH) {
            // executed a branch instruction which succeeded, so no longer terminating
            return false;
        }
        cpu.increment_pc();
        pipe.clear_decoding();
    } else {
        if let Some(instr) = &pipe.decoding {
            let instr_type = instr.instruction_type;
            let succeeded = execute_instr(&Rc::clone(instr), cpu, pipe);
            if succeeded && (instr_type == InstructionType::BRANCH) {
                // executed a branch instruction which succeeded, so no longer terminating
                return false;
            }
        }
        pipe.clear_decoding();
    }
    cpu.increment_pc();
    true
}
fn end_pipeline ( cpu : & mut CpuState , pipe : & mut Pipe ) -> bool { if let Some ( instr ) = & pipe . executing { let instr_type = instr . instruction_type ; let succeeded = execute_instr ( & Rc :: clone ( instr ) , cpu , pipe ) ; if succeeded && ( instr_type == InstructionType :: BRANCH ) { // executed a branch instruction which succeeded, so no longer terminating return false ; } cpu . increment_pc ( ) ; pipe . clear_decoding ( ) ; } else { if let Some ( instr ) = & pipe . decoding { let instr_type = instr . instruction_type ; let succeeded = execute_instr ( & Rc :: clone ( instr ) , cpu , pipe ) ; if succeeded && ( instr_type == InstructionType :: BRANCH ) { // executed a branch instruction which succeeded, so no longer terminating return false ; } } pipe . clear_decoding ( ) ; } cpu . increment_pc ( ) ; true }
Function that tries to end the pipeline and returns whether it did actually
succeed in ending it
Function that tries to end the pipeline and returns whether it did actually succeed in ending it
cpu
&mut CpuState
pipe
&mut Pipe