Beispiel #1
0
void Power_Module::calcSwitch(const SwitchMonitor* sm){

  switchArea += areaCrossbar(sm->NumInputs(), sm->NumOutputs());
  outputArea += areaOutputModule(sm->NumOutputs());
  switchPowerLeak += powerCrossbarLeak(channel_width, sm->NumInputs(), sm->NumOutputs());

  const vector<int> activity = sm->GetActivity();
  vector<double> type_activity(classes);

  for(int i = 0; i<sm->NumOutputs(); i++){
    for(int k = 0; k<classes; k++){
      type_activity[k] = 0;
    }
    for(int j = 0; j<sm->NumInputs(); j++){
      for(int k  = 0; k<classes; k++){
	double a = activity[k+classes*(i+sm->NumOutputs()*j)];
	a = a/totalTime;
	if(a>1){
	  cout<<"Switcht activity factor is greater than 1!!!\n";exit(-1);
	}
	double Px = powerCrossbar(channel_width, sm->NumInputs(),sm->NumOutputs(),j,i);
	switchPower += a*channel_width*Px;
	switchPowerCtrl += a *powerCrossbarCtrl(channel_width,  sm->NumInputs(),sm->NumOutputs());
	type_activity[k]+=a;
      }
    }
    outputPowerClk += powerWireClk( 1, channel_width ) ;
    for(int k = 0; k<classes; k++){
      outputPower += type_activity[k] * powerWireDFF( 1, channel_width, 1.0 ) ;
      outputCtrlPower += type_activity[k] * powerOutputCtrl(channel_width ) ;
    }
  }

}
Beispiel #2
0
void Power_Module::calcChannel(const FlitChannel* f){
  double channelLength = f->GetLatency()* wire_length;
  wire const this_wire = wireOptimize(channelLength);
  double const & K = this_wire.K;
  double const & N = this_wire.N;
  double const & M = this_wire.M;
  //area
  channelArea += areaChannel(K,N,M);

  //activity factor;
  const vector<int> temp = f->GetActivity();
  vector<double> a(classes);
  for(int i = 0; i< classes; i++){

    a[i] = ((double)temp[i])/totalTime;
  }

  //power calculation
  double const bitPower = powerRepeatedWire(channelLength, K,M,N);

  channelClkPower += powerWireClk(M,channel_width);
  for(int i = 0; i< classes; i++){
    channelWirePower += bitPower * a[i]*channel_width;
    channelDFFPower += powerWireDFF(M, channel_width, a[i]);
  }
  channelLeakPower+= powerRepeatedWireLeak(K,M,N)*channel_width;
}
Beispiel #3
0
void Power_Module::calcSwitch(SwitchMonitor* sm){

  switchArea += areaCrossbar(sm->NumInputs(), sm->NumOutputs());
  outputArea += areaOutputModule(sm->NumOutputs());
  switchPowerLeak += powerCrossbarLeak(channel_width, sm->NumInputs(), sm->NumOutputs());

  int * activity = sm->GetActivity();
  double * type_activity = (double*)malloc(sizeof(double)*Flit::NUM_FLIT_TYPES);

  for(int i = 0; i<sm->NumOutputs(); i++){
    for(int k = 0; k<Flit::NUM_FLIT_TYPES; k++){
      type_activity[k] = 0;
    }
    for(int j = 0; j<sm->NumInputs(); j++){
      for(int k  = 0; k<Flit::NUM_FLIT_TYPES; k++){
	double a = activity[k+Flit::NUM_FLIT_TYPES*(i+sm->NumOutputs()*j)];
	a = a/totalTime;
	if(a>1){
	  cout<<"Switcht activity factor is greater than 1!!!\n";exit(-1);
	}
	double Px = powerCrossbar(channel_width, sm->NumInputs(),sm->NumOutputs(),j,i);
	switchPower += a*channel_width*Px;
	switchPowerCtrl += a *powerCrossbarCtrl(channel_width,  sm->NumInputs(),sm->NumOutputs());
	type_activity[k]+=a;
      }
    }
    outputPowerClk += powerWireClk( 1, channel_width ) ;
    for(int k = 0; k<Flit::NUM_FLIT_TYPES; k++){
      outputPower += type_activity[k] * powerWireDFF( 1, channel_width, 1.0 ) ;
      outputCtrlPower += type_activity[k] * powerOutputCtrl(channel_width ) ;
    }
  }

}
Beispiel #4
0
void Power_Module::calcChannel(FlitChannel* f){
  double channelLength = f->GetLatency()* wire_length;
  wire * this_wire = wireOptimize(channelLength);
  double K = this_wire->K;
  double N = this_wire->N;
  double M = this_wire->M;
  //area
  channelArea += areaChannel(K,N,M);

  //activity factor;
  int* temp = f->GetActivity();
  double* a = (double*)malloc(sizeof(double)* Flit::NUM_FLIT_TYPES);
  for(int i = 0; i< Flit::NUM_FLIT_TYPES; i++){

    a[i] = ((double)temp[i])/totalTime;
  }

  //power calculation
  double bitPower = powerRepeatedWire(channelLength, K,M,N);

  channelClkPower += powerWireClk(M,channel_width);
  for(int i = 0; i< Flit::NUM_FLIT_TYPES; i++){
    channelWirePower += bitPower * a[i]*channel_width;
    channelDFFPower += powerWireDFF(M, channel_width, a[i]);
  }
  channelLeakPower+= powerRepeatedWireLeak(K,M,N)*channel_width;
}
wire const & Power_Module::wireOptimize(double L)
{
    map<double, wire>::iterator iter = wire_map.find(L);
    if(iter == wire_map.end())
    {

        double W = 64;
        double bestMetric =  100000000 ;
        double bestK = -1;
        double bestM = -1;
        double bestN = -1;
        for (double K = 1.0 ; K < 10 ; K+=0.1 )
        {
            for (double N = 1.0 ; N < 40 ; N += 1.0 )
            {
                for (double M = 1.0 ; M < 40.0 ; M +=1.0 )
                {
                    double l = 1.0 * L/( N * M) ;

                    double k0 = R * (Co_delay + Ci_delay) ;
                    double k1 = R/K * Cw + K * Rw * Ci_delay ;
                    double k2 = 0.5 * Rw * Cw ;
                    double Tw = k0 + (k1 * l) + k2 * (l * l) ;
                    double alpha = 0.2 ;
                    double power = alpha * W * powerRepeatedWire( L, K, M, N) + powerWireDFF( M, W, alpha ) ;
                    double metric = M * M * M * M * power ;
                    if ( (N*Tw) < (0.8 * tCLK) )
                    {
                        if ( metric < bestMetric )
                        {
                            bestMetric = metric ;
                            bestK = K ;
                            bestM = M ;
                            bestN = N ;
                        }
                    }
                }
            }
        }
        cout<<"L = "<<L<<" K = "<<bestK<<" M = "<<bestM<<" N = "<<bestN<<endl;

        wire const temp = {L, bestK, bestM, bestN};
        iter = wire_map.insert(make_pair(L, temp)).first;
    }
    return iter->second;
}
Beispiel #6
0
wire* Power_Module::wireOptimize(double L){
  double W,K,M,N,bestMetric;
  if(wire_map.find(L)!=wire_map.end()){
    return wire_map.find(L)->second;
  } 
  
  W = 64;
  bestMetric =  100000000 ;
  double bestK = -1;
  double bestM = -1;
  double bestN = -1;
  for ( K = 1.0 ; K < 10 ; K+=0.1 ) {
    for (N = 1.0 ; N < 40 ; N += 1.0 ) {
      for (M = 1.0 ; M < 40.0 ; M +=1.0 ) {
	double l = 1.0 * L/( N * M) ;
	
	double k0 = R * (Co_delay + Ci_delay) ;
	double k1 = R/K * Cw + K * Rw * Ci_delay ;
	double k2 = 0.5 * Rw * Cw ;
	double Tw = k0 + (k1 * l) + k2 * (l * l) ;
	double alpha = 0.2 ;
	double power = alpha * W * powerRepeatedWire( L, K, M, N) + powerWireDFF( M, W, alpha ) ;
	double metric = M * M * M * M * power ;
	if ( (N*Tw) < (0.8 * tCLK) ) {
	  if ( metric < bestMetric ) {
	    bestMetric = metric ;
	    bestK = K ;
	    bestM = M ;
	    bestN = N ;
	  }
	}
      }
    }
  }
  cout<<"L = "<<L<<" K = "<<bestK<<" M = "<<bestM<<" N = "<<bestN<<endl;
  
  wire * temp = new wire;
  temp->L = L;
  temp->K = bestK;
  temp->M = bestM;
  temp->N = bestN;
  wire_map[L] = temp;
  return temp;

}