Beispiel #1
0
  /** consume the data and return the number of items produced * */
  protected int fireMe(
      FlatNode fire, SimulationCounter counters, HashMap<FlatNode, Integer> executionCounts) {
    if (fire.contents instanceof SIRFilter) {
      // decrement the schedule execution counter
      decrementExecutionCounts(fire, executionCounts, counters);

      // consume the date from the buffer
      counters.decrementBufferCount(fire, consumedItems(fire, counters, executionCounts));

      // for a steady state execution return the normal push
      int ret = ((SIRFilter) fire.contents).getPushInt();

      // if the filter is a two stage, and it has not fired
      // return the initPush() unless the initWork does nothing
      if (initSimulation && !counters.hasFired(fire) && fire.contents instanceof SIRTwoStageFilter)
        ret = ((SIRTwoStageFilter) fire.contents).getInitPushInt();
      else if (!initSimulation && KjcOptions.ratematch) {
        // we are ratematching so produce all the data on the one firing.
        ret *= ssg.getMult(fire, false);
      }
      // now this node has fired
      counters.setFired(fire);
      return ret;
    } else if (fire.contents instanceof SIRJoiner) {
      return fireJoiner(fire, counters, executionCounts);
    }

    Utils.fail("Trying to fire a non-filter or joiner");
    return -1;
  }