From 7f49fe9feb174d34efc2a011bad79b38522a360b Mon Sep 17 00:00:00 2001 From: Dongdong Li Date: Thu, 8 Aug 2013 00:15:58 -0800 Subject: Intesim2 Integration Details: See Review 80001 https://gpgpu-sim-code-review.appspot.com/80001/ [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 16747] --- src/intersim2/power/buffer_monitor.cpp | 71 +++++ src/intersim2/power/buffer_monitor.hpp | 68 +++++ src/intersim2/power/power_module.cpp | 532 +++++++++++++++++++++++++++++++++ src/intersim2/power/power_module.hpp | 186 ++++++++++++ src/intersim2/power/switch_monitor.cpp | 67 +++++ src/intersim2/power/switch_monitor.hpp | 66 ++++ src/intersim2/power/techfile.txt | 26 ++ 7 files changed, 1016 insertions(+) create mode 100644 src/intersim2/power/buffer_monitor.cpp create mode 100644 src/intersim2/power/buffer_monitor.hpp create mode 100644 src/intersim2/power/power_module.cpp create mode 100644 src/intersim2/power/power_module.hpp create mode 100644 src/intersim2/power/switch_monitor.cpp create mode 100644 src/intersim2/power/switch_monitor.hpp create mode 100755 src/intersim2/power/techfile.txt (limited to 'src/intersim2/power') diff --git a/src/intersim2/power/buffer_monitor.cpp b/src/intersim2/power/buffer_monitor.cpp new file mode 100644 index 0000000..aaf71f0 --- /dev/null +++ b/src/intersim2/power/buffer_monitor.cpp @@ -0,0 +1,71 @@ +// $Id: buffer_monitor.cpp 5188 2012-08-30 00:31:31Z dub $ + +/* + 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 "buffer_monitor.hpp" + +#include "flit.hpp" + +BufferMonitor::BufferMonitor( int inputs, int classes ) +: _cycles(0), _inputs(inputs), _classes(classes) { + _reads.resize(inputs * classes, 0) ; + _writes.resize(inputs * classes, 0) ; +} + +int BufferMonitor::index( int input, int cl ) const { + assert((input >= 0) && (input < _inputs)); + assert((cl >= 0) && (cl < _classes)); + return cl + _classes * input ; +} + +void BufferMonitor::cycle() { + _cycles++ ; +} + +void BufferMonitor::write( int input, Flit const * f ) { + _writes[ index(input, f->cl) ]++ ; +} + +void BufferMonitor::read( int input, Flit const * f ) { + _reads[ index(input, f->cl) ]++ ; +} + +void BufferMonitor::display(ostream & os) const { + for ( int i = 0 ; i < _inputs ; i++ ) { + os << "[ " << i << " ] " ; + for ( int c = 0 ; c < _classes ; c++ ) { + os << "Type=" << c + << ":(R#" << _reads[ index( i, c) ] << "," + << "W#" << _writes[ index( i, c) ] << ")" << " " ; + } + os << endl ; + } +} + +ostream & operator<<( ostream & os, BufferMonitor const & obj ) { + obj.display(os); + return os ; +} diff --git a/src/intersim2/power/buffer_monitor.hpp b/src/intersim2/power/buffer_monitor.hpp new file mode 100644 index 0000000..41b719f --- /dev/null +++ b/src/intersim2/power/buffer_monitor.hpp @@ -0,0 +1,68 @@ +// $Id: buffer_monitor.hpp 5188 2012-08-30 00:31:31Z dub $ + +/* + 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. +*/ + +#ifndef _BUFFER_MONITOR_HPP_ +#define _BUFFER_MONITOR_HPP_ + +#include +#include + +using namespace std; + +class Flit; + +class BufferMonitor { + int _cycles ; + int _inputs ; + int _classes ; + vector _reads ; + vector _writes ; + int index( int input, int cl ) const ; +public: + BufferMonitor( int inputs, int classes ) ; + void cycle() ; + void write( int input, Flit const * f ) ; + void read( int input, Flit const * f ) ; + inline const vector & GetReads() const { + return _reads; + } + inline const vector & GetWrites() const { + return _writes; + } + inline int NumInputs() const { + return _inputs; + } + inline int NumClasses() const { + return _classes; + } + void display(ostream & os) const; + +} ; + +ostream & operator<<( ostream & os, BufferMonitor const & obj ) ; + +#endif diff --git a/src/intersim2/power/power_module.cpp b/src/intersim2/power/power_module.cpp new file mode 100644 index 0000000..e319f4b --- /dev/null +++ b/src/intersim2/power/power_module.cpp @@ -0,0 +1,532 @@ +// $Id: power_module.cpp 5188 2012-08-30 00:31:31Z dub $ + +/* + 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: "< + +#include "module.hpp" +#include "network.hpp" +#include "config_utils.hpp" +#include "flitchannel.hpp" +#include "switch_monitor.hpp" +#include "buffer_monitor.hpp" + +struct wire{ + double L; + double K; + double M; + double N; +}; + +class Power_Module : public Module { + +protected: + //network undersimulation + Network * net; + int classes; + //all channels are this width + double channel_width; + //resimulate all with channel_width decremented by channel_sweep until 0 + double channel_sweep; + //write result to a tabbed format to file + string output_file_name; + + //buffer depth + double depthVC; + //vcs + double numVC; + + //store the property of wires based on length + map wire_map; + + //////////////////////////////////Constants///////////////////////////// + //wire length in (mm) + double wire_length; + //////////Metal Parameters//////////// + // Wire left/right coupling capacitance [ F/mm ] + double Cw_cpl ; + // Wire up/down groudn capacitance [ F/mm ] + double Cw_gnd ; + double Cw ; + double Rw ; + // metal pitch [mm] + double MetalPitch ; + + + //////////Device Parameters//////////// + + double LAMBDA ; // [um/LAMBDA] + double Cd ; // [F/um] (for Delay) + double Cg ; // [F/um] (for Delay) + double Cgdl ; // [F/um] (for Delay) + + double Cd_pwr; // [F/um] (for Power) + double Cg_pwr ; // [F/um] (for Power) + + double IoffN ; // [A/um] + double IoffP ; // [A/um] + // Leakage from bitlines, two-port cell [A] + double IoffSRAM; + // [Ohm] ( D1=1um Inverter) + double R ; + // [F] ( D1=1um Inverter - for Power ) + double Ci_delay; + // [F] ( D1=1um Inverter - for Power ) + double Co_delay ; + + double Ci ; + double Co ; + double Vdd ; + double FO4 ; + double tCLK ; + double fCLK ; + + double H_INVD2; + double W_INVD2; + double H_DFQD1; + double W_DFQD1; + double H_ND2D1; + double W_ND2D1; + double H_SRAM; + double W_SRAM; + double ChannelPitch ; + double CrossbarPitch; + ////////////////////////////////End of Constants///////////////////////////// + + /////////////results/////////////////// + double totalTime; + double channelWirePower; + double channelClkPower; + double channelDFFPower; + double channelLeakPower; + double inputReadPower; + double inputWritePower; + double inputLeakagePower; + double switchPower; + double switchPowerCtrl; + double switchPowerLeak; + double outputPower; + double outputPowerClk; + double outputCtrlPower; + double channelArea; + double switchArea; + double inputArea; + double outputArea; + double maxInputPort; + double maxOutputPort; + + + //////////////////////// + + //channels + void calcChannel(const FlitChannel * f); + wire const & wireOptimize(double l); + double powerRepeatedWire(double L, double K, double M, double N); + double powerRepeatedWireLeak (double K, double M, double N); + double powerWireClk (double M, double W); + double powerWireDFF(double M, double W, double alpha); + + //memory + void calcBuffer(const BufferMonitor *bm); + double powerWordLine(double memoryWidth, double memoryDepth); + double powerMemoryBitRead(double memoryDepth); + double powerMemoryBitWrite(double memoryDepth); + double powerMemoryBitLeak(double memoryDepth ); + + //switch + void calcSwitch(const SwitchMonitor *sm); + double powerCrossbar(double width, double inputs, double outputs, double from, double to); + double powerCrossbarCtrl(double width, double inputs, double outputs); + double powerCrossbarLeak (double width, double inputs, double outputs); + + //output + double powerOutputCtrl(double width); + + //area + + double areaChannel (double K, double N, double M); + double areaCrossbar(double Inputs, double Outputs) ; + double areaInputModule(double Words) ; + double areaOutputModule(double Outputs); + +public: + Power_Module(Network * net, const Configuration &config); + ~Power_Module(); + + void run(); + + +}; +#endif diff --git a/src/intersim2/power/switch_monitor.cpp b/src/intersim2/power/switch_monitor.cpp new file mode 100644 index 0000000..f998cb1 --- /dev/null +++ b/src/intersim2/power/switch_monitor.cpp @@ -0,0 +1,67 @@ +// $Id: switch_monitor.cpp 5188 2012-08-30 00:31:31Z dub $ + +/* + 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 "switch_monitor.hpp" + +#include "flit.hpp" + +SwitchMonitor::SwitchMonitor( int inputs, int outputs, int classes ) +: _cycles(0), _inputs(inputs), _outputs(outputs), _classes(classes) { + _event.resize(inputs * outputs * classes, 0) ; +} + +int SwitchMonitor::index( int input, int output, int cl ) const { + assert((input >= 0) && (input < _inputs)); + assert((output >= 0) && (output < _outputs)); + assert((cl >= 0) && (cl < _classes)); + return cl + _classes * ( output + _outputs * input ) ; +} + +void SwitchMonitor::cycle() { + _cycles++ ; +} + +void SwitchMonitor::traversal( int input, int output, Flit const * f ) { + _event[ index( input, output, f->cl) ]++ ; +} + +void SwitchMonitor::display(ostream & os) const { + for ( int i = 0 ; i < _inputs ; i++ ) { + for ( int o = 0 ; o < _outputs ; o++) { + os << "[" << i << " -> " << o << "] " ; + for ( int c = 0 ; c < _classes ; c++ ) { + os << c << ":" << _event[index(i,o,c)] << " " ; + } + os << endl ; + } + } +} + +ostream & operator<<( ostream & os, SwitchMonitor const & obj ) { + obj.display(os); + return os ; +} diff --git a/src/intersim2/power/switch_monitor.hpp b/src/intersim2/power/switch_monitor.hpp new file mode 100644 index 0000000..dcc1276 --- /dev/null +++ b/src/intersim2/power/switch_monitor.hpp @@ -0,0 +1,66 @@ +// $Id: switch_monitor.hpp 5188 2012-08-30 00:31:31Z dub $ + +/* + 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. +*/ + +#ifndef _SWITCH_MONITOR_HPP_ +#define _SWITCH_MONITOR_HPP_ + +#include +#include + +using namespace std; + +class Flit; + +class SwitchMonitor { + int _cycles ; + int _inputs ; + int _outputs ; + int _classes ; + vector _event ; + int index( int input, int output, int cl ) const ; +public: + SwitchMonitor( int inputs, int outputs, int classes ) ; + void cycle() ; + vector const & GetActivity() const { + return _event; + } + inline int const & NumInputs() const { + return _inputs; + } + inline int const & NumOutputs() const { + return _outputs; + } + inline int const & NumClasses() const { + return _classes; + } + void traversal( int input, int output, Flit const * f ) ; + void display(ostream & os) const; +} ; + +ostream & operator<<( ostream & os, SwitchMonitor const & obj ) ; + +#endif diff --git a/src/intersim2/power/techfile.txt b/src/intersim2/power/techfile.txt new file mode 100755 index 0000000..c953713 --- /dev/null +++ b/src/intersim2/power/techfile.txt @@ -0,0 +1,26 @@ +// 2007 ITRS predictions for a 32nm high-performance library +H_INVD2 = 8;//int +W_INVD2 = 3;//int +H_DFQD1 = 8;//int +W_DFQD1 = 16;//int +H_ND2D1 = 8;//int +W_ND2D1 = 3;//int +H_SRAM = 8;//int +W_SRAM = 6;//int +Vdd = 0.9;//float +R = 606.321;//float +IoffSRAM = 0.00000032;//float +// 70 C +IoffP = 0.00000102;//float +IoffN = 0.00000102;//float +Cg_pwr = 0.000000000000000534;//float +Cd_pwr = 0.000000000000000267;//float +Cgdl = 0.0000000000000001068;//float +Cg = 0.000000000000000534;//float +Cd = 0.000000000000000267;//float +LAMBDA = 0.016;//float +MetalPitch = 0.000080;//float +Rw = 0.720044;//float +Cw_gnd = 0.000000000000267339;//float +Cw_cpl = 0.000000000000267339;//float +wire_length = 2.0;//float \ No newline at end of file -- cgit v1.3