示例#1
0
 public void ResetClock()
 {
     _clock.clearClock();
     Debug.Log("Reseting Clock");
 }
示例#2
0
    public void strobe()
    {
        Debug.Log("The button has been strobed!!");

        if (t_PCin.isOn)
        {
            PCscript.pcVal = busScript.busVal;
        }

        if (t_MDin.isOn)
        {
            MDscript.mdString = busScript.busVal.ToString();
        }

        if (t_MAin.isOn)
        {
            MAscript.maVal = busScript.busVal;
        }

        if (t_Cin.isOn)
        {
            Cscript.cVal = ALUScript.ALUVal;
        }

        if (t_Ain.isOn)
        {
            Ascript.aVal = busScript.busVal;
        }

        if (t_Rin.isOn)
        {
            switch (selReg)
            {
            case "a":
                selRegVal     = registerABox.text;
                selRegLoc     = Int32.Parse(selRegVal);
                regChild      = registers.gameObject.transform.GetChild(selRegLoc).GetComponent <Text> ();
                regChild.text = busScript.busVal.ToString();
                break;

            case "b":
                selRegVal     = registerABox.text;
                selRegLoc     = Int32.Parse(selRegVal);
                regChild      = registers.gameObject.transform.GetChild(selRegLoc).GetComponent <Text> ();
                regChild.text = busScript.busVal.ToString();
                break;

            case "c":
                selRegVal     = registerABox.text;
                selRegLoc     = Int32.Parse(selRegVal);
                regChild      = registers.gameObject.transform.GetChild(selRegLoc).GetComponent <Text> ();
                regChild.text = busScript.busVal.ToString();
                break;
            }
        }

        if (t_IRin.isOn)
        {
            InstructionScript.instructionVal = busScript.busVal;
        }


        // Read and Write from memory --------------------------------------------------------
        if (t_MDRead.isOn)
        {
            MDscript.mdString = MemoryScript.memList [MAscript.maVal].hexWord;
        }

        // ALU codes -------------------------------------------------------------------------
        if (t_INC4.isOn)
        {
            ALUScript.ALUVal  = busScript.busVal;
            ALUScript.ALUVal += 4;
            if (t_Cin.isOn)
            {
                Cscript.cVal = ALUScript.ALUVal;
            }
        }
        if (t_ADD.isOn)
        {
            ALUScript.ALUVal  = busScript.busVal;
            ALUScript.ALUVal += Ascript.aVal;
            if (t_Cin.isOn)
            {
                Cscript.cVal = ALUScript.ALUVal;
            }
        }
        if (t_SUB.isOn)
        {
            ALUScript.ALUVal  = busScript.busVal;
            ALUScript.ALUVal -= Ascript.aVal;
            if (t_Cin.isOn)
            {
                Cscript.cVal = ALUScript.ALUVal;
            }
        }


        //Ending Code ------------------------------------------------------------------------
        if (t_END.isOn)
        {
            _clock.clearClock();
            s_clear.clear();
        }
        else
        {
            if (t_END.isOn == false)
            {
                _clock.incClock();
            }
        }

        s_clear.clear();
    }