Package com.cburch.logisim.circuit

Examples of com.cburch.logisim.circuit.Propagator


        else            setCursor(t.getCursor());
      } else if (act == ProjectEvent.ACTION_SET_STATE) {
        CircuitState oldState = (CircuitState) event.getOldData();
        CircuitState newState = (CircuitState) event.getData();
        if (oldState != null && newState != null) {
          Propagator oldProp = oldState.getPropagator();
          Propagator newProp = newState.getPropagator();
          if (oldProp != newProp) {
            tickCounter.clear();
          }
        }
      }
View Full Code Here


    int retCode;
    long tickCount = 0;
    long start = System.currentTimeMillis();
    boolean halted = false;
    ArrayList<Value> prevOutputs = null;
    Propagator prop = circState.getPropagator();
    while (true) {
      ArrayList<Value> curOutputs = new ArrayList<Value>();
      for (Instance pin : outputPins) {
        InstanceState pinState = circState.getInstanceState(pin);
        Value val = Pin.FACTORY.getValue(pinState);
        if (pin == haltPin) {
          halted |= val.equals(Value.TRUE);
        } else if (showTable) {
          curOutputs.add(val);
        }
      }
      if (showTable) {
        displayTableRow(prevOutputs, curOutputs);
      }
     
      if (halted) {
        retCode = 0; // normal exit
        break;
      }
      if (prop.isOscillating()) {
        retCode = 1; // abnormal exit
        break;
      }
      if (keyboardStates != null) {
        char[] buffer = stdinThread.getBuffer();
        if (buffer != null) {
          for (InstanceState keyState : keyboardStates) {
            Keyboard.addToBuffer(keyState, buffer);
          }
        }
      }
      prevOutputs = curOutputs;
      tickCount++;
      prop.tick();
      prop.propagate();
    }
    long elapse = System.currentTimeMillis() - start;
    if (showTty) ensureLineTerminated();
    if (showHalt || retCode != 0) {
      if (retCode == 0) {
View Full Code Here

        int retCode;
        long tickCount = 0;
        long start = System.currentTimeMillis();
        boolean halted = false;
        ArrayList<Value> prevOutputs = null;
        Propagator prop = circState.getPropagator();
        while (true) {
            ArrayList<Value> curOutputs = new ArrayList<Value>();
            for (Instance pin : outputPins) {
                InstanceState pinState = circState.getInstanceState(pin);
                Value val = Pin.FACTORY.getValue(pinState);
                if (pin == haltPin) {
                    halted |= val.equals(Value.TRUE);
                } else if (showTable) {
                    curOutputs.add(val);
                }
            }
            if (showTable) {
                displayTableRow(prevOutputs, curOutputs);
            }

            if (halted) {
                // normal exit
                retCode = 0;
                break;
            }
            if (prop.isOscillating()) {
                // abnormal exit
                retCode = 1;
                break;
            }
            if (keyboardStates != null) {
                char[] buffer = stdinThread.getBuffer();
                if (buffer != null) {
                    for (InstanceState keyState : keyboardStates) {
                        Keyboard.addToBuffer(keyState, buffer);
                    }
                }
            }
            prevOutputs = curOutputs;
            tickCount++;
            prop.tick();
            prop.propagate();
        }
        long elapse = System.currentTimeMillis() - start;
        if (showTty) {
            ensureLineTerminated();
        }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.circuit.Propagator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.