예제 #1
0
    public void ALUReset()
    {
        // Get all child objects (bits) for our ALU
        for (int i = 0; i < gameObjBits.Length; i++)
        {
            gameObjBits[i] = gameObject.transform.GetChild(i).gameObject; // Bit7 = [0] ... Bit0 = [7]
            gameObjBits[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }

        busModule    = GameObject.Find("Bus").GetComponent <BusModule>();
        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();
    }
    void Start()
    {
        RAM = GameObject.Find("RAM").GetComponent <RAMModule>();
        IR  = GameObject.Find("Instruction Register").GetComponent <InstructionRegisterModule>();
        ALU = GameObject.Find("ALU").GetComponent <ALUModule>();
        PC  = GameObject.Find("Program Counter").GetComponent <ProgramCounterModule>();
        BUS = GameObject.Find("Bus").GetComponent <BusModule>();

        A = GameObject.Find("Register_A").GetComponent <RegisterModule>();
        B = GameObject.Find("Register_B").GetComponent <RegisterModule>();
        O = GameObject.Find("Output Register").GetComponent <RegisterModule>();

        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();
        assembler    = GameObject.Find("Assembler").GetComponent <Assembler>();
    }
예제 #3
0
    public void ProgramCounterReset()
    {
        busModule    = GameObject.Find("Bus").GetComponent <BusModule>();
        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();

        for (int i = 0; i < pcBits.Length; i++)
        {
            pcBits[i] = 0;
        }

        for (int i = 0; i < pcBitGameObj.Length; i++)
        {
            pcBitGameObj[i] = gameObject.transform.GetChild(i).gameObject;
            pcBitGameObj[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }

        bits = 0;
    }
예제 #4
0
    public void RAMReset()
    {
        for (int i = 0; i < 16; i++)
        {
            reg[i] = new int[8];
        }

        for (int i = 0; i < fourDipBits.Length; i++)
        {
            fourDipBits[i] = gameObject.transform.GetChild(i).gameObject;
            fourDipBits[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }

        for (int i = 0; i < ramBits.Length; i++)
        {
            ramBits[i] = gameObject.transform.GetChild(i + 4).gameObject;
            ramBits[i].GetComponent <Renderer>().material.SetColor("_Color", Color.white);
        }


        busModule    = GameObject.Find("Bus").GetComponent <BusModule>();
        externalFunc = GameObject.Find("ExternalFuncs").GetComponent <ExternalFuncs>();
    }