@Override
    public void run() {
        String sAddr;
        
        /* set the value of parameters in instructionThread */
        setXF(controlPanel.XF);
        setRF(controlPanel.RF);
        setI(controlPanel.I);
        setT(controlPanel.T);
        setMEMORY(controlPanel.MEMORY);
        setALU(controlPanel.ALU);
        setIR(controlPanel.IR);
        setOPCODE(controlPanel.OPCODE);
        setADDR(controlPanel.ADDR);
        setCC(controlPanel.CC);
        setPC(controlPanel.PC);
        setMAR(controlPanel.getMAR());
        setMBR(controlPanel.getMBR());
        setIX1(controlPanel.getIX1());
        setIX2(controlPanel.getIX2());
        setIX3(controlPanel.getIX3());
        setGPR0(controlPanel.getGPR0());
        setGPR1(controlPanel.getGPR1());
        setGPR2(controlPanel.getGPR2());       
        setGPR3(controlPanel.getGPR3());
        setStrSwitches(controlPanel.strSwitches);
        setKEYBORD(controlPanel.getKEYBORD());
        setPRINTER(controlPanel.getPRINTER());
        
        sAddr = Long.toBinaryString(512);
        sAddr = String.format("%0" + (20-sAddr.length())+ "d", 0) + sAddr;
        PC.set(sAddr);
        
        if (controlPanel.runType != 5){ // run a program in a file
            
//            timer1 = new Timer (1, action);
//            timer1.start ();
            
            while(!MEMORY.get(PC.get()).substring(0,6).equals("000000")){
                                  
                 ControlPanel.lblPC.setText(String.format("%s", Integer.parseInt(PC.get(),2)));
                    controlPanel.getMAR().set(PC.get());
                    controlPanel.getMBR().set(controlPanel.MEMORY.get(controlPanel.getMAR().get()));
                    strSwitches=controlPanel.MEMORY.get(controlPanel.getMAR().get());
                    
                    controlPanel.setPipelineColor(pipenum, Color.RED);
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException ex) {
                        Logger.getLogger(PipelinedInstruction.class.getName()).log(Level.SEVERE, null, ex);
                    }
                    controlPanel.setPipelineColor(pipenum, Color.GREEN);
                    executeOneInst();
                    
                }
                     
            controlPanel.jMessages.append("Boot Completed!\n");
           
        }
        
        else {
            executeOneInst();
        }
        isStarted = false;
       
    }