Example #1
0
  public static void evaluateGate(Gate g, Args options) {

    // refreshGateAttributes(g);
    // simulateREU(g);

    evaluateGateONOFFRatio(g);

    if (options.is_noise_margin()) {
      evaluateGateNoiseMargin(g, options);
    }

    if (options.is_snr()) {
      evaluateGateSNR(g, options);
    }
  }
Example #2
0
  /**
   * The function evaluateCircuit calls other evaluate functions based on the circuit_score chose by
   * user.
   *
   * <p>-circuit_score onoff_ratio score = log(ON/OFF), where ON is the lowest ON in the truthtable,
   * and OFF is the highest off in the truthtable
   *
   * <p>-circuit_score noise_margin noise margin is computed from input REU distance from low margin
   * (if low) or high margin (if high) score = average noise margin of all logic gates used for
   * NOR/NOT only, and cannot be used if there are input gates and no logic gates
   *
   * <p>-circuit_score histogram score = 1 - overlap penalty, where overlap is from the worst pair
   * among ONs and OFFs in the truthtable
   *
   * <p>Circuit is evaluated by evaluating each gate, so the same function calls appear but with a
   * Gate parameter instead of LogicCircuit parameter
   */
  public static void evaluateCircuit(LogicCircuit lc, GateLibrary gate_library, Args options) {

    refreshGateAttributes(lc, gate_library);

    // if sequential
    if (options.get_circuit_type() == DNACompiler.CircuitType.sequential) {

      SequentialHelper.setInitialREUs(lc, gate_library);

      HashMap<String, ArrayList<ArrayList<Double>>> track_reus = new HashMap<>();

      for (Gate g : lc.get_Gates()) {
        track_reus.put(g.Name, new ArrayList<ArrayList<Double>>());
        ArrayList<Double> copy_reus = new ArrayList<Double>(g.get_outreus());
        track_reus.get(g.Name).add(copy_reus);
        track_reus.get(g.Name).add(copy_reus);
      }

      boolean converges = SequentialHelper.convergeREUs(lc, gate_library, options, track_reus);

      if (!converges) {

        lc.get_scores().set_onoff_ratio(0.0);
        lc.get_scores().set_noise_margin_contract(false);

        return;
      }
    }

    // if combinational
    else if (options.get_circuit_type() == DNACompiler.CircuitType.combinational) {
      simulateREU(lc, gate_library, options);
    }

    evaluateCircuitONOFFRatio(lc);

    if (options.is_noise_margin()) {
      evaluateCircuitNoiseMargin(lc, options);
    }

    if (options.is_snr()) {
      evaluateCircuitSNR(lc, options);
    }
  }