Exemplo n.º 1
0
 public BitConstant(List<Bit> bits) {
   long constant_value = 0;
   int constant_size = 0;
   long bitmask = 0x1;
   for (Bit bit : bits) {
     if (bit.isOn()) {
       constant_value |= bitmask;
     }
     bitmask <<= 1;
     constant_size++;
   }
   constant = new BinaryNumber(constant_value, constant_size);
 }
Exemplo n.º 2
0
  /**
   * Gets the FPGA hardware resource usage of this component.
   *
   * @return a FPGAResource objec
   */
  @Override
  public FPGAResource getHardwareResourceUsage() {
    int lutCount = 0;

    Value inputValue = getDataPort().getValue();
    for (int i = 0; i < inputValue.getSize(); i++) {
      Bit inputBit = inputValue.getBit(i);
      if (!inputBit.isConstant() && inputBit.isCare()) {
        lutCount++;
      }
    }

    FPGAResource hwResource = new FPGAResource();
    hwResource.addLUT(lutCount);

    return hwResource;
  }