public void LoadSubGate(ObjectInputStream s) throws IOException, ClassNotFoundException {
        int numSignals = s.readInt();
        mySignals = new Vector<Signal>();
        for (int a = 0; a < numSignals; a++) {
            Signal newSignal = new Signal();
            newSignal.Set(s.readBoolean());
            newSignal.working = s.readBoolean();
            mySignals.addElement(newSignal);
        }

        for (int a = 0; a < 8; a++) {
            int sigIndex = s.readInt();
            if (sigIndex >= 0) {
                portSignals[a].internalSignal = mySignals.elementAt(sigIndex);
            }
            portSignals[a].type = s.readInt();
        }

        int numGates = s.readInt();
        for (int a = 0; a < numGates; a++) {
            Gate newGate = new Gate((String) s.readObject());
            newGate.state = s.readBoolean();
            myGates.addElement(newGate);
            for (int b = 0; b < 8; b++) {
                int sigIndex = s.readInt();
                if (sigIndex >= 0) {
                    newGate.portSignals[b].externalSignal = mySignals.elementAt(sigIndex);
                }
            }
            if (newGate.type.equalsIgnoreCase("Chip")) {
                newGate.LoadSubGate(s);
            }
        }
        speed = s.readInt();
    }