public void buildReport() {

    vdomainReport = ReportCellFactory.eINSTANCE.createCellReportModule();

    for (VoltageSource vs : vdomain.getVoltageSrcs()) {

      // get the cell split for the voltage source
      //
      PortDBNode vsPin = vs.getPin();
      if (moduleWithPM instanceof InstanceDBNode) {
        // the PM is defined in a hierarchical instance
        // make the pin relative to the current model
        vsPin = (PortDBNode) ((InstanceDBNode) moduleWithPM).append(vsPin.elements());
      }

      CellReportPinBuilder vsrcReportBuilder = new CellReportPinBuilder(vsPin);
      vsrcReportBuilder.buildReport();

      CellReportFamilyGLModuleContent summaryVS = vsrcReportBuilder.getReport().getModuleSummary();

      CellReportModuleBuilder builder = new CellReportModuleBuilder(vdomainReport);
      builder.addPortFromTotalSubReport(vs.getName(), summaryVS);
    }
  }
Esempio n. 2
0
  public boolean fillScenario(String vcdFile) {

    scenario.clearActivities();

    // Read the mapping file if any --------------
    //
    try {
      if (remapFileName != null && remapFileName.trim().length() > 0) readPinMapping();
    } catch (FileNotFoundException e) {
      Logger.error("VCD", "cannot find file " + remapFileName);
    } catch (IOException e) {
      Logger.error("VCD", "file " + remapFileName + "incorrect");
    } catch (Exception e) {
      Logger.error("VCD", "FATAL ERROR when reading the rempping file" + remapFileName);
    }

    // Convert the VCD ----------------------------
    //
    try {
      reader = new VCDReader(vcdFile);
    } catch (Exception e) {
      Logger.error("VCD", "cannot open file " + vcdFile);
      return false;
    }

    Signal sig;
    String origPinName;
    String pinName;
    PortDBNode portNode;
    finalTime = -1;
    Object value;
    BoxSliceActivitySlice period = null;

    while ((sig = reader.getForceCommand()) != null) {

      if (finalTime != sig.time) {
        if (period != null) period.setActivityRatio(sig.time);

        period =
            scenario.addActivityPeriod(
                Float.toString(sig.time).replaceAll("\\.", "_"), sig.time, false, false);

        finalTime = sig.time;
      }

      if (sig == VCDReader.NO_SIGNAL) {
        if (sig.time > 0) break;
        else continue;
      }

      origPinName = sig.name.trim();

      if (pinRemapping != null && pinRemapping.containsKey(origPinName))
        pinName = pinRemapping.get(origPinName);
      else if (ignoredVCDPin != null && ignoredVCDPin.contains(origPinName)) continue; // ignore
      else pinName = origPinName;

      //			//DEBUG
      //			if (!pinName.contains("lclk_falcon_1"))
      //				continue;

      if (pinNodeCache.containsKey(pinName)) {
        portNode = pinNodeCache.get(pinName);

        // the pin was already encountered and does not exist, skip the VCD line
        if (portNode == null) continue;

      } else {
        portNode = DBNodeTools.getPortDBNode(scenario.getModel(), pinName);

        pinNodeCache.put(pinName, portNode);

        if (portNode == null) {
          Logger.error("VCD", "the pin " + origPinName + " or its remapping does not exist");
          continue;
        }
      }
      ComputerTypes computerType = portNode.getPort().getComputerType();
      value = computerType.getDefaultValue();

      switch (sig.type) {
        case REAL:
          if (!computerType.getJavaType().equalsIgnoreCase("float"))
            value = ToolsDesignTypes.formatValueToType(computerType, (float) sig.value_real);
          else value = (float) sig.value_real;
          break;

        default:
          switch (computerType) {
            case STRING:
              value = new String(new java.math.BigInteger(sig.value_bus, 2).toByteArray());
              break;

            default:
              value = ToolsDesignTypes.formatValueToType(computerType, sig.value_bus);
              break;
          }
          break;
      }

      period.getSlice().addActivity(new PinState(null, portNode, value, false), 1, true, 0);
    }

    // normalize the time of all period
    float current = 0;
    float t;
    for (BoxSliceActivity act : scenario.getActivities()) {
      t = act.getActivityRatio() / finalTime;
      act.setActivityRatio(t - current);
      current = t;
    }

    return true;
  }