openfpga/src/annotation/annotate_simulation_setting.cpp
/********************************************************************
 * Find the average signal density for all the nets of user's benchmark
 *******************************************************************/
Find the average signal density for all the nets of user's benchmark
Find the average signal density for all the nets of user ' s benchmark
static 
float average_atom_net_signal_density(const AtomContext& atom_ctx,
                                      const std::unordered_map<AtomNetId, t_net_power>& net_activity) {
  float avg_density = 0.;
  size_t net_cnt = 0;
  for (const AtomNetId& atom_net : atom_ctx.nlist.nets()) {
    if (0 == net_activity.count(atom_net)) {
      continue;
    }
    if (0. == net_activity.at(atom_net).density) {
      continue;
    }
    avg_density += net_activity.at(atom_net).density; 
    net_cnt++;
  }
  return avg_density / net_cnt; 
}
static float average_atom_net_signal_density ( const AtomContext & atom_ctx , const std :: unordered_map < AtomNetId , t_net_power > & net_activity ) { float avg_density = 0. ; size_t net_cnt = 0 ; for ( const AtomNetId & atom_net : atom_ctx . nlist . nets ( ) ) { if ( 0 == net_activity . count ( atom_net ) ) { continue ; } if ( 0. == net_activity . at ( atom_net ) . density ) { continue ; } avg_density += net_activity . at ( atom_net ) . density ; net_cnt ++ ; } return avg_density / net_cnt ; }
Find the average signal density for all the nets of user's benchmark
Find the average signal density for all the nets of user ' s benchmark
/* get the average density of all the nets */ /* Skip the nets without any activity annotation */ /* Only care non-zero density nets */