Package com.cburch.logisim.instance

Examples of com.cburch.logisim.instance.Port


      inPt  = Location.create(-30, 0);
      selPt = Location.create(-10, 10);
    }
   
    Port[] ps = new Port[3];
    ps[0] = new Port(0, 0, Port.OUTPUT, group.getWidth());
    ps[1] = new Port(inPt.getX(), inPt.getY(), Port.INPUT, data.getWidth());
    ps[2] = new Port(selPt.getX(), selPt.getY(), Port.INPUT, select.getWidth());
    ps[0].setToolTip(Strings.getter("bitSelectorOutputTip"));
    ps[1].setToolTip(Strings.getter("bitSelectorDataTip"));
    ps[2].setToolTip(Strings.getter("bitSelectorSelectTip"));
    instance.setPorts(ps);
  }
View Full Code Here


    case 3: y = -10; break;
    default: y = ((inputs - 1) / 2) * -10;
    }

    Port[] ps = new Port[inputs + 1];
    ps[0] = new Port(0, 0, Port.OUTPUT, BitWidth.create(outWidth));
    ps[0].setToolTip(Strings.getter("bitAdderOutputManyTip"));
    for (int i = 0; i < inputs; i++) {
      ps[i + 1] = new Port(-40, y + i * dy, Port.INPUT, inWidth);
      ps[i + 1].setToolTip(Strings.getter("bitAdderInputTip"));
    }
    instance.setPorts(ps);
  }
View Full Code Here

    Object size = instance.getAttributeValue(ATTR_SIZE);
    Direction facing = instance.getAttributeValue(StdAttr.FACING);
    int dx = size == SIZE_NARROW ? -20 : -30;

    Port[] ports = new Port[2];
    ports[0] = new Port(0, 0, Port.OUTPUT, StdAttr.WIDTH);
    Location out = Location.create(0, 0).translate(facing, dx);
    ports[1] = new Port(out.getX(), out.getY(), Port.INPUT, StdAttr.WIDTH);
    instance.setPorts(ports);
  }
View Full Code Here

        Color.BLACK, DEFAULT_BACKGROUND
      });
    setIconName("tty.gif");
   
    Port[] ps = new Port[4];
    ps[CLR] = new Port(2010, Port.INPUT, 1);
    ps[CK= new Port( 0,   0, Port.INPUT, 1);
    ps[WE= new Port(1010, Port.INPUT, 1);
    ps[IN= new Port( 0, -10, Port.INPUT, 7);
    ps[CLR].setToolTip(Strings.getter("ttyClearTip"));
    ps[CK].setToolTip(Strings.getter("ttyClockTip"));
    ps[WE].setToolTip(Strings.getter("ttyEnableTip"));
    ps[IN].setToolTip(Strings.getter("ttyInputTip"));
    setPorts(ps);
View Full Code Here

     * the component's anchor location, then whether the port is an
     * input/output/both, and finally the expected bit width for the port.
     * The bit width can be a constant (like 1) or an attribute (as here).
     */
    setPorts(new Port[] {
        new Port(-30, 0, Port.INPUT, StdAttr.WIDTH),
        new Port(0, 0, Port.OUTPUT, StdAttr.WIDTH),
      });
  }
View Full Code Here

class GrayCounter extends InstanceFactory {
  public GrayCounter() {
    super("Gray Counter");
    setOffsetBounds(Bounds.create(-30, -15, 30, 30));
    setPorts(new Port[] {
        new Port(-30, 0, Port.INPUT, 1),
        new Port0, 0, Port.OUTPUT, StdAttr.WIDTH),
    });
   
    // We'll have width, label, and label font attributes. The latter two
    // attributes allow us to associate a label with the component (though
    // we'll also need configureNewInstance to configure the label's
View Full Code Here

 
  public SimpleGrayCounter() {
    super("Gray Counter (Simple)");
    setOffsetBounds(Bounds.create(-30, -15, 30, 30));
    setPorts(new Port[] {
        new Port(-30, 0, Port.INPUT, 1),
        new Port0, 0, Port.OUTPUT, BIT_WIDTH.getWidth()),
    });
  }
View Full Code Here

    setInstancePoker(Poker.class);
    setInstanceLogger(Logger.class);
   
    Port[] ps = new Port[numInputs + STD_PORTS];
    if (numInputs == 1) {
      ps[0] = new Port(-40, 20, Port.INPUT, 1);
      ps[1] = new Port(-400, Port.INPUT, 1);
    } else if (numInputs == 2) {
      ps[0] = new Port(-400, Port.INPUT, 1);
      ps[1] = new Port(-40, 20, Port.INPUT, 1);
      ps[2] = new Port(-40, 10, Port.INPUT, 1);
    } else {
      throw new RuntimeException("flip-flop input > 2");
    }
    ps[numInputs + 1] = new Port00, Port.OUTPUT, 1);
    ps[numInputs + 2] = new Port0, 20, Port.OUTPUT, 1);
    ps[numInputs + 3] = new Port(-10, 30, Port.INPUT,  1);
    ps[numInputs + 4] = new Port(-30, 30, Port.INPUT,  1);
    ps[numInputs + 5] = new Port(-20, 30, Port.INPUT,  1);
    ps[numInputs].setToolTip(Strings.getter("flipFlopClockTip"));
    ps[numInputs + 1].setToolTip(Strings.getter("flipFlopQTip"));
    ps[numInputs + 2].setToolTip(Strings.getter("flipFlopNotQTip"));
    ps[numInputs + 3].setToolTip(Strings.getter("flipFlopResetTip"));
    ps[numInputs + 4].setToolTip(Strings.getter("flipFlopPresetTip"));
View Full Code Here

    setIconName("ground.gif");
    setAttributes(new Attribute[] { StdAttr.FACING, StdAttr.WIDTH },
        new Object[] { Direction.SOUTH, BitWidth.ONE });
    setFacingAttribute(StdAttr.FACING);
    setKeyConfigurator(new BitWidthConfigurator(StdAttr.WIDTH));
    setPorts(new Port[] { new Port(0, 0, Port.OUTPUT, StdAttr.WIDTH) });
  }
View Full Code Here

    Object powerLoc = instance.getAttributeValue(Wiring.ATTR_GATE);
    boolean flip = (facing == Direction.SOUTH || facing == Direction.WEST)
      == (powerLoc == Wiring.GATE_TOP_LEFT);

    Port[] ports = new Port[3];
    ports[OUTPUT] = new Port(0, 0, Port.OUTPUT, StdAttr.WIDTH);
    ports[INPUT] = new Port(40 * dx, 40 * dy, Port.INPUT, StdAttr.WIDTH);
    if (flip) {
      ports[GATE] = new Port(20 * (dx + dy), 20 * (-dx + dy), Port.INPUT, 1);
    } else {
      ports[GATE] = new Port(20 * (dx - dy), 20 * (dx + dy), Port.INPUT, 1);
    }
    instance.setPorts(ports);
  }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.instance.Port

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.