From 6b9eb92bd0b03d69a2f2e9c075a8af99d860d4d1 Mon Sep 17 00:00:00 2001 From: Myrice Date: Tue, 7 Apr 2015 14:43:05 -0700 Subject: Booksim2 abandoned svn and moved to github (https://github.com/booksim/booksim2). This .svn folder is useless now and should be deleted. For further integration, a git submodule/git subtree may be used. Since I modified their source code, we cannot use git submodule/git subtree easily. Signed-off-by: Myrice --- ...a9e6ee8d633c141585cd663a6307195b79db63.svn-base | 532 --------------------- 1 file changed, 532 deletions(-) delete mode 100644 src/intersim2/.svn/pristine/0f/0fa9e6ee8d633c141585cd663a6307195b79db63.svn-base (limited to 'src/intersim2/.svn/pristine/0f') diff --git a/src/intersim2/.svn/pristine/0f/0fa9e6ee8d633c141585cd663a6307195b79db63.svn-base b/src/intersim2/.svn/pristine/0f/0fa9e6ee8d633c141585cd663a6307195b79db63.svn-base deleted file mode 100644 index a7b540b..0000000 --- a/src/intersim2/.svn/pristine/0f/0fa9e6ee8d633c141585cd663a6307195b79db63.svn-base +++ /dev/null @@ -1,532 +0,0 @@ -// $Id$ - -/* - Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this - list of conditions and the following disclaimer in the documentation and/or - other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#include "power_module.hpp" -#include "booksim_config.hpp" -#include "buffer_monitor.hpp" -#include "switch_monitor.hpp" -#include "iq_router.hpp" - -Power_Module::Power_Module(Network * n , const Configuration &config) - : Module( 0, "power_module" ){ - - - string pfile = config.GetStr("tech_file"); - PowerConfig pconfig; - pconfig.ParseFile(pfile); - - net = n; - output_file_name = config.GetStr("power_output_file"); - classes = config.GetInt("classes"); - channel_width = (double)config.GetInt("channel_width"); - channel_sweep = (double)config.GetInt("channel_sweep"); - - numVC = (double)config.GetInt("num_vcs"); - depthVC = (double)config.GetInt("vc_buf_size"); - - //////////////////////////////////Constants///////////////////////////// - //wire length in (mm) - wire_length = pconfig.GetFloat("wire_length"); - //////////Metal Parameters//////////// - // Wire left/right coupling capacitance [ F/mm ] - Cw_cpl = pconfig.GetFloat("Cw_cpl"); - // Wire up/down groudn capacitance [ F/mm ] - Cw_gnd = pconfig.GetFloat("Cw_gnd"); - Cw = 2.0 * Cw_cpl + 2.0 * Cw_gnd ; - Rw = pconfig.GetFloat("Rw"); - // metal pitch [mm] - MetalPitch = pconfig.GetFloat("MetalPitch"); - - //////////Device Parameters//////////// - - LAMBDA = pconfig.GetFloat("LAMBDA") ; // [um/LAMBDA] - Cd = pconfig.GetFloat("Cd"); // [F/um] (for Delay) - Cg = pconfig.GetFloat("Cg"); // [F/um] (for Delay) - Cgdl = pconfig.GetFloat("Cgdl"); // [F/um] (for Delay) - - Cd_pwr = pconfig.GetFloat("Cd_pwr") ; // [F/um] (for Power) - Cg_pwr = pconfig.GetFloat("Cg_pwr") ; // [F/um] (for Power) - - IoffN = pconfig.GetFloat("IoffN"); // [A/um] - IoffP = pconfig.GetFloat("IoffP"); // [A/um] - // Leakage from bitlines, two-port cell [A] - IoffSRAM = pconfig.GetFloat("IoffSRAM"); - // [Ohm] ( D1=1um Inverter) - R = pconfig.GetFloat("R"); - // [F] ( D1=1um Inverter - for Power ) - Ci_delay = (1.0 + 2.0) * ( Cg + Cgdl ); - // [F] ( D1=1um Inverter - for Power ) - Co_delay = (1.0 + 2.0) * Cd ; - - - Ci = (1.0 + 2.0) * Cg_pwr ; - Co = (1.0 + 2.0) * Cd_pwr ; - - Vdd = pconfig.GetFloat("Vdd"); - FO4 = R * ( 3.0 * Cd + 12 * Cg + 12 * Cgdl); - tCLK = 20 * FO4; - fCLK = 1.0 / tCLK; - - H_INVD2=(double)pconfig.GetInt("H_INVD2"); - W_INVD2=(double)pconfig.GetInt("W_INVD2") ; - H_DFQD1=(double)pconfig.GetInt("H_DFQD1"); - W_DFQD1= (double)pconfig.GetInt("W_DFQD1"); - H_ND2D1= (double)pconfig.GetInt("H_ND2D1"); - W_ND2D1=(double)pconfig.GetInt("W_ND2D1"); - H_SRAM=(double)pconfig.GetInt("H_SRAM"); - W_SRAM=(double)pconfig.GetInt("W_SRAM"); - - ChannelPitch = 2.0 * MetalPitch ; - CrossbarPitch = 2.0 * MetalPitch ; -} - -Power_Module::~Power_Module(){ - - -} - - -////////////////////////////////////////////// -//Channels -////////////////////////////////////////////// - -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 temp = f->GetActivity(); - vector 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; -} - -wire const & Power_Module::wireOptimize(double L){ - map::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 = "<NumInputs(), sm->NumOutputs()); - outputArea += areaOutputModule(sm->NumOutputs()); - switchPowerLeak += powerCrossbarLeak(channel_width, sm->NumInputs(), sm->NumOutputs()); - - const vector activity = sm->GetActivity(); - vector type_activity(classes); - - for(int i = 0; iNumOutputs(); i++){ - for(int k = 0; kNumInputs(); j++){ - for(int k = 0; kNumOutputs()*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 inject = net->GetInject(); - vector eject = net->GetEject(); - vector chan = net->GetChannels(); - - for(int i = 0; iNumNodes(); i++){ - calcChannel(inject[i]); - } - - for(int i = 0; iNumNodes(); i++){ - calcChannel(eject[i]); - } - - for(int i = 0; iNumChannels();i++){ - calcChannel(chan[i]); - } - - vector routers = net->GetRouters(); - for(size_t i = 0; i < routers.size(); i++){ - IQRouter* temp = dynamic_cast(routers[i]); - const BufferMonitor * bm = temp->GetBufferMonitor(); - calcBuffer(bm); - const SwitchMonitor * sm = temp->GetSwitchMonitor(); - calcSwitch(sm); - } - - double totalpower = channelWirePower+channelClkPower+channelDFFPower+channelLeakPower+ inputReadPower+inputWritePower+inputLeakagePower+ switchPower+switchPowerCtrl+switchPowerLeak+outputPower+outputPowerClk+outputCtrlPower; - double totalarea = channelArea+switchArea+inputArea+outputArea; - cout<< "-----------------------------------------\n" ; - cout<< "- OCN Power Summary\n" ; - cout<< "- Completion Time: "<