Examples of toIntValue()


Examples of com.cburch.logisim.data.Value.toIntValue()

            newVal = ld ? max : 0;
          } else if (onGoal == ON_GOAL_STAY) {
            newVal = oldVal;
          } else if (onGoal == ON_GOAL_LOAD) {
            Value in = state.getPort(IN);
            newVal = in.isFullyDefined() ? in.toIntValue() : 0;
            if (newVal > max) newVal &= max;
          } else if (onGoal == ON_GOAL_CONT) {
            newVal = ld ? oldVal - 1 : oldVal + 1;
          } else {
            System.err.println("Invalid goal attribute " + onGoal); //OK
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

        } else {
          newVal = ld ? oldVal - 1 : oldVal + 1;
        }
      } else if (ld) { // trigger, enable = 0, load = 1: should load
        Value in = state.getPort(IN);
        newVal = in.isFullyDefined() ? in.toIntValue() : 0;
        if (newVal > max) newVal &= max;
      } else { // trigger, enable = 0, load = 0: no change
        newVal = oldVal;
      }
      newValue = Value.createKnown(dataWidth, newVal);
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

    } else if (en == Value.ERROR && state.isPortConnected(outputs + 1)) {
      others = Value.createError(data);
    } else {
      Value sel = state.getPort(outputs);
      if (sel.isFullyDefined()) {
        outIndex = sel.toIntValue();
        out = Value.TRUE;
      } else if (sel.isErrorValue()) {
        others = Value.createError(data);
      } else {
        others = Value.createUnknown(data);
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

      myState.setCurrent(-1);
      state.setPort(DATA, Value.createUnknown(dataBits), DELAY);
      return;
    }

    int addr = addrValue.toIntValue();
    if (!addrValue.isFullyDefined() || addr < 0)
      return;
    if (addr != myState.getCurrent()) {
      myState.setCurrent(addr);
      myState.scrollToShow(addr);
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

    int summary = 0;
    Value baseVal = state.getPort(0);
    if (baseVal == null) baseVal = Value.createUnknown(BitWidth.create(4));
    int segs; // each nibble is one segment, in top-down, left-to-right
      // order: middle three nibbles are the three horizontal segments
    switch (baseVal.toIntValue()) {
    case 0:  segs = 0x1110111; break;
    case 1:  segs = 0x0000011; break;
    case 2:  segs = 0x0111110; break;
    case 3:  segs = 0x0011111; break;
    case 4:  segs = 0x1001011; break;
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

    } else if (en == Value.ERROR && state.isPortConnected(outputs + 1)) {
      others = Value.createError(data);
    } else {
      Value sel = state.getPort(outputs);
      if (sel.isFullyDefined()) {
        outIndex = sel.toIntValue();
        out = state.getPort(outputs + (enable ? 2 : 1));
      } else if (sel.isErrorValue()) {
        others = Value.createError(data);
      } else {
        others = Value.createUnknown(data);
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

    if (state.getPort(CLR) == Value.TRUE) {
      data.value = 0;
    } else if (triggered && state.getPort(EN) != Value.FALSE) {
      Value in = state.getPort(IN);
      if (in.isFullyDefined()) data.value = in.toIntValue();
    }

    state.setPort(OUT, Value.createKnown(dataWidth, data.value), DELAY);
  }
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

      myState.setCurrent(-1);
      state.setPort(DATA, Value.createUnknown(dataBits), DELAY);
      return;
    }

    int addr = addrValue.toIntValue();
    if (!addrValue.isFullyDefined() || addr < 0)
      return;
    if (addr != myState.getCurrent()) {
      myState.setCurrent(addr);
      myState.scrollToShow(addr);
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

      } else {
        shouldStore = !outputEnabled;
      }
      if (shouldStore) {
        Value dataValue = state.getPort(separate ? DIN : DATA);
        myState.getContents().set(addr, dataValue.toIntValue());
      }
    }

    if (outputEnabled) {
      int val = myState.getContents().get(addr);
View Full Code Here

Examples of com.cburch.logisim.data.Value.toIntValue()

    } else if (en == Value.ERROR && state.isPortConnected(inputs + 1)) {
      out = Value.createError(data);
    } else {
      Value sel = state.getPort(inputs);
      if (sel.isFullyDefined()) {
        out = state.getPort(sel.toIntValue());
      } else if (sel.isErrorValue()) {
        out = Value.createError(data);
      } else {
        out = Value.createUnknown(data);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.