Beispiel #1
0
int SIM_fpfp_init(SIM_power_ff_t *ff, int model, double load)
{
  double c1, c2, c3, c4, c5, c6;
  
  if ((ff->model = model) && model < FF_MAX_MODEL) {
    switch (model) {
      case NEG_DFF:
	   SIM_fpfp_clear_stat(ff);

           /* node 5 and node 6 are identical to node 1 in capacitance */
	   c1 = c5 = c6 = SIM_fpfp_node_cap(2, 1);
	   c2 = SIM_fpfp_node_cap(2, 3);
	   c3 = SIM_fpfp_node_cap(3, 2);
	   c4 = SIM_fpfp_node_cap(2, 3);

	   ff->e_switch = (c4 + c1 + c2 + c3 + c5 + c6 + load) / 2 * EnergyFactor;
	   /* no 1/2 for e_keep and e_clock because clock signal switches twice in one cycle */
	   ff->e_keep_1 = c3 * EnergyFactor; 
	   ff->e_keep_0 = c2 * EnergyFactor; 
	   ff->e_clock = SIM_fpfp_clock_cap() * EnergyFactor;
	   break;

      default:;	/* some error handler */
    }

    return 0;
  }
  else
    return -1;
}
Beispiel #2
0
static int SIM_arbiter_clear_stat(SIM_power_arbiter_t *arb)
{
  arb->n_chg_req = arb->n_chg_grant = arb->n_chg_mint = 0;
  arb->n_chg_carry = arb->n_chg_carry_in = 0;

  SIM_array_clear_stat(&arb->queue);
  SIM_fpfp_clear_stat(&arb->pri_ff);

  return 0;
}