garnet: added orion2.0 for network power calculation

This commit is contained in:
Tushar Krishna 2011-02-06 22:14:17 -08:00
parent 59163f824c
commit a679e732ce
82 changed files with 9841 additions and 6308 deletions

View file

@ -40,9 +40,14 @@ InputUnit_d::InputUnit_d(int id, Router_d *router)
m_id = id;
m_router = router;
m_num_vcs = m_router->get_num_vcs();
m_vc_per_vnet = m_router->get_vc_per_vnet();
m_num_buffer_reads = 0;
m_num_buffer_writes = 0;
m_num_buffer_reads.resize(m_num_vcs/m_vc_per_vnet);
m_num_buffer_writes.resize(m_num_vcs/m_vc_per_vnet);
for (int i = 0; i < m_num_buffer_reads.size(); i++) {
m_num_buffer_reads[i] = 0;
m_num_buffer_writes[i] = 0;
}
creditQueue = new flitBuffer_d();
// Instantiating the virtual channels
@ -82,11 +87,11 @@ InputUnit_d::wakeup()
// write flit into input buffer
m_vcs[vc]->insertFlit(t_flit);
int vnet = vc/m_vc_per_vnet;
// number of writes same as reads
// any flit that is written will be read only once
m_num_buffer_writes++;
m_num_buffer_reads++;
m_num_buffer_writes[vnet]++;
m_num_buffer_reads[vnet]++;
}
}

View file

@ -162,21 +162,23 @@ class InputUnit_d : public Consumer
}
inline double
get_buf_read_count()
get_buf_read_count(int vnet)
{
return m_num_buffer_reads;
return m_num_buffer_reads[vnet];
}
inline double
get_buf_write_count()
get_buf_write_count(int vnet)
{
return m_num_buffer_writes;
return m_num_buffer_writes[vnet];
}
private:
int m_id;
int m_num_vcs;
double m_num_buffer_writes, m_num_buffer_reads;
int m_vc_per_vnet;
std::vector<double> m_num_buffer_writes;
std::vector<double> m_num_buffer_reads;
Router_d *m_router;
NetworkLink_d *m_in_link;

View file

@ -37,7 +37,7 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/common/Consumer.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh"
#include "mem/ruby/network/orion/power_bus.hh"
#include "mem/ruby/network/orion/NetworkPower.hh"
class GarnetNetwork_d;
@ -56,7 +56,6 @@ class NetworkLink_d : public Consumer
int get_id(){return m_id;}
void wakeup();
double calculate_offline_power(power_bus*);
double calculate_power();
inline bool isReady() { return linkBuffer->isReady(); }

View file

@ -60,13 +60,19 @@ Router_d::Router_d(int id, GarnetNetwork_d *network_ptr)
m_input_unit.clear();
m_output_unit.clear();
buf_read_count = 0;
buf_write_count = 0;
crossbar_count = 0;
vc_local_arbit_count = 0;
vc_global_arbit_count = 0;
sw_local_arbit_count = 0;
sw_global_arbit_count = 0;
buf_read_count.resize(m_virtual_networks);
buf_write_count.resize(m_virtual_networks);
vc_local_arbit_count.resize(m_virtual_networks);
vc_global_arbit_count.resize(m_virtual_networks);
for (int i = 0; i < m_virtual_networks; i++) {
buf_read_count[i] = 0;
buf_write_count[i] = 0;
vc_local_arbit_count[i] = 0;
vc_global_arbit_count[i] = 0;
}
}
Router_d::~Router_d()
@ -154,15 +160,19 @@ Router_d::update_sw_winner(int inport, flit_d *t_flit)
void
Router_d::calculate_performance_numbers()
{
for (int i = 0; i < m_input_unit.size(); i++) {
buf_read_count += m_input_unit[i]->get_buf_read_count();
buf_write_count += m_input_unit[i]->get_buf_write_count();
for (int j = 0; j < m_virtual_networks; j++) {
for (int i = 0; i < m_input_unit.size(); i++) {
buf_read_count[j] += m_input_unit[i]->get_buf_read_count(j);
buf_write_count[j] += m_input_unit[i]->get_buf_write_count(j);
}
vc_local_arbit_count[j] = m_vc_alloc->get_local_arbit_count(j);
vc_global_arbit_count[j] = m_vc_alloc->get_global_arbit_count(j);
}
crossbar_count = m_switch->get_crossbar_count();
vc_local_arbit_count = m_vc_alloc->get_local_arbit_count();
vc_global_arbit_count = m_vc_alloc->get_global_arbit_count();
sw_local_arbit_count = m_sw_alloc->get_local_arbit_count();
sw_global_arbit_count = m_sw_alloc->get_global_arbit_count();
crossbar_count = m_switch->get_crossbar_count();
}
void

View file

@ -37,7 +37,7 @@
#include "mem/ruby/network/garnet/NetworkHeader.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/flit_d.hh"
#include "mem/ruby/common/NetDest.hh"
#include "mem/ruby/network/orion/power_router_init.hh"
#include "mem/ruby/network/orion/NetworkPower.hh"
class GarnetNetwork_d;
class NetworkLink_d;
@ -78,10 +78,7 @@ class Router_d
void swarb_req();
void printConfig(std::ostream& out);
void power_router_initialize(power_router *router,
power_router_info *info);
double calculate_power();
double calculate_offline_power(power_router*, power_router_info*);
void calculate_performance_numbers();
private:
@ -90,10 +87,12 @@ class Router_d
GarnetNetwork_d *m_network_ptr;
int m_flit_width;
double buf_read_count, buf_write_count;
double crossbar_count;
double vc_local_arbit_count, vc_global_arbit_count;
std::vector<double> buf_read_count;
std::vector<double> buf_write_count;
std::vector<double> vc_local_arbit_count;
std::vector<double> vc_global_arbit_count;
double sw_local_arbit_count, sw_global_arbit_count;
double crossbar_count;
std::vector<InputUnit_d *> m_input_unit;
std::vector<OutputUnit_d *> m_output_unit;

View file

@ -39,8 +39,13 @@ VCallocator_d::VCallocator_d(Router_d *router)
m_router = router;
m_num_vcs = m_router->get_num_vcs();
m_vc_per_vnet = m_router->get_vc_per_vnet();
m_local_arbiter_activity = 0;
m_global_arbiter_activity = 0;
m_local_arbiter_activity.resize(m_num_vcs/m_vc_per_vnet);
m_global_arbiter_activity.resize(m_num_vcs/m_vc_per_vnet);
for (int i = 0; i < m_local_arbiter_activity.size(); i++) {
m_local_arbiter_activity[i] = 0;
m_global_arbiter_activity[i] = 0;
}
}
void
@ -158,7 +163,7 @@ VCallocator_d::select_outvc(int inport_iter, int invc_iter)
outvc_offset = 0;
int outvc = outvc_base + outvc_offset;
if (m_output_unit[outport]->is_vc_idle(outvc)) {
m_local_arbiter_activity++;
m_local_arbiter_activity[vnet]++;
m_outvc_req[outport][outvc][inport_iter][invc_iter] = true;
if (!m_outvc_is_req[outport][outvc])
m_outvc_is_req[outport][outvc] = true;
@ -220,7 +225,7 @@ VCallocator_d::arbitrate_outvcs()
}
int invc = invc_base + invc_offset;
if (m_outvc_req[outport_iter][outvc_iter][inport][invc]) {
m_global_arbiter_activity++;
m_global_arbiter_activity[vnet]++;
m_input_unit[inport]->grant_vc(invc, outvc_iter);
m_output_unit[outport_iter]->update_vc(
outvc_iter, inport, invc);

View file

@ -58,15 +58,15 @@ class VCallocator_d : public Consumer
void select_outvc(int inport_iter, int invc_iter);
inline double
get_local_arbit_count()
get_local_arbit_count(int vnet)
{
return m_local_arbiter_activity;
return m_local_arbiter_activity[vnet];
}
inline double
get_global_arbit_count()
get_global_arbit_count(int vnet)
{
return m_global_arbiter_activity;
return m_global_arbiter_activity[vnet];
}
private:
@ -74,7 +74,8 @@ class VCallocator_d : public Consumer
int m_num_inports;
int m_num_outports;
double m_local_arbiter_activity, m_global_arbiter_activity;
std::vector<double > m_local_arbiter_activity;
std::vector<double > m_global_arbiter_activity;
Router_d *m_router;

View file

@ -0,0 +1,93 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/Allocator/Arbiter.hh"
#include "mem/ruby/network/orion/Allocator/MatrixArbiter.hh"
#include "mem/ruby/network/orion/Allocator/RRArbiter.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
Arbiter::Arbiter(const ArbiterModel arb_model_,
const uint32_t req_width_,
const double len_in_wire_,
const TechParameter* tech_param_ptr_)
{
assert(req_width_ == req_width_);
assert(len_in_wire_ == len_in_wire_);
m_arb_model = arb_model_;
m_req_width = req_width_;
m_len_in_wire = len_in_wire_;
m_tech_param_ptr = tech_param_ptr_;
}
Arbiter::~Arbiter()
{}
double
Arbiter::get_static_power() const
{
double vdd = m_tech_param_ptr->get_vdd();
double SCALE_S = m_tech_param_ptr->get_SCALE_S();
return m_i_static*vdd*SCALE_S;
}
Arbiter*
Arbiter::create_arbiter(const string& arb_model_str_,
const string& ff_model_str_,
uint32_t req_width_,
double len_in_wire_,
const TechParameter* tech_param_ptr_)
{
if (arb_model_str_ == string("RR_ARBITER")) {
return new RRArbiter(ff_model_str_, req_width_,
len_in_wire_, tech_param_ptr_);
} else if (arb_model_str_ == string("MATRIX_ARBITER")) {
return new MatrixArbiter(ff_model_str_, req_width_,
len_in_wire_, tech_param_ptr_);
} else {
cerr << "WARNING: No Arbiter model" << endl;
return (Arbiter*)NULL;
}
}

View file

@ -0,0 +1,87 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __ARBITER_H__
#define __ARBITER_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class FlipFlop;
class Arbiter
{
public:
enum ArbiterModel
{
NO_MODEL = 0,
RR_ARBITER,
MATRIX_ARBITER
};
public:
Arbiter(const ArbiterModel arb_model_,
const uint32_t req_width_,
const double len_in_wire_,
const TechParameter* tech_param_ptr_);
virtual ~Arbiter() = 0;
public:
virtual double calc_dynamic_energy(double num_req_, bool is_max_) const = 0;
double get_static_power() const;
protected:
ArbiterModel m_arb_model;
uint32_t m_req_width;
double m_len_in_wire;
const TechParameter* m_tech_param_ptr;
FlipFlop* m_ff_ptr;
double m_e_chg_req;
double m_e_chg_grant;
double m_i_static;
public:
static Arbiter* create_arbiter(const string& arb_model_str_,
const string& ff_model_str_,
uint32_t req_width_,
double len_in_wire_,
const TechParameter* tech_param_ptr_);
};
#endif

View file

@ -0,0 +1,251 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <cassert>
#include <cmath>
#include <iostream>
#include "mem/ruby/network/orion/Allocator/MatrixArbiter.hh"
#include "mem/ruby/network/orion/FlipFlop.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
MatrixArbiter::MatrixArbiter(const string& ff_model_str_,
uint32_t req_width_,
double len_in_wire_,
const TechParameter* tech_param_ptr_)
: Arbiter(RR_ARBITER, req_width_, len_in_wire_, tech_param_ptr_)
{
init(ff_model_str_);
}
MatrixArbiter::~MatrixArbiter()
{
delete m_ff_ptr;
}
double
MatrixArbiter::calc_dynamic_energy(double num_req_, bool is_max_) const
{
assert(num_req_ < m_req_width);
double num_grant;
if (num_req_ >= 1) num_grant = 1;
else if (num_req_) num_grant = 1.0 / ceil(1.0 / num_req_);
else num_grant = 0;
uint32_t total_pri = m_req_width * (m_req_width - 1) / 2;
double num_chg_pri = (m_req_width - 1) * (is_max_? 1 : 0.5);
double e_atomic;
double e_arb = 0;
//FIXME: we may overestimate request switch
e_atomic = m_e_chg_req * num_req_;
e_arb += e_atomic;
e_atomic = m_e_chg_grant * num_grant;
e_arb += e_atomic;
// priority register
e_atomic = m_ff_ptr->get_e_switch() * num_chg_pri * num_grant;
e_arb += e_atomic;
// assume 1 and 0 are uniformly distributed
if ((m_ff_ptr->get_e_keep_0() >= m_ff_ptr->get_e_keep_1()) || (!is_max_))
{
e_atomic = m_ff_ptr->get_e_keep_0();
e_atomic *= (total_pri - num_chg_pri * num_grant) * (is_max_? 1 : 0.5);
e_arb += e_atomic;
}
if ((m_ff_ptr->get_e_keep_0() < m_ff_ptr->get_e_keep_1()) || (!is_max_))
{
e_atomic = m_ff_ptr->get_e_keep_1();
e_atomic *= (total_pri - num_chg_pri * num_grant) * (is_max_? 1 : 0.5);
e_arb += e_atomic;
}
e_atomic = m_ff_ptr->get_e_clock()*total_pri;
e_arb += e_atomic;
// based on above assumptions
if (is_max_)
{
e_atomic = m_e_chg_int;
e_atomic *= (min(num_req_, m_req_width * 0.5) + 2) * (m_req_width - 1);
}
else
{
e_atomic = m_e_chg_int * (num_req_ + 1) * (m_req_width - 1) * 0.5;
}
e_arb += e_atomic;
return e_arb;
}
void MatrixArbiter::init(const string& ff_model_str_)
{
double e_factor = m_tech_param_ptr->get_EnergyFactor();
m_e_chg_req = calc_req_cap() / 2 * e_factor;
// two grant signals switch together, so no 1/2
m_e_chg_grant = calc_grant_cap() * e_factor;
m_e_chg_int = calc_int_cap() / 2 * e_factor;
double ff_load = calc_pri_cap();
m_ff_ptr = new FlipFlop(ff_model_str_, ff_load, m_tech_param_ptr);
m_i_static = calc_i_static();
return;
}
// the "huge" NOR gate in matrix arbiter model is an approximation
// switch cap of request signal
double MatrixArbiter::calc_req_cap()
{
double total_cap = 0;
// part 1: gate cap of NOR gates
// FIXME: need actual size
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
double gatecap = m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0);
total_cap += (m_req_width - 1) * gatecap;
// part 2: inverter
// FIXME: need actual size
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
total_cap += m_tech_param_ptr->calc_draincap(Wdecinvn,
TechParameter::NCH, 1)
+ m_tech_param_ptr->calc_draincap(Wdecinvp, TechParameter::PCH, 1)
+ m_tech_param_ptr->calc_gatecap(Wdecinvn+Wdecinvp, 0);
// part 3: gate cap of the "huge" NOR gate
// FIXME: need actual size
total_cap += m_tech_param_ptr->calc_gatecap(WdecNORn + WdecNORp, 0);
// part 4: wire cap
double Cmetal = m_tech_param_ptr->get_Cmetal();
total_cap += m_len_in_wire * Cmetal;
return total_cap;
}
// switch cap of priority signal
double MatrixArbiter::calc_pri_cap()
{
double total_cap = 0;
// part 1: gate cap of NOR gate
// FIXME: need actual size
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
total_cap += 2 * m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0);
return total_cap;
}
// switch cap of grant signa
double MatrixArbiter::calc_grant_cap()
{
double total_cap = 0;
// part 1: drain cap of NOR gate
// FIXME: need actual size
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
double draincap1 = m_tech_param_ptr->calc_draincap(WdecNORn,
TechParameter::NCH, 1);
double draincap2 = m_tech_param_ptr->calc_draincap(WdecNORp,
TechParameter::PCH,
m_req_width);
total_cap += m_req_width * (draincap1 + draincap2);
return total_cap;
}
// switch cap of internal node
double MatrixArbiter::calc_int_cap()
{
double total_cap = 0;
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
// part 1: drain cap of NOR gate (this bloc)
// FIXME: need actual size
total_cap += 2 * m_tech_param_ptr->calc_draincap(WdecNORn,
TechParameter::NCH, 1)
+ m_tech_param_ptr->calc_draincap(WdecNORp, TechParameter::PCH, 2);
// part 2: gate cap of NOR gate (next block)
// FIXME: need actual size
total_cap += m_tech_param_ptr->calc_gatecap(WdecNORn + WdecNORp, 0);
return total_cap;
}
double MatrixArbiter::calc_i_static()
{
double i_static = 0;
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double Wdff = m_tech_param_ptr->get_Wdff();
double NOR2_TAB_0 = m_tech_param_ptr->get_NOR2_TAB(0);
double NOR2_TAB_1 = m_tech_param_ptr->get_NOR2_TAB(1);
double NOR2_TAB_2 = m_tech_param_ptr->get_NOR2_TAB(2);
double NOR2_TAB_3 = m_tech_param_ptr->get_NOR2_TAB(3);
double NMOS_TAB_0 = m_tech_param_ptr->get_NMOS_TAB(0);
double PMOS_TAB_0 = m_tech_param_ptr->get_PMOS_TAB(0);
double DFF_TAB_0 = m_tech_param_ptr->get_DFF_TAB(0);
// NOR
i_static += ((2 * m_req_width - 1) * m_req_width *
((WdecNORp * NOR2_TAB_0 + WdecNORn *
(NOR2_TAB_1 + NOR2_TAB_2 + NOR2_TAB_3)) / 4));
// inverter
i_static += m_req_width *
((Wdecinvn * NMOS_TAB_0 + Wdecinvp * PMOS_TAB_0) / 2);
// dff
i_static += (m_req_width * (m_req_width - 1) / 2) * Wdff * DFF_TAB_0;
return i_static;
}

View file

@ -0,0 +1,71 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __MATRIXARBITER_H__
#define __MATRIXARBITER_H__
#include "mem/ruby/network/orion/Type.hh"
#include "mem/ruby/network/orion/Allocator/Arbiter.hh"
class TechParameter;
class MatrixArbiter : public Arbiter
{
public:
MatrixArbiter(
const string& ff_model_str_,
uint32_t req_width_,
double len_in_wire_,
const TechParameter* tech_param_ptr_
);
~MatrixArbiter();
public:
double calc_dynamic_energy(double num_req_, bool is_max_) const;
private:
void init(const string& ff_model_str_);
double calc_req_cap();
double calc_pri_cap();
double calc_grant_cap();
double calc_int_cap();
double calc_i_static();
private:
double m_e_chg_int;
};
#endif

View file

@ -0,0 +1,238 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cmath>
#include "mem/ruby/network/orion/Allocator/RRArbiter.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
#include "mem/ruby/network/orion/FlipFlop.hh"
using namespace std;
RRArbiter::RRArbiter(
const string& ff_model_str_,
uint32_t req_width_,
double len_in_wire_,
const TechParameter* tech_param_ptr_
) : Arbiter(RR_ARBITER, req_width_, len_in_wire_, tech_param_ptr_)
{
init(ff_model_str_);
}
RRArbiter::~RRArbiter()
{
delete m_ff_ptr;
}
double RRArbiter::calc_dynamic_energy(double num_req_, bool is_max_) const
{
if (num_req_ > m_req_width)
{
cerr << "WARNING: (num_req_ > m_req_width). Set num_req_ = m_req_width" << endl;
num_req_ = m_req_width;
}
double num_grant;
if (num_req_ >= 1) num_grant = 1;
else if (num_req_) num_grant = 1.0 / ceil(1.0/num_req_);
else num_grant = 0;
double e_atomic;
double e_arb = 0;
e_atomic = m_e_chg_req*num_req_;
e_arb += e_atomic;
e_atomic = m_e_chg_grant*num_grant;
e_arb += e_atomic;
// assume carry signal propagates half length in average case */
// carry does not propagate in maximum case, i.e. all carrys go down */
e_atomic = m_e_chg_carry*m_req_width*(is_max_? 1:0.5)*num_grant;
e_arb += e_atomic;
e_atomic = m_e_chg_carry_in*(m_req_width*(is_max_? 1:0.5)-1)*num_grant;
e_arb += e_atomic;
// priority register
e_atomic = m_ff_ptr->get_e_switch()*2*num_grant;
e_arb += e_atomic;
e_atomic = m_ff_ptr->get_e_keep_0()*(m_req_width-2*num_grant);
e_arb += e_atomic;
e_atomic = m_ff_ptr->get_e_clock()*m_req_width;
e_arb += e_atomic;
return e_arb;
}
void RRArbiter::init(const string& ff_model_str_)
{
double e_factor = m_tech_param_ptr->get_EnergyFactor();
m_e_chg_req = calc_req_cap()/2*e_factor;
// two grant signals switch together, so no 1/2
m_e_chg_grant = calc_grant_cap()*e_factor;
m_e_chg_carry = calc_carry_cap()/2*e_factor;
m_e_chg_carry_in = calc_carry_in_cap()/2*e_factor;
double ff_load = calc_pri_cap();
m_ff_ptr = new FlipFlop(ff_model_str_, ff_load, m_tech_param_ptr);
m_i_static = calc_i_static();
return;
}
// switch cap of request signal (round robin arbiter)
double RRArbiter::calc_req_cap()
{
double total_cap = 0;
// part 1: gate cap of 2 NOR gates
// FIXME: need actual size
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
total_cap += 2*m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0);
// part 2: inverter
// FIXME: need actual size
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
total_cap += m_tech_param_ptr->calc_draincap(Wdecinvn, TechParameter::NCH, 1)
+ m_tech_param_ptr->calc_draincap(Wdecinvp, TechParameter::PCH, 1)
+ m_tech_param_ptr->calc_gatecap(Wdecinvn+Wdecinvp, 0);
// part 3: wire cap
double Cmetal = m_tech_param_ptr->get_Cmetal();
total_cap += m_len_in_wire*Cmetal;
return total_cap;
}
// switch cap of priority signal
double RRArbiter::calc_pri_cap()
{
double total_cap = 0;
// part 1: gate cap of NOR gate
// FIXME: need actual size
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
total_cap += m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0);
return total_cap;
}
// switch cap of grant signa
double RRArbiter::calc_grant_cap()
{
double total_cap = 0;
// part 1: drain cap of NOR gate
// FIXME: need actual size
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
total_cap += 2*m_tech_param_ptr->calc_draincap(WdecNORn, TechParameter::NCH, 1)
+ m_tech_param_ptr->calc_draincap(WdecNORp, TechParameter::PCH, 2);
return total_cap;
}
// switch cap of carry signal
double RRArbiter::calc_carry_cap()
{
double total_cap = 0;
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
// part 1: drain cap of NOR gate (this bloc)
// FIXME: need actual size
total_cap += 2*m_tech_param_ptr->calc_draincap(WdecNORn, TechParameter::NCH, 1)
+ m_tech_param_ptr->calc_draincap(WdecNORp, TechParameter::PCH, 2);
// part 2: gate cap of NOR gate (next block)
// FIXME: need actual size
total_cap += m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0);
return total_cap;
}
// switch cap of internal carry node
double RRArbiter::calc_carry_in_cap()
{
double total_cap = 0;
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
// part 1: gate cap of 2 NOR gate
// FIXME: need actual size
total_cap += 2*m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0);
// part 2: drain cap of NOR gate (this bloc)
// FIXME: need actual size
total_cap += 2*m_tech_param_ptr->calc_draincap(WdecNORn, TechParameter::NCH, 1)
+ m_tech_param_ptr->calc_draincap(WdecNORp, TechParameter::PCH, 2);
return total_cap;
}
double RRArbiter::calc_i_static()
{
double i_static = 0;
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double Wdff = m_tech_param_ptr->get_Wdff();
double NOR2_TAB_0 = m_tech_param_ptr->get_NOR2_TAB(0);
double NOR2_TAB_1 = m_tech_param_ptr->get_NOR2_TAB(1);
double NOR2_TAB_2 = m_tech_param_ptr->get_NOR2_TAB(2);
double NOR2_TAB_3 = m_tech_param_ptr->get_NOR2_TAB(3);
double NMOS_TAB_0 = m_tech_param_ptr->get_NMOS_TAB(0);
double PMOS_TAB_0 = m_tech_param_ptr->get_PMOS_TAB(0);
double DFF_TAB_0 = m_tech_param_ptr->get_DFF_TAB(0);
// NOR
i_static += (6*m_req_width*((WdecNORp*NOR2_TAB_0+WdecNORn*(NOR2_TAB_1+NOR2_TAB_2+NOR2_TAB_3))/4));
// inverter
i_static += 2*m_req_width*((Wdecinvn*NMOS_TAB_0+Wdecinvp*PMOS_TAB_0)/2);
// dff
i_static += m_req_width*Wdff*DFF_TAB_0;
return i_static;
}

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __RRARBITER_H__
#define __RRARBITER_H__
#include "mem/ruby/network/orion/Type.hh"
#include "mem/ruby/network/orion/Allocator/Arbiter.hh"
class TechParameter;
class RRArbiter : public Arbiter
{
public:
RRArbiter(
const string& ff_model_str_,
uint32_t req_width_,
double len_in_wire_,
const TechParameter* tech_param_ptr_
);
~RRArbiter();
public:
double calc_dynamic_energy(double num_req_, bool is_max_) const;
private:
void init(const string& ff_model_str_);
double calc_req_cap();
double calc_pri_cap();
double calc_grant_cap();
double calc_carry_cap();
double calc_carry_in_cap();
double calc_i_static();
private:
double m_e_chg_carry;
double m_e_chg_carry_in;
};
#endif

View file

@ -0,0 +1,38 @@
# Copyright (c) 2010 Massachusetts Institute of Technology
# 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;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# 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.
#
# Authors: Tushar Krishna
Import('*')
if not env['RUBY']:
Return()
Source('Arbiter.cc')
Source('MatrixArbiter.cc')
Source('RRArbiter.cc')
Source('SWAllocator.cc')
Source('VCAllocator.cc')

View file

@ -0,0 +1,175 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/Allocator/SWAllocator.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/Allocator/Arbiter.hh"
#include "mem/ruby/network/orion/Crossbar/Crossbar.hh"
using namespace std;
SWAllocator::SWAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
double len_in_wire_,
const string& local_arb_model_str_,
const string& local_arb_ff_model_str_,
const string& global_arb_model_str_,
const string& global_arb_ff_model_str_,
const TechParameter* tech_param_ptr_
)
{
assert(num_in_port_ == num_in_port_);
assert(num_out_port_ == num_out_port_);
assert(num_vclass_ == num_vclass_);
assert(num_vchannel_ == num_vchannel_);
assert(len_in_wire_ == len_in_wire_);
m_num_in_port = num_in_port_;
m_num_out_port = num_out_port_;
m_num_vclass = num_vclass_;
m_num_vchannel = num_vchannel_;
if ((m_num_vclass*m_num_vchannel) > 1)
{
m_local_arb_ptr = Arbiter::create_arbiter(
local_arb_model_str_, local_arb_ff_model_str_,
m_num_vclass*m_num_vchannel, 0, tech_param_ptr_);
}
else
{
m_local_arb_ptr = NULL;
}
if (m_num_in_port > 2)
{
m_global_arb_ptr = Arbiter::create_arbiter(
global_arb_model_str_, global_arb_ff_model_str_,
m_num_in_port-1, len_in_wire_, tech_param_ptr_);
}
else
{
m_global_arb_ptr = NULL;
}
}
SWAllocator::~SWAllocator()
{}
double SWAllocator::get_dynamic_energy_local_sw_arb(double num_req_, bool is_max_) const
{
double e_local_arb = 0;
if (m_local_arb_ptr)
{
e_local_arb = m_local_arb_ptr->calc_dynamic_energy(num_req_, is_max_);
}
return e_local_arb;
}
double SWAllocator::get_dynamic_energy_global_sw_arb(double num_req_, bool is_max_) const
{
double e_global_arb = 0;
if (m_global_arb_ptr)
{
e_global_arb = m_global_arb_ptr->calc_dynamic_energy(num_req_, is_max_);
}
return e_global_arb;
}
double SWAllocator::get_static_power() const
{
double p_va = 0;
if (m_local_arb_ptr)
{
// FIXME: might not be m_num_in_port;
p_va += m_local_arb_ptr->get_static_power()*m_num_in_port;
}
if (m_global_arb_ptr)
{
p_va += m_global_arb_ptr->get_static_power()*m_num_out_port;
}
return p_va;
}
void SWAllocator::print_all() const
{
cout << "SWAllocator:" << endl;
if (m_local_arb_ptr)
{
for (uint32_t i = 0; i < m_num_vclass*m_num_vchannel; i++)
{
cout << "\t" << "Local arb (" << i << ") = " << get_dynamic_energy_local_sw_arb(i, false) << endl;
}
}
if (m_global_arb_ptr)
{
for (uint32_t i = 0; i < m_num_in_port-1; i++)
{
cout << "\t" << "Global arb (" << i << ") = " << get_dynamic_energy_global_sw_arb(i, false) << endl;
}
}
cout << "\t" << "Static power = " << get_static_power() << endl;
return;
}
SWAllocator* SWAllocator::create_swallocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const Crossbar* xbar_ptr_,
const OrionConfig* orion_cfg_ptr_
)
{
double len_in_wire = xbar_ptr_->get_len_req_wire();
const string& local_arb_model_str = orion_cfg_ptr_->get<string>("SA_IN_ARB_MODEL");
const string& local_arb_ff_model_str = orion_cfg_ptr_->get<string>("SA_IN_ARB_FF_MODEL");
const string& global_arb_model_str = orion_cfg_ptr_->get<string>("SA_OUT_ARB_MODEL");
const string& global_arb_ff_model_str = orion_cfg_ptr_->get<string>("SA_OUT_ARB_FF_MODEL");
const TechParameter* tech_param_ptr = orion_cfg_ptr_->get_tech_param_ptr();
return new SWAllocator(num_in_port_, num_out_port_, num_vclass_, num_vchannel_,
len_in_wire, local_arb_model_str, local_arb_ff_model_str,
global_arb_model_str, global_arb_ff_model_str,tech_param_ptr);
}

View file

@ -0,0 +1,95 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __SWALLOCATOR_H__
#define __SWALLOCATOR_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class OrionConfig;
class Arbiter;
class Crossbar;
class SWAllocator
{
protected:
SWAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
double len_in_wire_,
const string& local_arb_model_str_,
const string& local_arb_ff_model_str_,
const string& global_arb_model_str_,
const string& global_arb_ff_model_str_,
const TechParameter* tech_param_ptr_
);
public:
~SWAllocator();
public:
double get_dynamic_energy_local_sw_arb(double num_req_, bool is_max_) const;
double get_dynamic_energy_global_sw_arb(double num_req_, bool is_max_) const;
double get_static_power() const;
void print_all() const;
protected:
void init();
protected:
uint32_t m_num_in_port;
uint32_t m_num_out_port;
uint32_t m_num_vclass;
uint32_t m_num_vchannel;
Arbiter* m_local_arb_ptr;
Arbiter* m_global_arb_ptr;
public:
static SWAllocator* create_swallocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const Crossbar* xbar_ptr_,
const OrionConfig* orion_cfg_ptr_
);
};
#endif

View file

@ -0,0 +1,302 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include "mem/ruby/network/orion/Allocator/VCAllocator.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/Allocator/Arbiter.hh"
#include "mem/ruby/network/orion/Buffer/Buffer.hh"
using namespace std;
VCAllocator::VCAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const string& arb_model_str_,
const string& arb_ff_model_str_,
const TechParameter* tech_param_ptr_
)
{
assert(num_in_port_ == num_in_port_);
assert(num_out_port_ == num_out_port_);
assert(num_vclass_ == num_vclass_);
assert(num_vchannel_ == num_vchannel_);
m_va_model = ONE_STAGE_ARB;
m_num_in_port = num_in_port_;
m_num_out_port = num_out_port_;
m_num_vclass = num_vclass_;
m_num_vchannel = num_vchannel_;
m_local_arb_ptr = NULL;
m_global_arb_ptr = Arbiter::create_arbiter(
arb_model_str_, arb_ff_model_str_,
(m_num_in_port-1)*m_num_vchannel, 0, tech_param_ptr_);
m_vc_select_ptr = NULL;
}
VCAllocator::VCAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const string& local_arb_model_str_,
const string& local_arb_ff_model_str_,
const string& global_arb_model_str_,
const string& global_arb_ff_model_str_,
const TechParameter* tech_param_ptr_
)
{
assert(num_in_port_ == num_in_port_);
assert(num_out_port_ == num_out_port_);
assert(num_vclass_ == num_vclass_);
assert(num_vchannel_ == num_vchannel_);
m_va_model = TWO_STAGE_ARB;
m_num_in_port = num_in_port_;
m_num_out_port = num_out_port_;
m_num_vclass = num_vclass_;
m_num_vchannel = num_vchannel_;
// first stage
m_local_arb_ptr = Arbiter::create_arbiter(
local_arb_model_str_, local_arb_ff_model_str_,
m_num_vchannel, 0, tech_param_ptr_);
// second stage
m_global_arb_ptr = Arbiter::create_arbiter(
global_arb_model_str_, global_arb_ff_model_str_,
(m_num_in_port-1)*m_num_vchannel, 0, tech_param_ptr_);
m_vc_select_ptr = NULL;
}
VCAllocator::VCAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const string& vc_select_buf_model_str_,
const OrionConfig* orion_cfg_ptr_
)
{
assert(num_in_port_ == num_in_port_);
assert(num_out_port_ == num_out_port_);
assert(num_vclass_ == num_vclass_);
assert(num_vchannel_ == num_vchannel_);
m_va_model = VC_SELECT;
m_num_in_port = num_in_port_;
m_num_out_port = num_out_port_;
m_num_vclass = num_vclass_;
m_num_vchannel = num_vchannel_;
m_local_arb_ptr = NULL;
m_global_arb_ptr = NULL;
uint32_t vc_select_buf_num_set = m_num_vchannel;
uint32_t vc_select_buf_line_width = (uint32_t)ceil(log2(m_num_vchannel));
m_vc_select_ptr = new Buffer(vc_select_buf_model_str_, true, false,
vc_select_buf_num_set, vc_select_buf_line_width, 1, 1, orion_cfg_ptr_);
}
VCAllocator::~VCAllocator()
{
delete m_local_arb_ptr;
delete m_global_arb_ptr;
delete m_vc_select_ptr;
}
double VCAllocator::get_dynamic_energy_local_vc_arb(double num_req_, bool is_max_) const
{
double e_local_arb = 0;
switch(m_va_model)
{
case TWO_STAGE_ARB:
e_local_arb = m_local_arb_ptr->calc_dynamic_energy(num_req_, is_max_);
break;
case ONE_STAGE_ARB:
case VC_SELECT:
default:
e_local_arb = 0;
}
return e_local_arb;
}
double VCAllocator::get_dynamic_energy_global_vc_arb(double num_req_, bool is_max_) const
{
double e_global_arb = 0;
switch(m_va_model)
{
case ONE_STAGE_ARB:
case TWO_STAGE_ARB:
e_global_arb = m_global_arb_ptr->calc_dynamic_energy(num_req_, is_max_);
break;
case VC_SELECT:
default:
e_global_arb = 0;
}
return e_global_arb;
}
double VCAllocator::get_dynamic_energy_vc_select(bool is_read_, bool is_max_) const
{
double e_vc_select = 0;
switch(m_va_model)
{
case VC_SELECT:
e_vc_select = m_vc_select_ptr->get_dynamic_energy(is_read_, is_max_);
break;
case ONE_STAGE_ARB:
case TWO_STAGE_ARB:
default:
e_vc_select = 0;
}
return e_vc_select;
}
double VCAllocator::get_static_power() const
{
double p_va = 0;
switch(m_va_model)
{
case ONE_STAGE_ARB:
p_va = m_global_arb_ptr->get_static_power()*m_num_out_port*m_num_vclass*m_num_vchannel;
break;
case TWO_STAGE_ARB:
p_va += m_local_arb_ptr->get_static_power()*m_num_in_port*m_num_vclass*m_num_vchannel;
p_va += m_global_arb_ptr->get_static_power()*m_num_out_port*m_num_vclass*m_num_vchannel;
break;
case VC_SELECT:
p_va = m_vc_select_ptr->get_static_power()*m_num_out_port*m_num_vclass;
break;
default:
cerr << "ERROR: Invalid VA model" << endl;
exit(1);
}
return p_va;
}
void VCAllocator::print_all() const
{
switch(m_va_model)
{
case ONE_STAGE_ARB:
cout << "VCAllocator: ONE_STAGE_ARB" << endl;
for (uint32_t i = 0; i < (m_num_in_port-1)*m_num_vchannel; i++)
{
cout << "\t" << "Global arb (" << i << ") = " << get_dynamic_energy_global_vc_arb(i, false) << endl;
}
break;
case TWO_STAGE_ARB:
cout << "VCAllocator: TWO_STAGE_ARB" << endl;
for (uint32_t i = 0; i < m_num_vchannel; i++)
{
cout << "\t" << "Local arb (" << i << ") = " << get_dynamic_energy_local_vc_arb(i, false) << endl;
}
for (uint32_t i = 0; i < (m_num_in_port-1)*m_num_vchannel; i++)
{
cout << "\t" << "Global arb (" << i << ") = " << get_dynamic_energy_global_vc_arb(i, false) << endl;
}
break;
case VC_SELECT:
cout << "VCAllocator: VC_SELECT" << endl;
cout << "\t" << "Read = " << get_dynamic_energy_vc_select(true, false) << endl;
cout << "\t" << "Write = " << get_dynamic_energy_vc_select(false, false) << endl;
break;
default:
;
}
cout << "\t" << "Static power = " << get_static_power() << endl;
return;
}
VCAllocator* VCAllocator::create_vcallocator(
const string& vcalloc_model_str_,
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const OrionConfig* orion_cfg_ptr_
)
{
if (num_vchannel_ > 1)
{
if (vcalloc_model_str_ == string("ONE_STAGE_ARB"))
{
const string& arb_model_str = orion_cfg_ptr_->get<string>("VA_OUT_ARB_MODEL");
const string& arb_ff_model_str = orion_cfg_ptr_->get<string>("VA_OUT_ARB_FF_MODEL");
const TechParameter* tech_param_ptr = orion_cfg_ptr_->get_tech_param_ptr();
return new VCAllocator(num_in_port_, num_out_port_, num_vclass_, num_vchannel_,
arb_model_str, arb_ff_model_str, tech_param_ptr);
}
else if (vcalloc_model_str_ == string("TWO_STAGE_ARB"))
{
const string& local_arb_model_str = orion_cfg_ptr_->get<string>("VA_IN_ARB_MODEL");
const string& local_arb_ff_model_str = orion_cfg_ptr_->get<string>("VA_IN_ARB_FF_MODEL");
const string& global_arb_model_str = orion_cfg_ptr_->get<string>("VA_OUT_ARB_MODEL");
const string& global_arb_ff_model_str = orion_cfg_ptr_->get<string>("VA_OUT_ARB_FF_MODEL");
const TechParameter* tech_param_ptr = orion_cfg_ptr_->get_tech_param_ptr();
return new VCAllocator(num_in_port_, num_out_port_, num_vclass_, num_vchannel_,
local_arb_model_str, local_arb_ff_model_str,
global_arb_model_str, global_arb_ff_model_str,tech_param_ptr);
}
else if (vcalloc_model_str_ == string("VC_SELECT"))
{
const string& vc_select_buf_model_str = orion_cfg_ptr_->get<string>("VA_BUF_MODEL");
return new VCAllocator(num_in_port_, num_out_port_, num_vclass_, num_vchannel_,
vc_select_buf_model_str, orion_cfg_ptr_);
}
else
{
cerr << "WARNING: No VC allocator model" << endl;
return (VCAllocator*)NULL;
}
}
else
{
// reduce to a register
return new VCAllocator(num_in_port_, num_out_port_, num_vclass_, 1,
"REGISTER", orion_cfg_ptr_);
}
}

View file

@ -0,0 +1,123 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __VCALLOCATOR_H__
#define __VCALLOCATOR_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class OrionConfig;
class Arbiter;
class Buffer;
class VCAllocator
{
public:
enum VAModel
{
NO_MODEL = 0,
ONE_STAGE_ARB,
TWO_STAGE_ARB,
VC_SELECT
};
public:
~VCAllocator();
protected:
// for ONE_STAGE_ARB
VCAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const string& arb_model_str_,
const string& arb_ff_model_str_,
const TechParameter* tech_param_ptr_
);
// for TWO_STAGE_ARB
VCAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const string& local_arb_model_str_,
const string& local_arb_ff_model_str_,
const string& global_arb_model_str_,
const string& global_arb_ff_model_str_,
const TechParameter* tech_param_ptr_
);
// for VC_SELECT
VCAllocator(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const string& vc_select_buf_model_str_,
const OrionConfig* orion_cfg_ptr_
);
public:
double get_dynamic_energy_local_vc_arb(double num_req_, bool is_max_) const;
double get_dynamic_energy_global_vc_arb(double num_req_, bool is_max_) const;
double get_dynamic_energy_vc_select(bool is_read_, bool is_max_) const;
double get_static_power() const;
void print_all() const;
protected:
VAModel m_va_model;
uint32_t m_num_in_port;
uint32_t m_num_out_port;
uint32_t m_num_vclass;
uint32_t m_num_vchannel;
Arbiter* m_local_arb_ptr;
Arbiter* m_global_arb_ptr;
Buffer* m_vc_select_ptr;
public:
static VCAllocator* create_vcallocator(
const string& vcalloc_model_str_,
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
uint32_t num_vchannel_,
const OrionConfig* orion_cfg_ptr_
);
};
#endif

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include "mem/ruby/network/orion/Buffer/AmpUnit.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
AmpUnit::AmpUnit(
const string& amp_model_str_,
const TechParameter* tech_param_ptr_
)
{
if (amp_model_str_.compare("GENERIC_AMP") == 0)
{
m_amp_model = GENERIC_AMP;
}
else
{
m_amp_model = NO_MODEL;
}
if (m_amp_model != NO_MODEL)
{
m_tech_param_ptr = tech_param_ptr_;
init();
}
}
AmpUnit::~AmpUnit()
{}
void AmpUnit::init()
{
double vdd = m_tech_param_ptr->get_vdd();
double period = m_tech_param_ptr->get_period();
double amp_Idsat = m_tech_param_ptr->get_amp_idsat();
m_e_access = (vdd / 8.0 * period * amp_Idsat);
return;
}

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,30 +25,49 @@
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef POWER_LL_H_
#define POWER_LL_H_
extern double SIM_power_driver_size(double driving_cap, double desiredrisetime);
extern int SIM_power_init(void);
extern double SIM_power_gatecap(double width, double wirelength) ;
extern double SIM_power_gatecappass(double width, double wirelength);
extern double SIM_power_draincap(double width, int nchannel, int stack);
extern double SIM_power_transresswitch(double width, int nchannel, int stack);
extern double SIM_power_transreson(double width,int nchannel,int stack);
extern double SIM_power_restowidth(double res,int nchannel);
extern double SIM_power_horowitz(double inputramptime,double tf,double vs1,double vs2,int rise);
#ifndef __AMPUNIT_H__
#define __AMPUNIT_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class AmpUnit
{
public:
enum AmpModel
{
NO_MODEL = 0,
GENERIC_AMP
};
public:
AmpUnit(
const string& amp_model_str_,
const TechParameter* tech_param_ptr_
);
~AmpUnit();
public:
double get_e_access() const { return m_e_access; }
private:
void init();
private:
AmpModel m_amp_model;
const TechParameter* m_tech_param_ptr;
double m_e_access;
};
#endif

View file

@ -0,0 +1,199 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include "mem/ruby/network/orion/Buffer/BitlineUnit.hh"
#include "mem/ruby/network/orion/Buffer/SRAM.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
BitlineUnit::BitlineUnit(
const string bl_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
)
{
if (bl_model_str_ == "RW_BITLINE")
{
m_bl_model = RW_BITLINE;
}
else if (bl_model_str_ == "WO_BITLINE")
{
m_bl_model = WO_BITLINE;
}
else
{
m_bl_model = NO_MODEL;
}
if (m_bl_model != NO_MODEL)
{
m_sram_ptr = sram_ptr_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
}
BitlineUnit::~BitlineUnit()
{}
void BitlineUnit::init()
{
uint32_t num_port = m_sram_ptr->get_num_port();
uint32_t num_data_end = m_sram_ptr->get_num_data_end();
double bl_cmetal;
if ((num_port > 1) || (num_data_end == 2))
{
bl_cmetal = m_tech_param_ptr->get_CC3M2metal();
}
else
{
bl_cmetal = m_tech_param_ptr->get_CM2metal();
}
uint32_t num_row = m_sram_ptr->get_num_row();
double RegCellHeight = m_tech_param_ptr->get_RegCellHeight();
double WordlineSpacing = m_tech_param_ptr->get_WordlineSpacing();
m_bl_len = num_row*(RegCellHeight + num_port*WordlineSpacing);
m_bl_wire_cap = m_bl_len * bl_cmetal;
double e_factor = m_tech_param_ptr->get_EnergyFactor();
double sense_e_factor = m_tech_param_ptr->get_SenseEnergyFactor();
switch(m_bl_model)
{
case RW_BITLINE:
if (num_data_end == 2)
{
m_e_col_sel = calc_col_select_cap() * e_factor;
m_e_col_read = calc_col_read_cap() * sense_e_factor;
}
else
{
m_e_col_sel = 0;
m_e_col_read = calc_col_read_cap() * e_factor;
}
m_e_col_write = calc_col_write_cap() * e_factor;
m_i_static = calc_i_static();
break;
case WO_BITLINE:
m_e_col_sel = m_e_col_read = 0;
m_e_col_write = calc_col_write_cap() * e_factor;
//FIXME - no static power?
break;
default:
printf("error\n");
}
return;
}
double BitlineUnit::calc_col_select_cap()
{
double Wbitmuxn = m_tech_param_ptr->get_Wbitmuxn();
return m_tech_param_ptr->calc_gatecap(Wbitmuxn, 1);
}
double BitlineUnit::calc_col_read_cap()
{
double total_cap = 0;
// part 1: drain cap of precharge tx's
//total_cap = m_num_bl_pre * Util::calc_draincap(m_pre_size, Util::PCH, 1);
// part 2: drain cap of pass tx's
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
uint32_t num_row = m_sram_ptr->get_num_row();
total_cap = num_row * m_tech_param_ptr->calc_draincap(Wmemcellr, TechParameter::NCH, 1);
// part 3: metal cap
total_cap += m_bl_wire_cap;
m_pre_unit_load = total_cap;
// part 4: bitline inverter
uint32_t num_data_end = m_sram_ptr->get_num_data_end();
if (num_data_end == 1)
{
// FIXME: magic numbers
double MSCALE = m_tech_param_ptr->get_MSCALE();
total_cap += m_tech_param_ptr->calc_gatecap(MSCALE * (29.9 + 7.8), 0) + m_tech_param_ptr->calc_gatecap(MSCALE * (47.0 + 12.0), 0);
}
// part 5: gate cap of sense amplifier or output driver
bool is_outdrv = m_sram_ptr->get_is_outdrv();
if (num_data_end == 2)
{ // sense amplifier
double WsenseQ1to4 = m_tech_param_ptr->get_WsenseQ1to4();
total_cap += 2 * m_tech_param_ptr->calc_gatecap(WsenseQ1to4, 10);
}
else if (is_outdrv)
{
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
total_cap += m_tech_param_ptr->calc_gatecap(Woutdrvnandn, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnandp, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnorn, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnorp, 1);
}
return total_cap;
}
double BitlineUnit::calc_col_write_cap()
{
double total_cap, psize, nsize;
// part 1: line cap, including drain cap of pass tx's and metal cap
uint32_t num_row = m_sram_ptr->get_num_row();
double Wmemcellw = m_tech_param_ptr->get_Wmemcellw();
total_cap = num_row * m_tech_param_ptr->calc_draincap(Wmemcellw, TechParameter::NCH, 1) + m_bl_wire_cap;
// part 2: write driver
double period = m_tech_param_ptr->get_period();
psize = m_tech_param_ptr->calc_driver_psize(total_cap, period / 8.0);
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
nsize = psize * Wdecinvn / Wdecinvp;
total_cap += m_tech_param_ptr->calc_draincap(psize, TechParameter::PCH, 1) + m_tech_param_ptr->calc_draincap(nsize, TechParameter::NCH, 1) + m_tech_param_ptr->calc_gatecap(psize + nsize, 1);
return total_cap;
}
double BitlineUnit::calc_i_static()
{
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double NMOS_TAB_0 = m_tech_param_ptr->get_NMOS_TAB(0);
double PMOS_TAB_0 = m_tech_param_ptr->get_PMOS_TAB(0);
return (2*(Wdecinvn*NMOS_TAB_0+Wdecinvp*PMOS_TAB_0));
}

View file

@ -0,0 +1,93 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __BITLINEUNIT_H__
#define __BITLINEUNIT_H__
#include "mem/ruby/network/orion/Type.hh"
class SRAM;
class TechParameter;
class BitlineUnit
{
public:
enum BitlineModel
{
NO_MODEL = 0,
RW_BITLINE,
WO_BITLINE
};
public:
BitlineUnit(
const string bl_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
);
~BitlineUnit();
public:
double get_pre_unit_load() const { return m_pre_unit_load; }
double get_e_col_read() const { return m_e_col_read; }
double get_e_col_wrtie() const { return m_e_col_write; }
double get_i_static() const { return m_i_static; }
private:
void init();
double calc_col_select_cap();
double calc_col_read_cap();
double calc_col_write_cap();
double calc_i_static();
private:
BitlineModel m_bl_model;
const SRAM* m_sram_ptr;
const TechParameter* m_tech_param_ptr;
double m_bl_len;
double m_bl_wire_cap;
double m_pre_unit_load;
double m_e_col_sel;
double m_e_col_read;
double m_e_col_write;
double m_i_static;
};
#endif

View file

@ -0,0 +1,187 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/Buffer/Buffer.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/Buffer/SRAM.hh"
#include "mem/ruby/network/orion/Buffer/Register.hh"
using namespace std;
Buffer::Buffer(
const string& buffer_model_str_,
bool is_fifo_,
bool is_outdrv_,
uint32_t num_entry_,
uint32_t line_width_,
uint32_t num_read_port_,
uint32_t num_write_port_,
const OrionConfig* orion_cfg_ptr_
)
{
if (buffer_model_str_ == string("SRAM"))
{
m_buffer_model = BUF_SRAM;
}
else if(buffer_model_str_ == string("REGISTER"))
{
m_buffer_model = BUF_REG;
}
else
{
m_buffer_model = NO_MODEL;
}
if (m_buffer_model != NO_MODEL)
{
assert(num_entry_ == num_entry_);
assert(line_width_ == line_width_);
assert(num_read_port_ == num_read_port_);
assert(num_write_port_ == num_write_port_);
m_num_entry = num_entry_;
m_line_width = line_width_;
m_is_fifo = is_fifo_;
m_is_outdrv = is_outdrv_;
m_num_read_port = num_read_port_;
m_num_write_port = num_write_port_;
m_orion_cfg_ptr = orion_cfg_ptr_;
m_tech_param_ptr = m_orion_cfg_ptr->get_tech_param_ptr();
init();
}
}
Buffer::~Buffer()
{
delete m_sram_ptr;
}
double Buffer::get_dynamic_energy(
bool is_read_,
bool is_max_
) const
{
if (m_buffer_model == BUF_SRAM)
{
if (is_read_)
{
return m_sram_ptr->calc_e_read(is_max_);
}
else
{
return m_sram_ptr->calc_e_write(is_max_);
}
}
else if (m_buffer_model == BUF_REG)
{
if (is_read_)
{
return m_reg_ptr->calc_e_read();
}
else
{
return m_reg_ptr->calc_e_write();
}
}
else
{
return 0;
}
}
double Buffer::get_static_power() const
{
double vdd = m_tech_param_ptr->get_vdd();
double SCALE_S = m_tech_param_ptr->get_SCALE_S();
if (m_buffer_model == BUF_SRAM)
{
return m_sram_ptr->calc_i_static()*vdd*SCALE_S;
}
else if (m_buffer_model == BUF_REG)
{
return m_reg_ptr->calc_i_static()*vdd*SCALE_S;
}
else
{
return 0;
}
}
void Buffer::print_all() const
{
cout << "Buffer" << endl;
cout << "\t" << "Read = " << get_dynamic_energy(true, false) << endl;
cout << "\t" << "Write = " << get_dynamic_energy(false, false) << endl;
cout << "\t" << "Static power = " << get_static_power() << endl;
return;
}
void Buffer::init()
{
if(m_buffer_model == BUF_SRAM)
{
uint32_t num_data_end = m_orion_cfg_ptr->get<uint32_t>("SRAM_NUM_DATA_END");
const string& rowdec_model_str = m_orion_cfg_ptr->get<string>("SRAM_ROWDEC_MODEL");
const string& wl_model_str = m_orion_cfg_ptr->get<string>("SRAM_WORDLINE_MODEL");
const string& bl_pre_model_str = m_orion_cfg_ptr->get<string>("SRAM_BITLINE_PRE_MODEL");
const string& mem_model_str = "NORMAL_MEM";
const string& bl_model_str = m_orion_cfg_ptr->get<string>("SRAM_BITLINE_MODEL");
const string& amp_model_str = m_orion_cfg_ptr->get<string>("SRAM_AMP_MODEL");
const string& outdrv_model_str = m_orion_cfg_ptr->get<string>("SRAM_OUTDRV_MODEL");
m_sram_ptr = new SRAM(
m_num_entry, m_line_width, m_is_fifo, m_is_outdrv,
m_num_read_port, m_num_write_port, num_data_end,
rowdec_model_str, wl_model_str, bl_pre_model_str, mem_model_str,
bl_model_str, amp_model_str, outdrv_model_str, m_tech_param_ptr);
}
else if (m_buffer_model == BUF_REG)
{
m_sram_ptr = NULL;
m_reg_ptr = new Register(m_num_entry, m_line_width, m_tech_param_ptr);
}
else
{
m_sram_ptr = NULL;
m_reg_ptr = NULL;
}
return;
}

View file

@ -0,0 +1,96 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __BUFFER_H__
#define __BUFFER_H__
#include "mem/ruby/network/orion/Type.hh"
class OrionConfig;
class TechParameter;
class SRAM;
class Register;
class Buffer
{
public:
enum BufferModel
{
NO_MODEL = 0,
BUF_SRAM,
BUF_REG
};
public:
Buffer(
const string& buffer_model_str_,
bool is_fifo_,
bool is_outdrv_,
uint32_t num_entry_,
uint32_t line_width_,
uint32_t num_read_port_,
uint32_t num_write_port_,
const OrionConfig* orion_cfg_ptr_
);
~Buffer();
public:
double get_dynamic_energy(bool is_read_, bool is_max_) const;
double get_static_power() const;
void print_all() const;
private:
void init();
private:
BufferModel m_buffer_model;
uint32_t m_num_entry;
uint32_t m_line_width;
bool m_is_fifo;
bool m_is_outdrv;
uint32_t m_num_read_port;
uint32_t m_num_write_port;
const OrionConfig* m_orion_cfg_ptr;
const TechParameter* m_tech_param_ptr;
SRAM* m_sram_ptr;
Register* m_reg_ptr;
};
#endif

View file

@ -0,0 +1,171 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <cmath>
#include "mem/ruby/network/orion/Buffer/DecoderUnit.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
DecoderUnit::DecoderUnit(
const string& dec_model_str_,
uint32_t dec_width_,
const TechParameter* tech_param_ptr_
)
{
if (dec_model_str_.compare("GENERIC_DEC") == 0)
{
m_dec_model = GENERIC_DEC;
}
else
{
m_dec_model = NO_MODEL;
}
if (m_dec_model != NO_MODEL)
{
m_dec_width = dec_width_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
}
DecoderUnit::~DecoderUnit()
{
}
void DecoderUnit::init()
{
if (m_dec_width >= 4)
{ // 2-level decoder
m_num_in_1st = (m_dec_width == 4)? 2:3;
m_num_out_0th = 1 << (m_num_in_1st - 1);
m_num_in_2nd = (uint32_t)ceil((double)m_dec_width/(double)m_num_in_1st);
m_num_out_1st = 1 << (m_dec_width - m_num_in_1st);
}
else if (m_dec_width >= 2)
{ // 1-level decoder
m_num_in_1st = m_dec_width;
m_num_out_0th = 1 << (m_num_in_1st - 1);
m_num_in_2nd = m_num_out_1st = 0;
}
else
{
m_num_in_1st = m_num_out_0th = m_num_in_2nd = m_num_out_1st = 0;
}
// compute energy constants
double e_factor = m_tech_param_ptr->get_vdd() * m_tech_param_ptr->get_vdd();
if (m_dec_width >= 4)
{
m_e_chg_l1 = calc_chgl1_cap() * e_factor;
m_e_chg_output = calc_select_cap() * e_factor;
}
else if (m_dec_width >= 2)
{
m_e_chg_l1 = calc_chgl1_cap() * e_factor;
m_e_chg_output = 0;
}
else
{
m_e_chg_l1 = m_e_chg_output = 0;
}
m_e_chg_addr = calc_chgaddr_cap() * e_factor;
return;
}
double DecoderUnit::calc_chgl1_cap()
{
double total_cap;
// part 1: drain cap of level-1 decoder
double Wdec3to8p = m_tech_param_ptr->get_Wdec3to8p();
double Wdec3to8n = m_tech_param_ptr->get_Wdec3to8n();
total_cap = m_num_in_1st * m_tech_param_ptr->calc_draincap(Wdec3to8p, TechParameter::PCH, 1) + m_tech_param_ptr->calc_draincap(Wdec3to8n, TechParameter::NCH, m_num_in_1st);
/* part 2: gate cap of level-2 decoder */
/* WHS: 40 and 20 should go to PARM */
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
total_cap += m_num_out_0th*m_tech_param_ptr->calc_gatecap((WdecNORn+WdecNORp), m_num_in_2nd*40 + 20);
return total_cap;
}
double DecoderUnit::calc_select_cap()
{
double total_cap;
// part 1: drain cap of last level decoders
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
total_cap = m_num_in_2nd * m_tech_param_ptr->calc_draincap(WdecNORn, TechParameter::NCH, 1) + m_tech_param_ptr->calc_draincap(WdecNORp, TechParameter::PCH, m_num_in_2nd);
// part 2: output inverter
// WHS: 20 should go to PARM
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
total_cap += m_tech_param_ptr->calc_draincap(Wdecinvn, TechParameter::NCH, 1) + m_tech_param_ptr->calc_draincap(Wdecinvp, TechParameter::PCH, 1) + m_tech_param_ptr->calc_gatecap(Wdecinvn + Wdecinvp, 20);
return total_cap;
}
double DecoderUnit::calc_chgaddr_cap()
{
double total_cap;
// stage 1: input driver
double Wdecdrivep = m_tech_param_ptr->get_Wdecdrivep();
double Wdecdriven = m_tech_param_ptr->get_Wdecdriven();
total_cap = m_tech_param_ptr->calc_draincap(Wdecdrivep, TechParameter::PCH, 1) + m_tech_param_ptr->calc_draincap(Wdecdriven, TechParameter::NCH, 1) + m_tech_param_ptr->calc_gatecap(Wdecdriven, 1);
/* inverter to produce complement addr, this needs 1/2 */
/* WHS: assume Wdecinv(np) for this inverter */
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
total_cap += (m_tech_param_ptr->calc_draincap(Wdecinvp, TechParameter::PCH, 1) + m_tech_param_ptr->calc_draincap(Wdecinvn, TechParameter::NCH, 1) + m_tech_param_ptr->calc_gatecap(Wdecinvp, 1) + m_tech_param_ptr->calc_gatecap(Wdecinvn, 1)) / 2;
/* stage 2: gate cap of level-1 decoder */
/* WHS: 10 should go to PARM */
double Wdec3to8p = m_tech_param_ptr->get_Wdec3to8p();
double Wdec3to8n = m_tech_param_ptr->get_Wdec3to8n();
total_cap += m_num_out_0th*m_tech_param_ptr->calc_gatecap( Wdec3to8n + Wdec3to8p, 10 );
return total_cap;
}

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,58 +25,64 @@
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
// Crossbar
#ifndef __DECODERUNIT_H__
#define __DECODERUNIT_H__
#ifndef _POWER_CROSSBAR_H
#define _POWER_CROSSBAR_H
#include "mem/ruby/network/orion/Type.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
typedef enum {
TRANS_GATE,
TRISTATE_GATE
} power_connect_model;
class DecoderUnit
{
public:
enum DecModel
{
NO_MODEL = 0,
GENERIC_DEC
};
/* transmission gate type */
typedef enum {
N_GATE,
NP_GATE
} power_trans;
public:
DecoderUnit(
const string& dec_model_str_,
uint32_t dec_width_,
const TechParameter* tech_param_ptr_
);
~DecoderUnit();
typedef enum {
MATRIX_CROSSBAR =1,
MULTREE_CROSSBAR,
CUT_THRU_CROSSBAR,
CROSSBAR_MAX_MODEL
} power_crossbar_model;
public:
uint32_t get_dec_width() const { return m_dec_width; }
uint32_t get_num_in_2nd() const { return m_num_in_2nd; }
double get_e_chg_addr() const { return m_e_chg_addr; }
double get_e_chg_output() const { return m_e_chg_output; }
double get_e_chg_l1() const { return m_e_chg_l1; }
private:
void init();
double calc_chgl1_cap();
double calc_select_cap();
double calc_chgaddr_cap();
typedef struct {
int model;
unsigned n_in;
unsigned n_out;
unsigned data_width;
unsigned degree; //used only for multree xbar
unsigned connect_type;
unsigned trans_type;
unsigned long int n_chg_in;
unsigned long int n_chg_int;
unsigned long int n_chg_out;
unsigned long int n_chg_ctr;
unsigned long int mask;
double e_chg_in;
double e_chg_int;
double e_chg_out;
double e_chg_ctr;
unsigned depth; //used only for multree xbar
double i_leakage;
} power_crossbar;
private:
DecModel m_dec_model;
uint32_t m_dec_width;
const TechParameter* m_tech_param_ptr;
uint32_t m_num_in_1st;
uint32_t m_num_in_2nd;
uint32_t m_num_out_0th;
uint32_t m_num_out_1st;
extern int crossbar_record(power_crossbar *xb, int io, unsigned long int new_data, unsigned long int old_data, unsigned new_port, unsigned old_port);
extern int power_crossbar_init(power_crossbar *crsbar, int model, unsigned n_in, unsigned n_out, unsigned data_width, unsigned degree, int connect_type, int trans_type, double in_len, double out_len, double *req_len);
extern double crossbar_report(power_crossbar *crsbar);
double m_e_chg_l1;
double m_e_chg_output;
double m_e_chg_addr;
};
#endif

View file

@ -0,0 +1,132 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include "mem/ruby/network/orion/Buffer/MemUnit.hh"
#include "mem/ruby/network/orion/Buffer/SRAM.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
MemUnit::MemUnit(
const string& mem_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
)
{
if (mem_model_str_.compare("NORMAL_MEM") == 0)
{
m_mem_model = NORMAL_MEM;
}
else
{
m_mem_model = NO_MODEL;
}
if (m_mem_model != NO_MODEL)
{
m_sram_ptr = sram_ptr_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
}
MemUnit::~MemUnit()
{}
void MemUnit::init()
{
double e_factor = m_tech_param_ptr->get_EnergyFactor();
m_e_switch = calc_mem_cap() * e_factor;
m_i_static = calc_i_static();
}
double MemUnit::calc_mem_cap()
{
double Wmemcella = m_tech_param_ptr->get_Wmemcella();
double Wmemcellbscale = m_tech_param_ptr->get_Wmemcellbscale();
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double Wmemcellw = m_tech_param_ptr->get_Wmemcellw();
uint32_t num_data_end = m_sram_ptr->get_num_data_end();
uint32_t num_read_port = m_sram_ptr->get_num_read_port();
uint32_t num_write_port = m_sram_ptr->get_num_write_port();
const TechParameter* tp = m_tech_param_ptr;
double total_cap = 0;
// part 1: drain capacitance of pass transistors
total_cap += tp->calc_draincap(Wmemcellr, TechParameter::NCH, 1)*num_read_port*num_data_end/2.0;
total_cap += tp->calc_draincap(Wmemcellw, TechParameter::NCH, 1)*num_write_port;
// has coefficient (1/2 * 2)
// part 2: drain capacitance of memory cell
total_cap += tp->calc_draincap(Wmemcella, TechParameter::NCH, 1) + tp->calc_draincap(Wmemcella*Wmemcellbscale, TechParameter::PCH, 1
);
// has coefficient (1/2 * 2)
// part 3: gate capacitance of memory cell
total_cap += tp->calc_gatecap(Wmemcella, 1) + tp->calc_gatecap(Wmemcella*Wmemcellbscale, 1);
return total_cap;
}
double MemUnit::calc_i_static()
{
double Wmemcella = m_tech_param_ptr->get_Wmemcella();
double Wmemcellbscale = m_tech_param_ptr->get_Wmemcellbscale();
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double Wmemcellw = m_tech_param_ptr->get_Wmemcellw();
uint32_t num_data_end = m_sram_ptr->get_num_data_end();
uint32_t num_read_port = m_sram_ptr->get_num_read_port();
uint32_t num_write_port = m_sram_ptr->get_num_write_port();
const TechParameter* tp = m_tech_param_ptr;
double ret = 0;
// memory cell
//FIXME - why
ret += (Wmemcella*tp->get_NMOS_TAB(0) + Wmemcella*Wmemcellbscale*tp->get_PMOS_TAB(0))*2;
// read port pass tx
ret += (Wmemcellr*tp->get_NMOS_TAB(0)*num_data_end*num_read_port);
// write port pass tx
ret += (Wmemcellw*tp->get_NMOS_TAB(0)*2*num_write_port);
return ret;
}

View file

@ -0,0 +1,80 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __MEMUNIT_H__
#define __MEMUNIT_H__
#include "mem/ruby/network/orion/Type.hh"
class SRAM;
class TechParameter;
class MemUnit
{
public:
enum MemModel
{
NO_MODEL = 0,
NORMAL_MEM
};
public:
MemUnit(
const string& mem_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
);
~MemUnit();
public:
double get_e_switch() const { return m_e_switch; }
double get_i_static() const { return m_i_static; }
private:
void init();
double calc_mem_cap();
double calc_i_static();
private:
MemModel m_mem_model;
const SRAM* m_sram_ptr;
const TechParameter* m_tech_param_ptr;
double m_e_switch;
double m_i_static;
};
#endif

View file

@ -0,0 +1,175 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include "mem/ruby/network/orion/Buffer/OutdrvUnit.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
#include "mem/ruby/network/orion/Buffer/SRAM.hh"
OutdrvUnit::OutdrvUnit(
const string& outdrv_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
)
{
if (outdrv_model_str_ == string("CACHE_OUTDRV"))
{
m_outdrv_model = CACHE_OUTDRV;
}
else if (outdrv_model_str_ == string("REG_OUTDRV"))
{
m_outdrv_model = REG_OUTDRV;
}
else
{
m_outdrv_model = NO_MODEL;
}
if (m_outdrv_model != NO_MODEL)
{
m_sram_ptr = sram_ptr_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
else
{
m_e_select = 0;
m_e_out_1 = 0;
m_e_out_0 = 0;
m_e_chg_data = 0;
}
}
OutdrvUnit::~OutdrvUnit()
{}
void OutdrvUnit::init()
{
double e_factor = m_tech_param_ptr->get_EnergyFactor();
m_e_select = calc_select_cap() * e_factor;
m_e_out_1 = calc_outdata_cap(1) * e_factor;
m_e_out_0 = calc_outdata_cap(0) * e_factor;
switch(m_outdrv_model)
{
case CACHE_OUTDRV:
m_e_chg_data = calc_chgdata_cap() * e_factor;
break;
case REG_OUTDRV:
m_e_chg_data = 0;
break;
default:
printf("error\n");
}
m_i_static = calc_i_static();
return;
}
double OutdrvUnit::calc_select_cap()
{
double total_cap;
// stage 1: inverter
double Woutdrvseln = m_tech_param_ptr->get_Woutdrvseln();
double Woutdrvselp = m_tech_param_ptr->get_Woutdrvselp();
total_cap = m_tech_param_ptr->calc_gatecap(Woutdrvseln, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvselp, 1) + m_tech_param_ptr->calc_draincap(Woutdrvseln, TechParameter::NCH, 1) + m_tech_param_ptr->calc_draincap(Woutdrvselp, TechParameter::PCH, 1);
// stage 2: gate cap of nand gate and nor gate
// only consider 1 gate cap because another and drain cap switch depends on data value
uint32_t line_width = m_sram_ptr->get_line_width();
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
total_cap += line_width * (m_tech_param_ptr->calc_gatecap(Woutdrvnandn, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnandp, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnorn, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnorp, 1));
return total_cap;
}
double OutdrvUnit::calc_chgdata_cap()
{
double total_cap;
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
total_cap = (m_tech_param_ptr->calc_gatecap(Woutdrvnandn, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnandp, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnorn, 1) + m_tech_param_ptr->calc_gatecap(Woutdrvnorp, 1)) / 2.0;
return total_cap;
}
double OutdrvUnit::calc_outdata_cap(bool value_)
{
double total_cap = 0;
// stage 1: drain cap of nand gate or nor gate
if (value_)
{
//drain cap of nand gate
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
total_cap = m_tech_param_ptr->calc_draincap(Woutdrvnandn, TechParameter::NCH, 2) + 2 * m_tech_param_ptr->calc_draincap(Woutdrvnandp, TechParameter::PCH, 1);
}
else
{
//drain cap of nor gate
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
total_cap = 2 * m_tech_param_ptr->calc_draincap(Woutdrvnorn, TechParameter::NCH, 1) + m_tech_param_ptr->calc_draincap(Woutdrvnorp, TechParameter::PCH, 2);
}
// stage 2: gate cap of output inverter
if (value_)
{
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
total_cap += m_tech_param_ptr->calc_gatecap(Woutdriverp, 1);
}
else
{
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
total_cap += m_tech_param_ptr->calc_gatecap(Woutdrivern, 1);
}
//drian cap of output inverter should be included into bus cap
//TODO
return total_cap;
}
double OutdrvUnit::calc_i_static()
{
//FIXME - add static power
return 0;
}

View file

@ -0,0 +1,89 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __OUTDRVUNIT_H__
#define __OUTDRVUNIT_H__
#include "mem/ruby/network/orion/Type.hh"
class SRAM;
class TechParameter;
class OutdrvUnit
{
public:
enum OutdrvModel
{
NO_MODEL = 0,
CACHE_OUTDRV,
REG_OUTDRV
};
public:
OutdrvUnit(
const string& outdrv_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
);
~OutdrvUnit();
public:
double get_e_select() const { return m_e_select; }
double get_e_chg_data() const { return m_e_chg_data; }
double get_e_out_0() const { return m_e_out_0; }
double get_e_out_1() const { return m_e_out_1; }
private:
void init();
double calc_select_cap();
double calc_chgdata_cap();
double calc_outdata_cap(bool value_);
double calc_i_static();
private:
OutdrvModel m_outdrv_model;
const SRAM* m_sram_ptr;
const TechParameter* m_tech_param_ptr;
double m_e_select;
double m_e_out_1;
double m_e_out_0;
double m_e_chg_data;
double m_i_static;
};
#endif

View file

@ -0,0 +1,136 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include "mem/ruby/network/orion/Buffer/PrechargeUnit.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
#include "mem/ruby/network/orion/Buffer/SRAM.hh"
PrechargeUnit::PrechargeUnit(
const string& pre_model_str_,
double pre_load_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
)
{
if (pre_model_str_ == "SINGLE_BITLINE")
{
m_pre_model = SINGLE_BITLINE;
}
else if (pre_model_str_ == "EQU_BITLINE")
{
m_pre_model = EQU_BITLINE;
}
else if (pre_model_str_ == "SINGLE_OTHER")
{
m_pre_model = SINGLE_OTHER;
}
else
{
m_pre_model = NO_MODEL;
}
if (m_pre_model != NO_MODEL)
{
m_pre_load = pre_load_;
m_sram_ptr = sram_ptr_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
}
PrechargeUnit::~PrechargeUnit()
{
}
void PrechargeUnit::init()
{
double period = m_tech_param_ptr->get_period();
m_pre_size = m_tech_param_ptr->calc_driver_psize(m_pre_load, period/8.0);
//FIXME - shouldn't be added
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
m_pre_size += m_pre_size*Wdecinvn/Wdecinvp;
uint32_t num_gate = calc_num_pre_gate();
// WHS: 10 should go to PARM
double e_factor = m_tech_param_ptr->get_EnergyFactor();
m_e_charge_gate = calc_pre_cap(m_pre_size, 10) * num_gate * e_factor;
uint32_t num_data_end = m_sram_ptr->get_num_data_end();
if (num_data_end == 2)
{
e_factor = m_tech_param_ptr->get_SenseEnergyFactor();
}
else
{
e_factor = m_tech_param_ptr->get_EnergyFactor();
}
uint32_t num_drain = calc_num_pre_drain();
m_e_charge_drain = m_tech_param_ptr->calc_draincap(m_pre_size, TechParameter::PCH, 1)*num_drain*e_factor;
// static power
double PMOS_TAB_0 = m_tech_param_ptr->get_PMOS_TAB(0);
m_i_static = num_gate*m_pre_size*PMOS_TAB_0;
}
uint32_t PrechargeUnit::calc_num_pre_gate()
{
switch(m_pre_model)
{
case SINGLE_BITLINE: return 2;
case EQU_BITLINE: return 3;
case SINGLE_OTHER: return 1;
default: printf("error\n"); return 0;
}
}
uint32_t PrechargeUnit::calc_num_pre_drain()
{
switch(m_pre_model)
{
case SINGLE_BITLINE: return 1;
case EQU_BITLINE: return 2;
case SINGLE_OTHER: return 1;
default: printf("error\n"); return 0;
}
}
double PrechargeUnit::calc_pre_cap(double width_, double length_)
{
return m_tech_param_ptr->calc_gatecap(width_, length_);
}

View file

@ -0,0 +1,90 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __PRECHARGEUNIT_H__
#define __PRECHARGEUNIT_H__
#include "mem/ruby/network/orion/Type.hh"
class SRAM;
class TechParameter;
class PrechargeUnit
{
public:
enum PrechargeModel
{
NO_MODEL = 0,
SINGLE_BITLINE,
EQU_BITLINE,
SINGLE_OTHER
};
public:
PrechargeUnit(
const string& pre_model_str_,
double pre_load_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
);
~PrechargeUnit();
public:
double get_e_charge_gate() const { return m_e_charge_gate; }
double get_e_charge_drain() const { return m_e_charge_drain; }
double get_i_static() const { return m_i_static; }
private:
void init();
uint32_t calc_num_pre_gate();
uint32_t calc_num_pre_drain();
double calc_pre_cap(double width_, double length_);
private:
PrechargeModel m_pre_model;
double m_pre_load;
const SRAM* m_sram_ptr;
const TechParameter* m_tech_param_ptr;
double m_pre_size;
double m_e_charge_gate;
double m_e_charge_drain;
double m_i_static;
};
#endif

View file

@ -0,0 +1,113 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/Buffer/Register.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
#include "mem/ruby/network/orion/FlipFlop.hh"
using namespace std;
Register::Register(
uint32_t num_entry_,
uint32_t line_width_,
const TechParameter *tech_param_ptr_
)
{
assert(num_entry_ == num_entry_);
assert(line_width_ == line_width_);
m_num_entry = num_entry_;
m_line_width = line_width_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
Register::~Register()
{
delete m_ff_ptr;
}
double Register::calc_e_read() const
{
// average read energy for one buffer entry
double e_read = 0;
// for each read operation, the energy consists of one read operation and n write
// operateion. n means there is n flits in the buffer before read operation.
// assume n is info->n_entry * 0.25.
//
if (m_num_entry > 1)
{
e_read = (m_avg_read + m_num_entry*0.25*m_avg_write);
}
else
{
e_read = m_avg_read;
}
return e_read;
}
double Register::calc_e_write() const
{
// average write energy for one buffer entry
double e_write = 0;
e_write = m_avg_write;
return e_write;
}
double Register::calc_i_static() const
{
double i_static = m_ff_ptr->get_i_static()*m_line_width*m_num_entry;
return i_static;
}
void Register::init()
{
m_ff_ptr = new FlipFlop("NEG_DFF", 0, m_tech_param_ptr);
uint32_t num_clock = m_line_width;
m_avg_read = m_ff_ptr->get_e_clock()*((double)num_clock)/2.0;
double num_switch = m_line_width/2.0;
m_avg_write = m_ff_ptr->get_e_switch()*num_switch+m_ff_ptr->get_e_clock()*num_clock;
return;
}

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,23 +25,49 @@
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include "mem/ruby/network/orion/power_static.hh"
#ifndef __REGISTER_H__
#define __REGISTER_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class FlipFlop;
class Register
{
public:
Register(
uint32_t num_entry_,
uint32_t line_width_,
const TechParameter* tech_param_ptr_
);
~Register();
public:
double calc_e_read() const;
double calc_e_write() const;
double calc_i_static() const;
private:
void init();
private:
uint32_t m_num_entry;
uint32_t m_line_width;
const TechParameter* m_tech_param_ptr;
FlipFlop* m_ff_ptr;
double m_avg_read;
double m_avg_write;
};
#if (PARM_TECH_POINT == 18)
double NMOS_TAB[1] = {20.5e-9};
double PMOS_TAB[1] = {9.2e-9};
double NAND2_TAB[4] = {6.4e-10, 20.4e-9, 12.6e-9, 18.4e-9};
double NOR2_TAB[4] ={40.9e-9, 8.32e-9, 9.2e-9, 2.3e-10};
#elif (PARM_TECH_POINT == 10)
double NMOS_TAB[1] = {22.7e-9};
double PMOS_TAB[1] = {18.0e-9};
double NAND2_TAB[4] = {1.2e-9, 22.6e-9, 11.4e-9, 35.9e-9};
double NOR2_TAB[4] ={45.1e-9, 11.5e-9, 17.9e-9, 1.8e-9};
#elif (PARM_TECH_POINT == 7)
double NMOS_TAB[1] = {118.1e-9};
double PMOS_TAB[1] = {135.2e-9};
double NAND2_TAB[4] = {19.7e-9, 115.3e-9, 83.0e-9, 267.6e-9};
double NOR2_TAB[4] ={232.4e-9, 79.6e-9, 127.9e-9, 12.3e-9};
#endif

View file

@ -0,0 +1,43 @@
# Copyright (c) 2010 Massachusetts Institute of Technology
# 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;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# 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.
#
# Authors: Tushar Krishna
Import('*')
if not env['RUBY']:
Return()
Source('AmpUnit.cc')
Source('BitlineUnit.cc')
Source('Buffer.cc')
Source('DecoderUnit.cc')
Source('MemUnit.cc')
Source('OutdrvUnit.cc')
Source('PrechargeUnit.cc')
Source('Register.cc')
Source('SRAM.cc')
Source('WordlineUnit.cc')

View file

@ -0,0 +1,271 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cmath>
#include <cassert>
#include "mem/ruby/network/orion/Buffer/SRAM.hh"
#include "mem/ruby/network/orion/Buffer/OutdrvUnit.hh"
#include "mem/ruby/network/orion/Buffer/AmpUnit.hh"
#include "mem/ruby/network/orion/Buffer/BitlineUnit.hh"
#include "mem/ruby/network/orion/Buffer/MemUnit.hh"
#include "mem/ruby/network/orion/Buffer/PrechargeUnit.hh"
#include "mem/ruby/network/orion/Buffer/WordlineUnit.hh"
#include "mem/ruby/network/orion/Buffer/DecoderUnit.hh"
using namespace std;
SRAM::SRAM(
uint32_t num_entry_,
uint32_t line_width_,
bool is_fifo_,
bool is_outdrv_,
uint32_t num_read_port_,
uint32_t num_write_port_,
uint32_t num_data_end_,
const string& rowdec_model_str_,
const string& wl_model_str_,
const string& bl_pre_model_str_,
const string& mem_model_str_,
const string& bl_model_str_,
const string& amp_model_str_,
const string& outdrv_model_str_,
const TechParameter* tech_param_ptr_
)
{
assert(num_entry_ == num_entry_);
assert(line_width_ == line_width_);
assert(num_read_port_ == num_read_port_);
assert(num_write_port_ == num_write_port_);
assert(num_data_end_ == num_data_end_);
m_num_entry = num_entry_;
m_line_width = line_width_;
m_is_fifo = is_fifo_;
m_is_outdrv = is_outdrv_;
m_num_read_port = num_read_port_;
m_num_write_port = num_write_port_;
m_num_data_end = num_data_end_;
m_rowdec_model_str = rowdec_model_str_;
m_wl_model_str = wl_model_str_;
m_bl_pre_model_str = bl_pre_model_str_;
m_mem_model_str = mem_model_str_;
m_bl_model_str = bl_model_str_;
m_amp_model_str = amp_model_str_;
m_outdrv_model_str = outdrv_model_str_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
SRAM::~SRAM()
{
delete m_outdrv_unit_ptr;
delete m_amp_unit_ptr;
delete m_bl_unit_ptr;
delete m_mem_unit_ptr;
delete m_bl_pre_unit_ptr;
delete m_wl_unit_ptr;
delete m_rowdec_unit_ptr;
}
double SRAM::calc_e_read(
bool is_max_
) const
{
double e_atomic;
double e_read = 0;
// decoder
if (m_rowdec_unit_ptr != NULL)
{
e_atomic = m_rowdec_unit_ptr->get_e_chg_addr()*m_rowdec_unit_ptr->get_dec_width()*(is_max_? 1:0.5);
e_atomic += m_rowdec_unit_ptr->get_e_chg_output();
// assume all 1st-level decoders change output
e_atomic += m_rowdec_unit_ptr->get_e_chg_l1()*m_rowdec_unit_ptr->get_num_in_2nd();
e_read += e_atomic;
}
//wordline
e_atomic = m_wl_unit_ptr->get_e_read();
e_read += e_atomic;
//bitline pre
e_atomic = m_bl_pre_unit_ptr->get_e_charge_gate()*m_line_width;
if (m_num_data_end == 2)
{
e_atomic += m_bl_pre_unit_ptr->get_e_charge_drain()*m_line_width;
}
else
{
e_atomic += m_bl_pre_unit_ptr->get_e_charge_drain()*m_line_width*(is_max_? 1:0.5);
}
e_read += e_atomic;
//bitline
if (m_num_data_end == 2)
{
e_atomic = m_bl_unit_ptr->get_e_col_read()*m_line_width;
}
else
{
e_atomic = m_bl_unit_ptr->get_e_col_read()*m_line_width*(is_max_? 1:0.5);
}
e_read += e_atomic;
if (m_num_data_end == 2)
{
e_atomic = m_amp_unit_ptr->get_e_access()*m_line_width;
e_read += e_atomic;
}
if (m_outdrv_unit_ptr != NULL)
{
e_atomic = m_outdrv_unit_ptr->get_e_select();
e_atomic += m_outdrv_unit_ptr->get_e_chg_data()*m_line_width*(is_max_? 1:0.5);
//assume 1 and 0 are uniformly distributed
if ((m_outdrv_unit_ptr->get_e_out_1() >= m_outdrv_unit_ptr->get_e_out_0()) || (!is_max_))
{
e_atomic += m_outdrv_unit_ptr->get_e_out_1()*m_line_width*(is_max_? 1:0.5);
}
if ((m_outdrv_unit_ptr->get_e_out_1() < m_outdrv_unit_ptr->get_e_out_0()) || (!is_max_))
{
e_atomic += m_outdrv_unit_ptr->get_e_out_0()*m_line_width*(is_max_? 1:0.5);
}
e_read += e_atomic;
}
return e_read;
}
double SRAM::calc_e_write(
bool is_max_
) const
{
double e_atomic;
double e_write = 0;
// decoder
if (m_rowdec_unit_ptr != NULL)
{
e_atomic = m_rowdec_unit_ptr->get_e_chg_addr()*m_rowdec_unit_ptr->get_dec_width()*(is_max_? 1:0.5);
e_atomic += m_rowdec_unit_ptr->get_e_chg_output();
// assume all 1st-level decoders change output
e_atomic += m_rowdec_unit_ptr->get_e_chg_l1()*m_rowdec_unit_ptr->get_num_in_2nd();
e_write += e_atomic;
}
//wordline
e_atomic = m_wl_unit_ptr->get_e_write();
e_write += e_atomic;
//bitline
e_atomic = m_bl_unit_ptr->get_e_col_wrtie()*m_line_width*(is_max_? 1:0.5);
e_write += e_atomic;
//mem cell
e_atomic = m_mem_unit_ptr->get_e_switch()*m_line_width*(is_max_? 1:0.5);
e_write += e_atomic;
return e_write;
}
double SRAM::calc_i_static() const
{
double i_static = 0;
i_static += m_bl_unit_ptr->get_i_static()*m_line_width*m_num_write_port;
i_static += m_mem_unit_ptr->get_i_static()*m_num_entry*m_line_width;
i_static += m_bl_pre_unit_ptr->get_i_static()*m_line_width*m_num_read_port;
i_static += m_wl_unit_ptr->get_i_static()*m_num_entry*(m_num_read_port+m_num_write_port);
return i_static;
}
void SRAM::init()
{
// output driver unit
if (m_is_outdrv)
{
m_outdrv_unit_ptr = new OutdrvUnit(m_outdrv_model_str, this, m_tech_param_ptr);
}
else
{
m_outdrv_unit_ptr = NULL;
}
// sense amplifier unit
if (m_num_data_end == 2)
{
m_amp_unit_ptr = new AmpUnit(m_amp_model_str, m_tech_param_ptr);
}
else
{
m_amp_unit_ptr = NULL;
}
// bitline unit
m_bl_unit_ptr = new BitlineUnit(m_bl_model_str, this, m_tech_param_ptr);
// mem unit
m_mem_unit_ptr = new MemUnit(m_mem_model_str, this, m_tech_param_ptr);
// precharge unit
double bl_pre_unit_load = m_bl_unit_ptr->get_pre_unit_load();
m_bl_pre_unit_ptr = new PrechargeUnit(m_bl_pre_model_str, bl_pre_unit_load, this, m_tech_param_ptr);
// wordline unit
m_wl_unit_ptr = new WordlineUnit(m_wl_model_str, this, m_tech_param_ptr);
// decode unit
if (!m_is_fifo)
{
m_rowdec_width = (uint32_t)log2((double)m_num_entry);
m_rowdec_unit_ptr = new DecoderUnit(m_rowdec_model_str, m_rowdec_width, m_tech_param_ptr);
}
else
{
m_rowdec_unit_ptr = NULL;
}
return;
}

View file

@ -0,0 +1,120 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __SRAM_H__
#define __SRAM_H__
#include "mem/ruby/network/orion/Type.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
class OutdrvUnit;
class AmpUnit;
class BitlineUnit;
class MemUnit;
class PrechargeUnit;
class WordlineUnit;
class DecoderUnit;
class SRAM
{
public:
SRAM(
uint32_t num_entry_,
uint32_t line_width_,
bool is_fifo_,
bool is_outdrv_,
uint32_t num_read_port_,
uint32_t num_write_port_,
uint32_t num_data_end_,
const string& rowdec_model_str_,
const string& wl_model_str_,
const string& bl_pre_model_str_,
const string& mem_model_str_,
const string& bl_model_str_,
const string& amp_model_str_,
const string& outdrv_model_str_,
const TechParameter* tech_param_ptr_
);
~SRAM();
public:
uint32_t get_line_width() const { return m_line_width; }
uint32_t get_num_data_end() const { return m_num_data_end; }
uint32_t get_num_read_port() const { return m_num_read_port; }
uint32_t get_num_write_port() const { return m_num_write_port; }
uint32_t get_num_port() const { return (m_num_read_port+m_num_write_port); }
bool get_is_outdrv() const { return m_is_outdrv; }
uint32_t get_num_row() const { return m_num_entry; }
uint32_t get_num_col() const { return m_line_width; }
double calc_e_read(bool is_max_) const;
double calc_e_write(bool is_max_) const;
double calc_i_static() const;
private:
void init();
private:
uint32_t m_num_entry;
uint32_t m_line_width;
bool m_is_fifo;
bool m_is_outdrv;
string m_rowdec_model_str;
string m_wl_model_str;
string m_bl_pre_model_str;
string m_mem_model_str;
string m_bl_model_str;
string m_amp_model_str;
string m_outdrv_model_str;
const TechParameter* m_tech_param_ptr;
OutdrvUnit* m_outdrv_unit_ptr;
AmpUnit* m_amp_unit_ptr;
BitlineUnit* m_bl_unit_ptr;
MemUnit* m_mem_unit_ptr;
PrechargeUnit* m_bl_pre_unit_ptr;
WordlineUnit* m_wl_unit_ptr;
DecoderUnit* m_rowdec_unit_ptr;
uint32_t m_num_read_port;
uint32_t m_num_write_port;
uint32_t m_num_data_end;
uint32_t m_rowdec_width;
};
#endif

View file

@ -0,0 +1,150 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include "mem/ruby/network/orion/Buffer/WordlineUnit.hh"
#include "mem/ruby/network/orion/Buffer/SRAM.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
WordlineUnit::WordlineUnit(
const string& wl_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
)
{
if (wl_model_str_ == string("RW_WORDLINE"))
{
m_wl_model = RW_WORDLINE;
}
else if (wl_model_str_ == string("WO_WORDLINE"))
{
m_wl_model = WO_WORDLINE;
}
else
{
m_wl_model = NO_MODEL;
}
if (m_wl_model != NO_MODEL)
{
m_sram_ptr = sram_ptr_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
}
WordlineUnit::~WordlineUnit()
{}
void WordlineUnit::init()
{
uint32_t num_port = m_sram_ptr->get_num_port();
uint32_t num_read_port = m_sram_ptr->get_num_read_port();
uint32_t num_col = m_sram_ptr->get_num_col();
uint32_t num_data_end = m_sram_ptr->get_num_data_end();
double RegCellWidth = m_tech_param_ptr->get_RegCellWidth();
double BitlineSpacing = m_tech_param_ptr->get_BitlineSpacing();
if (num_data_end == 2)
{
m_wl_len = num_col*(RegCellWidth + 2*num_port*BitlineSpacing);
}
else
{
m_wl_len = num_col*(RegCellWidth + (2*num_port-num_read_port)*BitlineSpacing);
}
double wl_cmetal;
if (num_port > 1)
{
wl_cmetal = m_tech_param_ptr->get_CC3M3metal();
}
else
{
wl_cmetal = m_tech_param_ptr->get_CM3metal();
}
m_wl_wire_cap = m_wl_len*wl_cmetal;
double e_factor = m_tech_param_ptr->get_EnergyFactor();
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double Wmemcellw = m_tech_param_ptr->get_Wmemcellw();
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
double NMOS_TAB_0 = m_tech_param_ptr->get_NMOS_TAB(0);
double PMOS_TAB_0 = m_tech_param_ptr->get_PMOS_TAB(0);
switch(m_wl_model)
{
case RW_WORDLINE:
m_e_read = calc_wordline_cap(num_col*num_data_end, Wmemcellr) * e_factor;
m_e_write = calc_wordline_cap(num_col*2, Wmemcellw) * e_factor;
m_i_static = (Woutdrivern*NMOS_TAB_0 + Woutdriverp*PMOS_TAB_0);
break;
case WO_WORDLINE:
m_e_read = 0;
m_e_write = calc_wordline_cap(num_col*2, Wmemcellw)*e_factor;
m_i_static = 0;
break;
default:
printf("error\n");
}
return;
}
double WordlineUnit::calc_wordline_cap(
uint32_t num_mos_,
double mos_width_
) const
{
double total_cap;
// part 1: line cap, including gate cap of pass tx's and metal cap
double BitWidth = m_tech_param_ptr->get_BitWidth();
total_cap = m_tech_param_ptr->calc_gatecappass(mos_width_, BitWidth/2.0-mos_width_)*num_mos_ + m_wl_wire_cap;
// part 2: input driver
double period = m_tech_param_ptr->get_period();
double psize, nsize;
psize = m_tech_param_ptr->calc_driver_psize(total_cap, period/16.0);
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
nsize = psize*Wdecinvn/Wdecinvp;
// WHS: 20 should go to PARM
total_cap += m_tech_param_ptr->calc_draincap(nsize, TechParameter::NCH, 1) + m_tech_param_ptr->calc_draincap(psize, TechParameter::PCH, 1) + m_tech_param_ptr->calc_gatecap(psize+nsize, 20);
return total_cap;
}

View file

@ -0,0 +1,87 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __WORDLINEUNIT_H__
#define __WORDLINEUNIT_H__
#include "mem/ruby/network/orion/Type.hh"
class SRAM;
class TechParameter;
class WordlineUnit
{
public:
enum WordlineModel
{
NO_MODEL = 0,
RW_WORDLINE,
WO_WORDLINE
};
public:
WordlineUnit(
const string& wl_model_str_,
const SRAM* sram_ptr_,
const TechParameter* tech_param_ptr_
);
~WordlineUnit();
public:
double get_e_read() const { return m_e_read; }
double get_e_write() const { return m_e_write; }
double get_i_static() const { return m_i_static; }
private:
void init();
double calc_wordline_cap(uint32_t num_mos_, double mos_width_) const;
double calc_i_static();
private:
WordlineModel m_wl_model;
const SRAM* m_sram_ptr;
const TechParameter* m_tech_param_ptr;
double m_wl_len;
double m_wl_wire_cap;
double m_e_read;
double m_e_write;
double m_i_static;
};
#endif

View file

@ -0,0 +1,183 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include "mem/ruby/network/orion/Clock.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/Wire.hh"
Clock::Clock(
bool is_in_buf_,
bool is_in_shared_switch_,
bool is_out_buf_,
bool is_out_shared_switch_,
const OrionConfig* orion_cfg_ptr_
)
{
m_is_in_buf = is_in_buf_;
m_is_in_shared_switch = is_in_shared_switch_;
m_is_out_buf = is_out_buf_;
m_is_out_shared_switch = is_out_shared_switch_;
m_orion_cfg_ptr = orion_cfg_ptr_;
init();
}
Clock::~Clock()
{}
double Clock::get_dynamic_energy() const
{
return (m_e_pipe_reg + m_e_htree);
}
double Clock::get_static_power() const
{
double vdd = m_tech_param_ptr->get_vdd();
return (m_i_static*vdd);
}
void Clock::init()
{
m_tech_param_ptr = m_orion_cfg_ptr->get_tech_param_ptr();
double e_factor = m_tech_param_ptr->get_EnergyFactor();
// Pipeline registers capacitive load on clock network
uint32_t num_in_port = m_orion_cfg_ptr->get_num_in_port();
uint32_t num_out_port = m_orion_cfg_ptr->get_num_out_port();
uint32_t num_vclass = m_orion_cfg_ptr->get_num_vclass();
uint32_t num_vchannel = m_orion_cfg_ptr->get_num_vchannel();
uint32_t flit_width = m_orion_cfg_ptr->get_flit_width();
uint32_t num_pipe_reg = 0;
// pipeline registers after the link traversal stage
num_pipe_reg += num_in_port*flit_width;
// pipeline registers for input buffer
if (m_is_in_buf)
{
if (m_is_in_shared_switch)
{
num_pipe_reg += num_in_port*flit_width;
}
else
{
num_pipe_reg += num_in_port*num_vclass*num_vchannel*flit_width;
}
}
// pipeline registers for crossbar
if (m_is_out_shared_switch)
{
num_pipe_reg += num_out_port*flit_width;
}
else
{
num_pipe_reg += num_out_port*num_vclass*num_vchannel*flit_width;
}
// pipeline registers for output buffer
if (m_is_out_buf) // assume output buffers share links
{
num_pipe_reg += num_out_port*flit_width;
}
double cap_clock = m_tech_param_ptr->get_ClockCap();
m_e_pipe_reg = num_pipe_reg*cap_clock*e_factor;
//========================H_tree wiring load ========================*/
// The 1e-6 factor is to convert the "router_diagonal" back to meters.
// To be consistent we use micro-meters unit for our inputs, but
// the functions, internally, use meters. */
double i_static_nmos = 0;
double i_static_pmos = 0;
bool is_htree = m_orion_cfg_ptr->get<bool>("IS_HTREE_CLOCK");
if(is_htree)
{
const string& width_spacing_model_str = m_orion_cfg_ptr->get<string>("WIRE_WIDTH_SPACING");
const string& buf_scheme_str = m_orion_cfg_ptr->get<string>("WIRE_BUFFERING_MODEL");
bool is_shielding = m_orion_cfg_ptr->get<bool>("WIRE_IS_SHIELDING");
Wire wire(width_spacing_model_str, buf_scheme_str, is_shielding, m_tech_param_ptr);
double router_diagonal = m_orion_cfg_ptr->get<double>("ROUTER_DIAGONAL");
double Clockwire = m_tech_param_ptr->get_ClockCap();
double Reswire = m_tech_param_ptr->get_Reswire();
double htree_clockcap;
double htree_res;
int k;
double h;
double cap_clock_buf = 0;
double BufferNMOSOffCurrent = m_tech_param_ptr->get_BufferNMOSOffCurrent();
double BufferPMOSOffCurrent = m_tech_param_ptr->get_BufferPMOSOffCurrent();
if (m_tech_param_ptr->is_trans_type_hvt() || m_tech_param_ptr->is_trans_type_nvt())
{
htree_clockcap = (4+4+2+2)*(router_diagonal*1e-6)*Clockwire;
htree_res = (4+4+2+2)*(router_diagonal*1e-6)*Reswire;
wire.calc_opt_buffering(&k, &h, ((4+4+2+2)*router_diagonal*1e-6));
i_static_nmos = BufferNMOSOffCurrent*h*k*15;
i_static_pmos = BufferPMOSOffCurrent*h*k*15;
}
else
{
htree_clockcap = (8+4+4+4+4)*(router_diagonal*1e-6)*Clockwire;
htree_res = (8+4+4+4+4)*(router_diagonal*1e-6)*Reswire;
wire.calc_opt_buffering(&k, &h, ((4+4+2+2)*router_diagonal*1e-6));
i_static_nmos = BufferNMOSOffCurrent*h*k*29;
i_static_pmos = BufferPMOSOffCurrent*h*k*15;
}
cap_clock_buf = ((double)k)*cap_clock*h;
m_e_htree = (htree_clockcap+cap_clock)*e_factor;
}
else
{
m_e_htree = 0;
}
double SCALE_S = m_tech_param_ptr->get_SCALE_S();
double DFF_TAB_0 = m_tech_param_ptr->get_DFF_TAB(0);
double Wdff = m_tech_param_ptr->get_Wdff();
m_i_static = (((i_static_nmos+i_static_pmos)/2)/SCALE_S + (num_pipe_reg*DFF_TAB_0*Wdff));
}

View file

@ -0,0 +1,77 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __CLOCK_H__
#define __CLOCK_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class OrionConfig;
class Clock
{
public:
Clock(
bool is_in_buf_,
bool is_in_shared_switch_,
bool is_out_buf_,
bool is_out_shared_switch_,
const OrionConfig* orion_cfg_ptr_
);
~Clock();
public:
double get_dynamic_energy() const;
double get_static_power() const;
private:
void init();
double calc_cap_pipe_reg();
private:
bool m_is_in_buf;
bool m_is_in_shared_switch;
bool m_is_out_buf;
bool m_is_out_shared_switch;
const OrionConfig* m_orion_cfg_ptr;
const TechParameter* m_tech_param_ptr;
double m_e_pipe_reg;
double m_e_htree;
double m_i_static;
};
#endif

View file

@ -0,0 +1,170 @@
/*
* Copyright (c) 2010 Massachusetts Institute of Technology
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Chia-Hsin Owen Chen
*/
#include "mem/ruby/network/orion/ConfigFile.hh"
using std::string;
ConfigFile::ConfigFile( string filename, string delimiter,
string comment, string sentry )
: myDelimiter(delimiter), myComment(comment), mySentry(sentry)
{
// Construct a ConfigFile, getting keys and values from given file
std::ifstream in( filename.c_str() );
if( !in ) throw file_not_found( filename );
in >> (*this);
}
ConfigFile::ConfigFile()
: myDelimiter( string(1,'=') ), myComment( string(1,'#') )
{
// Construct a ConfigFile without a file; empty
}
void ConfigFile::remove( const string& key )
{
// Remove key and its value
myContents.erase( myContents.find( key ) );
return;
}
bool ConfigFile::keyExists( const string& key ) const
{
// Indicate whether key is found
mapci p = myContents.find( key );
return ( p != myContents.end() );
}
/* static */
void ConfigFile::trim( string& s )
{
// Remove leading and trailing whitespace
static const char whitespace[] = " \n\t\v\r\f";
s.erase( 0, s.find_first_not_of(whitespace) );
s.erase( s.find_last_not_of(whitespace) + 1U );
}
std::ostream& operator<<( std::ostream& os, const ConfigFile& cf )
{
// Save a ConfigFile to os
for( ConfigFile::mapci p = cf.myContents.begin();
p != cf.myContents.end();
++p )
{
os << p->first << " " << cf.myDelimiter << " ";
os << p->second << std::endl;
}
return os;
}
std::istream& operator>>( std::istream& is, ConfigFile& cf )
{
// Load a ConfigFile from is
// Read in keys and values, keeping internal whitespace
typedef string::size_type pos;
const string& delim = cf.myDelimiter; // separator
const string& comm = cf.myComment; // comment
const string& sentry = cf.mySentry; // end of file sentry
const pos skip = delim.length(); // length of separator
string nextline = ""; // might need to read ahead to see where value ends
while( is || nextline.length() > 0 )
{
// Read an entire line at a time
string line;
if( nextline.length() > 0 )
{
line = nextline; // we read ahead; use it now
nextline = "";
}
else
{
std::getline( is, line );
}
// Ignore comments
line = line.substr( 0, line.find(comm) );
// Check for end of file sentry
if( sentry != "" && line.find(sentry) != string::npos ) return is;
// Parse the line if it contains a delimiter
pos delimPos = line.find( delim );
if( delimPos < string::npos )
{
// Extract the key
string key = line.substr( 0, delimPos );
line.replace( 0, delimPos+skip, "" );
// See if value continues on the next line
// Stop at blank line, next line with a key, end of stream,
// or end of file sentry
bool terminate = false;
while( !terminate && is )
{
std::getline( is, nextline );
terminate = true;
string nlcopy = nextline;
ConfigFile::trim(nlcopy);
if( nlcopy == "" ) continue;
nextline = nextline.substr( 0, nextline.find(comm) );
if( nextline.find(delim) != string::npos )
continue;
if( sentry != "" && nextline.find(sentry) != string::npos )
continue;
nlcopy = nextline;
ConfigFile::trim(nlcopy);
if( nlcopy != "" ) line += "\n";
line += nextline;
terminate = false;
}
// Store key and value
ConfigFile::trim(key);
ConfigFile::trim(line);
cf.myContents[key] = line; // overwrites if key is repeated
}
}
return is;
}

View file

@ -0,0 +1,252 @@
// Class for reading named values from configuration files
// Richard J. Wagner v2.1 24 May 2004 wagnerr@umich.edu
// Copyright (c) 2004 Richard J. Wagner
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
// Typical usage
// -------------
//
// Given a configuration file "settings.inp":
// atoms = 25
// length = 8.0 # nanometers
// name = Reece Surcher
//
// Named values are read in various ways, with or without default values:
// ConfigFile config( "settings.inp" );
// int atoms = config.read<int>( "atoms" );
// double length = config.read( "length", 10.0 );
// string author, title;
// config.readInto( author, "name" );
// config.readInto( title, "title", string("Untitled") );
//
// See file example.cpp for more examples.
#ifndef CONFIGFILE_H
#define CONFIGFILE_H
#include <string>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
using std::string;
class ConfigFile {
// Data
protected:
string myDelimiter; // separator between key and value
string myComment; // separator between value and comments
string mySentry; // optional string to signal end of file
std::map<string,string> myContents; // extracted keys and values
typedef std::map<string,string>::iterator mapi;
typedef std::map<string,string>::const_iterator mapci;
// Methods
public:
ConfigFile( string filename,
string delimiter = "=",
string comment = "#",
string sentry = "EndConfigFile" );
ConfigFile();
// Search for key and read value or optional default value
template<class T> T read( const string& key ) const; // call as read<T>
template<class T> T read( const string& key, const T& value ) const;
template<class T> bool readInto( T& var, const string& key ) const;
template<class T>
bool readInto( T& var, const string& key, const T& value ) const;
// Modify keys and values
template<class T> void add( string key, const T& value );
void remove( const string& key );
// Check whether key exists in configuration
bool keyExists( const string& key ) const;
// Check or change configuration syntax
string getDelimiter() const { return myDelimiter; }
string getComment() const { return myComment; }
string getSentry() const { return mySentry; }
string setDelimiter( const string& s )
{ string old = myDelimiter; myDelimiter = s; return old; }
string setComment( const string& s )
{ string old = myComment; myComment = s; return old; }
// Write or read configuration
friend std::ostream& operator<<( std::ostream& os, const ConfigFile& cf );
friend std::istream& operator>>( std::istream& is, ConfigFile& cf );
protected:
template<class T> static string T_as_string( const T& t );
template<class T> static T string_as_T( const string& s );
static void trim( string& s );
// Exception types
public:
struct file_not_found {
string filename;
file_not_found( const string& filename_ = string() )
: filename(filename_) {} };
struct key_not_found { // thrown only by T read(key) variant of read()
string key;
key_not_found( const string& key_ = string() )
: key(key_) {} };
};
/* static */
template<class T>
string ConfigFile::T_as_string( const T& t )
{
// Convert from a T to a string
// Type T must support << operator
std::ostringstream ost;
ost << t;
return ost.str();
}
/* static */
template<class T>
T ConfigFile::string_as_T( const string& s )
{
// Convert from a string to a T
// Type T must support >> operator
T t;
std::istringstream ist(s);
ist >> t;
return t;
}
/* static */
template<>
inline string ConfigFile::string_as_T<string>( const string& s )
{
// Convert from a string to a string
// In other words, do nothing
return s;
}
/* static */
template<>
inline bool ConfigFile::string_as_T<bool>( const string& s )
{
// Convert from a string to a bool
// Interpret "false", "F", "no", "n", "0" as false
// Interpret "true", "T", "yes", "y", "1", "-1", or anything else as true
bool b = true;
string sup = s;
for( string::iterator p = sup.begin(); p != sup.end(); ++p )
*p = toupper(*p); // make string all caps
if( sup==string("FALSE") || sup==string("F") ||
sup==string("NO") || sup==string("N") ||
sup==string("0") || sup==string("NONE") )
b = false;
return b;
}
template<class T>
T ConfigFile::read( const string& key ) const
{
// Read the value corresponding to key
mapci p = myContents.find(key);
if( p == myContents.end() ) throw key_not_found(key);
return string_as_T<T>( p->second );
}
template<class T>
T ConfigFile::read( const string& key, const T& value ) const
{
// Return the value corresponding to key or given default value
// if key is not found
mapci p = myContents.find(key);
if( p == myContents.end() ) return value;
return string_as_T<T>( p->second );
}
template<class T>
bool ConfigFile::readInto( T& var, const string& key ) const
{
// Get the value corresponding to key and store in var
// Return true if key is found
// Otherwise leave var untouched
mapci p = myContents.find(key);
bool found = ( p != myContents.end() );
if( found ) var = string_as_T<T>( p->second );
return found;
}
template<class T>
bool ConfigFile::readInto( T& var, const string& key, const T& value ) const
{
// Get the value corresponding to key and store in var
// Return true if key is found
// Otherwise set var to given default
mapci p = myContents.find(key);
bool found = ( p != myContents.end() );
if( found )
var = string_as_T<T>( p->second );
else
var = value;
return found;
}
template<class T>
void ConfigFile::add( string key, const T& value )
{
// Add a key with given value
string v = T_as_string( value );
trim(key);
trim(v);
myContents[key] = v;
return;
}
#endif // CONFIGFILE_H
// Release notes:
// v1.0 21 May 1999
// + First release
// + Template read() access only through non-member readConfigFile()
// + ConfigurationFileBool is only built-in helper class
//
// v2.0 3 May 2002
// + Shortened name from ConfigurationFile to ConfigFile
// + Implemented template member functions
// + Changed default comment separator from % to #
// + Enabled reading of multiple-line values
//
// v2.1 24 May 2004
// + Made template specializations inline to avoid compiler-dependent linkage
// + Allowed comments within multiple-line values
// + Enabled blank line termination for multiple-line values
// + Added optional sentry to detect end of configuration file
// + Rewrote messy trimWhitespace() function as elegant trim()

View file

@ -0,0 +1,393 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/Crossbar/Crossbar.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/Crossbar/MatrixCrossbar.hh"
#include "mem/ruby/network/orion/Crossbar/MultreeCrossbar.hh"
using namespace std;
Crossbar::Crossbar(
CrossbarModel xbar_model_,
const string& conn_type_str_,
const string& trans_type_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
uint32_t num_in_seg_,
uint32_t num_out_seg_,
uint32_t degree_,
const TechParameter* tech_param_ptr_
)
{
m_xbar_model = xbar_model_;
if (m_xbar_model != NO_MODEL)
{
assert((num_in_ == num_in_) && (num_in_ != 0));
assert((num_out_ == num_out_) && (num_out_ != 0));
assert((data_width_ == data_width_) && (data_width_ != 0));
assert(num_in_seg_ == num_in_seg_);
assert(num_out_seg_ == num_out_seg_);
set_conn_type(conn_type_str_);
set_trans_type(trans_type_str_);
m_num_in = num_in_;
m_num_out = num_out_;
m_num_in_seg = num_in_seg_;
m_num_out_seg = num_out_seg_;
m_data_width = data_width_;
m_degree = degree_;
m_tech_param_ptr = tech_param_ptr_;
}
else
{
cerr << "ERROR at " << __FILE__ << " " << __LINE__ << endl;
}
}
Crossbar::~Crossbar()
{}
double Crossbar::get_static_power() const
{
double vdd = m_tech_param_ptr->get_vdd();
double SCALE_S = m_tech_param_ptr->get_SCALE_S();
return (m_i_static*vdd*SCALE_S);
}
void Crossbar::print_all() const
{
cout << "Crossbar" << endl;
cout << "\t" << "Traversal = " << get_dynamic_energy(false) << endl;
cout << "\t" << "Static power = " << get_static_power() << endl;
return;
}
void Crossbar::set_conn_type(const string& conn_type_str_)
{
if (conn_type_str_ == string("TRANS_GATE"))
{
m_conn_type = TRANS_GATE;
}
else if (conn_type_str_ == string("TRISTATE_GATE"))
{
m_conn_type = TRISTATE_GATE;
}
else
{
cerr << "Invalid connect type: '" << conn_type_str_ << "'. Use TRANS_GATE as default." << endl;
m_conn_type = TRANS_GATE;
}
return;
}
void Crossbar::set_trans_type(const string& trans_type_str_)
{
if (trans_type_str_ == string("NP_GATE"))
{
m_trans_type = NP_GATE;
}
else if (trans_type_str_ == string("N_GATE"))
{
m_trans_type = N_GATE;
}
else
{
cerr << "Invalid trans type: '" << trans_type_str_ << "'. Use N_GATE as default." << endl;
m_trans_type = N_GATE;
}
}
double Crossbar::calc_in_cap()
{
double total_cap = 0;
// part 1: wire cap
total_cap += m_cap_in_wire;
double trans_cap = 0;
// part 2: drain cap of transmission gate or gate cap of tri-state gate
if (m_conn_type == TRANS_GATE)
{
//FIXME: resizing strategy
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double nsize = Wmemcellr;
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double psize = nsize*Wdecinvp/Wdecinvn;
trans_cap = m_tech_param_ptr->calc_draincap(nsize, TechParameter::NCH, 1);
if (m_trans_type == NP_GATE)
{
trans_cap += m_tech_param_ptr->calc_draincap(psize, TechParameter::PCH, 1);
}
}
else if (m_conn_type == TRISTATE_GATE)
{
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
trans_cap = m_tech_param_ptr->calc_gatecap(Woutdrvnandn+Woutdrvnandp, 0)
+ m_tech_param_ptr->calc_gatecap(Woutdrvnorn+Woutdrvnorp, 0);
}
total_cap += trans_cap*m_num_out;
// segmented crossbar
if (m_num_in_seg > 1)
{
total_cap *= (m_num_in_seg+1)/(m_num_in_seg*2);
// input capacitance of tri-state buffer
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
total_cap += (m_num_in_seg+2)*(m_num_in_seg-1)/(m_num_in_seg*2)*(m_tech_param_ptr->calc_gatecap(Woutdrvnandn+Woutdrvnandp, 0)+m_tech_param_ptr->calc_gatecap(Woutdrvnorn+Woutdrvnorp, 0));
// output capacitance of tri-state buffer
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
total_cap += (m_num_in_seg-1)/2*(m_tech_param_ptr->calc_draincap(Woutdrivern, TechParameter::NCH, 1)+m_tech_param_ptr->calc_draincap(Woutdriverp, TechParameter::PCH, 1));
}
// part 3: input driver
//FIXME: how to specify timing
double period = m_tech_param_ptr->get_period();
double psize = m_tech_param_ptr->calc_driver_psize(total_cap, period/3.0);
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double nsize = psize*Wdecinvn/Wdecinvp;
total_cap += m_tech_param_ptr->calc_draincap(nsize, TechParameter::NCH, 1)+m_tech_param_ptr->calc_draincap(psize, TechParameter::PCH, 1)+m_tech_param_ptr->calc_gatecap(nsize+psize, 0);
return total_cap/2.0;
}
double Crossbar::calc_out_cap(uint32_t num_in_)
{
double total_cap = 0;
// part 1: wire cap
total_cap += m_cap_out_wire;
double trans_cap = 0;
// part 2: drain cap of transmission gate or tri-state gate
if (m_conn_type == TRANS_GATE)
{
// FIXME: resizing strategy
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double nsize = Wmemcellr;
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double psize = nsize*Wdecinvp/Wdecinvn;
trans_cap = m_tech_param_ptr->calc_draincap(nsize, TechParameter::NCH, 1);
if (m_trans_type == NP_GATE)
{
trans_cap += m_tech_param_ptr->calc_draincap(psize, TechParameter::PCH, 1);
}
}
else if (m_conn_type == TRISTATE_GATE)
{
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
trans_cap = m_tech_param_ptr->calc_draincap(Woutdrivern, TechParameter::NCH, 1)+m_tech_param_ptr->calc_draincap(Woutdriverp, TechParameter::PCH, 1);
}
total_cap += trans_cap*num_in_;
// segmented crossbar
if (m_num_out_seg > 1)
{
total_cap *= (m_num_out_seg+1)/(m_num_out_seg*2);
// input capacitance of tri-state buffer
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
total_cap += (m_num_out_seg+2)*(m_num_out_seg-1)/(m_num_out_seg*2)*(m_tech_param_ptr->calc_gatecap(Woutdrvnandn+Woutdrvnandp, 0)+m_tech_param_ptr->calc_gatecap(Woutdrvnorn+Woutdrvnorp, 0));
// output capacitance of tri-state buffer
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
total_cap += (m_num_out_seg-1)/2*(m_tech_param_ptr->calc_draincap(Woutdrivern, TechParameter::NCH, 1)+m_tech_param_ptr->calc_draincap(Woutdriverp, TechParameter::PCH, 1));
}
// part 3: output driver
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
total_cap += m_tech_param_ptr->calc_draincap(Woutdrivern, TechParameter::NCH, 1)+m_tech_param_ptr->calc_draincap(Woutdriverp, TechParameter::PCH, 1)+m_tech_param_ptr->calc_gatecap(Woutdrivern+Woutdriverp, 0);
return total_cap/2.0;
}
double Crossbar::calc_int_cap()
{
double total_cap = 0;
if (m_conn_type == TRANS_GATE)
{
// part 1: drain cap of transmission gate
//FIXME: Wmemcellr and resize
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double nsize = Wmemcellr;
double trans_cap = m_tech_param_ptr->calc_draincap(nsize, TechParameter::NCH, 1);
if (m_trans_type == NP_GATE)
{
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double psize = nsize*Wdecinvp/Wdecinvn;
trans_cap += m_tech_param_ptr->calc_draincap(psize, TechParameter::PCH, 1);
}
total_cap += trans_cap*(m_degree+1);
}
else if (m_conn_type == TRISTATE_GATE)
{
// part 1: drain cap of tri-state gate
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
double trans_cap = (m_tech_param_ptr->calc_draincap(Woutdrivern, TechParameter::NCH, 1)+m_tech_param_ptr->calc_draincap(Woutdriverp, TechParameter::PCH, 1))*m_degree;
// part 2: gate cap of tri-state gate
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
trans_cap += m_tech_param_ptr->calc_gatecap(Woutdrvnandn+Woutdrvnandp, 0)+m_tech_param_ptr->calc_gatecap(Woutdrvnorn+Woutdrvnorp, 0);
total_cap += trans_cap;
}
return total_cap/2.0;
}
double Crossbar::calc_ctr_cap(double cap_wire_, bool prev_ctr_, bool next_ctr_)
{
double total_cap = 0;
// part 1: wire cap
total_cap += cap_wire_;
double trans_cap = 0;
// part 2: gate cap of transmission gate or tri-state gate
if (m_conn_type == TRANS_GATE)
{
//FIXME Wmemcellr and resize
double Wmemcellr = m_tech_param_ptr->get_Wmemcellr();
double nsize = Wmemcellr;
double trans_cap = m_tech_param_ptr->calc_gatecap(nsize, 0);
if (m_trans_type == NP_GATE)
{
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double psize = nsize*Wdecinvp/Wdecinvn;
trans_cap += m_tech_param_ptr->calc_gatecap(psize, 0);
}
}
else if (m_conn_type == TRISTATE_GATE)
{
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
trans_cap = m_tech_param_ptr->calc_gatecap(Woutdrvnandn+Woutdrvnandp, 0)
+ m_tech_param_ptr->calc_gatecap(Woutdrvnorn+Woutdrvnorp, 0);
}
total_cap += trans_cap*m_data_width;
// part 3: inverter
if (!((m_conn_type == TRANS_GATE) && (m_trans_type == N_GATE) && (!prev_ctr_)))
{
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
total_cap += m_tech_param_ptr->calc_draincap(Wdecinvn, TechParameter::NCH, 1)+m_tech_param_ptr->calc_draincap(Wdecinvp, TechParameter::PCH, 1)
+ m_tech_param_ptr->calc_gatecap(Wdecinvn+Wdecinvp, 0);
}
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
// part 4: drain cap of previous level control signal
if (prev_ctr_)
{
// FIXME: need actual size, use decoder data for now
total_cap += m_degree*m_tech_param_ptr->calc_draincap(WdecNORn, TechParameter::NCH, 1)
+m_tech_param_ptr->calc_draincap(WdecNORp, TechParameter::PCH, m_degree);
}
// part 5: gate cap of next level control signal
if (next_ctr_)
{
// FIXME: need actual size, use decoder data for now
total_cap += m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, m_degree*40+20);
}
return total_cap;
}
Crossbar* Crossbar::create_crossbar(
const string& xbar_model_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
const OrionConfig* orion_cfg_ptr_
)
{
if (xbar_model_str_ == string("MATRIX_CROSSBAR"))
{
const string& conn_type_str = orion_cfg_ptr_->get<string>("CROSSBAR_CONNECT_TYPE");
const string& trans_type_str = orion_cfg_ptr_->get<string>("CROSSBAR_TRANS_GATE_TYPE");
uint32_t num_in_seg = orion_cfg_ptr_->get<uint32_t>("CROSSBAR_NUM_IN_SEG");
uint32_t num_out_seg = orion_cfg_ptr_->get<uint32_t>("CROSSBAR_NUM_OUT_SEG");
double len_in_wire = orion_cfg_ptr_->get<double>("CROSSBAR_LEN_IN_WIRE");
double len_out_wire = orion_cfg_ptr_->get<double>("CROSSBAR_LEN_OUT_WIRE");
const TechParameter* tech_param_ptr = orion_cfg_ptr_->get_tech_param_ptr();
return new MatrixCrossbar(conn_type_str, trans_type_str,
num_in_, num_out_, data_width_, num_in_seg, num_out_seg,
len_in_wire, len_out_wire, tech_param_ptr);
}
else if (xbar_model_str_ == string("MULTREE_CROSSBAR"))
{
const string& conn_type_str = orion_cfg_ptr_->get<string>("CROSSBAR_CONNECT_TYPE");
const string& trans_type_str = orion_cfg_ptr_->get<string>("CROSSBAR_TRANS_GATE_TYPE");
uint32_t degree = orion_cfg_ptr_->get<uint32_t>("CROSSBAR_MUX_DEGREE");
const TechParameter* tech_param_ptr = orion_cfg_ptr_->get_tech_param_ptr();
return new MultreeCrossbar(conn_type_str, trans_type_str,
num_in_, num_out_, data_width_, degree, tech_param_ptr);
}
else
{
cerr << "WARNING: No Crossbar model" << endl;
return (Crossbar*)NULL;
}
}

View file

@ -0,0 +1,130 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __CROSSBAR_H__
#define __CROSSBAR_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class OrionConfig;
class Crossbar
{
public:
enum CrossbarModel
{
NO_MODEL = 0,
MATRIX_CROSSBAR,
MULTREE_CROSSBAR
};
enum ConnectType
{
TRANS_GATE,
TRISTATE_GATE
};
enum TransType
{
N_GATE,
NP_GATE
};
public:
Crossbar(
CrossbarModel xbar_model_,
const string& conn_type_str_,
const string& trans_type_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
uint32_t num_in_seg_,
uint32_t num_out_seg_,
uint32_t degree_,
const TechParameter* tech_param_ptr_
);
virtual ~Crossbar() = 0;
public:
double get_len_req_wire() const { return m_len_req_wire; }
virtual double get_dynamic_energy(bool is_max_) const = 0;
double get_static_power() const;
void print_all() const;
protected:
void set_conn_type(const string& conn_type_str_);
void set_trans_type(const string& trans_type_str_);
double calc_in_cap();
double calc_out_cap(uint32_t num_in_);
double calc_int_cap();
double calc_ctr_cap(double cap_wire_, bool prev_ctr_, bool next_ctr_);
virtual double calc_i_static() = 0;
protected:
CrossbarModel m_xbar_model;
ConnectType m_conn_type;
TransType m_trans_type;
uint32_t m_num_in;
uint32_t m_num_out;
uint32_t m_data_width;
uint32_t m_num_in_seg;
uint32_t m_num_out_seg;
uint32_t m_degree;
const TechParameter* m_tech_param_ptr;
double m_cap_in_wire;
double m_cap_out_wire;
double m_cap_ctr_wire;
double m_len_req_wire;
double m_e_chg_in;
double m_e_chg_out;
double m_e_chg_ctr;
double m_e_chg_int;
double m_i_static;
public:
static Crossbar* create_crossbar(
const string& xbar_model_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
const OrionConfig* orion_cfg_ptr_
);
};
#endif

View file

@ -0,0 +1,152 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/Crossbar/MatrixCrossbar.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
MatrixCrossbar::MatrixCrossbar(
const string& conn_type_str_,
const string& trans_type_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
uint32_t num_in_seg_,
uint32_t num_out_seg_,
double len_in_wire_,
double len_out_wire_,
const TechParameter* tech_param_ptr_
) : Crossbar(
MATRIX_CROSSBAR, conn_type_str_, trans_type_str_,
num_in_, num_out_, data_width_, num_in_seg_, num_out_seg_,
0, tech_param_ptr_)
{
assert(len_in_wire_ == len_in_wire_);
assert(len_out_wire_ == len_out_wire_);
m_len_in_wire = len_in_wire_;
m_len_out_wire = len_out_wire_;
init();
}
MatrixCrossbar::~MatrixCrossbar()
{}
double MatrixCrossbar::get_dynamic_energy(bool is_max_) const
{
double e_atomic;
double e_access = 0;
e_atomic = m_e_chg_in*m_data_width*(is_max_? 1:0.5);
e_access += e_atomic;
e_atomic = m_e_chg_out*m_data_width*(is_max_? 1:0.5);
e_access += e_atomic;
e_atomic = m_e_chg_ctr;
e_access += e_atomic;
return e_access;
}
void MatrixCrossbar::init()
{
// FIXME: need accurate spacing
double CrsbarCellWidth = m_tech_param_ptr->get_CrsbarCellWidth();
double CrsbarCellHeight = m_tech_param_ptr->get_CrsbarCellHeight();
double len_in = m_num_out*m_data_width*CrsbarCellWidth;
double len_out = m_num_in*m_data_width*CrsbarCellHeight;
if(len_in > m_len_in_wire) m_len_in_wire = len_in;
if(len_out > m_len_out_wire) m_len_out_wire = len_out;
double CC3metal = m_tech_param_ptr->get_CC3metal();
m_cap_in_wire = CC3metal*m_len_in_wire;
m_cap_out_wire = CC3metal*m_len_out_wire;
double Cmetal = m_tech_param_ptr->get_Cmetal();
m_cap_ctr_wire = Cmetal*m_len_in_wire/2.0;
m_len_req_wire = m_len_in_wire;
double e_factor = m_tech_param_ptr->get_EnergyFactor();
m_e_chg_in = calc_in_cap()*e_factor;
m_e_chg_out = calc_out_cap(m_num_out)*e_factor;
//FIXME: wire length estimation, really reset?
//control signal should reset after transmission is done, so no 1/2
m_e_chg_ctr = calc_ctr_cap(m_cap_ctr_wire, 0, 0)*e_factor;
m_e_chg_int = 0;
m_i_static = calc_i_static();
return;
}
double MatrixCrossbar::calc_i_static()
{
double Woutdrvnandn = m_tech_param_ptr->get_Woutdrvnandn();
double Woutdrvnandp = m_tech_param_ptr->get_Woutdrvnandp();
double Woutdrvnorn = m_tech_param_ptr->get_Woutdrvnorn();
double Woutdrvnorp = m_tech_param_ptr->get_Woutdrvnorp();
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
double NAND2_TAB_0 = m_tech_param_ptr->get_NAND2_TAB(0);
double NAND2_TAB_1 = m_tech_param_ptr->get_NAND2_TAB(1);
double NAND2_TAB_2 = m_tech_param_ptr->get_NAND2_TAB(2);
double NAND2_TAB_3 = m_tech_param_ptr->get_NAND2_TAB(3);
double NOR2_TAB_0 = m_tech_param_ptr->get_NOR2_TAB(0);
double NOR2_TAB_1 = m_tech_param_ptr->get_NOR2_TAB(1);
double NOR2_TAB_2 = m_tech_param_ptr->get_NOR2_TAB(2);
double NOR2_TAB_3 = m_tech_param_ptr->get_NOR2_TAB(3);
double NMOS_TAB_0 = m_tech_param_ptr->get_NMOS_TAB(0);
double PMOS_TAB_0 = m_tech_param_ptr->get_PMOS_TAB(0);
double i_static = 0;
// tri-state buffers
i_static += ((Woutdrvnandp*(NAND2_TAB_0+NAND2_TAB_1+NAND2_TAB_2)+Woutdrvnandn*NAND2_TAB_3)/4
+ (Woutdrvnorp*NOR2_TAB_0+Woutdrvnorn*(NOR2_TAB_1+NOR2_TAB_2+NOR2_TAB_3))/4
+ Woutdrivern*NMOS_TAB_0+Woutdriverp*PMOS_TAB_0)*m_num_in*m_num_out*m_data_width;
// input driver
i_static += (Wdecinvn*NMOS_TAB_0+Wdecinvp*PMOS_TAB_0)*m_num_in*m_data_width;
// output driver
i_static += (Woutdrivern*NMOS_TAB_0+Woutdriverp*PMOS_TAB_0)*m_num_out*m_data_width;
// control siganl inverter
i_static += (Wdecinvn*NMOS_TAB_0+Wdecinvp*PMOS_TAB_0)*m_num_in*m_num_out;
return i_static;
}

View file

@ -0,0 +1,73 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __MATRIXCROSSBAR_H__
#define __MATRIXCROSSBAR_H__
#include "mem/ruby/network/orion/Type.hh"
#include "mem/ruby/network/orion/Crossbar/Crossbar.hh"
class TechParameter;
class MatrixCrossbar : public Crossbar
{
public:
MatrixCrossbar(
const string& conn_type_str_,
const string& trans_type_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
uint32_t num_in_seg_,
uint32_t num_out_seg_,
double len_in_wire_,
double len_out_wire_,
const TechParameter* tech_param_ptr_
);
~MatrixCrossbar();
public:
double get_dynamic_energy(bool is_max_) const;
private:
void init();
double calc_i_static();
private:
double m_len_in_wire;
double m_len_out_wire;
};
#endif

View file

@ -0,0 +1,162 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cmath>
#include "mem/ruby/network/orion/Crossbar/MultreeCrossbar.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
MultreeCrossbar::MultreeCrossbar(
const string& conn_type_str_,
const string& trans_type_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
uint32_t degree_,
const TechParameter *tech_param_ptr_
) : Crossbar(
MULTREE_CROSSBAR, conn_type_str_, trans_type_str_,
num_in_, num_out_, data_width_, 0, 0, degree_, tech_param_ptr_)
{
m_len_req_wire = 0;
init();
}
MultreeCrossbar::~MultreeCrossbar()
{}
double MultreeCrossbar::get_dynamic_energy(bool is_max_) const
{
double e_atomic;
double e_access = 0;
e_atomic = m_e_chg_in*m_data_width*(is_max_? 1:0.5);
e_access += e_atomic;
e_atomic = m_e_chg_out*m_data_width*(is_max_? 1:0.5);
e_access += e_atomic;
e_atomic = m_e_chg_ctr;
e_access += e_atomic;
if (m_depth > 1)
{
e_atomic = m_e_chg_int*m_data_width*(m_depth-1)*(is_max_? 1:0.5);
e_access += e_atomic;
}
return e_access;
}
void MultreeCrossbar::init()
{
double CrsbarCellWidth = m_tech_param_ptr->get_CrsbarCellWidth();
double CCmetal = m_tech_param_ptr->get_CCmetal();
double Lamda = m_tech_param_ptr->get_Lamda();
double CC3metal = m_tech_param_ptr->get_CC3metal();
double len_in_wire;
// input wire horizontal segment length
len_in_wire = m_num_in*m_data_width*CrsbarCellWidth*(m_num_out/2);
m_cap_in_wire = len_in_wire*CCmetal;
// input wire vertical segment length
len_in_wire = m_num_in*m_data_width*(5*Lamda)*(m_num_out/2);
m_cap_in_wire += len_in_wire*CC3metal;
m_cap_out_wire = 0;
double Cmetal = m_tech_param_ptr->get_Cmetal();
double len_ctr_wire = m_num_in*m_data_width*CrsbarCellWidth*(m_num_out/2)/2;
m_cap_ctr_wire = Cmetal*len_ctr_wire;
double e_factor = m_tech_param_ptr->get_EnergyFactor();
m_e_chg_in = calc_in_cap()*e_factor;
m_e_chg_out = calc_out_cap(m_degree)*e_factor;
m_e_chg_int = calc_int_cap()*e_factor;
m_depth = (uint32_t)ceil(log((double)m_num_in)/log((double)m_degree));
// control signal should reset after transmission is done
if (m_depth == 1)
{
// only one level of control sigal
m_e_chg_ctr = calc_ctr_cap(m_cap_ctr_wire, 0, 0)*e_factor;
}
else
{
// first level and last level control signals
m_e_chg_ctr = calc_ctr_cap(m_cap_ctr_wire, 0, 1)*e_factor + calc_ctr_cap(0, 1, 0)*e_factor;
// intermediate control signals
if (m_depth > 2)
{
m_e_chg_ctr += (m_depth-2)*calc_ctr_cap(0, 1, 1)*e_factor;
}
}
m_i_static = calc_i_static();
}
double MultreeCrossbar::calc_i_static()
{
double Wdecinvn = m_tech_param_ptr->get_Wdecinvn();
double Wdecinvp = m_tech_param_ptr->get_Wdecinvp();
double Woutdrivern = m_tech_param_ptr->get_Woutdrivern();
double Woutdriverp = m_tech_param_ptr->get_Woutdriverp();
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
double NOR2_TAB_0 = m_tech_param_ptr->get_NOR2_TAB(0);
double NOR2_TAB_1 = m_tech_param_ptr->get_NOR2_TAB(1);
double NOR2_TAB_2 = m_tech_param_ptr->get_NOR2_TAB(2);
double NOR2_TAB_3 = m_tech_param_ptr->get_NOR2_TAB(3);
double NMOS_TAB_0 = m_tech_param_ptr->get_NMOS_TAB(0);
double PMOS_TAB_0 = m_tech_param_ptr->get_PMOS_TAB(0);
double i_static = 0;
// input driver
i_static += (Wdecinvn*NMOS_TAB_0+Wdecinvp*PMOS_TAB_0)*m_num_in*m_data_width;
// output driver
i_static += (Woutdrivern*NMOS_TAB_0+Woutdriverp*PMOS_TAB_0)*m_num_out*m_data_width;
// mux
i_static += (WdecNORp*NOR2_TAB_0+WdecNORn*(NOR2_TAB_1+NOR2_TAB_2+NOR2_TAB_3))/4*(2*m_num_in-1)*m_num_out*m_data_width;
// control signal inverter
i_static += (Wdecinvn*NMOS_TAB_0+Wdecinvp*PMOS_TAB_0)*m_num_in*m_num_out;
return i_static;
}

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,41 +25,45 @@
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef _POWER_BUS_H
#define _POWER_BUS_H
#ifndef __MULTREECROSSBAR_H__
#define __MULTREECROSSBAR_H__
typedef enum {
RESULT_BUS = 1,
GENERIC_BUS,
BUS_MAX_MODEL
} power_bus_model;
#include "mem/ruby/network/orion/Type.hh"
#include "mem/ruby/network/orion/Crossbar/Crossbar.hh"
typedef enum {
IDENT_ENC = 1, /* identity encoding */
TRANS_ENC, /* transition encoding */
BUSINV_ENC, /* bus inversion encoding */
BUS_MAX_ENC
} power_bus_enc;
class TechParameter;
class MultreeCrossbar : public Crossbar
{
public:
MultreeCrossbar(
const string& conn_type_str_,
const string& trans_type_str_,
uint32_t num_in_,
uint32_t num_out_,
uint32_t data_width_,
uint32_t degree_,
const TechParameter* tech_param_ptr_
);
~MultreeCrossbar();
typedef struct {
int model;
int encoding;
unsigned data_width;
unsigned grp_width;
unsigned long int n_switch;
double e_switch;
/* redundant field */
unsigned bit_width;
unsigned long int bus_mask;
} power_bus;
public:
double get_dynamic_energy(bool is_max_) const;
extern int power_bus_init(power_bus *bus, int model, int encoding, unsigned width, unsigned grp_width, unsigned n_snd, unsigned n_rcv, double length, double time);
private:
void init();
double calc_i_static();
extern int bus_record(power_bus *bus, unsigned long int old_state, unsigned long int new_state);
extern double bus_report(power_bus *bus);
private:
uint32_t m_depth;
};
#endif

View file

@ -0,0 +1,36 @@
# Copyright (c) 2010 Massachusetts Institute of Technology
# 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;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# 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.
#
# Authors: Tushar Krishna
Import('*')
if not env['RUBY']:
Return()
Source('Crossbar.cc')
Source('MatrixCrossbar.cc')
Source('MultreeCrossbar.cc')

View file

@ -0,0 +1,138 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/FlipFlop.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
FlipFlop::FlipFlop(
const string& ff_model_str_,
double load_,
const TechParameter* tech_param_ptr_
)
{
if (ff_model_str_ == string("NEG_DFF"))
{
m_ff_model = NEG_DFF;
}
else
{
m_ff_model = NO_MODEL;
}
if (m_ff_model != NO_MODEL)
{
assert(load_ == load_);
m_load = load_;
m_tech_param_ptr = tech_param_ptr_;
init();
}
}
FlipFlop::~FlipFlop()
{}
void FlipFlop::init()
{
double c1, c2, c3, c4, c5, c6;
double e_factor = m_tech_param_ptr->get_EnergyFactor();
switch(m_ff_model)
{
case NEG_DFF:
c1 = c5 = c6 = calc_node_cap(2, 1);
c2 = calc_node_cap(2, 3);
c3 = calc_node_cap(3, 2);
c4 = calc_node_cap(2, 3);
m_e_switch = (c1+c2+c3+c4+c5+c6+m_load)*e_factor/2.0;
// no 1/2 for e_keep and e_clock because clock signal switches twice in one cycle
m_e_keep_1 = c3*e_factor;
m_e_keep_0 = c2*e_factor;
m_e_clock = calc_clock_cap()*e_factor;
m_i_static = calc_i_static();
break;
default:
cerr << "error" << endl;
}
return;
}
//this model is based on the gate-level design given by Randy H. Katz "Contemporary Logic Design"
//Figure 6.24, node numbers (1-6) are assigned to all gate outputs, left to right, top to bottom
//
//We should have pure cap functions and leave the decision of whether or not to have coefficient
//1/2 in init function.
double FlipFlop::calc_node_cap(uint32_t num_fanin_, uint32_t num_fanout_)
{
double total_cap = 0;
//FIXME: all need actual size
//part 1: drain cap of NOR gate
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
total_cap += num_fanin_*m_tech_param_ptr->calc_draincap(WdecNORn, TechParameter::NCH, 1) + m_tech_param_ptr->calc_draincap(WdecNORp, TechParameter::PCH, num_fanin_);
//part 2: gate cap of NOR gate
total_cap += num_fanout_*m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0);
return total_cap;
}
double FlipFlop::calc_clock_cap()
{
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
return (2*m_tech_param_ptr->calc_gatecap(WdecNORn+WdecNORp, 0));
}
double FlipFlop::calc_i_static()
{
double WdecNORn = m_tech_param_ptr->get_WdecNORn();
double WdecNORp = m_tech_param_ptr->get_WdecNORp();
double NOR2_TAB_0 = m_tech_param_ptr->get_NOR2_TAB(0);
double NOR2_TAB_1 = m_tech_param_ptr->get_NOR2_TAB(1);
double NOR2_TAB_2 = m_tech_param_ptr->get_NOR2_TAB(2);
double NOR2_TAB_3 = m_tech_param_ptr->get_NOR2_TAB(3);
return (WdecNORp*NOR2_TAB_0 + WdecNORn*(NOR2_TAB_1+NOR2_TAB_2+NOR2_TAB_3))/4*6;
}

View file

@ -0,0 +1,87 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __FLIPFLOP_H__
#define __FLIPFLOP_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class FlipFlop
{
public:
enum FFModel
{
NO_MODEL = 0,
NEG_DFF
};
public:
FlipFlop(
const string& ff_model_str_,
double load_,
const TechParameter* tech_param_ptr_
);
~FlipFlop();
public:
double get_e_switch() const { return m_e_switch; }
double get_e_keep_1() const { return m_e_keep_1; }
double get_e_keep_0() const { return m_e_keep_0; }
double get_e_clock() const { return m_e_clock; }
double get_i_static() const { return m_i_static; }
private:
void init();
double calc_node_cap(uint32_t num_fanin_, uint32_t num_fanout_);
double calc_clock_cap();
double calc_i_static();
private:
FFModel m_ff_model;
const TechParameter* m_tech_param_ptr;
double m_load;
double m_e_switch;
double m_e_keep_1;
double m_e_keep_0;
double m_e_clock;
double m_i_static;
};
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2010 Massachusetts Institute of Technology
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,407 +24,236 @@
* 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.
*
* Authors: Chia-Hsin Owen Chen
* Tushar Krishna
*/
#include <stdio.h>
#include <math.h>
#include "mem/ruby/network/orion/power_router_init.hh"
#include "mem/ruby/network/orion/power_array.hh"
#include "mem/ruby/network/orion/power_crossbar.hh"
#include "mem/ruby/network/orion/power_arbiter.hh"
#include "mem/ruby/network/orion/power_bus.hh"
#include "mem/ruby/network/orion/NetworkPower.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
#include "mem/ruby/network/orion/SIM_port.hh"
#include "mem/ruby/network/orion/parm_technology.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/OrionRouter.hh"
#include "mem/ruby/network/orion/OrionLink.hh"
/* --------- Static energy calculation functions ------------ */
//Input buffer
double SIM_reg_stat_energy(power_array_info *info, power_array *arr, double n_read, double n_write)
double
Router_d::calculate_power()
{
double Eavg = 0, Eatomic, Estruct, Estatic;
//Network Activities from garnet
calculate_performance_numbers();
double sim_cycles;
sim_cycles = g_eventQueue_ptr->getTime() - m_network_ptr->getRubyStartTime();
// Number of virtual networks/message classes declared in Ruby
// maybe greater than active virtual networks.
// Estimate active virtual networks for correct power estimates
int num_active_vclass = 0;
std::vector<bool > active_vclass_ary;
active_vclass_ary.resize(m_virtual_networks);
/* decoder */
if (info->row_dec_model) {
//row decoder
Estruct = 0;
/* assume switch probability 0.5 for address bits */
//input
Eatomic = arr->row_dec.e_chg_addr * arr->row_dec.n_bits * SWITCHING_FACTOR * (n_read + n_write);
Estruct += Eatomic;
std::vector<double > vc_local_arbit_count_active;
std::vector<double > vc_global_arbit_count_active;
std::vector<double > buf_read_count_active;
std::vector<double > buf_write_count_active;
//output
Eatomic = arr->row_dec.e_chg_output * (n_read + n_write);
Estruct += Eatomic;
/* assume all 1st-level decoders change output */
//internal node
Eatomic = arr->row_dec.e_chg_l1 * arr->row_dec.n_in_2nd * (n_read + n_write);
Estruct += Eatomic;
Eavg += Estruct;
}
/* wordline */
Estruct = 0;
//read
Eatomic = arr->data_wordline.e_read * n_read;
Estruct += Eatomic;
//write
Eatomic = arr->data_wordline.e_write * n_write;
Estruct += Eatomic;
Eavg += Estruct;
/* bitlines */
Estruct = 0;
//read
if (arr->data_bitline.end == 2) {
Eatomic = arr->data_bitline.e_col_read * info->eff_data_cols * n_read;
}
else {
/* assume switch probability 0.5 for single-ended bitlines */
Eatomic = arr->data_bitline.e_col_read * info->eff_data_cols * SWITCHING_FACTOR * n_read;
}
Estruct += Eatomic;
//write
/* assume switch probability 0.5 for write bitlines */
Eatomic = arr->data_bitline.e_col_write * info->data_width * SWITCHING_FACTOR * n_write;
Estruct += Eatomic;
//precharge
Eatomic = arr->data_bitline_pre.e_charge * info->eff_data_cols * n_read;
Estruct += Eatomic;
Eavg += Estruct;
/* memory cells */
Estruct = 0;
/* assume switch probability 0.5 for memory cells */
Eatomic = arr->data_mem.e_switch * info->data_width * SWITCHING_FACTOR * n_write;
Estruct += Eatomic;
Eavg += Estruct;
/* sense amplifier */
if (info->data_end == 2) {
Estruct = 0;
Eatomic = arr->data_amp.e_access * info->eff_data_cols * n_read;
Estruct += Eatomic;
Eavg += Estruct;
}
/* output driver */
if (info->outdrv_model) {
Estruct = 0;
//enable
Eatomic = arr->outdrv.e_select * n_read;
Estruct += Eatomic;
//data
/* same switch probability as bitlines */
Eatomic = arr->outdrv.e_chg_data * arr->outdrv.item_width * SWITCHING_FACTOR * info->n_item * info->assoc * n_read;
Estruct += Eatomic;
//output 1
/* assume 1 and 0 are uniformly distributed */
if (arr->outdrv.e_out_1 >= arr->outdrv.e_out_0 ) {
Eatomic = arr->outdrv.e_out_1 * arr->outdrv.item_width * SWITCHING_FACTOR * n_read;
Estruct += Eatomic;
}
//output 0
if (arr->outdrv.e_out_1 < arr->outdrv.e_out_0) {
Eatomic = arr->outdrv.e_out_0 * arr->outdrv.item_width * SWITCHING_FACTOR * n_read;
Estruct += Eatomic;
for (int i =0; i < m_virtual_networks; i++) {
if (vc_local_arbit_count[i] > 0) {
num_active_vclass++;
active_vclass_ary[i] = true;
vc_local_arbit_count_active.push_back(vc_local_arbit_count[i]);
vc_global_arbit_count_active.push_back(vc_global_arbit_count[i]);
buf_read_count_active.push_back(buf_read_count[i]);
buf_write_count_active.push_back(buf_write_count[i]);
}
else {
// Inactive vclass
assert(vc_global_arbit_count[i] == 0);
active_vclass_ary[i] = false;
}
}
Eavg += Estruct;
}
// Orion Initialization
OrionConfig* orion_cfg_ptr;
OrionRouter* orion_rtr_ptr;
static double freq_Hz;
/* static power */
Estatic = arr->i_leakage * Vdd * Period * SCALE_S;
const string cfg_fn = "src/mem/ruby/network/orion/router.cfg";
orion_cfg_ptr = new OrionConfig(cfg_fn);
freq_Hz = orion_cfg_ptr->get<double>("FREQUENCY");
//static energy
Eavg += Estatic;
uint32_t num_in_port = m_input_unit.size();
uint32_t num_out_port = m_output_unit.size();
uint32_t num_vclass = num_active_vclass;
std::vector<uint32_t > vclass_type_ary;
return Eavg;
for (int i = 0; i < m_virtual_networks; i++) {
if (active_vclass_ary[i]) {
int temp_vc = i*m_vc_per_vnet;
vclass_type_ary.push_back((uint32_t) m_network_ptr->get_vnet_type(temp_vc));
}
}
assert(vclass_type_ary.size() == num_active_vclass);
uint32_t num_vc_per_vclass = m_vc_per_vnet;
uint32_t in_buf_per_data_vc = m_network_ptr->getBuffersPerDataVC();
uint32_t in_buf_per_ctrl_vc = m_network_ptr->getBuffersPerCtrlVC();
uint32_t flit_width = m_flit_width * 8; //flit width in bits
orion_rtr_ptr = new OrionRouter(
num_in_port,
num_out_port,
num_vclass,
vclass_type_ary,
num_vc_per_vclass,
in_buf_per_data_vc,
in_buf_per_ctrl_vc,
flit_width,
orion_cfg_ptr
);
//Power Calculation
double Pbuf_wr_dyn = 0.0;
double Pbuf_rd_dyn = 0.0;
double Pvc_arb_local_dyn = 0.0;
double Pvc_arb_global_dyn = 0.0;
double Psw_arb_local_dyn = 0.0;
double Psw_arb_global_dyn = 0.0;
double Pxbar_dyn = 0.0;
double Pclk_dyn = 0.0;
double Ptotal_dyn = 0.0;
double Pbuf_sta = 0.0;
double Pvc_arb_sta = 0.0;
double Psw_arb_sta = 0.0;
double Pxbar_sta = 0.0;
double Ptotal_sta = 0.0;
double Ptotal = 0.0;
//Dynamic Power
// Note: For each active arbiter in vc_arb or sw_arb of size T:1,
// assuming half the requests (T/2) are high on average.
// TODO: estimate expected value of requests from simulation.
for (int i = 0; i < num_vclass; i++) {
// Buffer Write
Pbuf_wr_dyn +=
orion_rtr_ptr->calc_dynamic_energy_buf(i, WRITE_MODE, false)*
(buf_write_count_active[i]/sim_cycles)*freq_Hz;
// Buffer Read
Pbuf_rd_dyn +=
orion_rtr_ptr->calc_dynamic_energy_buf(i, READ_MODE, false)*
(buf_read_count_active[i]/sim_cycles)*freq_Hz;
// VC arbitration local
// Each input VC arbitrates for one output VC (in its vclass)
// at its output port.
// Arbiter size: num_vc_per_vclass:1
Pvc_arb_local_dyn +=
orion_rtr_ptr->calc_dynamic_energy_local_vc_arb(i,
num_vc_per_vclass/2, false)*
(vc_local_arbit_count_active[i]/sim_cycles)*
freq_Hz;
// VC arbitration global
// Each output VC chooses one input VC out of all possible requesting
// VCs (within vclass) at all input ports
// Arbiter size: num_in_port*num_vc_per_vclass:1
// Round-robin at each input VC for outvcs in the local stage will
// try to keep outvc conflicts to the minimum.
// Assuming conflicts due to request for same outvc from
// num_in_port/2 requests.
// TODO: use garnet to estimate this
Pvc_arb_global_dyn +=
orion_rtr_ptr->calc_dynamic_energy_global_vc_arb(i,
num_in_port/2, false)*
(vc_global_arbit_count_active[i]/sim_cycles)*
freq_Hz;
}
// Switch Allocation Local
// Each input port chooses one input VC as requestor
// Arbiter size: num_vclass*num_vc_per_vclass:1
Psw_arb_local_dyn +=
orion_rtr_ptr->calc_dynamic_energy_local_sw_arb(
num_vclass*num_vc_per_vclass/2, false)*
(sw_local_arbit_count/sim_cycles)*
freq_Hz;
// Switch Allocation Global
// Each output port chooses one input port as winner
// Arbiter size: num_in_port:1
Psw_arb_global_dyn +=
orion_rtr_ptr->calc_dynamic_energy_global_sw_arb(
num_in_port/2, false)*
(sw_global_arbit_count/sim_cycles)*
freq_Hz;
// Crossbar
Pxbar_dyn +=
orion_rtr_ptr->calc_dynamic_energy_xbar(false)*
(crossbar_count/sim_cycles)*freq_Hz;
// Clock
Pclk_dyn += orion_rtr_ptr->calc_dynamic_energy_clock()*freq_Hz;
// Total
Ptotal_dyn = Pbuf_wr_dyn + Pbuf_rd_dyn +
Pvc_arb_local_dyn + Pvc_arb_global_dyn +
Psw_arb_local_dyn + Psw_arb_global_dyn +
Pxbar_dyn +
Pclk_dyn;
// Static Power
Pbuf_sta = orion_rtr_ptr->get_static_power_buf();
Pvc_arb_sta = orion_rtr_ptr->get_static_power_va();
Psw_arb_sta = orion_rtr_ptr->get_static_power_sa();
Pxbar_sta = orion_rtr_ptr->get_static_power_xbar();
Ptotal_sta += Pbuf_sta + Pvc_arb_sta + Psw_arb_sta + Pxbar_sta;
Ptotal = Ptotal_dyn + Ptotal_sta;
return Ptotal;
}
//crossbar
double SIM_crossbar_stat_energy(power_crossbar *crsbar, double n_data)
double
NetworkLink_d::calculate_power()
{
double Eavg = 0, Eatomic;
OrionConfig* orion_cfg_ptr;
OrionLink* orion_link_ptr;
static double freq_Hz;
double link_length;
int channel_width;
if (n_data > crsbar->n_out) {
n_data = crsbar->n_out;
}
// Initialization
const string cfg_fn = "src/mem/ruby/network/orion/router.cfg";
orion_cfg_ptr = new OrionConfig(cfg_fn);
freq_Hz = orion_cfg_ptr->get<double>("FREQUENCY");
link_length = orion_cfg_ptr->get<double>("LINK_LENGTH");
channel_width = m_net_ptr->getFlitSize();
orion_link_ptr = new OrionLink(
link_length,
channel_width /* channel width */,
orion_cfg_ptr);
switch (crsbar->model) {
case MATRIX_CROSSBAR:
case CUT_THRU_CROSSBAR:
case MULTREE_CROSSBAR:
/* assume 0.5 data switch probability */
//input
Eatomic = crsbar->e_chg_in * crsbar->data_width * SWITCHING_FACTOR * n_data;
Eavg += Eatomic;
// Dynamic Power
double sim_cycles =
(double)(g_eventQueue_ptr->getTime() - m_net_ptr->getRubyStartTime());
//output
Eatomic = crsbar->e_chg_out * crsbar->data_width * SWITCHING_FACTOR * n_data;
Eavg += Eatomic;
double Plink_dyn = orion_link_ptr->calc_dynamic_energy(channel_width/2)*
(m_link_utilized/ sim_cycles)*freq_Hz;
//control
Eatomic = crsbar->e_chg_ctr * n_data;
Eavg += Eatomic;
// Static Power
double Plink_sta = orion_link_ptr->get_static_power();
if (crsbar->model == MULTREE_CROSSBAR && crsbar->depth > 1) {
//internal node
Eatomic = crsbar->e_chg_int * crsbar->data_width * (crsbar->depth - 1) * SWITCHING_FACTOR * n_data;
Eavg += Eatomic;
}
break;
double Ptotal = Plink_dyn + Plink_sta;
default: break;/* some error handler */
}
return Eavg;
}
//arbiter
/* stat over one cycle */
/* info is only used by queuing arbiter */
double SIM_arbiter_stat_energy(power_arbiter *arb, power_array_info *info, double n_req)
{
double Eavg = 0, Estruct, Eatomic;
double total_pri, n_chg_pri, n_grant;
/* energy cycle distribution */
if (n_req > arb->req_width) {
n_req = arb->req_width;
}
if (n_req >= 1) n_grant = 1;
else n_grant = 1.0 / ceil(1.0 / n_req);
switch (arb->model) {
case RR_ARBITER:
/* FIXME: we may overestimate request switch */
//request
Eatomic = arb->e_chg_req * n_req;
Eavg += Eatomic;
//grant
Eatomic = arb->e_chg_grant * n_grant;
Eavg += Eatomic;
/* assume carry signal propagates half length in average case */
/* carry does not propagate in maximum case, i.e. all carrys go down */
//carry
Eatomic = arb->e_chg_carry * arb->req_width * SWITCHING_FACTOR * n_grant;
Eavg += Eatomic;
//internal carry
Eatomic = arb->e_chg_carry_in * (arb->req_width * SWITCHING_FACTOR - 1) * n_grant;
Eavg += Eatomic;
/* priority registers */
Estruct = 0;
//priority
//switch
Eatomic = arb->pri_ff.e_switch * 2 * n_grant;
Estruct += Eatomic;
//keep 0
Eatomic = arb->pri_ff.e_keep_0 * (arb->req_width - 2 * n_grant);
Estruct += Eatomic;
//clock
Eatomic = arb->pri_ff.e_clock * arb->req_width;
Estruct += Eatomic;
Eavg += Estruct;
break;
case MATRIX_ARBITER:
total_pri = arb->req_width * (arb->req_width - 1) * 0.5;
/* assume switch probability 0.5 for priorities */
n_chg_pri = (arb->req_width - 1) * SWITCHING_FACTOR;
/* FIXME: we may overestimate request switch */
//request
Eatomic = arb->e_chg_req * n_req;
Eavg += Eatomic;
//grant
Eatomic = arb->e_chg_grant * n_grant;
Eavg += Eatomic;
/* priority registers */
Estruct = 0;
//priority
//switch
Eatomic = arb->pri_ff.e_switch * n_chg_pri * n_grant;
Estruct += Eatomic;
/* assume 1 and 0 are uniformly distributed */
//keep 0
if (arb->pri_ff.e_keep_0 >= arb->pri_ff.e_keep_1) {
Eatomic = arb->pri_ff.e_keep_0 * (total_pri - n_chg_pri * n_grant) * SWITCHING_FACTOR;
Estruct += Eatomic;
}
//keep 1
if (arb->pri_ff.e_keep_0 < arb->pri_ff.e_keep_1) {
Eatomic = arb->pri_ff.e_keep_1 * (total_pri - n_chg_pri * n_grant) * SWITCHING_FACTOR;
Estruct += Eatomic;
}
//clock
Eatomic = arb->pri_ff.e_clock * total_pri;
Estruct += Eatomic;
Eavg += Estruct;
/* based on above assumptions */
//internal node
/* p(n-1)/2 + (n-1)/2 */
Eatomic = arb->e_chg_mint * (n_req + 1) * (arb->req_width - 1) * 0.5;
Eavg += Eatomic;
break;
case QUEUE_ARBITER:
/* FIXME: what if n_req > 1? */
Eavg = SIM_reg_stat_energy(info, &arb->queue, n_req, n_grant);
break;
default: break;/* some error handler */
}
return Eavg;
}
double SIM_bus_stat_energy(power_bus *bus, double e_link)
{
double Ebus;
Ebus = bus->e_switch * e_link * SWITCHING_FACTOR * bus->bit_width;
return (Ebus);
}
double Router_d::calculate_offline_power(power_router *router, power_router_info *info)
{
double Eavg = 0;
double P_in_buf, P_xbar, P_vc_in_arb, P_vc_out_arb, P_sw_in_arb, P_sw_out_arb, P_leakage, P_total;
double E_in_buf, E_xbar, E_vc_in_arb, E_vc_out_arb, E_sw_in_arb, E_sw_out_arb, E_leakage;
double e_in_buf_read, e_in_buf_write, e_crossbar, e_vc_local_arb, e_vc_global_arb, e_sw_local_arb, e_sw_global_arb;
double sim_cycles;
sim_cycles = g_eventQueue_ptr->getTime() - m_network_ptr->getRubyStartTime();
calculate_performance_numbers();
//counts obtained from perf. simulator
e_in_buf_read = (double )(buf_read_count/sim_cycles);
e_in_buf_write = (double )(buf_write_count/sim_cycles);
e_crossbar = (double )(crossbar_count/sim_cycles);
e_vc_local_arb = (double)(vc_local_arbit_count/sim_cycles);
e_vc_global_arb = (double)(vc_global_arbit_count/sim_cycles);
e_sw_local_arb = (double )(sw_local_arbit_count/sim_cycles);
e_sw_global_arb = (double )(sw_global_arbit_count/sim_cycles);
// e_link = (double )(link_traversal_count/sim_cycles);
/* input buffers */
if (info->in_buf)
E_in_buf = SIM_reg_stat_energy(&info->in_buf_info, &router->in_buf, e_in_buf_read, e_in_buf_write);
P_in_buf = E_in_buf * PARM_Freq;
Eavg += E_in_buf;
/* main crossbar */
if (info->crossbar_model)
E_xbar= SIM_crossbar_stat_energy(&router->crossbar, e_crossbar);
P_xbar = E_xbar * PARM_Freq;
Eavg += E_xbar;
/* vc input (local) arbiter */
if (info->vc_in_arb_model)
E_vc_in_arb = SIM_arbiter_stat_energy(&router->vc_in_arb, &info->vc_in_arb_queue_info, e_sw_local_arb);
P_vc_in_arb = E_vc_in_arb * PARM_Freq;
Eavg += E_vc_in_arb;
/* vc output (global) arbiter */
if (info->vc_out_arb_model)
E_vc_out_arb = SIM_arbiter_stat_energy(&router->vc_out_arb, &info->vc_out_arb_queue_info, e_sw_global_arb);
P_vc_out_arb = E_vc_out_arb * PARM_Freq;
Eavg += E_vc_out_arb;
/* sw input (local) arbiter */
if (info->sw_in_arb_model)
E_sw_in_arb = SIM_arbiter_stat_energy(&router->sw_in_arb, &info->sw_in_arb_queue_info, e_sw_local_arb);
P_sw_in_arb = E_sw_in_arb * PARM_Freq;
Eavg += E_sw_in_arb;
/* sw output (global) arbiter */
if (info->sw_out_arb_model)
E_sw_out_arb = SIM_arbiter_stat_energy(&router->sw_out_arb, &info->sw_out_arb_queue_info, e_sw_global_arb);
P_sw_out_arb = E_sw_out_arb * PARM_Freq;
Eavg += E_sw_out_arb;
/* static power */
E_leakage = router->i_leakage * Vdd * Period * SCALE_S;
P_leakage = E_leakage * PARM_Freq;
Eavg += E_leakage;
P_total = Eavg * PARM_Freq;
return Eavg;
}
double NetworkLink_d::calculate_offline_power(power_bus* bus)
{
double sim_cycles = (double) (g_eventQueue_ptr->getTime() - m_net_ptr->getRubyStartTime());
double e_link = (double) (m_link_utilized)/ sim_cycles;
double E_link = SIM_bus_stat_energy(bus, e_link);
double P_link = E_link * PARM_Freq;
return P_link;
}
double NetworkLink_d::calculate_power()
{
power_bus bus;
power_bus_init(&bus, GENERIC_BUS, IDENT_ENC, PARM_flit_width, 0, 1, 1, PARM_link_length, 0);
double total_power = calculate_offline_power(&bus);
return total_power;
}
void Router_d::power_router_initialize(power_router *router, power_router_info *info)
{
info->n_in = m_input_unit.size();
info->n_out = m_output_unit.size();
info->flit_width = PARM_flit_width;
info->n_v_channel = m_num_vcs;
info->n_v_class = m_virtual_networks;
}
double Router_d::calculate_power()
{
power_router router;
power_router_info router_info;
double total_energy, total_power;
power_router_initialize(&router, &router_info);
power_router_init(&router, &router_info);
total_energy = calculate_offline_power(&router, &router_info);
total_power = total_energy * PARM_Freq;
return total_power;
return Ptotal;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2010 Massachusetts Institute of Technology
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,9 +24,24 @@
* 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.
*
* Authors: Chia-Hsin Owen Chen
* Tushar Krishna
*/
#ifndef _NETWORK_POWER_H
#define _NETWORK_POWER_H
#ifndef POWER_TRACE_H
#define POWER_TRACE_H
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "mem/ruby/network/garnet/fixed-pipeline/NetworkLink_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.hh"
#include "mem/ruby/network/garnet/fixed-pipeline/Router_d.hh"
//int RW :
#define READ_MODE 0
#define WRITE_MODE 1
#endif

View file

@ -0,0 +1,201 @@
/*
* Copyright (c) 2010 Massachusetts Institute of Technology
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Chia-Hsin Owen Chen
*/
#include <iostream>
#include <string>
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/ConfigFile.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
string OrionConfig::ms_param_name[] = {
"TECH_NODE",
"TRANSISTOR_TYPE",
"VDD",
"FREQUENCY",
"NUM_INPUT_PORT",
"NUM_OUTPUT_PORT",
"FLIT_WIDTH",
"NUM_VIRTUAL_CLASS",
"NUM_VIRTUAL_CHANNEL",
"IS_IN_SHARED_BUFFER",
"IS_OUT_SHARED_BUFFER",
"IS_IN_SHARED_SWITCH",
"IS_OUT_SHARED_SWITCH",
"IS_INPUT_BUFFER",
"IN_BUF_MODEL",
"IN_BUF_NUM_SET",
"IN_BUF_NUM_READ_PORT",
"IS_OUTPUT_BUFFER",
"OUT_BUF_MODEL",
"OUT_BUF_NUM_SET",
"OUT_BUF_NUM_WRITE_PORT",
"SRAM_NUM_DATA_END",
"SRAM_ROWDEC_MODEL",
"SRAM_ROWDEC_PRE_MODEL",
"SRAM_WORDLINE_MODEL",
"SRAM_BITLINE_PRE_MODEL",
"SRAM_BITLINE_MODEL",
"SRAM_AMP_MODEL",
"SRAM_OUTDRV_MODEL",
"CROSSBAR_MODEL",
"CROSSBAR_CONNECT_TYPE",
"CROSSBAR_TRANS_GATE_TYPE",
"CROSSBAR_MUX_DEGREE",
"CROSSBAR_NUM_IN_SEG",
"CROSSBAR_NUM_OUT_SEG",
"CROSSBAR_LEN_IN_WIRE",
"CROSSBAR_LEN_OUT_WIRE",
"VA_MODEL",
"VA_IN_ARB_MODEL",
"VA_IN_ARB_FF_MODEL",
"VA_OUT_ARB_MODEL",
"VA_OUT_ARB_FF_MODEL",
"VA_BUF_MODEL",
"SA_IN_ARB_MODEL",
"SA_IN_ARB_FF_MODEL",
"SA_OUT_ARB_MODEL",
"SA_OUT_ARB_FF_MODEL",
"LINK_LENGTH",
"WIRE_LAYER_TYPE",
"WIRE_WIDTH_SPACING",
"WIRE_BUFFERING_MODEL",
"WIRE_IS_SHIELDING",
"IS_HTREE_CLOCK",
"ROUTER_DIAGONAL"
};
OrionConfig::OrionConfig(const string& cfg_fn_)
{
uint32_t num_param = sizeof(ms_param_name)/sizeof(string);
for(uint32_t i = 0; i < num_param; i++)
{
m_params_map[ms_param_name[i]] = "NOT_SET";
}
read_file(cfg_fn_);
m_tech_param_ptr = new TechParameter(this);
}
OrionConfig::OrionConfig(const OrionConfig& orion_cfg_)
{
m_params_map = orion_cfg_.m_params_map;
m_num_in_port = orion_cfg_.m_num_in_port;
m_num_out_port = orion_cfg_.m_num_out_port;
m_num_vclass = orion_cfg_.m_num_vclass;
m_num_vchannel = orion_cfg_.m_num_vchannel;
m_in_buf_num_set = orion_cfg_.m_in_buf_num_set;
m_flit_width = orion_cfg_.m_flit_width;
m_tech_param_ptr = new TechParameter(this);
}
OrionConfig::~OrionConfig()
{
delete m_tech_param_ptr;
}
void OrionConfig::set_num_in_port(uint32_t num_in_port_)
{
m_params_map[string("NUM_INPUT_PORT")] = T_as_string<uint32_t>(num_in_port_);
m_num_in_port = num_in_port_;
return;
}
void OrionConfig::set_num_out_port(uint32_t num_out_port_)
{
m_params_map[string("NUM_OUTPUT_PORT")] = T_as_string<uint32_t>(num_out_port_);
m_num_out_port = num_out_port_;
return;
}
void OrionConfig::set_num_vclass(uint32_t num_vclass_)
{
m_params_map[string("NUM_VIRTUAL_CLASS")] = T_as_string<uint32_t>(num_vclass_);
m_num_vclass = num_vclass_;
return;
}
void OrionConfig::set_num_vchannel(uint32_t num_vchannel_)
{
m_params_map[string("NUM_VIRTUAL_CHANNEL")] = T_as_string<uint32_t>(num_vchannel_);
m_num_vchannel = num_vchannel_;
return;
}
void OrionConfig::set_in_buf_num_set(uint32_t in_buf_num_set_)
{
m_params_map[string("IN_BUF_NUM_SET")] = T_as_string<uint32_t>(in_buf_num_set_);
m_in_buf_num_set = in_buf_num_set_;
return;
}
void OrionConfig::set_flit_width(uint32_t flit_width_)
{
m_params_map[string("FLIT_WIDTH")] = T_as_string<uint32_t>(flit_width_);
m_flit_width = flit_width_;
return;
}
void OrionConfig::read_file(
const string& filename_
)
{
ConfigFile cfg_file(filename_);
uint32_t num_param = sizeof(ms_param_name)/sizeof(string);
for(uint32_t i = 0; i < num_param; i++)
{
cfg_file.readInto(m_params_map[ms_param_name[i]], ms_param_name[i]);
}
m_num_in_port = get<uint32_t>("NUM_INPUT_PORT");
m_num_out_port = get<uint32_t>("NUM_OUTPUT_PORT");
m_num_vclass = get<uint32_t>("NUM_VIRTUAL_CLASS");
m_num_vchannel = get<uint32_t>("NUM_VIRTUAL_CHANNEL");
m_in_buf_num_set = get<uint32_t>("IN_BUF_NUM_SET");
m_flit_width = get<uint32_t>("FLIT_WIDTH");
return;
}
void OrionConfig::print_config(ostream& out_)
{
uint32_t num_param = sizeof(ms_param_name)/sizeof(string);
for(uint32_t i = 0; i < num_param; i++)
{
out_ << ms_param_name[i] << " = " << m_params_map[ms_param_name[i]] << endl;
}
return;
}

View file

@ -0,0 +1,158 @@
/*
* Copyright (c) 2010 Massachusetts Institute of Technology
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Chia-Hsin Owen Chen
*/
#ifndef __ORIONCONFIG_H__
#define __ORIONCONFIG_H__
#include <iostream>
#include <sstream>
#include <map>
#include "mem/ruby/network/orion/Type.hh"
using namespace std;
class TechParameter;
class OrionConfig
{
public:
OrionConfig(const string& cfg_fn_);
OrionConfig(const OrionConfig& orion_cfg_);
~OrionConfig();
public:
void set_num_in_port(uint32_t num_in_port_);
void set_num_out_port(uint32_t num_out_port_);
void set_num_vclass(uint32_t num_vclass_);
void set_num_vchannel(uint32_t num_vchannel_);
void set_in_buf_num_set(uint32_t in_buf_num_set_);
void set_flit_width(uint32_t flit_width_);
void read_file(const string& filename_);
void print_config(ostream& out_);
public:
template<class T>
T get(const string& key_) const;
const TechParameter* get_tech_param_ptr() const { return m_tech_param_ptr; }
uint32_t get_num_in_port() const { return m_num_in_port; }
uint32_t get_num_out_port() const { return m_num_out_port; }
uint32_t get_num_vclass() const { return m_num_vclass; }
uint32_t get_num_vchannel() const { return m_num_vchannel; }
uint32_t get_in_buf_num_set() const { return m_in_buf_num_set; }
uint32_t get_flit_width() const { return m_flit_width; }
private:
map<string, string> m_params_map;
TechParameter* m_tech_param_ptr;
uint32_t m_num_in_port;
uint32_t m_num_out_port;
uint32_t m_num_vclass;
uint32_t m_num_vchannel;
uint32_t m_in_buf_num_set;
uint32_t m_flit_width;
protected:
struct key_not_found
{
string m_key;
key_not_found(const string& key_ = string()) : m_key(key_)
{}
};
template<class T>
static T string_as_T(const string& str_);
template<class T>
static string T_as_string(const T& t_);
private:
static string ms_param_name[];
};
template<class T>
T OrionConfig::get(const string& key_) const
{
map<string, string>::const_iterator it;
it = m_params_map.find(key_);
if (it == m_params_map.end())
{
cerr << key_ << " NOT FOUND!" << endl;
throw key_not_found(key_);
}
return string_as_T<T>(it->second);
}
template<class T>
T OrionConfig::string_as_T(const string& str_)
{
T ret;
std::istringstream ist(str_);
ist >> ret;
return ret;
}
template<>
inline string OrionConfig::string_as_T<string>(const string& str_)
{
return str_;
}
template<>
inline bool OrionConfig::string_as_T<bool>(const string& str_)
{
bool ret;
if (str_ == string("TRUE"))
{
ret = true;
}
else if (str_ == string("FALSE"))
{
ret = false;
}
else
{
cerr << "Invalid bool value: '" << str_ << "'. Treated as FALSE." << endl;
ret = false;
}
return ret;
}
template<class T>
string OrionConfig::T_as_string(const T& t)
{
std::ostringstream ost;
ost << t;
return ost.str();
}
#endif

View file

@ -0,0 +1,98 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cassert>
#include "mem/ruby/network/orion/OrionLink.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/Wire.hh"
using namespace std;
OrionLink::OrionLink(
double len_,
uint32_t line_width_,
const OrionConfig* orion_cfg_ptr_
)
{
assert(len_ == len_);
assert(line_width_ == line_width_);
m_len = len_;
m_line_width = line_width_;
m_orion_cfg_ptr = orion_cfg_ptr_;
init();
}
OrionLink::~OrionLink()
{}
double OrionLink::calc_dynamic_energy(uint32_t num_bit_flip_) const
{
assert(num_bit_flip_ <= m_line_width);
return (num_bit_flip_*(m_dynamic_energy_per_bit/2));
}
double OrionLink::get_static_power() const
{
return (m_line_width*m_static_power_per_bit);
}
void OrionLink::init()
{
const TechParameter* tech_param_ptr = m_orion_cfg_ptr->get_tech_param_ptr();
const string& width_spacing_model_str = m_orion_cfg_ptr->get<string>("WIRE_WIDTH_SPACING");
const string& buf_scheme_str = m_orion_cfg_ptr->get<string>("WIRE_BUFFERING_MODEL");
bool is_shielding = m_orion_cfg_ptr->get<bool>("WIRE_IS_SHIELDING");
Wire wire(width_spacing_model_str, buf_scheme_str, is_shielding, tech_param_ptr);
m_dynamic_energy_per_bit = wire.calc_dynamic_energy(m_len);
m_static_power_per_bit = wire.calc_static_power(m_len);
return;
}
void OrionLink::print() const
{
cout << "Link - Dynamic Energy" << endl;
cout << "\t" << "One Bit = " << calc_dynamic_energy(1) << endl;
cout << endl;
cout << "Link - Static Power" << endl;
cout << "\t" << "One Bit = " << get_static_power() << endl;
cout << endl;
return;
}

View file

@ -0,0 +1,72 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __ORIONLINK_H__
#define __ORIONLINK_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class OrionConfig;
class OrionLink
{
public:
OrionLink(
double len_,
uint32_t line_width_,
const OrionConfig* orion_cfg_ptr_
);
~OrionLink();
public:
double calc_dynamic_energy(uint32_t num_bit_flip_) const;
double get_static_power() const;
void print() const;
private:
void init();
private:
double m_len;
uint32_t m_line_width;
const OrionConfig* m_orion_cfg_ptr;
double m_dynamic_energy_per_bit;
double m_static_power_per_bit;
};
#endif

View file

@ -0,0 +1,495 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <cassert>
#include "OrionRouter.hh"
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/Buffer/Buffer.hh"
#include "mem/ruby/network/orion/Crossbar/Crossbar.hh"
#include "mem/ruby/network/orion/Allocator/VCAllocator.hh"
#include "mem/ruby/network/orion/Allocator/SWAllocator.hh"
#include "mem/ruby/network/orion/Clock.hh"
OrionRouter::OrionRouter(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
std::vector<uint32_t > vclass_type_ary_,
uint32_t num_vc_per_vclass_,
uint32_t in_buf_per_data_vc_,
uint32_t in_buf_per_ctrl_vc_,
uint32_t flit_width_,
OrionConfig* orion_cfg_ptr_
)
{
assert((num_in_port_ == num_in_port_) && (num_in_port_ != 0));
assert((num_out_port_ == num_out_port_) && (num_out_port_ != 0));
assert((num_vclass_ == num_vclass_) && (num_vclass_ != 0));
assert((num_vc_per_vclass_ == num_vc_per_vclass_) && (num_vc_per_vclass_ != 0));
assert(in_buf_per_data_vc_ != 0);
assert(in_buf_per_ctrl_vc_ != 0);
assert((flit_width_ == flit_width_) && (flit_width_ != 0));
orion_cfg_ptr_->set_num_in_port(num_in_port_);
orion_cfg_ptr_->set_num_out_port(num_out_port_);
orion_cfg_ptr_->set_num_vclass(num_vclass_);
orion_cfg_ptr_->set_flit_width(flit_width_);
m_orion_cfg_ptr = orion_cfg_ptr_;
m_num_in_port = m_orion_cfg_ptr->get<uint32_t>("NUM_INPUT_PORT");
m_num_out_port = m_orion_cfg_ptr->get<uint32_t>("NUM_OUTPUT_PORT");
m_flit_width = m_orion_cfg_ptr->get<uint32_t>("FLIT_WIDTH");
m_num_vclass = m_orion_cfg_ptr->get<uint32_t>("NUM_VIRTUAL_CLASS");
m_num_vc_per_vclass_ary = new uint32_t [m_num_vclass];
m_in_buf_num_set_ary = new uint32_t [m_num_vclass];
for (int i = 0; i < m_num_vclass; i++)
{
// can also suppport different vcs per vclass
m_num_vc_per_vclass_ary[i] = num_vc_per_vclass_;
if (vclass_type_ary_[i] == 0) // ctrl
m_in_buf_num_set_ary[i] = in_buf_per_ctrl_vc_;
else if (vclass_type_ary_[i] == 1) // data
m_in_buf_num_set_ary[i] = in_buf_per_data_vc_;
else
assert(0);
}
init();
}
OrionRouter::~OrionRouter()
{
delete[] m_num_vc_per_vclass_ary;
delete[] m_in_buf_num_set_ary;
if (m_in_buf_ary_ptr)
{
for (uint32_t i = 0; i < m_num_vclass; i++)
{
delete m_in_buf_ary_ptr[i];
}
delete[] m_in_buf_ary_ptr;
}
if (m_va_ary_ptr)
{
for (uint32_t i = 0; i < m_num_vclass; i++)
{
delete m_va_ary_ptr[i];
}
delete[] m_va_ary_ptr;
}
delete m_xbar_ptr;
delete m_sa_ptr;
delete m_clk_ptr;
}
double OrionRouter::calc_dynamic_energy_buf(uint32_t vclass_id_, bool is_read_, bool is_max_) const
{
assert(vclass_id_ < m_num_vclass);
if (m_in_buf_ary_ptr)
{
if (m_in_buf_ary_ptr[vclass_id_])
{
return m_in_buf_ary_ptr[vclass_id_]->get_dynamic_energy(is_read_, is_max_);
}
else
{
return 0;
}
}
else
{
return 0;
}
}
double OrionRouter::calc_dynamic_energy_xbar(bool is_max_) const
{
if (m_xbar_ptr)
{
return m_xbar_ptr->get_dynamic_energy(is_max_);
}
else
{
return 0;
}
}
double OrionRouter::calc_dynamic_energy_local_vc_arb(uint32_t vclass_id_, double num_req_, bool is_max_) const
{
assert(vclass_id_ < m_num_vclass);
if (m_va_ary_ptr)
{
if (m_va_ary_ptr[vclass_id_])
{
return m_va_ary_ptr[vclass_id_]->get_dynamic_energy_local_vc_arb(num_req_, is_max_);
}
else
{
return 0;
}
}
else
{
return 0;
}
}
double OrionRouter::calc_dynamic_energy_global_vc_arb(uint32_t vclass_id_, double num_req_, bool is_max_) const
{
assert(vclass_id_ < m_num_vclass);
if (m_va_ary_ptr)
{
if (m_va_ary_ptr[vclass_id_])
{
return m_va_ary_ptr[vclass_id_]->get_dynamic_energy_global_vc_arb(num_req_, is_max_);
}
else
{
return 0;
}
}
else
{
return 0;
}
}
//double OrionRouter::calc_dynamic_energy_vc_select(bool is_read_, bool is_max_) const
//{
// if (m_vc_select_ptr)
// {
// return m_vc_select_ptr->get_dynamic_energy_vc_select(is_read_, is_max_);
// }
// else
// {
// return 0;
// }
//}
double OrionRouter::calc_dynamic_energy_local_sw_arb(double num_req_, bool is_max_) const
{
if (m_sa_ptr)
{
return m_sa_ptr->get_dynamic_energy_local_sw_arb(num_req_, is_max_);
}
else
{
return 0;
}
}
double OrionRouter::calc_dynamic_energy_global_sw_arb(double num_req_, bool is_max_) const
{
if (m_sa_ptr)
{
return m_sa_ptr->get_dynamic_energy_global_sw_arb(num_req_, is_max_);
}
else
{
return 0;
}
}
double OrionRouter::calc_dynamic_energy_clock() const
{
if (m_clk_ptr)
{
return m_clk_ptr->get_dynamic_energy();
}
else
{
return 0;
}
}
double OrionRouter::get_static_power_buf() const
{
if (m_in_buf_ary_ptr)
{
double total_static_power = 0;
for (uint32_t i = 0; i < m_num_vclass; i++)
{
uint32_t num_in_buf;
if (m_is_in_shared_buf)
{
num_in_buf = m_num_in_port;
}
else
{
num_in_buf = m_num_vc_per_vclass_ary[i]*m_num_in_port;
}
total_static_power += m_in_buf_ary_ptr[i]->get_static_power()*(double)num_in_buf;
}
return total_static_power;
}
else
{
return 0;
}
}
double OrionRouter::get_static_power_xbar() const
{
if (m_xbar_ptr)
{
return m_xbar_ptr->get_static_power();
}
else
{
return 0;
}
}
double OrionRouter::get_static_power_va() const
{
if (m_va_ary_ptr)
{
double total_static_power = 0;
for (uint32_t i = 0; i < m_num_vclass; i++)
{
total_static_power += m_va_ary_ptr[i]->get_static_power();
}
return total_static_power;
}
else
{
return 0;
}
}
//double OrionRouter::get_static_power_vc_select() const
//{
// if (m_vc_select_ptr)
// {
// return m_vc_select_ptr->get_static_power();
// }
// else
// {
// return 0;
// }
//}
double OrionRouter::get_static_power_sa() const
{
if (m_sa_ptr)
{
return m_sa_ptr->get_static_power();
}
else
{
return 0;
}
}
double OrionRouter::get_static_power_clock() const
{
if (m_clk_ptr)
{
return m_clk_ptr->get_static_power();
}
else
{
return 0;
}
}
void OrionRouter::init()
{
m_total_num_vc = 0;
for (uint32_t i = 0; i < m_num_vclass; i++)
{
m_total_num_vc += m_num_vc_per_vclass_ary[i];
}
if (m_total_num_vc > 1)
{
m_is_in_shared_buf = m_orion_cfg_ptr->get<bool>("IS_IN_SHARED_BUFFER");
m_is_out_shared_buf = m_orion_cfg_ptr->get<bool>("IS_OUT_SHARED_BUFFER");
m_is_in_shared_switch = m_orion_cfg_ptr->get<bool>("IS_IN_SHARED_SWITCH");
m_is_out_shared_switch = m_orion_cfg_ptr->get<bool>("IS_OUT_SHARED_SWITCH");
}
else
{
m_is_in_shared_buf = false;
m_is_out_shared_buf = false;
m_is_in_shared_switch = false;
m_is_out_shared_switch = false;
}
//input buffer
bool is_in_buf = m_orion_cfg_ptr->get<bool>("IS_INPUT_BUFFER");
if (is_in_buf)
{
bool is_fifo = true;
bool is_outdrv = (!m_is_in_shared_buf) && (m_is_in_shared_switch);
const string& in_buf_model_str = m_orion_cfg_ptr->get<string>("IN_BUF_MODEL");
m_in_buf_ary_ptr = new Buffer* [m_num_vclass];
for (uint32_t i = 0; i < m_num_vclass; i++)
{
uint32_t in_buf_num_read_port = m_orion_cfg_ptr->get<uint32_t>("IN_BUF_NUM_READ_PORT");
uint32_t in_buf_num_set = m_in_buf_num_set_ary[i];
m_in_buf_ary_ptr[i] = new Buffer(in_buf_model_str, is_fifo, is_outdrv,
in_buf_num_set, m_flit_width, in_buf_num_read_port, 1, m_orion_cfg_ptr);
}
}
else
{
m_in_buf_ary_ptr = NULL;
}
bool is_out_buf = m_orion_cfg_ptr->get<bool>("IS_OUTPUT_BUFFER");
//crossbar
uint32_t num_switch_in;
if (is_in_buf)
{
if (m_is_in_shared_buf)
{
uint32_t in_buf_num_read_port = m_orion_cfg_ptr->get<uint32_t>("IN_BUF_NUM_READ_PORT");
num_switch_in = in_buf_num_read_port*m_num_in_port;
}
else if (m_is_in_shared_switch)
{
num_switch_in = 1*m_num_in_port;
}
else
{
num_switch_in = m_total_num_vc*m_num_in_port;
}
}
else
{
num_switch_in = 1*m_num_in_port;
}
uint32_t num_switch_out;
if (is_out_buf)
{
if (m_is_out_shared_buf)
{
uint32_t out_buf_num_write_port = m_orion_cfg_ptr->get<uint32_t>("OUT_BUF_NUM_WRITE_PORT");
num_switch_out = out_buf_num_write_port*m_num_out_port;
}
else if (m_is_out_shared_switch)
{
num_switch_out = 1*m_num_out_port;
}
else
{
num_switch_out = m_total_num_vc*m_num_out_port;
}
}
else
{
num_switch_out = 1*m_num_out_port;
}
const string& xbar_model_str = m_orion_cfg_ptr->get<string>("CROSSBAR_MODEL");
m_xbar_ptr = Crossbar::create_crossbar(xbar_model_str,
num_switch_in, num_switch_out, m_flit_width, m_orion_cfg_ptr);
//vc allocator
const string& va_model_str = m_orion_cfg_ptr->get<string>("VA_MODEL");
m_va_ary_ptr = new VCAllocator* [m_num_vclass];
//m_vc_select_ary_ptr = new VCAllocator* [m_num_vclass];
for (uint32_t i = 0; i < m_num_vclass; i++)
{
m_va_ary_ptr[i] = VCAllocator::create_vcallocator(va_model_str,
m_num_in_port, m_num_out_port, 1, m_num_vc_per_vclass_ary[i],
m_orion_cfg_ptr);
//m_vc_select_ary_ptr[i] = VCAllocator::create_vcallocator("VC_SELECT",
// m_num_in_port, m_num_out_port, 1, m_num_vc_per_vclass_ary[i], m_orion_cfg_ptr);
}
//sw allocator
m_sa_ptr = SWAllocator::create_swallocator(
m_num_in_port, m_num_out_port, 1, m_total_num_vc,
m_xbar_ptr, m_orion_cfg_ptr);
//cloc
m_clk_ptr = new Clock(is_in_buf, m_is_in_shared_switch, is_out_buf, m_is_out_shared_switch, m_orion_cfg_ptr);
return;
}
void OrionRouter::print() const
{
if (m_in_buf_ary_ptr)
{
for (uint32_t i = 0; i < m_num_vclass; i++)
{
cout << "VClass " << i << endl;
if (m_in_buf_ary_ptr[i]) m_in_buf_ary_ptr[i]->print_all();
}
}
m_xbar_ptr->print_all();
for (uint32_t i = 0; i < m_num_vclass; i++)
{
cout << "VClass " << i << endl;
m_va_ary_ptr[i]->print_all();
//m_vc_select_ary_ptr[i]->print_all();
}
m_sa_ptr->print_all();
//cout << "Router - Dynamic Energy" << endl;
//cout << "\t" << "Buffer Read = " << calc_dynamic_energy_buf(true) << endl;
//cout << "\t" << "Buffer Write = " << calc_dynamic_energy_buf(false) << endl;
//cout << "\t" << "Crossbar = " << calc_dynamic_energy_xbar() << endl;
//cout << "\t" << "Local VC Allocator(1) = " << calc_dynamic_energy_local_vc_arb(1) << endl;
//cout << "\t" << "Global VC Allocator(1) = " << calc_dynamic_energy_global_vc_arb(1) << endl;
//cout << "\t" << "VC Select Read = " << calc_dynamic_energy_vc_select(true) << endl;
//cout << "\t" << "VC Select Write = " << calc_dynamic_energy_vc_select(false) << endl;
//cout << "\t" << "Local SW Allocator(2) = " << calc_dynamic_energy_local_sw_arb(1) << endl;
//cout << "\t" << "Global SW Allocator(2) = " << calc_dynamic_energy_global_sw_arb(1) << endl;
//cout << "\t" << "Clock = " << calc_dynamic_energy_clock() << endl;
//cout << endl;
//cout << "Router - Static Power" << endl;
//cout << "\t" << "Buffer = " << get_static_power_buf() << endl;
//cout << "\t" << "Crossbar = " << get_static_power_xbar() << endl;
//cout << "\t" << "VC Allocator = " << get_static_power_va() << endl;
//cout << "\t" << "SW Allocator = " << get_static_power_sa() << endl;
//cout << "\t" << "Clock = " << get_static_power_clock() << endl;
//cout << endl;
return;
}

View file

@ -0,0 +1,119 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __ORIONROUTER_H__
#define __ORIONROUTER_H__
#include <vector>
#include "mem/ruby/network/orion/Type.hh"
class OrionConfig;
class Buffer;
class Crossbar;
class VCAllocator;
class SWAllocator;
class Clock;
class OrionRouter
{
public:
OrionRouter(
const OrionConfig* orion_cfg_ptr_
);
//values in cfg file will be modified
OrionRouter(
uint32_t num_in_port_,
uint32_t num_out_port_,
uint32_t num_vclass_,
std::vector<uint32_t > vclass_type_,
uint32_t num_vc_per_vclass_,
uint32_t in_buf_per_data_vc_,
uint32_t in_buf_per_ctrl_vc_,
uint32_t flit_width_,
OrionConfig* orion_cfg_ptr_
);
~OrionRouter();
public:
//double calc_dynamic_energy(double e_fin_, bool is_max_ = false) const;
//double calc_dynamic_energy_in_buf(bool is_read_, bool is_max_ = false) const;
//double calc_dynamic_energy_out_buf(bool is_read_, bool is_max_ = false) const;
double calc_dynamic_energy_buf(uint32_t vclass_id_, bool is_read_, bool is_max_ = false) const;
double calc_dynamic_energy_xbar(bool is_max_ = false) const;
double calc_dynamic_energy_local_vc_arb(uint32_t vclass_id_, double num_req_, bool is_max_ = false) const;
double calc_dynamic_energy_global_vc_arb(uint32_t vclass_id_, double num_req_, bool is_max_ = false) const;
//double calc_dynamic_energy_vc_select(uint32_t vclass_id_, bool is_read_, bool is_max_ = false) const;
double calc_dynamic_energy_local_sw_arb(double num_req_, bool is_max_ = false) const;
double calc_dynamic_energy_global_sw_arb(double num_req_, bool is_max_ = false) const;
double calc_dynamic_energy_clock() const;
double get_static_power_buf() const;
double get_static_power_xbar() const;
double get_static_power_va() const;
double get_static_power_sa() const;
double get_static_power_clock() const;
void print() const;
void init();
private:
const OrionConfig* m_orion_cfg_ptr;
uint32_t m_num_in_port;
uint32_t m_num_out_port;
uint32_t m_flit_width;
uint32_t m_num_vclass;
uint32_t num_vc_per_vclass_;
uint32_t m_total_num_vc;
uint32_t* m_num_vc_per_vclass_ary;
uint32_t* m_in_buf_num_set_ary;
bool m_is_in_shared_buf;
bool m_is_out_shared_buf;
bool m_is_in_shared_switch;
bool m_is_out_shared_switch;
Buffer** m_in_buf_ary_ptr;
Crossbar* m_xbar_ptr;
VCAllocator** m_va_ary_ptr;
//VCAllocator** m_vc_select_ary_ptr;
SWAllocator* m_sa_ptr;
Clock* m_clk_ptr;
};
#endif

View file

@ -1,6 +1,3 @@
# -*- mode:python -*-
# Copyright (c) 2009 The Hewlett-Packard Development Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -26,19 +23,19 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Authors: Nathan Binkert
# Authors: Tushar Krishna
Import('*')
if not env['RUBY']:
Return()
Source('NetworkPower.cc', Werror=False)
Source('power_arbiter.cc')
Source('power_array.cc', Werror=False)
Source('power_bus.cc', Werror=False)
Source('power_crossbar.cc', Werror=False)
Source('power_ll.cc', Werror=False)
Source('power_router_init.cc')
Source('power_static.cc')
Source('power_utils.cc', Werror=False)
Source('NetworkPower.cc')
Source('Clock.cc')
Source('ConfigFile.cc')
Source('FlipFlop.cc')
Source('OrionConfig.cc')
Source('OrionLink.cc')
Source('OrionRouter.cc')
Source('TechParameter.cc')
Source('Wire.cc')

View file

@ -1,172 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 _SIM_PORT_H
#define _SIM_PORT_H
#define PARM_POWER_STATS 1
/* RF module parameters */
#define PARM_read_port 1
#define PARM_write_port 1
#define PARM_n_regs 64
#define PARM_reg_width 32
#define PARM_ndwl 1
#define PARM_ndbl 1
#define PARM_nspd 1
//Niket
#define PARM_vc_in_arb_model QUEUE_ARBITER
#define PARM_vc_out_arb_model QUEUE_ARBITER
#define PARM_vc_in_arb_ff_model NEG_DFF
#define PARM_vc_out_arb_ff_model NEG_DFF
#define PARM_sw_in_arb_model QUEUE_ARBITER
#define PARM_sw_out_arb_model QUEUE_ARBITER
#define PARM_sw_in_arb_ff_model NEG_DFF
#define PARM_sw_out_arb_ff_model NEG_DFF
#define PARM_VC_per_MC 4
//Niket
//#define PARM_wordline_model CACHE_RW_WORDLINE
//#define PARM_bitline_model RW_BITLINE
//#define PARM_mem_model NORMAL_MEM
//#define PARM_row_dec_model SIM_NO_MODEL
//#define PARM_row_dec_pre_model SIM_NO_MODEL
//#define PARM_col_dec_model SIM_NO_MODEL
//#define PARM_col_dec_pre_model SIM_NO_MODEL
//#define PARM_mux_model SIM_NO_MODEL
//#define PARM_outdrv_model SIM_NO_MODEL
/* these 3 should be changed together */
//#define PARM_data_end 2
//#define PARM_amp_model GENERIC_AMP
//#define PARM_bitline_pre_model EQU_BITLINE
//#define PARM_data_end 1
//#define PARM_amp_model SIM_NO_MODEL
//#define PARM_bitline_pre_model SINGLE_OTHER
/* router module parameters */
/* general parameters */
#define PARM_in_port 9
#define PARM_cache_in_port 0 /* # of cache input ports */
#define PARM_mc_in_port 0 /* # of memory controller input ports */
#define PARM_io_in_port 0 /* # of I/O device input ports */
#define PARM_out_port 9
#define PARM_cache_out_port 0 /* # of cache output ports */
#define PARM_mc_out_port 0 /* # of memory controller output ports */
#define PARM_io_out_port 0 /* # of I/O device output ports */
#define PARM_flit_width 128 /* flit width in bits */
/* virtual channel parameters */
#define PARM_v_channel 1 /* # of network port virtual channels */
#define PARM_v_class 0 /* # of total virtual classes */
#define PARM_cache_class 0 /* # of cache port virtual classes */
#define PARM_mc_class 0 /* # of memory controller port virtual classes */
#define PARM_io_class 0 /* # of I/O device port virtual classes */
/* ?? */
#define PARM_in_share_buf 0 /* do input virtual channels physically share buffers? */
#define PARM_out_share_buf 0 /* do output virtual channels physically share buffers? */
/* ?? */
#define PARM_in_share_switch 1 /* do input virtual channels share crossbar input ports? */
#define PARM_out_share_switch 1 /* do output virtual channels share crossbar output ports? */
/* crossbar parameters */
#define PARM_crossbar_model MATRIX_CROSSBAR /* crossbar model type */
#define PARM_crsbar_degree 4 /* crossbar mux degree */
#define PARM_connect_type TRISTATE_GATE /* crossbar connector type */
#define PARM_trans_type NP_GATE /* crossbar transmission gate type */
#define PARM_crossbar_in_len 0 /* crossbar input line length, if known */
#define PARM_crossbar_out_len 0 /* crossbar output line length, if known */
#define PARM_xb_in_seg 0
#define PARM_xb_out_seg 0
/* HACK HACK HACK */
#define PARM_exp_xb_model MATRIX_CROSSBAR
#define PARM_exp_in_seg 2
#define PARM_exp_out_seg 2
/* input buffer parameters */
#define PARM_in_buf 1 /* have input buffer? */
#define PARM_in_buf_set 4
#define PARM_in_buf_rport 1 /* # of read ports */
#define PARM_cache_in_buf 0
#define PARM_cache_in_buf_set 0
#define PARM_cache_in_buf_rport 0
#define PARM_mc_in_buf 0
#define PARM_mc_in_buf_set 0
#define PARM_mc_in_buf_rport 0
#define PARM_io_in_buf 0
#define PARM_io_in_buf_set 0
#define PARM_io_in_buf_rport 0
/* output buffer parameters */
#define PARM_out_buf 0
#define PARM_out_buf_set 4
#define PARM_out_buf_wport 1
/* central buffer parameters */
#define PARM_central_buf 0 /* have central buffer? */
#define PARM_cbuf_set 2560 /* # of rows */
#define PARM_cbuf_rport 2 /* # of read ports */
#define PARM_cbuf_wport 2 /* # of write ports */
#define PARM_cbuf_width 4 /* # of flits in one row */
#define PARM_pipe_depth 4 /* # of banks */
/* array parameters shared by various buffers */
#define PARM_wordline_model CACHE_RW_WORDLINE
#define PARM_bitline_model RW_BITLINE
#define PARM_mem_model NORMAL_MEM
#define PARM_row_dec_model GENERIC_DEC
#define PARM_row_dec_pre_model SINGLE_OTHER
#define PARM_col_dec_model SIM_NO_MODEL
#define PARM_col_dec_pre_model SIM_NO_MODEL
#define PARM_mux_model SIM_NO_MODEL
#define PARM_outdrv_model REG_OUTDRV
/* these 3 should be changed together */
/* use double-ended bitline because the array is too large */
#define PARM_data_end 2
#define PARM_amp_model GENERIC_AMP
#define PARM_bitline_pre_model EQU_BITLINE
//#define PARM_data_end 1
//#define PARM_amp_model SIM_NO_MODEL
//#define PARM_bitline_pre_model SINGLE_OTHER
/* arbiter parameters */
#define PARM_in_arb_model MATRIX_ARBITER /* input side arbiter model type */
#define PARM_in_arb_ff_model NEG_DFF /* input side arbiter flip-flop model type */
#define PARM_out_arb_model MATRIX_ARBITER /* output side arbiter model type */
#define PARM_out_arb_ff_model NEG_DFF /* output side arbiter flip-flop model type */
#endif /* _SIM_PORT_H */

View file

@ -1,385 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 _SIM_POWER_H
#define _SIM_POWER_H
#include <sys/types.h>
#include "mem/ruby/network/orion/SIM_power_test.hh"
#define SIM_NO_MODEL 0
#define MAX_ENERGY 1
#define AVG_ENERGY 0
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef MIN
#define MIN(a,b) (((a)>(b))?(b):(a))
#endif
#define NEXT_DEPTH(d) ((d) > 0 ? (d) - 1 : (d))
#define BIGNUM 1e30
#define BIGONE ((LIB_Type_max_uint)1)
#define BIGNONE ((LIB_Type_max_uint)-1)
#define HAMM_MASK(w) ((unsigned int)w < (sizeof(LIB_Type_max_uint) << 3) ? (BIGONE << w) - 1 : BIGNONE)
/* Used to communicate with the horowitz model */
#define RISE 1
#define FALL 0
#define NCH 1
#define PCH 0
/*
* Cache layout parameters and process parameters
* Thanks to Glenn Reinman for the technology scaling factors
*/
#if ( PARM(TECH_POINT) == 10 )
#define CSCALE (84.2172) /* wire capacitance scaling factor */
/* linear: 51.7172, predicted: 84.2172 */
#define RSCALE (80.0000) /* wire resistance scaling factor */
#define LSCALE 0.1250 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.38 /* voltage scaling factor */
#define VTSCALE 0.49 /* threshold voltage scaling factor */
#define SSCALE 0.80 /* sense voltage scaling factor */
/* FIXME: borrowed from 0.11u technology */
#define MCSCALE 5.2277 /* metal coupling capacitance scaling factor */
#define MCSCALE2 3 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.5 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (1/PARM(GEN_POWER_FACTOR))
/* copied from TECH_POINT 10 except LSCALE */
#elif ( PARM(TECH_POINT) == 11 )
#define CSCALE (84.2172) /* wire capacitance scaling factor */
#define RSCALE (80.0000) /* wire resistance scaling factor */
#define LSCALE 0.1375 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.38 /* voltage scaling factor */
#define VTSCALE 0.49 /* threshold voltage scaling factor */
#define SSCALE 0.80 /* sense voltage scaling factor */
#define MCSCALE 5.2277 /* metal coupling capacitance scaling factor */
#define MCSCALE2 3 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.5 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (1/PARM(GEN_POWER_FACTOR))
#elif ( PARM(TECH_POINT) == 18 )
#define CSCALE (19.7172) /* wire capacitance scaling factor */
#define RSCALE (20.0000) /* wire resistance scaling factor */
#define LSCALE 0.2250 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.4 /* voltage scaling factor */
#define VTSCALE 0.5046 /* threshold voltage scaling factor */
#define SSCALE 0.85 /* sense voltage scaling factor */
#define MCSCALE 4.1250 /* metal coupling capacitance scaling factor */
#define MCSCALE2 2.4444 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.2 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE 1
#elif ( PARM(TECH_POINT) == 25 )
#define CSCALE (10.2197) /* wire capacitance scaling factor */
#define RSCALE (10.2571) /* wire resistance scaling factor */
#define LSCALE 0.3571 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.45 /* voltage scaling factor */
#define VTSCALE 0.5596 /* threshold voltage scaling factor */
#define SSCALE 0.90 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE PARM(GEN_POWER_FACTOR)
#elif ( PARM(TECH_POINT) == 35 )
#define CSCALE (5.2197) /* wire capacitance scaling factor */
#define RSCALE (5.2571) /* wire resistance scaling factor */
#define LSCALE 0.4375 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.5 /* voltage scaling factor */
#define VTSCALE 0.6147 /* threshold voltage scaling factor */
#define SSCALE 0.95 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (PARM(GEN_POWER_FACTOR)*PARM(GEN_POWER_FACTOR))
#elif ( PARM(TECH_POINT) == 40 )
#define CSCALE 1.0 /* wire capacitance scaling factor */
#define RSCALE 1.0 /* wire resistance scaling factor */
#define LSCALE 0.5 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 1.0 /* voltage scaling factor */
#define VTSCALE 1.0 /* threshold voltage scaling factor */
#define SSCALE 1.0 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (PARM(GEN_POWER_FACTOR)*PARM(GEN_POWER_FACTOR)*PARM(GEN_POWER_FACTOR))
#else /* ( PARM(TECH_POINT) == 80 ) */
#define CSCALE 1.0 /* wire capacitance scaling factor */
#define RSCALE 1.0 /* wire resistance scaling factor */
#define LSCALE 1.0 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 1.0 /* voltage scaling factor */
#define VTSCALE 1.0 /* threshold voltage scaling factor */
#define SSCALE 1.0 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (PARM(GEN_POWER_FACTOR)*PARM(GEN_POWER_FACTOR)*PARM(GEN_POWER_FACTOR)*PARM(GEN_POWER_FACTOR))
#endif
#define MSCALE (LSCALE * .624 / .2250)
/*
* CMOS 0.8um model parameters
* - from Appendix II of Cacti tech report
*/
/* corresponds to 8um of m3 @ 225ff/um */
#define Cwordmetal (1.8e-15 * (CSCALE * ASCALE) * SCALE_M)
/* corresponds to 16um of m2 @ 275ff/um */
#define Cbitmetal (4.4e-15 * (CSCALE * ASCALE) * SCALE_M)
/* corresponds to 1um of m2 @ 275ff/um */
#define Cmetal (Cbitmetal/16)
#define CM2metal (Cbitmetal/16)
#define CM3metal (Cbitmetal/16)
/* minimal spacing metal cap per unit length */
#define CCmetal (Cmetal * MCSCALE)
#define CCM2metal (CM2metal * MCSCALE)
#define CCM3metal (CM3metal * MCSCALE)
/* 2x minimal spacing metal cap per unit length */
#define CC2metal (Cmetal * MCSCALE2)
#define CC2M2metal (CM2metal * MCSCALE2)
#define CC2M3metal (CM3metal * MCSCALE2)
/* 3x minimal spacing metal cap per unit length */
#define CC3metal (Cmetal * MCSCALE3)
#define CC3M2metal (CM2metal * MCSCALE3)
#define CC3M3metal (CM3metal * MCSCALE3)
/* um */
#define Leff (0.8 * LSCALE)
/* length unit in um */
#define Lamda (Leff * 0.5)
/* fF/um */
#define Cpolywire (0.25e-15 * CSCALE * LSCALE)
/* ohms*um of channel width */
#define Rnchannelstatic (25800 * LSCALE)
/* ohms*um of channel width */
#define Rpchannelstatic (61200 * LSCALE)
#define Rnchannelon (9723 * LSCALE)
#define Rpchannelon (22400 * LSCALE)
/* corresponds to 16um of m2 @ 48mO/sq */
#define Rbitmetal (0.320 * (RSCALE * ASCALE))
/* corresponds to 8um of m3 @ 24mO/sq */
#define Rwordmetal (0.080 * (RSCALE * ASCALE))
#ifndef Vdd
#define Vdd (5 * VSCALE)
#endif /* Vdd */
/* other stuff (from tech report, appendix 1) */
#define Period ((double)1/(double)PARM(Freq))
#define krise (0.4e-9 * LSCALE)
#define tsensedata (5.8e-10 * LSCALE)
#define tsensetag (2.6e-10 * LSCALE)
#define tfalldata (7e-10 * LSCALE)
#define tfalltag (7e-10 * LSCALE)
#define Vbitpre (3.3 * SSCALE)
#define Vt (1.09 * VTSCALE)
#define Vbitsense (0.10 * SSCALE)
#define Powerfactor (PARM(Freq))*Vdd*Vdd
#define EnergyFactor (Vdd*Vdd)
#define SensePowerfactor3 (PARM(Freq))*(Vbitsense)*(Vbitsense)
#define SensePowerfactor2 (PARM(Freq))*(Vbitpre-Vbitsense)*(Vbitpre-Vbitsense)
#define SensePowerfactor (PARM(Freq))*Vdd*(Vdd/2)
#define SenseEnergyFactor (Vdd*Vdd/2)
/* transistor widths in um (as described in tech report, appendix 1) */
#define Wdecdrivep (57.0 * LSCALE)
#define Wdecdriven (40.0 * LSCALE)
#define Wdec3to8n (14.4 * LSCALE)
#define Wdec3to8p (14.4 * LSCALE)
#define WdecNORn (5.4 * LSCALE)
#define WdecNORp (30.5 * LSCALE)
#define Wdecinvn (5.0 * LSCALE)
#define Wdecinvp (10.0 * LSCALE)
#define Wworddrivemax (100.0 * LSCALE)
#define Wmemcella (2.4 * LSCALE)
#define Wmemcellr (4.0 * LSCALE)
#define Wmemcellw (2.1 * LSCALE)
#define Wmemcellbscale 2 /* means 2x bigger than Wmemcella */
#define Wbitpreequ (10.0 * LSCALE)
#define Wbitmuxn (10.0 * LSCALE)
#define WsenseQ1to4 (4.0 * LSCALE)
#define Wcompinvp1 (10.0 * LSCALE)
#define Wcompinvn1 (6.0 * LSCALE)
#define Wcompinvp2 (20.0 * LSCALE)
#define Wcompinvn2 (12.0 * LSCALE)
#define Wcompinvp3 (40.0 * LSCALE)
#define Wcompinvn3 (24.0 * LSCALE)
#define Wevalinvp (20.0 * LSCALE)
#define Wevalinvn (80.0 * LSCALE)
#define Wcompn (20.0 * LSCALE)
#define Wcompp (30.0 * LSCALE)
#define Wcomppreequ (40.0 * LSCALE)
#define Wmuxdrv12n (30.0 * LSCALE)
#define Wmuxdrv12p (50.0 * LSCALE)
#define WmuxdrvNANDn (20.0 * LSCALE)
#define WmuxdrvNANDp (80.0 * LSCALE)
#define WmuxdrvNORn (60.0 * LSCALE)
#define WmuxdrvNORp (80.0 * LSCALE)
#define Wmuxdrv3n (200.0 * LSCALE)
#define Wmuxdrv3p (480.0 * LSCALE)
#define Woutdrvseln (12.0 * LSCALE)
#define Woutdrvselp (20.0 * LSCALE)
#define Woutdrvnandn (24.0 * LSCALE)
#define Woutdrvnandp (10.0 * LSCALE)
#define Woutdrvnorn (6.0 * LSCALE)
#define Woutdrvnorp (40.0 * LSCALE)
#define Woutdrivern (48.0 * LSCALE)
#define Woutdriverp (80.0 * LSCALE)
#define Wbusdrvn (48.0 * LSCALE)
#define Wbusdrvp (80.0 * LSCALE)
#define Wcompcellpd2 (2.4 * LSCALE)
#define Wcompdrivern (400.0 * LSCALE)
#define Wcompdriverp (800.0 * LSCALE)
#define Wcomparen2 (40.0 * LSCALE)
#define Wcomparen1 (20.0 * LSCALE)
#define Wmatchpchg (10.0 * LSCALE)
#define Wmatchinvn (10.0 * LSCALE)
#define Wmatchinvp (20.0 * LSCALE)
#define Wmatchnandn (20.0 * LSCALE)
#define Wmatchnandp (10.0 * LSCALE)
#define Wmatchnorn (20.0 * LSCALE)
#define Wmatchnorp (10.0 * LSCALE)
#define WSelORn (10.0 * LSCALE)
#define WSelORprequ (40.0 * LSCALE)
#define WSelPn (10.0 * LSCALE)
#define WSelPp (15.0 * LSCALE)
#define WSelEnn (5.0 * LSCALE)
#define WSelEnp (10.0 * LSCALE)
#define Wsenseextdrv1p (40.0*LSCALE)
#define Wsenseextdrv1n (24.0*LSCALE)
#define Wsenseextdrv2p (200.0*LSCALE)
#define Wsenseextdrv2n (120.0*LSCALE)
/* bit width of RAM cell in um */
#define BitWidth (16.0 * LSCALE)
/* bit height of RAM cell in um */
#define BitHeight (16.0 * LSCALE)
#define Cout (0.5e-12 * LSCALE)
/* Sizing of cells and spacings */
#define RatCellHeight (40.0 * LSCALE)
#define RatCellWidth (70.0 * LSCALE)
#define RatShiftRegWidth (120.0 * LSCALE)
#define RatNumShift 4
#define BitlineSpacing (6.0 * LSCALE)
#define WordlineSpacing (6.0 * LSCALE)
#define RegCellHeight (16.0 * LSCALE)
#define RegCellWidth (8.0 * LSCALE)
#define CamCellHeight (40.0 * LSCALE)
#define CamCellWidth (25.0 * LSCALE)
#define MatchlineSpacing (6.0 * LSCALE)
#define TaglineSpacing (6.0 * LSCALE)
#define CrsbarCellHeight (6.0 * LSCALE)
#define CrsbarCellWidth (6.0 * LSCALE)
/*===================================================================*/
/* ALU POWER NUMBERS for .18um 733Mhz */
/* normalize .18um cap to other gen's cap, then xPowerfactor */
#define POWER_SCALE (GEN_POWER_SCALE * PARM(NORMALIZE_SCALE) * Powerfactor)
#define I_ADD ((.37 - .091)*POWER_SCALE)
#define I_ADD32 (((.37 - .091)/2)*POWER_SCALE)
#define I_MULT16 ((.31-.095)*POWER_SCALE)
#define I_SHIFT ((.21-.089)*POWER_SCALE)
#define I_LOGIC ((.04-.015)*POWER_SCALE)
#define F_ADD ((1.307-.452)*POWER_SCALE)
#define F_MULT ((1.307-.452)*POWER_SCALE)
#define I_ADD_CLOCK (.091*POWER_SCALE)
#define I_MULT_CLOCK (.095*POWER_SCALE)
#define I_SHIFT_CLOCK (.089*POWER_SCALE)
#define I_LOGIC_CLOCK (.015*POWER_SCALE)
#define F_ADD_CLOCK (.452*POWER_SCALE)
#define F_MULT_CLOCK (.452*POWER_SCALE)
/*
transmission gate type
typedef enum {
N_GATE,
NP_GATE
} SIM_power_trans_t;
*/
/* some utility routines */
extern uint32_t SIM_power_logtwo(uint64_t x);
//extern int SIM_power_squarify(int rows, int cols);
extern double SIM_power_driver_size(double driving_cap, double desiredrisetime);
/* functions from cacti */
extern double SIM_power_gatecap(double width, double wirelength);
extern double SIM_power_gatecappass(double width, double wirelength);
extern double SIM_power_draincap(double width, int nchannel, int stack);
extern double SIM_power_restowidth(double res, int nchannel);
extern int SIM_power_init(void);
extern uint32_t SIM_power_Hamming(uint64_t old_val, uint64_t new_val,
uint64_t mask);
extern unsigned int SIM_power_Hamming_group(LIB_Type_max_uint d1_new, LIB_Type_max_uint d1_old, LIB_Type_max_uint d2_new, LIB_Type_max_uint d2_old, u_int width, u_int n_grp);
/* statistical functions */
//extern int SIM_print_stat_energy(char *path, double Energy, int print_flag);
//extern u_int SIM_power_strlen(char *s);
//extern char *SIM_power_strcat(char *dest, char *src);
//extern int SIM_power_res_path(char *path, u_int id);
//extern int SIM_power_dump_tech_para(void);
#endif /* _SIM_POWER_H */

View file

@ -1,285 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*/
/* all needed to perform computation out of Liberty */
#ifndef _SIM_POWER_TEST_H
#define _SIM_POWER_TEST_H
#include <unistd.h>
#include <sys/types.h>
#define LIB_Type_max_uint unsigned long int
#define LIB_Type_max_int long int
#define __INSTANCE__ mainpe__power
#define GLOBDEF(t,n) t mainpe__power___ ## n
#define GLOB(n) mainpe__power___ ## n
#define FUNC(n, args...) mainpe__power___ ## n (args)
#define FUNCPTR(n) mainpe__power___ ## n
#define PARM(x) PARM_ ## x
#undef PARM_AF
#undef PARM_MAXN
#undef PARM_MAXSUBARRAYS
#undef PARM_MAXSPD
#undef PARM_VTHSENSEEXTDRV
#undef PARM_VTHOUTDRNOR
#undef PARM_res_fpalu
#undef PARM_VTHCOMPINV
#undef PARM_MD_NUM_IREGS
#undef PARM_die_length
#undef PARM_BITOUT
#undef PARM_Cndiffside
#undef PARM_ruu_decode_width
#undef PARM_ruu_issue_width
#undef PARM_amp_Idsat
#undef PARM_AF_TYPE
#undef PARM_VSINV
#undef PARM_Cpdiffovlp
#undef PARM_data_width
#undef PARM_Cgatepass
#undef PARM_Cpdiffarea
#undef PARM_GEN_POWER_FACTOR
#undef PARM_res_memport
#undef PARM_VTHNAND60x90
#undef PARM_Cpdiffside
#undef PARM_Cpoxideovlp
#undef PARM_opcode_length
#undef PARM_MD_NUM_FREGS
#undef PARM_FUDGEFACTOR
#undef PARM_ruu_commit_width
#undef PARM_Cndiffovlp
#undef PARM_VTHOUTDRIVE
#undef PARM_Cndiffarea
#undef PARM_VTHMUXDRV1
#undef PARM_inst_length
#undef PARM_VTHMUXDRV2
#undef PARM_NORMALIZE_SCALE
#undef PARM_ras_size
#undef PARM_VTHMUXDRV3
#undef PARM_ADDRESS_BITS
#undef PARM_RUU_size
#undef PARM_Cgate
#undef PARM_VTHNOR12x4x1
#undef PARM_VTHNOR12x4x2
#undef PARM_VTHOUTDRINV
#undef PARM_VTHNOR12x4x3
#undef PARM_VTHEVALINV
#undef PARM_crossover_scaling
#undef PARM_VTHNOR12x4x4
#undef PARM_turnoff_factor
#undef PARM_res_ialu
#undef PARM_Cnoxideovlp
#undef PARM_VTHOUTDRNAND
#undef PARM_VTHINV100x60
#undef PARM_LSQ_size
#ifndef PARM_AF
#define PARM_AF (5.000000e-01)
#endif /* PARM_AF */
#ifndef PARM_MAXN
#define PARM_MAXN (8)
#endif /* PARM_MAXN */
#ifndef PARM_MAXSUBARRAYS
#define PARM_MAXSUBARRAYS (8)
#endif /* PARM_MAXSUBARRAYS */
#ifndef PARM_MAXSPD
#define PARM_MAXSPD (8)
#endif /* PARM_MAXSPD */
#ifndef PARM_VTHSENSEEXTDRV
#define PARM_VTHSENSEEXTDRV (4.370000e-01)
#endif /* PARM_VTHSENSEEXTDRV */
#ifndef PARM_VTHOUTDRNOR
#define PARM_VTHOUTDRNOR (4.310000e-01)
#endif /* PARM_VTHOUTDRNOR */
#ifndef PARM_res_fpalu
#define PARM_res_fpalu (4)
#endif /* PARM_res_fpalu */
#ifndef PARM_VTHCOMPINV
#define PARM_VTHCOMPINV (4.370000e-01)
#endif /* PARM_VTHCOMPINV */
#ifndef PARM_MD_NUM_IREGS
#define PARM_MD_NUM_IREGS (32)
#endif /* PARM_MD_NUM_IREGS */
#ifndef PARM_die_length
#define PARM_die_length (1.800000e-02)
#endif /* PARM_die_length */
#ifndef PARM_BITOUT
#define PARM_BITOUT (64)
#endif /* PARM_BITOUT */
#ifndef PARM_Cndiffside
#define PARM_Cndiffside (2.750000e-16)
#endif /* PARM_Cndiffside */
#ifndef PARM_ruu_decode_width
#define PARM_ruu_decode_width (4)
#endif /* PARM_ruu_decode_width */
#ifndef PARM_ruu_issue_width
#define PARM_ruu_issue_width (4)
#endif /* PARM_ruu_issue_width */
#ifndef PARM_amp_Idsat
#define PARM_amp_Idsat (5.000000e-04)
#endif /* PARM_amp_Idsat */
#ifndef PARM_AF_TYPE
#define PARM_AF_TYPE (1)
#endif /* PARM_AF_TYPE */
#ifndef PARM_VSINV
#define PARM_VSINV (4.560000e-01)
#endif /* PARM_VSINV */
#ifndef PARM_Cpdiffovlp
#define PARM_Cpdiffovlp (1.380000e-16)
#endif /* PARM_Cpdiffovlp */
#ifndef PARM_Cgatepass
#define PARM_Cgatepass (1.450000e-15)
#endif /* PARM_Cgatepass */
#ifndef PARM_Cpdiffarea
#define PARM_Cpdiffarea (3.430000e-16)
#endif /* PARM_Cpdiffarea */
#ifndef PARM_GEN_POWER_FACTOR
#define PARM_GEN_POWER_FACTOR (1.310000e+00)
#endif /* PARM_GEN_POWER_FACTOR */
#ifndef PARM_res_memport
#define PARM_res_memport (2)
#endif /* PARM_res_memport */
#ifndef PARM_VTHNAND60x90
#define PARM_VTHNAND60x90 (5.610000e-01)
#endif /* PARM_VTHNAND60x90 */
#ifndef PARM_Cpdiffside
#define PARM_Cpdiffside (2.750000e-16)
#endif /* PARM_Cpdiffside */
#ifndef PARM_Cpoxideovlp
#define PARM_Cpoxideovlp (3.380000e-16)
#endif /* PARM_Cpoxideovlp */
#ifndef PARM_opcode_length
#define PARM_opcode_length (8)
#endif /* PARM_opcode_length */
#ifndef PARM_MD_NUM_FREGS
#define PARM_MD_NUM_FREGS (32)
#endif /* PARM_MD_NUM_FREGS */
#ifndef PARM_FUDGEFACTOR
#define PARM_FUDGEFACTOR (1.000000e+00)
#endif /* PARM_FUDGEFACTOR */
#ifndef PARM_ruu_commit_width
#define PARM_ruu_commit_width (4)
#endif /* PARM_ruu_commit_width */
#ifndef PARM_Cndiffovlp
#define PARM_Cndiffovlp (1.380000e-16)
#endif /* PARM_Cndiffovlp */
#ifndef PARM_VTHOUTDRIVE
#define PARM_VTHOUTDRIVE (4.250000e-01)
#endif /* PARM_VTHOUTDRIVE */
#ifndef PARM_Cndiffarea
#define PARM_Cndiffarea (1.370000e-16)
#endif /* PARM_Cndiffarea */
#ifndef PARM_VTHMUXDRV1
#define PARM_VTHMUXDRV1 (4.370000e-01)
#endif /* PARM_VTHMUXDRV1 */
#ifndef PARM_inst_length
#define PARM_inst_length (32)
#endif /* PARM_inst_length */
#ifndef PARM_VTHMUXDRV2
#define PARM_VTHMUXDRV2 (4.860000e-01)
#endif /* PARM_VTHMUXDRV2 */
#ifndef PARM_NORMALIZE_SCALE
#define PARM_NORMALIZE_SCALE (6.488730e-10)
#endif /* PARM_NORMALIZE_SCALE */
#ifndef PARM_ras_size
#define PARM_ras_size (8)
#endif /* PARM_ras_size */
#ifndef PARM_VTHMUXDRV3
#define PARM_VTHMUXDRV3 (4.370000e-01)
#endif /* PARM_VTHMUXDRV3 */
#ifndef PARM_ADDRESS_BITS
#define PARM_ADDRESS_BITS (64)
#endif /* PARM_ADDRESS_BITS */
#ifndef PARM_RUU_size
#define PARM_RUU_size (16)
#endif /* PARM_RUU_size */
#ifndef PARM_Cgate
#define PARM_Cgate (1.950000e-15)
#endif /* PARM_Cgate */
#ifndef PARM_VTHNOR12x4x1
#define PARM_VTHNOR12x4x1 (5.030000e-01)
#endif /* PARM_VTHNOR12x4x1 */
#ifndef PARM_VTHNOR12x4x2
#define PARM_VTHNOR12x4x2 (4.520000e-01)
#endif /* PARM_VTHNOR12x4x2 */
#ifndef PARM_VTHOUTDRINV
#define PARM_VTHOUTDRINV (4.370000e-01)
#endif /* PARM_VTHOUTDRINV */
#ifndef PARM_VTHNOR12x4x3
#define PARM_VTHNOR12x4x3 (4.170000e-01)
#endif /* PARM_VTHNOR12x4x3 */
#ifndef PARM_VTHEVALINV
#define PARM_VTHEVALINV (2.670000e-01)
#endif /* PARM_VTHEVALINV */
#ifndef PARM_crossover_scaling
#define PARM_crossover_scaling (1.200000e+00)
#endif /* PARM_crossover_scaling */
#ifndef PARM_VTHNOR12x4x4
#define PARM_VTHNOR12x4x4 (3.900000e-01)
#endif /* PARM_VTHNOR12x4x4 */
#ifndef PARM_turnoff_factor
#define PARM_turnoff_factor (1.000000e-01)
#endif /* PARM_turnoff_factor */
#ifndef PARM_res_ialu
#define PARM_res_ialu (4)
#endif /* PARM_res_ialu */
#ifndef PARM_Cnoxideovlp
#define PARM_Cnoxideovlp (2.630000e-16)
#endif /* PARM_Cnoxideovlp */
#ifndef PARM_VTHOUTDRNAND
#define PARM_VTHOUTDRNAND (4.410000e-01)
#endif /* PARM_VTHOUTDRNAND */
#ifndef PARM_VTHINV100x60
#define PARM_VTHINV100x60 (4.380000e-01)
#endif /* PARM_VTHINV100x60 */
#ifndef PARM_LSQ_size
#define PARM_LSQ_size (8)
#endif /* PARM_LSQ_size */
#define TEST_LENGTH (100)
/* scaling factors from 0.1u to 0.07u, 0.05u and 0.035u */
#if (TEST_LENGTH == 70)
#define SCALE_T (0.5489156157)
#define SCALE_M (0.6566502462)
#define SCALE_S (1.4088071075)
#elif (TEST_LENGTH == 50)
#define SCALE_T (0.3251012552)
#define SCALE_M (0.4426460239)
#define SCALE_S (2.8667111607)
#elif (TEST_LENGTH == 35)
#define SCALE_T (0.2016627474)
#define SCALE_M (0.2489788586)
#define SCALE_S (8.7726826878)
#else
#define SCALE_T (1)
#define SCALE_M (1)
#define SCALE_S (1)
#endif /* TEST_LENGTH */
#endif /* _SIM_POWER_TEST_H */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,414 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __TECHPARAMETER_H__
#define __TECHPARAMETER_H__
#include <string>
#include "mem/ruby/network/orion/Type.hh"
using namespace std;
class OrionConfig;
class TechParameter
{
public:
enum TransistorType
{
LVT = 0,
NVT,
HVT,
NUM_TRANSISTOR_TYPE
};
enum WireLayerType
{
LOCAL = 0,
INTERMEDIATE,
GLOBAL,
NUM_WIRE_LAYER_TYPE
};
enum ChannelType
{
NCH,
PCH
};
public:
TechParameter(const OrionConfig* orion_cfg_ptr_);
~TechParameter();
public:
double calc_gatecap(double width_, double wirelength_) const;
double calc_gatecappass(double width_, double wirelength_) const;
double calc_draincap(double width_, ChannelType ch_, uint32_t num_stack_) const;
double calc_restowidth(double res_, ChannelType ch_) const;
double calc_driver_psize(double cap_, double rise_time_) const;
public:
bool is_trans_type_hvt() const { return (m_transistor_type == HVT); }
bool is_trans_type_nvt() const { return (m_transistor_type == NVT); }
bool is_trans_type_lvt() const { return (m_transistor_type == LVT); }
double get_tech_node() const { return m_tech_node; }
double get_vdd() const { return m_vdd; }
double get_freq() const { return m_freq; }
double get_period() const { return m_period; }
double get_amp_idsat() const { return m_amp_idsat; }
double get_SCALE_S() const { return m_SCALE_S; }
double get_MSCALE() const { return m_MSCALE; }
double get_Lamda() const { return m_Lamda; }
double get_Cmetal() const { return m_Cmetal; }
double get_CM2metal() const { return m_CM2metal; }
double get_CM3metal() const { return m_CM3metal; }
double get_CCmetal() const { return m_CCmetal; }
double get_CCM2metal() const { return m_CCM2metal; }
double get_CCM3metal() const { return m_CCM3metal; }
double get_CC2metal() const { return m_CC2metal; }
double get_CC2M2metal() const { return m_CC2M2metal; }
double get_CC2M3metal() const { return m_CC2M3metal; }
double get_CC3metal() const { return m_CC3metal; }
double get_CC3M2metal() const { return m_CC3M2metal; }
double get_CC3M3metal() const { return m_CC3M3metal; }
double get_EnergyFactor() const { return m_EnergyFactor; }
double get_SenseEnergyFactor() const { return m_SenseEnergyFactor; }
double get_Woutdrvseln() const { return m_Woutdrvseln; }
double get_Woutdrvselp() const { return m_Woutdrvselp; }
double get_Woutdrvnandn() const { return m_Woutdrvnandn; }
double get_Woutdrvnandp() const { return m_Woutdrvnandp; }
double get_Woutdrvnorn() const { return m_Woutdrvnorn; }
double get_Woutdrvnorp() const { return m_Woutdrvnorp; }
double get_Woutdrivern() const { return m_Woutdrivern; }
double get_Woutdriverp() const { return m_Woutdriverp; }
double get_WsenseQ1to4() const { return m_WsenseQ1to4; }
double get_Wbitmuxn() const { return m_Wbitmuxn; }
double get_Wmemcellr() const { return m_Wmemcellr; }
double get_Wmemcellw() const { return m_Wmemcellw; }
double get_Wmemcella() const { return m_Wmemcella; }
double get_Wmemcellbscale() const { return m_Wmemcellbscale; }
double get_RegCellHeight() const { return m_RegCellHeight; }
double get_RegCellWidth() const { return m_RegCellWidth; }
double get_WordlineSpacing() const { return m_WordlineSpacing; }
double get_BitlineSpacing() const { return m_BitlineSpacing; }
double get_BitWidth() const { return m_BitWidth; }
double get_Wdecinvn() const { return m_Wdecinvn; }
double get_Wdecinvp() const { return m_Wdecinvp; }
double get_Wdec3to8n() const { return m_Wdec3to8n; }
double get_Wdec3to8p() const { return m_Wdec3to8p; }
double get_WdecNORn() const { return m_WdecNORn; }
double get_WdecNORp() const { return m_WdecNORp; }
double get_Wdecdriven() const { return m_Wdecdriven; }
double get_Wdecdrivep() const { return m_Wdecdrivep; }
double get_CrsbarCellWidth() const { return m_CrsbarCellWidth; }
double get_CrsbarCellHeight() const { return m_CrsbarCellHeight; }
double get_Wdff() const { return m_Wdff; }
double get_WireMinWidth() const { return m_WireMinWidth; }
double get_WireMinSpacing() const { return m_WireMinSpacing; }
double get_WireBarrierThickness() const { return m_WireBarrierThickness; }
double get_WireMetalThickness() const { return m_WireMetalThickness; }
double get_WireDielectricThickness() const { return m_WireDielectricThickness; }
double get_WireDielectricConstant() const { return m_WireDielectricConstant; }
double get_BufferDriveResistance() const { return m_BufferDriveResistance; }
double get_BufferInputCapacitance() const { return m_BufferInputCapacitance; }
double get_BufferNMOSOffCurrent() const { return m_BufferNMOSOffCurrent; }
double get_BufferPMOSOffCurrent() const { return m_BufferPMOSOffCurrent; }
double get_ClockCap() const { return m_ClockCap; }
double get_Clockwire() const { return m_Clockwire; }
double get_Reswire() const { return m_Reswire; }
double get_NMOS_TAB(uint32_t idx) const { return m_NMOS_TAB[idx]; }
double get_PMOS_TAB(uint32_t idx) const { return m_PMOS_TAB[idx]; }
double get_NAND2_TAB(uint32_t idx) const { return m_NAND2_TAB[idx]; }
double get_NOR2_TAB(uint32_t idx) const { return m_NOR2_TAB[idx]; }
double get_DFF_TAB(uint32_t idx) const { return m_DFF_TAB[idx]; }
private:
void init();
void init_tech_110_800();
void init_tech_32_90();
void init_tech_90();
private:
const OrionConfig* m_orion_cfg_ptr;
unsigned int m_tech_node;
TransistorType m_transistor_type;
double m_vdd;
double m_freq;
double m_period;
WireLayerType m_wire_layer_type;
double m_af;
uint32_t m_max_n;
uint32_t m_max_subarrays;
uint32_t m_max_spd;
double m_vth_outdr_nor;
double m_vth_comp_inv;
uint32_t m_bit_out;
uint32_t m_ruu_issue_width;
double m_amp_idsat;
double m_vs_inv;
double m_gen_power_factor;
double m_vth_nand_60x90;
double m_fudge_factor;
double m_vth_outdrive;
double m_vth_muxdrv1;
double m_vth_muxdrv2;
double m_normalize_scale;
double m_vth_muxdrv3;
uint32_t m_address_bits;
uint32_t m_ruu_size;
double m_vth_nor_12x4x1;
double m_vth_nor_12x4x2;
double m_vth_outdr_inv;
double m_vth_nor_12x4x3;
double m_vth_eval_inv;
double m_vth_nor_12x4x4;
uint32_t m_res_ialu;
double m_vth_outdr_nand;
double m_vth_inv_100x60;
double m_Cpdiffarea;
double m_Cpdiffside;
double m_Cpoverlap;
double m_Cndiffarea;
double m_Cndiffside;
double m_Cnoverlap;
double m_Cgatepass;
double m_Cgate;
double m_Cpdiffovlp;
double m_Cndiffovlp;
double m_Cpoxideovlp;
double m_Cnoxideovlp;
double m_Vbitpre;
double m_Vbitsense;
double m_EnergyFactor;
double m_SenseEnergyFactor;
double m_SenseEnergyFactor3;
double m_SenseEnergyFactor2;
double m_SCALE_T;
double m_SCALE_M;
double m_SCALE_S;
double m_SCALE_W;
double m_SCALE_H;
double m_SCALE_BW;
double m_SCALE_Crs;
double m_LSCALE;
double m_MSCALE;
double m_BitWidth;
double m_BitHeight;
double m_BitlineSpacing;
double m_WordlineSpacing;
double m_RegCellWidth;
double m_RegCellHeight;
double m_Cout;
double m_Cwordmetal;
double m_Cbitmetal;
double m_Cmetal;
double m_CM2metal;
double m_CM3metal;
double m_CCmetal;
double m_CCM2metal;
double m_CCM3metal;
double m_CC2metal;
double m_CC2M2metal;
double m_CC2M3metal;
double m_CC3metal;
double m_CC3M2metal;
double m_CC3M3metal;
double m_Clockwire;
double m_Reswire;
double m_invCap;
double m_Resout;
double m_Leff;
double m_Lamda;
double m_Cpolywire;
double m_Rnchannelstatic;
double m_Rpchannelstatic;
double m_Rnchannelon;
double m_Rpchannelon;
double m_Rbitmetal;
double m_Rwordmetal;
double m_Vt;
double m_Wdecdrivep;
double m_Wdecdriven;
double m_Wdec3to8n;
double m_Wdec3to8p;
double m_WdecNORn;
double m_WdecNORp;
double m_Wdecinvn;
double m_Wdecinvp;
double m_Wdff;
double m_Wworddrivemax;
double m_Wmemcella;
double m_Wmemcellr;
double m_Wmemcellw;
double m_Wmemcellbscale;
double m_Wbitpreequ;
double m_Wbitmuxn;
double m_WsenseQ1to4;
double m_Wcompinvp1;
double m_Wcompinvn1;
double m_Wcompinvp2;
double m_Wcompinvn2;
double m_Wcompinvp3;
double m_Wcompinvn3;
double m_Wevalinvp;
double m_Wevalinvn;
double m_Wcompn;
double m_Wcompp;
double m_Wcomppreequ;
double m_Wmuxdrv12n;
double m_Wmuxdrv12p;
double m_WmuxdrvNANDn;
double m_WmuxdrvNANDp;
double m_WmuxdrvNORn;
double m_WmuxdrvNORp;
double m_Wmuxdrv3n;
double m_Wmuxdrv3p;
double m_Woutdrvseln;
double m_Woutdrvselp;
double m_Woutdrvnandn;
double m_Woutdrvnandp;
double m_Woutdrvnorn;
double m_Woutdrvnorp;
double m_Woutdrivern;
double m_Woutdriverp;
double m_Wbusdrvn;
double m_Wbusdrvp;
double m_Wcompcellpd2;
double m_Wcompdrivern;
double m_Wcompdriverp;
double m_Wcomparen2;
double m_Wcomparen1;
double m_Wmatchpchg;
double m_Wmatchinvn;
double m_Wmatchinvp;
double m_Wmatchnandn;
double m_Wmatchnandp;
double m_Wmatchnorn;
double m_Wmatchnorp;
double m_WSelORn;
double m_WSelORprequ;
double m_WSelPn;
double m_WSelPp;
double m_WSelEnn;
double m_WSelEnp;
double m_Wsenseextdrv1p;
double m_Wsenseextdrv1n;
double m_Wsenseextdrv2p;
double m_Wsenseextdrv2n;
double m_CamCellHeight;/*derived from Cacti 5.3 */
double m_CamCellWidth;/*derived from Cacti 5.3 */
double m_MatchlineSpacing;
double m_TaglineSpacing;
double m_CrsbarCellHeight;
double m_CrsbarCellWidth;
double m_krise;
double m_tsensedata;
double m_tsensetag;
double m_tfalldata;
double m_tfalltag;
double m_WireMinWidth;
double m_WireMinSpacing;
double m_WireMetalThickness;
double m_WireBarrierThickness;
double m_WireDielectricThickness;
double m_WireDielectricConstant;
double m_BufferDriveResistance;
double m_BufferIntrinsicDelay;
double m_BufferInputCapacitance;
double m_BufferPMOSOffCurrent;
double m_BufferNMOSOffCurrent;
double m_ClockCap;
double m_AreaNOR;
double m_AreaINV;
double m_AreaAND;
double m_AreaDFF;
double m_AreaMUX2;
double m_AreaMUX3;
double m_AreaMUX4;
double m_NMOS_TAB[1];
double m_PMOS_TAB[1];
double m_NAND2_TAB[4];
double m_NOR2_TAB[4];
double m_DFF_TAB[1];
};
#endif

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,16 +25,21 @@
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef _POWER_UTILS_H
#define _POWER_UTILS_H
#ifndef __TYPE_H__
#define __TYPE_H__
#include "base/types.hh"
typedef unsigned int uint32_t;
extern uint32_t SIM_power_Hamming(uint64_t old_val, uint64_t new_val,
uint64_t mask);
extern double logtwo(double x);
extern uint32_t SIM_power_logtwo(uint64_t x);
#include <string>
using std::string;
#endif

View file

@ -0,0 +1,383 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#include <iostream>
#include <cmath>
#include <cstdlib>
#include "base/misc.hh"
#include "mem/ruby/network/orion/Wire.hh"
#include "mem/ruby/network/orion/TechParameter.hh"
using namespace std;
Wire::Wire(
const string& wire_spacing_model_str_,
const string& buf_scheme_str_,
bool is_shielding_,
const TechParameter* tech_param_ptr_
)
{
set_width_spacing_model(wire_spacing_model_str_);
set_buf_scheme(buf_scheme_str_);
m_is_shielding = is_shielding_;
m_tech_param_ptr = tech_param_ptr_;
if (m_tech_param_ptr->get_tech_node() > 90)
{
cerr << "ERROR: Wire model only support tech node <= 90" << endl;
exit(1);
}
init();
}
Wire::~Wire()
{}
// OPTIMUM K and H CALCULATION
// Computes the optimum number and size of repeaters for the link
void Wire::calc_opt_buffering(
int* k_,
double* h_,
double len_
) const
{
double BufferDriveResistance = m_tech_param_ptr->get_BufferDriveResistance();
double BufferInputCapacitance = m_tech_param_ptr->get_BufferInputCapacitance();
switch(m_buf_scheme)
{
case MIN_DELAY:
{
if (m_is_shielding)
{
double r = m_res_unit_len*len_;
double c_g = 2*m_gnd_cap_unit_len*len_;
double c_c = 2*m_couple_cap_unit_len*len_;
*k_ = (int) sqrt(((0.4*r*c_g)+(0.57*r*c_c))/
(0.7*BufferDriveResistance*BufferInputCapacitance)); //k is the number of buffers to be inserted
*h_ = sqrt(((0.7*BufferDriveResistance*c_g)+
(1.4*1.5*BufferDriveResistance*c_c))/(0.7*r*BufferInputCapacitance)); //the size of the buffers to be inserted
break;
}
else
{
double r = m_res_unit_len*len_;
double c_g = 2*m_gnd_cap_unit_len*len_;
double c_c = 2*m_couple_cap_unit_len*len_;
*k_ = (int) sqrt(((0.4*r*c_g)+(1.51*r*c_c))/
(0.7*BufferDriveResistance*BufferInputCapacitance));
*h_ = sqrt(((0.7*BufferDriveResistance*c_g)+
(1.4*2.2*BufferDriveResistance*c_c))/(0.7*r*BufferInputCapacitance));
break;
}
}
case STAGGERED:
{
double r = m_res_unit_len*len_;
double c_g = 2*m_gnd_cap_unit_len*len_;
double c_c = 2*m_couple_cap_unit_len*len_;
*k_ = (int) sqrt(((0.4*r*c_g)+(0.57*r*c_c))/
(0.7*BufferDriveResistance*BufferInputCapacitance));
*h_ = sqrt(((0.7*BufferDriveResistance*c_g)+
(1.4*1.5*BufferDriveResistance*c_c))/(0.7*r*BufferInputCapacitance));
break;
}
}
return;
}
double Wire::calc_dynamic_energy(double len_) const
{
double c_g = 2*m_gnd_cap_unit_len*len_;
double c_c = 2*m_couple_cap_unit_len*len_;
double cap_wire = c_g + c_c;
int k;
double h;
calc_opt_buffering(&k, &h, len_);
double BufferInputCapacitance = m_tech_param_ptr->get_BufferInputCapacitance();
double cap_buf = ((double)k)*BufferInputCapacitance*h;
double e_factor = m_tech_param_ptr->get_EnergyFactor();
return ((cap_wire+cap_buf)*e_factor);
}
double Wire::calc_static_power(double len_) const
{
int k;
double h;
calc_opt_buffering(&k, &h, len_);
double BufferNMOSOffCurrent = m_tech_param_ptr->get_BufferNMOSOffCurrent();
double BufferPMOSOffCurrent = m_tech_param_ptr->get_BufferPMOSOffCurrent();
double i_static_nmos = BufferNMOSOffCurrent*h*k;
double i_static_pmos = BufferPMOSOffCurrent*h*k;
double vdd = m_tech_param_ptr->get_vdd();
return (vdd*(i_static_pmos+i_static_nmos)/2);
}
void Wire::init()
{
m_res_unit_len = calc_res_unit_len();
m_gnd_cap_unit_len = calc_gnd_cap_unit_len();
m_couple_cap_unit_len = calc_couple_cap_unit_len();
return;
}
void Wire::set_width_spacing_model(
const string& wire_spacing_model_str_
)
{
if (wire_spacing_model_str_ == string("SWIDTH_SSPACE"))
{
m_width_spacing_model = SWIDTH_SSPACE;
}
else if (wire_spacing_model_str_ == string("SWIDTH_DSPACE"))
{
m_width_spacing_model = SWIDTH_DSPACE;
}
else if (wire_spacing_model_str_ == string("DWIDTH_SSPACE"))
{
m_width_spacing_model = DWIDTH_SSPACE;
}
else if (wire_spacing_model_str_ == string("DWIDTH_DSPACE"))
{
m_width_spacing_model = DWIDTH_DSPACE;
}
else
{
cerr << "ERROR: Invalid wire width/spacing model" << endl;
exit(1);
}
return;
}
void Wire::set_buf_scheme(
const string& buf_scheme_str_
)
{
if (buf_scheme_str_ == string("MIN_DELAY"))
{
m_buf_scheme = MIN_DELAY;
}
else if (buf_scheme_str_ == string("STAGGERED"))
{
m_buf_scheme = STAGGERED;
}
else
{
cerr << "ERROR: Invalid wire buf scheme" << endl;
exit(1);
}
return;
}
// The following function computes the wire resistance considering
// width-spacing combination and a width-dependent resistivity model
double Wire::calc_res_unit_len()
{
double r = -1.0;
double rho;
// r, rho is in ohm.m
double WireMinWidth = m_tech_param_ptr->get_WireMinWidth();
double WireBarrierThickness = m_tech_param_ptr->get_WireBarrierThickness();
double WireMetalThickness = m_tech_param_ptr->get_WireMetalThickness();
switch(m_width_spacing_model)
{
case SWIDTH_SSPACE:
case SWIDTH_DSPACE:
rho = 2.202e-8 + (1.030e-15 / (WireMinWidth - 2*WireBarrierThickness));
r = ((rho) / ((WireMinWidth - 2*WireBarrierThickness) *
(WireMetalThickness - WireBarrierThickness)));
break;
case DWIDTH_SSPACE:
case DWIDTH_DSPACE:
rho = 2.202e-8 + (1.030e-15 / (2*WireMinWidth - 2*WireBarrierThickness));
r = ((rho) / ((2*WireMinWidth - 2*WireBarrierThickness) *
(WireMetalThickness - WireBarrierThickness)));
break;
default:
warn("Orion: Width spacing model not found: %s\n", m_width_spacing_model);
r = 1.0;
}
return r;
}
// COMPUTE WIRE CAPACITANCE using PTM models
double Wire::calc_gnd_cap_unit_len()
{
// c_g is in F
double c_g = -1.0;
double WireMinWidth = m_tech_param_ptr->get_WireMinWidth();
double WireMinSpacing = m_tech_param_ptr->get_WireMinSpacing();
double WireMetalThickness = m_tech_param_ptr->get_WireMetalThickness();
double WireDielectricThickness = m_tech_param_ptr->get_WireDielectricThickness();
double WireDielectricConstant = m_tech_param_ptr->get_WireDielectricConstant();
switch(m_width_spacing_model)
{
case SWIDTH_SSPACE:
{
double A = (WireMinWidth/WireDielectricThickness);
double B = 2.04*pow((WireMinSpacing/(WireMinSpacing +
0.54*WireDielectricThickness)), 1.77);
double C = pow((WireMetalThickness/(WireMetalThickness +
4.53*WireDielectricThickness)), 0.07);
c_g = WireDielectricConstant*8.85e-12*(A+(B*C));
break;
}
case SWIDTH_DSPACE:
{
double minSpacingNew = 2*WireMinSpacing + WireMinWidth;
double A = (WireMinWidth/WireDielectricThickness);
double B = 2.04*pow((minSpacingNew/(minSpacingNew +
0.54*WireDielectricThickness)), 1.77);
double C = pow((WireMetalThickness/(WireMetalThickness +
4.53*WireDielectricThickness)), 0.07);
c_g = WireDielectricConstant*8.85e-12*(A+(B*C));
break;
}
case DWIDTH_SSPACE:
{
double minWidthNew = 2*WireMinWidth;
double A = (minWidthNew/WireDielectricThickness);
double B = 2.04*pow((WireMinSpacing/(WireMinSpacing +
0.54*WireDielectricThickness)), 1.77);
double C = pow((WireMetalThickness/(WireMetalThickness +
4.53*WireDielectricThickness)), 0.07);
c_g = WireDielectricConstant*8.85e-12*(A+(B*C));
break;
}
case DWIDTH_DSPACE:
{
double minWidthNew = 2*WireMinWidth;
double minSpacingNew = 2*WireMinSpacing;
double A = (minWidthNew/WireDielectricThickness);
double B = 2.04*pow((minSpacingNew/(minSpacingNew+
0.54*WireDielectricThickness)), 1.77);
double C = pow((WireMetalThickness/(WireMetalThickness +
4.53*WireDielectricThickness)), 0.07);
c_g = WireDielectricConstant*8.85e-12*(A+(B*C));
break;
}
default:
warn("Orion: Width spacing model not found: %s\n", m_width_spacing_model);
c_g = 1.0;
}
return c_g;
}
// Computes the coupling capacitance considering cross-talk
double Wire::calc_couple_cap_unit_len()
{
//c_c is in F
double c_c = -1.0;
double WireMinWidth = m_tech_param_ptr->get_WireMinWidth();
double WireMinSpacing = m_tech_param_ptr->get_WireMinSpacing();
double WireMetalThickness = m_tech_param_ptr->get_WireMetalThickness();
double WireDielectricThickness = m_tech_param_ptr->get_WireDielectricThickness();
double WireDielectricConstant = m_tech_param_ptr->get_WireDielectricConstant();
switch(m_width_spacing_model)
{
case SWIDTH_SSPACE:
{
double A = 1.14*(WireMetalThickness/WireMinSpacing) *
exp(-4*WireMinSpacing/(WireMinSpacing + 8.01*WireDielectricThickness));
double B = 2.37*pow((WireMinWidth/(WireMinWidth + 0.31*WireMinSpacing)), 0.28);
double C = pow((WireDielectricThickness/(WireDielectricThickness +
8.96*WireMinSpacing)), 0.76) *
exp(-2*WireMinSpacing/(WireMinSpacing + 6*WireDielectricThickness));
c_c = WireDielectricConstant*8.85e-12*(A + (B*C));
break;
}
case SWIDTH_DSPACE:
{
double minSpacingNew = 2*WireMinSpacing + WireMinWidth;
double A = 1.14*(WireMetalThickness/minSpacingNew) *
exp(-4*minSpacingNew/(minSpacingNew + 8.01*WireDielectricThickness));
double B = 2.37*pow((WireMinWidth/(WireMinWidth + 0.31*minSpacingNew)), 0.28);
double C = pow((WireDielectricThickness/(WireDielectricThickness +
8.96*minSpacingNew)), 0.76) *
exp(-2*minSpacingNew/(minSpacingNew + 6*WireDielectricThickness));
c_c = WireDielectricConstant*8.85e-12*(A + (B*C));
break;
}
case DWIDTH_SSPACE:
{
double minWidthNew = 2*WireMinWidth;
double A = 1.14*(WireMetalThickness/WireMinSpacing) *
exp(-4*WireMinSpacing/(WireMinSpacing + 8.01*WireDielectricThickness));
double B = 2.37*pow((2*minWidthNew/(2*minWidthNew + 0.31*WireMinSpacing)), 0.28);
double C = pow((WireDielectricThickness/(WireDielectricThickness +
8.96*WireMinSpacing)), 0.76) *
exp(-2*WireMinSpacing/(WireMinSpacing + 6*WireDielectricThickness));
c_c = WireDielectricConstant*8.85e-12*(A + (B*C));
break;
}
case DWIDTH_DSPACE:
{
double minWidthNew = 2*WireMinWidth;
double minSpacingNew = 2*WireMinSpacing;
double A = 1.14*(WireMetalThickness/minSpacingNew) *
exp(-4*minSpacingNew/(minSpacingNew + 8.01*WireDielectricThickness));
double B = 2.37*pow((minWidthNew/(minWidthNew + 0.31*minSpacingNew)), 0.28);
double C = pow((WireDielectricThickness/(WireDielectricThickness +
8.96*minSpacingNew)), 0.76) *
exp(-2*minSpacingNew/(minSpacingNew + 6*WireDielectricThickness));
c_c = WireDielectricConstant*8.85e-12*(A + (B*C));
break;
}
default:
warn("Orion: Width spacing model not found: %s\n", m_width_spacing_model);
c_c = 1.0;
}
return c_c;
}

View file

@ -0,0 +1,92 @@
/*
* Copyright (c) 2009 Princeton University, and
* Regents of the University of California
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*
* Authors: Hangsheng Wang (Orion 1.0, Princeton)
* Xinping Zhu (Orion 1.0, Princeton)
* Xuning Chen (Orion 1.0, Princeton)
* Bin Li (Orion 2.0, Princeton)
* Kambiz Samadi (Orion 2.0, UC San Diego)
*/
#ifndef __WIRE_H__
#define __WIRE_H__
#include "mem/ruby/network/orion/Type.hh"
class TechParameter;
class Wire
{
public:
enum WidthSpacingModel
{
SWIDTH_SSPACE,
SWIDTH_DSPACE,
DWIDTH_SSPACE,
DWIDTH_DSPACE
};
enum BufferScheme
{
MIN_DELAY,
STAGGERED
};
public:
Wire(
const string& wire_spacing_model_str_,
const string& buf_scheme_str_,
bool is_shielding_,
const TechParameter* tech_param_ptr_
);
~Wire();
public:
void calc_opt_buffering(int* k_, double* h_, double len_) const;
double calc_dynamic_energy(double len_) const;
double calc_static_power(double len_) const;
private:
void init();
void set_width_spacing_model(const string& wire_spacing_model_str_);
void set_buf_scheme(const string& buf_scheme_str_);
double calc_res_unit_len();
double calc_gnd_cap_unit_len();
double calc_couple_cap_unit_len();
private:
const TechParameter* m_tech_param_ptr;
WidthSpacingModel m_width_spacing_model;
BufferScheme m_buf_scheme;
bool m_is_shielding;
double m_res_unit_len;
double m_gnd_cap_unit_len;
double m_couple_cap_unit_len;
};
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* Copyright (c) 2010 Massachusetts Institute of Technology
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -24,16 +24,16 @@
* 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.
*
* Authors: Chia-Hsin Owen Chen
*/
#ifndef _POWER_STATIC_H
#define _POWER_STATIC_H
#ifndef __ORION_H__
#define __ORION_H__
#include "mem/ruby/network/orion/parm_technology.hh"
extern double NMOS_TAB[1];
extern double PMOS_TAB[1];
extern double NAND2_TAB[4];
extern double NOR2_TAB[4];
#include "mem/ruby/network/orion/OrionConfig.hh"
#include "mem/ruby/network/orion/OrionRouter.hh"
#include "mem/ruby/network/orion/OrionLink.hh"
#endif

View file

@ -1,474 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 _PARM_TECHNOLOGY_H
#define _PARM_TECHNOLOGY_H
/******* LEAKAGE current values for different tech points are in power_static.c *******/
/******* for LINKS: metal cap is assumed to be CC2metal and repeater size is assumed to be n_size=Lambda*10, p_size=n_size*2 *******/
#define SWITCHING_FACTOR 0.5 /*used for offline calculations*/
/********************* Technology point **********/
#define PARM_TECH_POINT 10 /* 100nm */
#define PARM_Freq 3e9
/*************************************************/
/*********** Transistor parasitics ******************/
#define PARM_Cndiffside (2.750000e-16)
#define PARM_Cpdiffovlp (1.380000e-16)
#define PARM_Cgatepass (1.450000e-15)
#define PARM_Cpdiffarea (3.430000e-16)
#define PARM_Cpdiffside (2.750000e-16)
#define PARM_Cpoxideovlp (3.380000e-16)
#define PARM_Cndiffovlp (1.380000e-16)
#define PARM_Cndiffarea (1.370000e-16)
#define PARM_Cgate (1.950000e-15)
#define PARM_Cnoxideovlp (2.630000e-16)
/*************************************************/
/************* Scaling factors for different technology points ******************/
#if ( PARM_TECH_POINT == 10 ) /* 100nm */
#define CSCALE (84.2172) /* wire capacitance scaling factor */
/* linear: 51.7172, predicted: 84.2172 */
#define RSCALE (80.0000) /* wire resistance scaling factor */
#define LSCALE 0.1250 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.38 /* voltage scaling factor */
#define VTSCALE 0.49 /* threshold voltage scaling factor */
#define SSCALE 0.80 /* sense voltage scaling factor */
/* FIXME: borrowed from 0.11u technology */
#define MCSCALE 5.2277 /* metal coupling capacitance scaling factor */
#define MCSCALE2 3 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.5 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (1/PARM_GEN_POWER_FACTOR)
/* copied from TECH_POINT 10 except LSCALE */
#elif ( PARM_TECH_POINT == 11 ) /* 110nm */
#define CSCALE (84.2172) /* wire capacitance scaling factor */
#define RSCALE (80.0000) /* wire resistance scaling factor */
#define LSCALE 0.1375 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.38 /* voltage scaling factor */
#define VTSCALE 0.49 /* threshold voltage scaling factor */
#define SSCALE 0.80 /* sense voltage scaling factor */
#define MCSCALE 5.2277 /* metal coupling capacitance scaling factor */
#define MCSCALE2 3 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.5 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (1/PARM_GEN_POWER_FACTOR)
#elif ( PARM_TECH_POINT == 18 ) /* 180nm */
#define CSCALE (19.7172) /* wire capacitance scaling factor */
#define RSCALE (20.0000) /* wire resistance scaling factor */
#define LSCALE 0.2250 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.4 /* voltage scaling factor */
#define VTSCALE 0.5046 /* threshold voltage scaling factor */
#define SSCALE 0.85 /* sense voltage scaling factor */
#define MCSCALE 4.1250 /* metal coupling capacitance scaling factor */
#define MCSCALE2 2.4444 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.2 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE 1
#elif ( PARM_TECH_POINT == 25 ) /* 250nm */
#define CSCALE (10.2197) /* wire capacitance scaling factor */
#define RSCALE (10.2571) /* wire resistance scaling factor */
#define LSCALE 0.3571 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.45 /* voltage scaling factor */
#define VTSCALE 0.5596 /* threshold voltage scaling factor */
#define SSCALE 0.90 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE PARM_GEN_POWER_FACTOR
#elif ( PARM_TECH_POINT == 35 ) /* 350nm */
#define CSCALE (5.2197) /* wire capacitance scaling factor */
#define RSCALE (5.2571) /* wire resistance scaling factor */
#define LSCALE 0.4375 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 0.5 /* voltage scaling factor */
#define VTSCALE 0.6147 /* threshold voltage scaling factor */
#define SSCALE 0.95 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (PARM_GEN_POWER_FACTOR*PARM_GEN_POWER_FACTOR)
#elif ( PARM_TECH_POINT == 40 ) /* 400nm */
#define CSCALE 1.0 /* wire capacitance scaling factor */
#define RSCALE 1.0 /* wire resistance scaling factor */
#define LSCALE 0.5 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 1.0 /* voltage scaling factor */
#define VTSCALE 1.0 /* threshold voltage scaling factor */
#define SSCALE 1.0 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (PARM_GEN_POWER_FACTOR*PARM_GEN_POWER_FACTOR*PARM_GEN_POWER_FACTOR)
#else /* ( PARM_TECH_POINT == 80 ) */ /* 800nm */
#define CSCALE 1.0 /* wire capacitance scaling factor */
#define RSCALE 1.0 /* wire resistance scaling factor */
#define LSCALE 1.0 /* length (feature) scaling factor */
#define ASCALE (LSCALE*LSCALE) /* area scaling factor */
#define VSCALE 1.0 /* voltage scaling factor */
#define VTSCALE 1.0 /* threshold voltage scaling factor */
#define SSCALE 1.0 /* sense voltage scaling factor */
#define MCSCALE 1.0 /* metal coupling capacitance scaling factor */
#define MCSCALE2 1.0 /* metal coupling capacitance scaling factor (2X) */
#define MCSCALE3 1.0 /* metal coupling capacitance scaling factor (3X) */
#define GEN_POWER_SCALE (PARM_GEN_POWER_FACTOR*PARM_GEN_POWER_FACTOR*PARM_GEN_POWER_FACTOR*PARM_GEN_POWER_FACTOR)
#endif
#define MSCALE (LSCALE * .624 / .2250)
#define PARM_NORMALIZE_SCALE (6.488730e-10)
/* scaling factors from 0.1u to 0.07u, 0.05u and 0.035u */
/* if technology point is 0.07u, o.05u or 0.035u set PARM_TECH_POINT to 10 and
* set TEST_LENGTH to 70, 50 or 35 respectively(TEST_LENGTH =100 for all other technologies) */
#define TEST_LENGTH (70)
#if (TEST_LENGTH == 70)
#define SCALE_T (0.5489156157)
#define SCALE_M (0.6566502462)
#define SCALE_S (1.4088071075)
#elif (TEST_LENGTH == 50)
#define SCALE_T (0.3251012552)
#define SCALE_M (0.4426460239)
#define SCALE_S (2.8667111607)
#elif (TEST_LENGTH == 35)
#define SCALE_T (0.2016627474)
#define SCALE_M (0.2489788586)
#define SCALE_S (8.7726826878)
#else
#define SCALE_T (1)
#define SCALE_M (1)
#define SCALE_S (1)
#endif /* TEST_LENGTH */
/*************************************************/
/********************** technology point related ***************************/
/* um */
#define Leff (0.8 * LSCALE)
/* length unit in um */
#define Lamda (Leff * 0.5)
#ifndef Vdd
#define Vdd (5 * VSCALE)
#endif /* Vdd */
#define Period ((double)1/(double)PARM_Freq)
/*************************************************/
/**** for SRAM - decoder, mem cell, wordline, bitline, output driver ****/
/*
* CMOS 0.8um model parameters
* - from Appendix II of Cacti tech report
*/
/* corresponds to 8um of m3 @ 225ff/um */
#define Cwordmetal (1.8e-15 * (CSCALE * ASCALE) * SCALE_M)
/* corresponds to 16um of m2 @ 275ff/um */
#define Cbitmetal (4.4e-15 * (CSCALE * ASCALE) * SCALE_M)
/* corresponds to 1um of m2 @ 275ff/um */
#define Cmetal (Cbitmetal/16)
#define CM2metal (Cbitmetal/16)
#define CM3metal (Cbitmetal/16)
/* minimal spacing metal cap per unit length */
#define CCmetal (Cmetal * MCSCALE)
#define CCM2metal (CM2metal * MCSCALE)
#define CCM3metal (CM3metal * MCSCALE)
/* 2x minimal spacing metal cap per unit length */
#define CC2metal (Cmetal * MCSCALE2)
#define CC2M2metal (CM2metal * MCSCALE2)
#define CC2M3metal (CM3metal * MCSCALE2)
/* 3x minimal spacing metal cap per unit length */
#define CC3metal (Cmetal * MCSCALE3)
#define CC3M2metal (CM2metal * MCSCALE3)
#define CC3M3metal (CM3metal * MCSCALE3)
/* fF/um */
#define Cpolywire (0.25e-15 * CSCALE * LSCALE)
/* ohms*um of channel width */
#define Rnchannelstatic (25800 * LSCALE)
/* ohms*um of channel width */
#define Rpchannelstatic (61200 * LSCALE)
#define Rnchannelon (9723 * LSCALE)
#define Rpchannelon (22400 * LSCALE)
/* corresponds to 16um of m2 @ 48mO/sq */
#define Rbitmetal (0.320 * (RSCALE * ASCALE))
/* corresponds to 8um of m3 @ 24mO/sq */
#define Rwordmetal (0.080 * (RSCALE * ASCALE))
#define Powerfactor (PARM_Freq)*Vdd*Vdd
#define EnergyFactor (Vdd*Vdd)
#define SensePowerfactor3 (PARM_Freq)*(Vbitsense)*(Vbitsense) //
#define SensePowerfactor2 (PARM_Freq)*(Vbitpre-Vbitsense)*(Vbitpre-Vbitsense) //
#define SensePowerfactor (PARM_Freq)*Vdd*(Vdd/2) //
#define SenseEnergyFactor (Vdd*Vdd/2)
/* transistor widths in um (as described in tech report, appendix 1) */
#define Wdecdrivep (57.0 * LSCALE)
#define Wdecdriven (40.0 * LSCALE)
#define Wdec3to8n (14.4 * LSCALE)
#define Wdec3to8p (14.4 * LSCALE)
#define WdecNORn (5.4 * LSCALE)
#define WdecNORp (30.5 * LSCALE)
#define Wdecinvn (5.0 * LSCALE)
#define Wdecinvp (10.0 * LSCALE)
#define Wworddrivemax (100.0 * LSCALE)
#define Wmemcella (2.4 * LSCALE) /* AMIT memory cell inverter PMOS transistor width */
#define Wmemcellr (4.0 * LSCALE) /* AMIT memory cell read access transistor width */
#define Wmemcellw (2.1 * LSCALE) /* AMIT memory cell write access transistor width */
#define Wmemcellbscale 2 /* AMIT (mem cell inverter NMOS trans width = Wmemcella * Wmemcellbscale) means 2x bigger than Wmemcella */
#define Wbitpreequ (10.0 * LSCALE) //
#define Wbitmuxn (10.0 * LSCALE)
#define WsenseQ1to4 (4.0 * LSCALE)
#define Wcompinvp1 (10.0 * LSCALE)
#define Wcompinvn1 (6.0 * LSCALE)
#define Wcompinvp2 (20.0 * LSCALE)
#define Wcompinvn2 (12.0 * LSCALE)
#define Wcompinvp3 (40.0 * LSCALE)
#define Wcompinvn3 (24.0 * LSCALE)
#define Wevalinvp (20.0 * LSCALE)
#define Wevalinvn (80.0 * LSCALE)
#define Wcompn (20.0 * LSCALE)
#define Wcompp (30.0 * LSCALE)
#define Wcomppreequ (40.0 * LSCALE)
#define Wmuxdrv12n (30.0 * LSCALE)
#define Wmuxdrv12p (50.0 * LSCALE)
#define WmuxdrvNANDn (20.0 * LSCALE)
#define WmuxdrvNANDp (80.0 * LSCALE)
#define WmuxdrvNORn (60.0 * LSCALE)
#define WmuxdrvNORp (80.0 * LSCALE)
#define Wmuxdrv3n (200.0 * LSCALE)
#define Wmuxdrv3p (480.0 * LSCALE)
#define Woutdrvseln (12.0 * LSCALE)
#define Woutdrvselp (20.0 * LSCALE)
#define Woutdrvnandn (24.0 * LSCALE)
#define Woutdrvnandp (10.0 * LSCALE)
#define Woutdrvnorn (6.0 * LSCALE)
#define Woutdrvnorp (40.0 * LSCALE)
#define Woutdrivern (48.0 * LSCALE)
#define Woutdriverp (80.0 * LSCALE)
#define Wbusdrvn (48.0 * LSCALE)
#define Wbusdrvp (80.0 * LSCALE)
#define Wcompcellpd2 (2.4 * LSCALE) //
#define Wcompdrivern (400.0 * LSCALE)
#define Wcompdriverp (800.0 * LSCALE)
#define Wcomparen2 (40.0 * LSCALE)
#define Wcomparen1 (20.0 * LSCALE)
#define Wmatchpchg (10.0 * LSCALE)
#define Wmatchinvn (10.0 * LSCALE)
#define Wmatchinvp (20.0 * LSCALE)
#define Wmatchnandn (20.0 * LSCALE)
#define Wmatchnandp (10.0 * LSCALE)
#define Wmatchnorn (20.0 * LSCALE)
#define Wmatchnorp (10.0 * LSCALE)
#define WSelORn (10.0 * LSCALE) //
#define WSelORprequ (40.0 * LSCALE) //
#define WSelPn (10.0 * LSCALE) //
#define WSelPp (15.0 * LSCALE) //
#define WSelEnn (5.0 * LSCALE) //
#define WSelEnp (10.0 * LSCALE) //
#define Wsenseextdrv1p (40.0*LSCALE) //
#define Wsenseextdrv1n (24.0*LSCALE) //
#define Wsenseextdrv2p (200.0*LSCALE) //
#define Wsenseextdrv2n (120.0*LSCALE) //
/* bit width of RAM cell in um */
#define BitWidth (16.0 * LSCALE)
/* bit height of RAM cell in um */
#define BitHeight (16.0 * LSCALE)
#define Cout (0.5e-12 * LSCALE)
/* Sizing of cells and spacings */
#define RatCellHeight (40.0 * LSCALE) //
#define RatCellWidth (70.0 * LSCALE) //
#define RatShiftRegWidth (120.0 * LSCALE) //
#define RatNumShift 4 //
#define BitlineSpacing (6.0 * LSCALE)
#define WordlineSpacing (6.0 * LSCALE)
#define RegCellHeight (16.0 * LSCALE) /* AMIT memory cell height */
#define RegCellWidth (8.0 * LSCALE) /* AMIT memory cell width */
#define CamCellHeight (40.0 * LSCALE)
#define CamCellWidth (25.0 * LSCALE)
#define MatchlineSpacing (6.0 * LSCALE)
#define TaglineSpacing (6.0 * LSCALE)
#define CrsbarCellHeight (6.0 * LSCALE)
#define CrsbarCellWidth (6.0 * LSCALE)
/* Link length in um */
#define PARM_link_length 1000
/*************************************************/
/******* LEAKAGE current values for different tech points are in power_static.c *******/
/******* for LINKS: metal cap is assumed to be CC2metal and repeater size is assumed to be n_size=Lambda*10, p_size=n_size*2 *******/
/* -------------------------Miscellaneous---------------------------- */
#define SIM_NO_MODEL 0
#define MAX_ENERGY 1
#define AVG_ENERGY 0
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#ifndef MIN
#define MIN(a,b) (((a)>(b))?(b):(a))
#endif
#define NEXT_DEPTH(d) ((d) > 0 ? (d) - 1 : (d))
#define BIGNUM 1e30
#define BIGONE ((unsigned long int)1)
#define BIGNONE ((unsigned long int)-1)
#define HAMM_MASK(w) ((unsigned)w < (sizeof(unsigned long int) << 3) ? (BIGONE << w) - 1 : BIGNONE)
/* Used to communicate with the horowitz model */
#define RISE 1
#define FALL 0
#define NCH 1
#define PCH 0
/* --------------------------------------------------- */
/* ---------------------- not used ------------------------------- */
#define krise (0.4e-9 * LSCALE) //
#define tsensedata (5.8e-10 * LSCALE) //
#define tsensetag (2.6e-10 * LSCALE) //
#define tfalldata (7e-10 * LSCALE) //
#define tfalltag (7e-10 * LSCALE) //
#define Vbitpre (3.3 * SSCALE) //
#define Vt (1.09 * VTSCALE)
#define Vbitsense (0.10 * SSCALE) //
#define PARM_AF (5.000000e-01) //
#define PARM_MAXN (8) //
#define PARM_MAXSUBARRAYS (8) //
#define PARM_MAXSPD (8) //
#define PARM_VTHSENSEEXTDRV (4.370000e-01) //
#define PARM_VTHOUTDRNOR (4.310000e-01) //
#define PARM_res_fpalu (4) //
#define PARM_VTHCOMPINV (4.370000e-01) //
#define PARM_MD_NUM_IREGS (32) //
#define PARM_die_length (1.800000e-02) //
#define PARM_BITOUT (64) //
#define PARM_ruu_decode_width (4) //
#define PARM_ruu_issue_width (4) // AMIT used only for result bus
#define PARM_amp_Idsat (5.000000e-04) //used in amp_energy
#define PARM_AF_TYPE (1) //
#define PARM_VSINV (4.560000e-01) //used in driver size calculations
#define PARM_GEN_POWER_FACTOR (1.310000e+00) //
#define PARM_res_memport (2) //
#define PARM_VTHNAND60x90 (5.610000e-01) //
#define PARM_opcode_length (8) //
#define PARM_MD_NUM_FREGS (32) //
#define PARM_FUDGEFACTOR (1.000000e+00) //
#define PARM_ruu_commit_width (4) //
#define PARM_VTHOUTDRIVE (4.250000e-01) //
#define PARM_VTHMUXDRV1 (4.370000e-01) //
#define PARM_inst_length (32) //
#define PARM_VTHMUXDRV2 (4.860000e-01) //
#define PARM_ras_size (8) //
#define PARM_VTHMUXDRV3 (4.370000e-01) //
#define PARM_ADDRESS_BITS (64) //
#define PARM_RUU_size (16) //
#define PARM_VTHNOR12x4x1 (5.030000e-01) //
#define PARM_VTHNOR12x4x2 (4.520000e-01) //
#define PARM_VTHOUTDRINV (4.370000e-01) //
#define PARM_VTHNOR12x4x3 (4.170000e-01) //
#define PARM_VTHEVALINV (2.670000e-01) //
#define PARM_crossover_scaling (1.200000e+00) //
#define PARM_VTHNOR12x4x4 (3.900000e-01) //
#define PARM_turnoff_factor (1.000000e-01) //
#define PARM_res_ialu (4) //
#define PARM_VTHOUTDRNAND (4.410000e-01) //
#define PARM_VTHINV100x60 (4.380000e-01) //
#define PARM_LSQ_size (8) //
/* ALU POWER NUMBERS for .18um 733Mhz */
/* normalize .18um cap to other gen's cap, then xPowerfactor */
#define POWER_SCALE (GEN_POWER_SCALE * PARM_NORMALIZE_SCALE * Powerfactor) //
#define I_ADD ((.37 - .091)*POWER_SCALE) //
#define I_ADD32 (((.37 - .091)/2)*POWER_SCALE) //
#define I_MULT16 ((.31-.095)*POWER_SCALE) //
#define I_SHIFT ((.21-.089)*POWER_SCALE) //
#define I_LOGIC ((.04-.015)*POWER_SCALE) //
#define F_ADD ((1.307-.452)*POWER_SCALE) //
#define F_MULT ((1.307-.452)*POWER_SCALE) //
#define I_ADD_CLOCK (.091*POWER_SCALE) //
#define I_MULT_CLOCK (.095*POWER_SCALE) //
#define I_SHIFT_CLOCK (.089*POWER_SCALE) //
#define I_LOGIC_CLOCK (.015*POWER_SCALE) //
#define F_ADD_CLOCK (.452*POWER_SCALE) //
#define F_MULT_CLOCK (.452*POWER_SCALE) //
/* ----------------------------------------------------- */
#endif

View file

@ -1,392 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 <stdio.h>
#include "mem/ruby/network/orion/power_arbiter.hh"
#include "mem/ruby/network/orion/power_array.hh"
#include "mem/ruby/network/orion/power_ll.hh"
#include "mem/ruby/network/orion/parm_technology.hh"
#include "mem/ruby/network/orion/SIM_port.hh"
#include "mem/ruby/network/orion/power_static.hh"
#include "mem/ruby/network/orion/power_utils.hh"
/******************************* Power model for flip flop *****************************/
/* ------- flip flop model ---------- */
/* this model is based on the gate-level design given by Randy H. Katz "Contemporary Logic Design"
* Figure 6.24, node numbers (1-6) are assigned to all gate outputs, left to right, top to bottom
*
* We should have pure cap functions and leave the decision of whether or not to have coefficient
* 1/2 in init function.
*/
static double SIM_fpfp_node_cap(unsigned fan_in, unsigned fan_out)
{
double Ctotal = 0;
/* FIXME: all need actual sizes */
/* part 1: drain cap of NOR gate */
Ctotal += fan_in * SIM_power_draincap(WdecNORn, NCH, 1) + SIM_power_draincap(WdecNORp, PCH, fan_in);
/* part 2: gate cap of NOR gates */
Ctotal += fan_out * SIM_power_gatecap(WdecNORn + WdecNORp, 0);
return Ctotal;
}
static double SIM_fpfp_clock_cap(void)
{
/* gate cap of clock load */
return (2 * SIM_power_gatecap(WdecNORn + WdecNORp, 0));
}
int SIM_fpfp_clear_stat(power_ff *ff)
{
ff->n_switch = ff->n_keep_1 = ff->n_keep_0 = ff->n_clock = 0;
return 0;
}
int SIM_fpfp_init(power_ff *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;
/* static power */
ff->i_leakage = (WdecNORp * NOR2_TAB[0] + WdecNORn * (NOR2_TAB[1] + NOR2_TAB[2] + NOR2_TAB[3])) / 4 * 6 / PARM_TECH_POINT * 100;
break;
default: break;/* some error handler */
}
return 0;
}
else
return -1;
}
double SIM_fpfp_report(power_ff *ff)
{
return (ff->e_switch * ff->n_switch + ff->e_clock * ff->n_clock +
ff->e_keep_0 * ff->n_keep_0 + ff->e_keep_1 * ff->n_keep_1);
}
/* ------- flip flop model ---------- */
/* -------- arbiter power model ------------- */
/* switch cap of request signal (round robin arbiter) */
static double rr_arbiter_req_cap(double length)
{
double Ctotal = 0;
/* part 1: gate cap of 2 NOR gates */
/* FIXME: need actual size */
Ctotal += 2 * SIM_power_gatecap(WdecNORn + WdecNORp, 0);
/* part 2: inverter */
/* FIXME: need actual size */
Ctotal += SIM_power_draincap(Wdecinvn, NCH, 1) + SIM_power_draincap(Wdecinvp, PCH, 1) +
SIM_power_gatecap(Wdecinvn + Wdecinvp, 0);
/* part 3: wire cap */
Ctotal += length * Cmetal;
return Ctotal;
}
/* switch cap of priority signal (round robin arbiter) */
static double rr_arbiter_pri_cap()
{
double Ctotal = 0;
/* part 1: gate cap of NOR gate */
/* FIXME: need actual size */
Ctotal += SIM_power_gatecap(WdecNORn + WdecNORp, 0);
return Ctotal;
}
/* switch cap of grant signal (round robin arbiter) */
static double rr_arbiter_grant_cap()
{
double Ctotal = 0;
/* part 1: drain cap of NOR gate */
/* FIXME: need actual size */
Ctotal += 2 * SIM_power_draincap(WdecNORn, NCH, 1) + SIM_power_draincap(WdecNORp, PCH, 2);
return Ctotal;
}
/* switch cap of carry signal (round robin arbiter) */
static double rr_arbiter_carry_cap()
{
double Ctotal = 0;
/* part 1: drain cap of NOR gate (this block) */
/* FIXME: need actual size */
Ctotal += 2 * SIM_power_draincap(WdecNORn, NCH, 1) + SIM_power_draincap(WdecNORp, PCH, 2);
/* part 2: gate cap of NOR gate (next block) */
/* FIXME: need actual size */
Ctotal += SIM_power_gatecap(WdecNORn + WdecNORp, 0);
return Ctotal;
}
/* switch cap of internal carry node (round robin arbiter) */
static double rr_arbiter_carry_in_cap()
{
double Ctotal = 0;
/* part 1: gate cap of 2 NOR gates */
/* FIXME: need actual size */
Ctotal += 2 * SIM_power_gatecap(WdecNORn + WdecNORp, 0);
/* part 2: drain cap of NOR gate */
/* FIXME: need actual size */
Ctotal += 2 * SIM_power_draincap(WdecNORn, NCH, 1) + SIM_power_draincap(WdecNORp, PCH, 2);
return Ctotal;
}
/* the "huge" NOR gate in matrix arbiter model is an approximation */
/* switch cap of request signal (matrix arbiter) */
static double matrix_arbiter_req_cap(unsigned req_width, double length)
{
double Ctotal = 0;
/* FIXME: all need actual sizes */
/* part 1: gate cap of NOR gates */
Ctotal += (req_width - 1) * SIM_power_gatecap(WdecNORn + WdecNORp, 0);
/* part 2: inverter */
Ctotal += SIM_power_draincap(Wdecinvn, NCH, 1) + SIM_power_draincap(Wdecinvp, PCH, 1) +
SIM_power_gatecap(Wdecinvn + Wdecinvp, 0);
/* part 3: gate cap of the "huge" NOR gate */
Ctotal += SIM_power_gatecap(WdecNORn + WdecNORp, 0);
/* part 4: wire cap */
Ctotal += length * Cmetal;
return Ctotal;
}
/* switch cap of priority signal (matrix arbiter) */
static double matrix_arbiter_pri_cap(unsigned req_width)
{
double Ctotal = 0;
/* part 1: gate cap of NOR gates (2 groups) */
Ctotal += 2 * SIM_power_gatecap(WdecNORn + WdecNORp, 0);
/* no inverter because priority signal is kept by a flip flop */
return Ctotal;
}
/* switch cap of grant signal (matrix arbiter) */
static double matrix_arbiter_grant_cap(unsigned req_width)
{
/* drain cap of the "huge" NOR gate */
return (req_width * SIM_power_draincap(WdecNORn, NCH, 1) + SIM_power_draincap(WdecNORp, PCH, req_width));
}
/* switch cap of internal node (matrix arbiter) */
static double matrix_arbiter_int_cap()
{
double Ctotal = 0;
/* part 1: drain cap of NOR gate */
Ctotal += 2 * SIM_power_draincap(WdecNORn, NCH, 1) + SIM_power_draincap(WdecNORp, PCH, 2);
/* part 2: gate cap of the "huge" NOR gate */
Ctotal += SIM_power_gatecap(WdecNORn + WdecNORp, 0);
return Ctotal;
}
static int arbiter_clear_stat(power_arbiter *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;
}
int power_arbiter_init(power_arbiter *arb, int arbiter_model, int ff_model, unsigned req_width, double length, power_array_info *info)
{
if ((arb->model = arbiter_model) && arbiter_model < ARBITER_MAX_MODEL) {
arb->req_width = req_width;
arbiter_clear_stat(arb);
/* redundant field */
arb->mask = HAMM_MASK(req_width);
switch (arbiter_model) {
case RR_ARBITER:
arb->e_chg_req = rr_arbiter_req_cap(length) / 2 * EnergyFactor;
/* two grant signals switch together, so no 1/2 */
arb->e_chg_grant = rr_arbiter_grant_cap() * EnergyFactor;
arb->e_chg_carry = rr_arbiter_carry_cap() / 2 * EnergyFactor;
arb->e_chg_carry_in = rr_arbiter_carry_in_cap() / 2 * EnergyFactor;
arb->e_chg_mint = 0;
if (SIM_fpfp_init(&arb->pri_ff, ff_model, rr_arbiter_pri_cap()))
return -1;
break;
case MATRIX_ARBITER:
arb->e_chg_req = matrix_arbiter_req_cap(req_width, length) / 2 * EnergyFactor;
/* 2 grant signals switch together, so no 1/2 */
arb->e_chg_grant = matrix_arbiter_grant_cap(req_width) * EnergyFactor;
arb->e_chg_mint = matrix_arbiter_int_cap() / 2 * EnergyFactor;
arb->e_chg_carry = arb->e_chg_carry_in = 0;
if (SIM_fpfp_init(&arb->pri_ff, ff_model, matrix_arbiter_pri_cap(req_width)))
return -1;
break;
case QUEUE_ARBITER:
arb->e_chg_req = arb->e_chg_grant = arb->e_chg_mint = 0;
arb->e_chg_carry = arb->e_chg_carry_in = 0;
return power_array_init(info, &arb->queue);
break;
default: break;/* some error handler */
}
return 0;
}
else
return -1;
}
int arbiter_record(power_arbiter *arb, unsigned long int new_req, unsigned long int old_req, unsigned new_grant, unsigned old_grant)
{
switch (arb->model) {
case MATRIX_ARBITER:
arb->n_chg_req += SIM_power_Hamming(new_req, old_req, arb->mask);
arb->n_chg_grant += new_grant != old_grant;
/* FIXME: approximation */
arb->n_chg_mint += (arb->req_width - 1) * arb->req_width / 2;
/* priority registers */
/* FIXME: use average instead */
arb->pri_ff.n_switch += (arb->req_width - 1) / 2;
break;
case RR_ARBITER:
arb->n_chg_req += SIM_power_Hamming(new_req, old_req, arb->mask);
arb->n_chg_grant += new_grant != old_grant;
/* FIXME: use average instead */
arb->n_chg_carry += arb->req_width / 2;
arb->n_chg_carry_in += arb->req_width / 2 - 1;
/* priority registers */
arb->pri_ff.n_switch += 2;
break;
case QUEUE_ARBITER:
break;
default: break;/* some error handler */
}
return 0;
}
double arbiter_report(power_arbiter *arb)
{
switch (arb->model) {
case MATRIX_ARBITER:
return (arb->n_chg_req * arb->e_chg_req + arb->n_chg_grant * arb->e_chg_grant +
arb->n_chg_mint * arb->e_chg_mint +
arb->pri_ff.n_switch * arb->pri_ff.e_switch +
arb->pri_ff.n_keep_1 * arb->pri_ff.e_keep_1 +
arb->pri_ff.n_keep_0 * arb->pri_ff.e_keep_0 +
arb->pri_ff.n_clock * arb->pri_ff.e_clock);
case RR_ARBITER:
return (arb->n_chg_req * arb->e_chg_req + arb->n_chg_grant * arb->e_chg_grant +
arb->n_chg_carry * arb->e_chg_carry + arb->n_chg_carry_in * arb->e_chg_carry_in +
arb->pri_ff.n_switch * arb->pri_ff.e_switch +
arb->pri_ff.n_keep_1 * arb->pri_ff.e_keep_1 +
arb->pri_ff.n_keep_0 * arb->pri_ff.e_keep_0 +
arb->pri_ff.n_clock * arb->pri_ff.e_clock);
default: return -1;
}
}
/* ---------- arbiter power model ----------- */

View file

@ -1,90 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*/
// Arbiter
#ifndef _POWER_ARBITER_H
#define _POWER_ARBITER_H
#include "mem/ruby/network/orion/power_array.hh"
typedef enum {
RR_ARBITER =1,
MATRIX_ARBITER,
QUEUE_ARBITER,
ARBITER_MAX_MODEL
} power_arbiter_model;
typedef enum {
NEG_DFF = 1, /* negative egde-triggered D flip-flop */
FF_MAX_MODEL
} power_ff_model;
typedef struct {
int model;
unsigned long int n_switch;
unsigned long int n_keep_1;
unsigned long int n_keep_0;
unsigned long int n_clock;
double e_switch;
double e_keep_1;
double e_keep_0;
double e_clock;
double i_leakage;
} power_ff;
typedef struct{
int model;
unsigned req_width;
unsigned long int n_chg_req;
unsigned long int n_chg_grant;
unsigned long int n_chg_carry; //internal node of rr arbiter
unsigned long int n_chg_carry_in; //internal node of rr arbiter
unsigned long int n_chg_mint; //internal node of matrix arbiter
unsigned long int mask;
double e_chg_req;
double e_chg_grant;
double e_chg_carry;
double e_chg_carry_in;
double e_chg_mint;
power_ff pri_ff; //priority ff
power_array queue; //request queue
double i_leakage;
} power_arbiter;
extern int arbiter_record(power_arbiter *arb, unsigned long int new_req, unsigned long int old_req, unsigned new_grant, unsigned old_grant);
extern double arbiter_report(power_arbiter *arb);
extern int power_arbiter_init(power_arbiter *arb, int arbiter_model, int ff_model, unsigned req_width, double length, power_array_info *info);
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,394 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 _POWER_ARRAY_H
#define _POWER_ARRAY_H
#define SIM_ARRAY_NO_MODEL 0
#define SIM_ARRAY_READ 0
#define SIM_ARRAY_WRITE 1
#define SIM_ARRAY_RECOVER 1
/* read/write */
#define SIM_ARRAY_RW 0
/* only write */
#define SIM_ARRAY_WO 1
typedef enum {
GENERIC_DEC =1,
DEC_MAX_MODEL
} power_dec_model;
typedef enum {
GENERIC_MUX =1,
MUX_MAX_MODEL
} power_mux_model;
typedef enum {
GENERIC_AMP =1,
AMP_MAX_MODEL
} power_amp_model;
typedef enum {
CACHE_RW_WORDLINE =1,
CACHE_WO_WORDLINE,
CAM_RW_WORDLINE,
CAM_WO_WORDLINE,
WORDLINE_MAX_MODEL
} power_wordline_model;
typedef enum {
RW_BITLINE =1,
WO_BITLINE,
BITLINE_MAX_MODEL
} power_bitline_model;
typedef enum {
SINGLE_BITLINE =1,
EQU_BITLINE,
SINGLE_OTHER,
PRE_MAX_MODEL
} power_pre_model;
typedef enum {
NORMAL_MEM =1,
CAM_TAG_RW_MEM,
CAM_TAG_WO_MEM,
CAM_DATA_MEM,
CAM_ATTACH_MEM,
MEM_MAX_MODEL
} power_mem_model;
typedef enum {
CACHE_COMPONENT =1,
CAM_COMP,
COMP_MAX_MODEL
} power_comp_model;
typedef enum {
CACHE_OUTDRV =1,
CAM_OUTDRV,
REG_OUTDRV,
OUTDRV_MAX_MODEL
} power_outdrv_model;
typedef struct {
int model;
unsigned n_bits;
unsigned long int n_chg_output;
unsigned long int n_chg_addr;
unsigned long int n_chg_l1;
double e_chg_output;
double e_chg_addr;
double e_chg_l1;
unsigned n_in_1st;
unsigned n_in_2nd;
unsigned n_out_0th;
unsigned n_out_1st;
unsigned long int addr_mask;
} power_decoder;
typedef struct {
int model;
int share_rw;
unsigned long int n_read;
unsigned long int n_write;
double e_read;
double e_write;
double i_leakage;
} power_wordline;
typedef struct {
int model;
int share_rw;
unsigned end;
unsigned long int n_col_write;
unsigned long int n_col_read;
unsigned long int n_col_sel;
double e_col_write;
double e_col_read;
double e_col_sel;
double i_leakage;
} power_bitline;
typedef struct {
int model;
unsigned long int n_access;
double e_access;
} power_amp;
typedef struct {
int model;
unsigned n_bits;
unsigned assoc;
unsigned long int n_access;
unsigned long int n_match;
unsigned long int n_mismatch;
unsigned long int n_miss;
unsigned long int n_bit_match;
unsigned long int n_bit_mismatch;
unsigned long int n_chg_addr;
double e_access;
double e_match;
double e_mismatch;
double e_miss;
double e_bit_match;
double e_bit_mismatch;
double e_chg_addr;
unsigned long int comp_mask;
} power_comp;
typedef struct {
int model;
unsigned end;
unsigned long int n_switch;
double e_switch;
double i_leakage;
} power_mem;
typedef struct {
int model;
unsigned assoc;
unsigned long int n_mismatch;
unsigned long int n_chg_addr;
double e_mismatch;
double e_chg_addr;
} power_mux;
typedef struct {
int model;
unsigned item_width;
unsigned long int n_select;
unsigned long int n_chg_data;
unsigned long int n_out_1;
unsigned long int n_out_0;
double e_select;
double e_chg_data;
double e_out_1;
double e_out_0;
unsigned long int out_mask;
} power_out;
typedef struct {
int model;
unsigned long int n_charge;
double e_charge;
double i_leakage;
} power_arr_pre;
/*@
* data type: array port state
*
* - row_addr -- input to row decoder
* col_addr -- input to column decoder, if any
* tag_addr -- input to tag comparator
* $+ tag_line -- value of tag bitline
* # data_line_size -- size of data_line in char
* # data_line -- value of data bitline
*
* legend:
* -: only used by non-fully-associative array
* +: only used by fully-associative array
* #: only used by fully-associative array or RF array
* $: only used by write-through array
*
* NOTE:
* (1) *_addr may not necessarily be an address
* (2) data_line_size is the allocated size of data_line in simulator,
* which must be no less than the physical size of data line
* (3) each instance of module should define an instance-specific data
* type with non-zero-length data_line and cast it to this type
*/
typedef struct {
unsigned long int row_addr;
unsigned long int col_addr;
unsigned long int tag_addr;
unsigned long int tag_line;
unsigned data_line_size;
char data_line[0];
} SIM_array_port_state_t;
/*@
* data type: array set state
*
* entry -- pointer to some entry structure if an entry is selected for
* r/w, NULL otherwise
* entry_set -- pointer to corresponding set structure
* + write_flag -- 1 if entry is already written once, 0 otherwise
* + write_back_flag -- 1 if entry is already written back, 0 otherwise
* valid_bak -- valid bit of selected entry before operation
* dirty_bak -- dirty bit of selected entry, if any, before operation
* tag_bak -- tag of selected entry before operation
* use_bak -- use bits of all entries before operation
*
* legend:
* +: only used by fully-associative array
*
* NOTE:
* (1) entry is interpreted by modules, if some module has no "entry structure",
* then make sure this field is non-zero if some entry is selected
* (2) tag_addr may not necessarily be an address
* (3) each instance of module should define an instance-specific data
* type with non-zero-length use_bit and cast it to this type
*/
typedef struct {
void *entry;
void *entry_set;
int write_flag;
int write_back_flag;
unsigned valid_bak;
unsigned dirty_bak;
unsigned long int tag_bak;
unsigned use_bak[0];
} SIM_array_set_state_t;
// Array
typedef struct {
power_decoder row_dec;
power_decoder col_dec;
power_wordline data_wordline;
power_wordline tag_wordline;
power_bitline data_bitline;
power_bitline tag_bitline;
power_mem data_mem;
power_mem tag_mem;
power_mem tag_attach_mem;
power_amp data_amp;
power_amp tag_amp;
power_comp comp;
power_mux mux;
power_out outdrv;
power_arr_pre row_dec_pre;
power_arr_pre col_dec_pre;
power_arr_pre data_bitline_pre;
power_arr_pre tag_bitline_pre;
power_arr_pre data_colsel_pre;
power_arr_pre tag_colsel_pre;
power_arr_pre comp_pre;
double i_leakage;
} power_array;
typedef struct {
//common for data and tag array
int share_rw;
unsigned read_ports;
unsigned write_ports;
unsigned n_set;
unsigned blk_bits;
unsigned assoc;
int row_dec_model;
//for data array
unsigned data_width;
int col_dec_model;
int mux_model;
int outdrv_model;
//for tag array
unsigned tag_addr_width;
unsigned tag_line_width;
int comp_model;
//data common
unsigned data_ndwl;
unsigned data_ndbl;
unsigned data_nspd;
unsigned data_n_share_amp;
unsigned data_end;
int data_wordline_model;
int data_bitline_model;
int data_amp_model;
int data_mem_model;
//tag common
unsigned tag_ndwl;
unsigned tag_ndbl;
unsigned tag_nspd;
unsigned tag_n_share_amp;
unsigned tag_end;
unsigned tag_wordline_model;
unsigned tag_bitline_model;
unsigned tag_amp_model;
unsigned tag_mem_model;
unsigned tag_attach_mem_model;
//precharging parameters
int row_dec_pre_model;
int col_dec_pre_model;
int data_bitline_pre_model;
int tag_bitline_pre_model;
int data_colsel_pre_model;
int tag_colsel_pre_model;
int comp_pre_model;
//derived
unsigned n_item;
unsigned eff_data_cols;
unsigned eff_tag_cols;
//flags used by prototype array model
unsigned use_bit_width;
unsigned valid_bit_width;
int write_policy;
//fields filled up during initialization
double data_arr_width;
double tag_arr_width;
double data_arr_height;
double tag_arr_height;
} power_array_info;
extern int power_array_init(power_array_info *info, power_array *arr );
extern double array_report(power_array_info *info, power_array *arr);
extern int SIM_buf_power_data_read(power_array_info *info, power_array *arr, unsigned long int data);
extern int SIM_buf_power_data_write(power_array_info *info, power_array *arr, char *data_line, char *old_data, char *new_data);
extern int SIM_array_clear_stat(power_array *arr);
extern int SIM_power_array_dec( power_array_info *info, power_array *arr, SIM_array_port_state_t *port, unsigned long int row_addr, int rw );
extern int SIM_power_array_data_read( power_array_info *info, power_array *arr, unsigned long int data );
extern int SIM_power_array_data_write( power_array_info *info, power_array *arr, SIM_array_set_state_t *set, unsigned n_item, char *data_line, char *old_data, char *new_data );
extern int power_array_tag_read( power_array_info *info, power_array *arr, SIM_array_set_state_t *set );
extern int power_array_tag_update( power_array_info *info, power_array *arr, SIM_array_port_state_t *port, SIM_array_set_state_t *set );
extern int power_array_tag_compare( power_array_info *info, power_array *arr, SIM_array_port_state_t *port, unsigned long int tag_input, unsigned long int col_addr, SIM_array_set_state_t *set );
extern int SIM_power_array_output( power_array_info *info, power_array *arr, unsigned data_size, unsigned length, void *data_out, void *data_all );
extern int SIM_array_port_state_init( power_array_info *info, SIM_array_port_state_t *port );
extern int SIM_array_set_state_init( power_array_info *info, SIM_array_set_state_t *set );
#endif

View file

@ -1,215 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 <stdio.h>
#include "mem/ruby/network/orion/power_bus.hh"
#include "mem/ruby/network/orion/power_ll.hh"
#include "mem/ruby/network/orion/parm_technology.hh"
#include "mem/ruby/network/orion/SIM_port.hh"
#include "mem/ruby/network/orion/power_static.hh"
#include "mem/ruby/network/orion/power_utils.hh"
/* ------- bus(link) model ---------- */
static int SIM_bus_bitwidth(int encoding, unsigned data_width, unsigned grp_width)
{
if (encoding && encoding < BUS_MAX_ENC)
switch (encoding) {
case IDENT_ENC:
case TRANS_ENC: return data_width;
case BUSINV_ENC: return data_width + data_width / grp_width + (data_width % grp_width ? 1:0);
default: return 0;/* some error handler */
}
else
return -1;
}
/*
* this function is provided to upper layers to compute the exact binary bus representation
* only correct when grp_width divides data_width
*/
unsigned long int SIM_bus_state(power_bus *bus, unsigned long int old_data, unsigned long int old_state, unsigned long int new_data)
{
unsigned long int mask_bus, mask_data;
unsigned long int new_state = 0;
unsigned done_width = 0;
switch (bus->encoding) {
case IDENT_ENC: return new_data;
case TRANS_ENC: return new_data ^ old_data;
case BUSINV_ENC:
/* FIXME: this function should be re-written for boundary checking */
mask_data = (BIGONE << bus->grp_width) - 1;
mask_bus = (mask_data << 1) + 1;
while (bus->data_width > done_width) {
if (SIM_power_Hamming(old_state & mask_bus, new_data & mask_data, mask_bus) > bus->grp_width / 2)
new_state += (~(new_data & mask_data) & mask_bus) << done_width + done_width / bus->grp_width;
else
new_state += (new_data & mask_data) << done_width + done_width / bus->grp_width;
done_width += bus->grp_width;
old_state >>= bus->grp_width + 1;
new_data >>= bus->grp_width;
}
return new_state;
default: return 0;/* some error handler */
}
}
static double SIM_resultbus_cap(void)
{
double Cline, reg_height;
/* compute size of result bus tags */
reg_height = PARM_RUU_size * (RegCellHeight + WordlineSpacing * 3 * PARM_ruu_issue_width);
/* assume num alu's = ialu */
/* FIXME: generate a more detailed result bus network model */
/* WHS: 3200 should go to PARM */
/* WHS: use minimal pitch for buses */
Cline = CCmetal * (reg_height + 0.5 * PARM_res_ialu * 3200 * LSCALE);
/* or use result bus length measured from 21264 die photo */
// Cline = CCmetal * 3.3 * 1000;
return Cline;
}
static double SIM_generic_bus_cap(unsigned n_snd, unsigned n_rcv, double length, double time)
{
double Ctotal = 0;
double n_size, p_size;
/* part 1: wire cap */
/* WHS: use minimal pitch for buses */
Ctotal += CC2metal * length;
if ((n_snd == 1) && (n_rcv == 1)) {
/* directed bus if only one sender and one receiver */
/* part 2: repeater cap */
/* FIXME: ratio taken from Raw, does not scale now */
n_size = Lamda * 10;
p_size = n_size * 2;
Ctotal += SIM_power_gatecap(n_size + p_size, 0) + SIM_power_draincap(n_size, NCH, 1) + SIM_power_draincap(p_size, PCH, 1);
n_size *= 2.5;
p_size *= 2.5;
Ctotal += SIM_power_gatecap(n_size + p_size, 0) + SIM_power_draincap(n_size, NCH, 1) + SIM_power_draincap(p_size, PCH, 1);
}
else {
/* otherwise, broadcasting bus */
/* part 2: input cap */
/* WHS: no idea how input interface is, use an inverter for now */
Ctotal += n_rcv * SIM_power_gatecap(Wdecinvn + Wdecinvp, 0);
/* part 3: output driver cap */
if (time) {
p_size = SIM_power_driver_size(Ctotal, time);
n_size = p_size / 2;
}
else {
p_size = Wbusdrvp;
n_size = Wbusdrvn;
}
Ctotal += n_snd * (SIM_power_draincap(Wdecinvn, NCH, 1) + SIM_power_draincap(Wdecinvp, PCH, 1));
}
return Ctotal;
}
/*
* n_snd -> # of senders
* n_rcv -> # of receivers
* time -> rise and fall time, 0 means using default transistor sizes
* grp_width only matters for BUSINV_ENC
*/
int power_bus_init(power_bus *bus, int model, int encoding, unsigned width, unsigned grp_width, unsigned n_snd, unsigned n_rcv, double length, double time)
{
if ((bus->model = model) && model < BUS_MAX_MODEL) {
bus->data_width = width;
bus->grp_width = grp_width;
bus->n_switch = 0;
switch (model) {
case RESULT_BUS:
/* assume result bus uses identity encoding */
bus->encoding = IDENT_ENC;
bus->e_switch = SIM_resultbus_cap() / 2 * EnergyFactor;
break;
case GENERIC_BUS:
if ((bus->encoding = encoding) && encoding < BUS_MAX_ENC) {
bus->e_switch = SIM_generic_bus_cap(n_snd, n_rcv, length, time) / 2 * EnergyFactor;
/* sanity check */
if (!grp_width || grp_width > width)
bus->grp_width = width;
}
else return -1;
default: break;/* some error handler */
}
bus->bit_width = SIM_bus_bitwidth(bus->encoding, width, bus->grp_width);
bus->bus_mask = HAMM_MASK(bus->bit_width);
return 0;
}
else
return -1;
}
int bus_record(power_bus *bus, unsigned long int old_state, unsigned long int new_state)
{
bus->n_switch += SIM_power_Hamming(new_state, old_state, bus->bus_mask);
return 0;
}
double bus_report(power_bus *bus)
{
return (bus->n_switch * bus->e_switch);
}
/* ------- bus(link) model ---------- */

View file

@ -1,365 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 <stdio.h>
#include <math.h>
#include "mem/ruby/network/orion/power_ll.hh"
#include "mem/ruby/network/orion/power_crossbar.hh"
#include "mem/ruby/network/orion/parm_technology.hh"
#include "mem/ruby/network/orion/SIM_port.hh"
#include "mem/ruby/network/orion/power_static.hh"
#include "mem/ruby/network/orion/power_utils.hh"
/*-------------------- CROSSBAR power model -------------------*/
static double crossbar_in_cap(double wire_cap, unsigned n_out, int connect_type, int trans_type, double *Nsize)
{
double Ctotal = 0, Ctrans = 0, psize, nsize, Cdriver = 0;
/* part 1: wire cap */
Ctotal += wire_cap;
//printf("CROSSBAR_INTERNAL: input wire cap = %g\n", wire_cap);
/* part 2: drain cap of transmission gate or gate cap of tri-state gate */
if (connect_type == TRANS_GATE) {
/* FIXME: resizing strategy */
nsize = Nsize ? *Nsize : Wmemcellr;
psize = nsize * Wdecinvp / Wdecinvn;
Ctrans = SIM_power_draincap(nsize, NCH, 1);
if (trans_type == NP_GATE)
Ctrans += SIM_power_draincap(psize, PCH, 1);
}
else if (connect_type == TRISTATE_GATE) {
Ctrans = SIM_power_gatecap(Woutdrvnandn + Woutdrvnandp, 0) +
SIM_power_gatecap(Woutdrvnorn + Woutdrvnorp, 0);
}
else {/* some error handler */}
//printf("CROSSBAR_INTERNAL: input connector cap = %g\n", (n_out * Ctrans));
Ctotal += n_out * Ctrans;
/* part 3: input driver */
/* FIXME: how to specify timing? */
psize = SIM_power_driver_size(Ctotal, Period / 3);
nsize = psize * Wdecinvn / Wdecinvp;
Cdriver = SIM_power_draincap(nsize, NCH, 1) + SIM_power_draincap(psize, PCH, 1) +
SIM_power_gatecap(nsize + psize, 0);
//printf("CROSSBAR_INTERNAL: input driver cap = %g\n", Cdriver);
Ctotal += Cdriver;
return Ctotal / 2;
}
static double crossbar_out_cap(double length, unsigned n_in, int connect_type, int trans_type, double *Nsize)
{
double Ctotal = 0, Cwire = 0, Ctrans = 0, Cdriver = 0, psize, nsize;
/* part 1: wire cap */
Cwire += CC3metal * length;
//printf("CROSSBAR_INTERNAL: output wire cap = %g\n", Cwire);
Ctotal += Cwire;
/* part 2: drain cap of transmission gate or tri-state gate */
if (connect_type == TRANS_GATE) {
/* FIXME: resizing strategy */
if (Nsize) {
/* FIXME: how to specify timing? */
psize = SIM_power_driver_size(Ctotal, Period / 3);
*Nsize = nsize = psize * Wdecinvn / Wdecinvp;
}
else {
nsize = Wmemcellr;
psize = nsize * Wdecinvp / Wdecinvn;
}
Ctrans = SIM_power_draincap(nsize, NCH, 1);
if (trans_type == NP_GATE)
Ctrans += SIM_power_draincap(psize, PCH, 1);
}
else if (connect_type == TRISTATE_GATE) {
Ctrans = SIM_power_draincap(Woutdrivern, NCH, 1) + SIM_power_draincap(Woutdriverp, PCH, 1);
}
else {/* some error handler */}
//printf("CROSSBAR_INTERNAL: output connector cap = %g\n", (n_in * Ctrans));
Ctotal += n_in * Ctrans;
/* part 3: output driver */
Cdriver += SIM_power_draincap(Woutdrivern, NCH, 1) + SIM_power_draincap(Woutdriverp, PCH, 1) +
SIM_power_gatecap(Woutdrivern + Woutdriverp, 0);
//printf("CROSSBAR_INTERNAL: output driver cap = %g\n", Cdriver);
Ctotal += Cdriver;
return Ctotal / 2;
}
/* cut-through crossbar only supports 4x4 now */
static double crossbar_io_cap(double length)
{
double Ctotal = 0, psize, nsize;
/* part 1: wire cap */
Ctotal += CC3metal * length;
/* part 2: gate cap of tri-state gate */
Ctotal += 2 * (SIM_power_gatecap(Woutdrvnandn + Woutdrvnandp, 0) +
SIM_power_gatecap(Woutdrvnorn + Woutdrvnorp, 0));
/* part 3: drain cap of tri-state gate */
Ctotal += 2 * (SIM_power_draincap(Woutdrivern, NCH, 1) + SIM_power_draincap(Woutdriverp, PCH, 1));
/* part 4: input driver */
/* FIXME: how to specify timing? */
psize = SIM_power_driver_size(Ctotal, Period * 0.8);
nsize = psize * Wdecinvn / Wdecinvp;
Ctotal += SIM_power_draincap(nsize, NCH, 1) + SIM_power_draincap(psize, PCH, 1) +
SIM_power_gatecap(nsize + psize, 0);
/* part 5: output driver */
Ctotal += SIM_power_draincap(Woutdrivern, NCH, 1) + SIM_power_draincap(Woutdriverp, PCH, 1) +
SIM_power_gatecap(Woutdrivern + Woutdriverp, 0);
/* HACK HACK HACK */
/* this HACK is to count a 1:4 mux and a 4:1 mux, so we have a 5x5 crossbar */
return Ctotal / 2 * 1.32;
}
static double crossbar_int_cap(unsigned degree, int connect_type, int trans_type)
{
double Ctotal = 0, Ctrans;
if (connect_type == TRANS_GATE) {
/* part 1: drain cap of transmission gate */
/* FIXME: Wmemcellr and resize */
Ctrans = SIM_power_draincap(Wmemcellr, NCH, 1);
if (trans_type == NP_GATE)
Ctrans += SIM_power_draincap(Wmemcellr * Wdecinvp / Wdecinvn, PCH, 1);
Ctotal += (degree + 1) * Ctrans;
}
else if (connect_type == TRISTATE_GATE) {
/* part 1: drain cap of tri-state gate */
Ctotal += degree * (SIM_power_draincap(Woutdrivern, NCH, 1) + SIM_power_draincap(Woutdriverp, PCH, 1));
/* part 2: gate cap of tri-state gate */
Ctotal += SIM_power_gatecap(Woutdrvnandn + Woutdrvnandp, 0) +
SIM_power_gatecap(Woutdrvnorn + Woutdrvnorp, 0);
}
else {/* some error handler */}
return Ctotal / 2;
}
/* FIXME: segment control signals are not handled yet */
static double crossbar_ctr_cap(double length, unsigned data_width, int prev_ctr, int next_ctr, unsigned degree, int connect_type, int trans_type)
{
double Ctotal = 0, Cgate;
/* part 1: wire cap */
Ctotal = Cmetal * length;
/* part 2: gate cap of transmission gate or tri-state gate */
if (connect_type == TRANS_GATE) {
/* FIXME: Wmemcellr and resize */
Cgate = SIM_power_gatecap(Wmemcellr, 0);
if (trans_type == NP_GATE)
Cgate += SIM_power_gatecap(Wmemcellr * Wdecinvp / Wdecinvn, 0);
}
else if (connect_type == TRISTATE_GATE) {
Cgate = SIM_power_gatecap(Woutdrvnandn + Woutdrvnandp, 0) +
SIM_power_gatecap(Woutdrvnorn + Woutdrvnorp, 0);
}
else {/* some error handler */}
Ctotal += data_width * Cgate;
/* part 3: inverter */
if (!(connect_type == TRANS_GATE && trans_type == N_GATE && !prev_ctr))
/* FIXME: need accurate size, use minimal size for now */
Ctotal += SIM_power_draincap(Wdecinvn, NCH, 1) + SIM_power_draincap(Wdecinvp, PCH, 1) +
SIM_power_gatecap(Wdecinvn + Wdecinvp, 0);
/* part 4: drain cap of previous level control signal */
if (prev_ctr)
/* FIXME: need actual size, use decoder data for now */
Ctotal += degree * SIM_power_draincap(WdecNORn, NCH, 1) + SIM_power_draincap(WdecNORp, PCH, degree);
/* part 5: gate cap of next level control signal */
if (next_ctr)
/* FIXME: need actual size, use decoder data for now */
Ctotal += SIM_power_gatecap(WdecNORn + WdecNORp, degree * 40 + 20);
return Ctotal;
}
int power_crossbar_init(power_crossbar *crsbar, int model, unsigned n_in, unsigned n_out, unsigned data_width, unsigned degree, int connect_type, int trans_type, double in_len, double out_len, double *req_len)
{
double in_length, out_length, ctr_length, Nsize, in_wire_cap, i_leakage;
if ((crsbar->model = model) && model < CROSSBAR_MAX_MODEL) {
crsbar->n_in = n_in;
crsbar->n_out = n_out;
crsbar->data_width = data_width;
crsbar->degree = degree;
crsbar->connect_type = connect_type;
crsbar->trans_type = trans_type;
/* redundant field */
crsbar->mask = HAMM_MASK(data_width);
crsbar->n_chg_in = crsbar->n_chg_int = crsbar->n_chg_out = crsbar->n_chg_ctr = 0;
switch (model) {
case MATRIX_CROSSBAR:
/* FIXME: need accurate spacing */
in_length = n_out * data_width * CrsbarCellWidth;
out_length = n_in * data_width * CrsbarCellHeight;
if (in_length < in_len) in_length = in_len;
if (out_length < out_len) out_length = out_len;
ctr_length = in_length / 2;
if (req_len) *req_len = in_length;
in_wire_cap = in_length * CC3metal;
crsbar->e_chg_out = crossbar_out_cap(out_length, n_in, connect_type, trans_type, &Nsize) * EnergyFactor;
crsbar->e_chg_in = crossbar_in_cap(in_wire_cap, n_out, connect_type, trans_type, &Nsize) * EnergyFactor;
/* FIXME: wire length estimation, really reset? */
/* control signal should reset after transmission is done, so no 1/2 */
crsbar->e_chg_ctr = crossbar_ctr_cap(ctr_length, data_width, 0, 0, 0, connect_type, trans_type) * EnergyFactor;
crsbar->e_chg_int = 0;
/* static power */
i_leakage = 0;
/* tri-state buffers */
i_leakage += ((Woutdrvnandp * (NAND2_TAB[0] + NAND2_TAB[1] + NAND2_TAB[2]) + Woutdrvnandn * NAND2_TAB[3]) / 4 +
(Woutdrvnorp * NOR2_TAB[0] + Woutdrvnorn * (NOR2_TAB[1] + NOR2_TAB[2] + NOR2_TAB[3])) / 4 +
Woutdrivern * NMOS_TAB[0] + Woutdriverp * PMOS_TAB[0]) * n_in * n_out * data_width;
/* input driver */
i_leakage += (Wdecinvn * NMOS_TAB[0] + Wdecinvp * PMOS_TAB[0]) * n_in * data_width;
/* output driver */
i_leakage += (Woutdrivern * NMOS_TAB[0] + Woutdriverp * PMOS_TAB[0]) * n_out * data_width;
/* control signal inverter */
i_leakage += (Wdecinvn * NMOS_TAB[0] + Wdecinvp * PMOS_TAB[0]) * n_in * n_out;
crsbar->i_leakage = i_leakage / PARM_TECH_POINT * 100;
break;
case MULTREE_CROSSBAR:
/* input wire horizontal segment length */
in_length = n_in * data_width * CrsbarCellWidth * (n_out / 2);
in_wire_cap = in_length * CCmetal;
/* input wire vertical segment length */
in_length = n_in * data_width * (5 * Lamda) * (n_out / 2);
in_wire_cap += in_length * CC3metal;
ctr_length = n_in * data_width * CrsbarCellWidth * (n_out / 2) / 2;
crsbar->e_chg_out = crossbar_out_cap(0, degree, connect_type, trans_type, NULL) * EnergyFactor;
crsbar->e_chg_in = crossbar_in_cap(in_wire_cap, n_out, connect_type, trans_type, NULL) * EnergyFactor;
crsbar->e_chg_int = crossbar_int_cap(degree, connect_type, trans_type) * EnergyFactor;
/* redundant field */
crsbar->depth = (unsigned)ceil(log(n_in) / log(degree));
/* control signal should reset after transmission is done, so no 1/2 */
if (crsbar->depth == 1)
/* only one level of control signal */
crsbar->e_chg_ctr = crossbar_ctr_cap(ctr_length, data_width, 0, 0, degree, connect_type, trans_type) * EnergyFactor;
else {
/* first level and last level control signals */
crsbar->e_chg_ctr = crossbar_ctr_cap(ctr_length, data_width, 0, 1, degree, connect_type, trans_type) * EnergyFactor +
crossbar_ctr_cap(0, data_width, 1, 0, degree, connect_type, trans_type) * EnergyFactor;
/* intermediate control signals */
if (crsbar->depth > 2)
crsbar->e_chg_ctr += (crsbar->depth - 2) * crossbar_ctr_cap(0, data_width, 1, 1, degree, connect_type, trans_type) * EnergyFactor;
}
/* static power */
i_leakage = 0;
/* input driver */
i_leakage += (Wdecinvn * NMOS_TAB[0] + Wdecinvp * PMOS_TAB[0]) * n_in * data_width;
/* output driver */
i_leakage += (Woutdrivern * NMOS_TAB[0] + Woutdriverp * PMOS_TAB[0]) * n_out * data_width;
/* mux */
i_leakage += (WdecNORp * NOR2_TAB[0] + WdecNORn * (NOR2_TAB[1] + NOR2_TAB[2] + NOR2_TAB[3])) / 4 * (2 * n_in - 1) * n_out * data_width;
/* control signal inverter */
i_leakage += (Wdecinvn * NMOS_TAB[0] + Wdecinvp * PMOS_TAB[0]) * n_in * n_out;
crsbar->i_leakage = i_leakage / PARM_TECH_POINT * 100;
break;
default: break;/* some error handler */
}
return 0;
}
else
return -1;
}
/* FIXME: MULTREE_CROSSBAR record missing */
int crossbar_record(power_crossbar *xb, int io, unsigned long int new_data, unsigned long int old_data, unsigned new_port, unsigned old_port)
{
switch (xb->model) {
case MATRIX_CROSSBAR:
if (io) /* input port */
xb->n_chg_in += SIM_power_Hamming(new_data, old_data, xb->mask);
else { /* output port */
xb->n_chg_out += SIM_power_Hamming(new_data, old_data, xb->mask);
xb->n_chg_ctr += new_port != old_port;
}
break;
case MULTREE_CROSSBAR:
break;
default: break;/* some error handler */
}
return 0;
}
double crossbar_report(power_crossbar *crsbar)
{
return (crsbar->n_chg_in * crsbar->e_chg_in + crsbar->n_chg_out * crsbar->e_chg_out +
crsbar->n_chg_int * crsbar->e_chg_int + crsbar->n_chg_ctr * crsbar->e_chg_ctr);
}
/* ---------- crossbar model ---------- */

View file

@ -1,270 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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.
*/
/*------------------------------------------------------------
* Copyright 1994 Digital Equipment Corporation and Steve Wilton
* All Rights Reserved
*
* Permission to use, copy, and modify this software and its documentation is
* hereby granted only under the following terms and conditions. Both the
* above copyright notice and this permission notice must appear in all copies
* of the software, derivative works or modified versions, and any portions
* thereof, and both notices must appear in supporting documentation.
*
* Users of this software agree to the terms and conditions set forth herein,
* and hereby grant back to Digital a non-exclusive, unrestricted, royalty-
* free right and license under any changes, enhancements or extensions
* made to the core functions of the software, including but not limited to
* those affording compatibility with other hardware or software
* environments, but excluding applications which incorporate this software.
* Users further agree to use their best efforts to return to Digital any
* such changes, enhancements or extensions that they make and inform Digital
* of noteworthy uses of this software. Correspondence should be provided
* to Digital at:
*
* Director of Licensing
* Western Research Laboratory
* Digital Equipment Corporation
* 100 Hamilton Avenue
* Palo Alto, California 94301
*
* This software may be distributed (but not offered for sale or transferred
* for compensation) to third parties, provided such third parties agree to
* abide by the terms and conditions of this notice.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*------------------------------------------------------------*/
#include <cassert>
#include <cmath>
#include "mem/ruby/network/orion/parm_technology.hh"
#include "mem/ruby/network/orion/SIM_port.hh"
#include "mem/ruby/network/orion/power_static.hh"
#include "mem/ruby/network/orion/power_ll.hh"
/*----------------------------------------------------------------------*/
double SIM_power_gatecap(double width,double wirelength) /* returns gate capacitance in Farads */
//double width; /* gate width in um (length is Leff) */
//double wirelength; /* poly wire length going to gate in lambda */
{
double overlapCap;
double gateCap;
double l = 0.1525;
#if defined(Pdelta_w)
overlapCap = (width - 2*Pdelta_w) * PCov;
gateCap = ((width - 2*Pdelta_w) * (l * LSCALE - 2*Pdelta_l) *
PCg) + 2.0 * overlapCap;
return gateCap;
#endif
return(width*Leff*PARM_Cgate+wirelength*Cpolywire*Leff * SCALE_T);
/* return(width*Leff*PARM_Cgate); */
/* return(width*CgateLeff+wirelength*Cpolywire*Leff);*/
}
double SIM_power_gatecappass(double width,double wirelength) /* returns gate capacitance in Farads */
//double width; /* gate width in um (length is Leff) */
//double wirelength; /* poly wire length going to gate in lambda */
{
return(SIM_power_gatecap(width,wirelength));
/* return(width*Leff*PARM_Cgatepass+wirelength*Cpolywire*Leff); */
}
/*----------------------------------------------------------------------*/
/* Routine for calculating drain capacitances. The draincap routine
* folds transistors larger than 10um */
double SIM_power_draincap(double width,int nchannel,int stack) /* returns drain cap in Farads */
//double width; /* um */
//int nchannel; /* whether n or p-channel (boolean) */
//int stack; /* number of transistors in series that are on */
{
double Cdiffside,Cdiffarea,Coverlap,cap;
double overlapCap;
double swAreaUnderGate;
double area_peri;
double diffArea;
double diffPeri;
double l = 0.4 * LSCALE;
diffArea = l * width;
diffPeri = 2 * l + 2 * width;
#if defined(Pdelta_w)
if(nchannel == 0) {
overlapCap = (width - 2 * Pdelta_w) * PCov;
swAreaUnderGate = (width - 2 * Pdelta_w) * PCjswA;
area_peri = ((diffArea * PCja)
+ (diffPeri * PCjsw));
return(stack*(area_peri + overlapCap + swAreaUnderGate));
}
else {
overlapCap = (width - 2 * Ndelta_w) * NCov;
swAreaUnderGate = (width - 2 * Ndelta_w) * NCjswA;
area_peri = ((diffArea * NCja * LSCALE)
+ (diffPeri * NCjsw * LSCALE));
return(stack*(area_peri + overlapCap + swAreaUnderGate));
}
#endif
Cdiffside = (nchannel) ? PARM_Cndiffside : PARM_Cpdiffside;
Cdiffarea = (nchannel) ? PARM_Cndiffarea : PARM_Cpdiffarea;
Coverlap = (nchannel) ? (PARM_Cndiffovlp+PARM_Cnoxideovlp) :
(PARM_Cpdiffovlp+PARM_Cpoxideovlp);
/* calculate directly-connected (non-stacked) capacitance */
/* then add in capacitance due to stacking */
if (width >= 10) {
cap = 3.0*Leff*width/2.0*Cdiffarea + 6.0*Leff*Cdiffside +
width*Coverlap;
cap += (double)(stack-1)*(Leff*width*Cdiffarea +
4.0*Leff*Cdiffside + 2.0*width*Coverlap);
} else {
cap = 3.0*Leff*width*Cdiffarea + (6.0*Leff+width)*Cdiffside +
width*Coverlap;
cap += (double)(stack-1)*(Leff*width*Cdiffarea +
2.0*Leff*Cdiffside + 2.0*width*Coverlap);
}
return(cap * SCALE_T);
}
/*----------------------------------------------------------------------*/
/* The following routines estimate the effective resistance of an
on transistor as described in the tech report. The first routine
gives the "switching" resistance, and the second gives the
"full-on" resistance */
double SIM_power_transresswitch(double width,int nchannel,int stack) /* returns resistance in ohms */
//double width; /* um */
//int nchannel; /* whether n or p-channel (boolean) */
//int stack; /* number of transistors in series */
{
double restrans;
restrans = (nchannel) ? (Rnchannelstatic):
(Rpchannelstatic);
/* calculate resistance of stack - assume all but switching trans
have 0.8X the resistance since they are on throughout switching */
return((1.0+((stack-1.0)*0.8))*restrans/width);
}
/*----------------------------------------------------------------------*/
double SIM_power_transreson(double width,int nchannel,int stack) /* returns resistance in ohms */
//double width; /* um */
//int nchannel; /* whether n or p-channel (boolean) */
//int stack; /* number of transistors in series */
{
double restrans;
restrans = (nchannel) ? Rnchannelon : Rpchannelon;
/* calculate resistance of stack. Unlike transres, we don't
multiply the stacked transistors by 0.8 */
return(stack*restrans/width);
}
/*----------------------------------------------------------------------*/
/* This routine operates in reverse: given a resistance, it finds
* the transistor width that would have this R. It is used in the
* data wordline to estimate the wordline driver size. */
double SIM_power_restowidth(double res,int nchannel) /* returns width in um */
//double res; /* resistance in ohms */
//int nchannel; /* whether N-channel or P-channel */
{
double restrans;
restrans = (nchannel) ? Rnchannelon : Rpchannelon;
return(restrans/res);
}
/*----------------------------------------------------------------------*/
double SIM_power_horowitz(double inputramptime,double tf,double vs1,double vs2,int rise)
//double inputramptime, /* input rise time */
// tf, /* time constant of gate */
// vs1,vs2; /* threshold voltages */
//int rise; /* whether INPUT rise or fall (boolean) */
{
double a,b,td;
a = inputramptime/tf;
if (rise==RISE) {
b = 0.5;
td = tf*sqrt(fabs( log(vs1)*log(vs1)+2*a*b*(1.0-vs1))) +
tf*(log(vs1)-log(vs2));
} else {
b = 0.4;
td = tf*sqrt(fabs( log(1.0-vs1)*log(1.0-vs1)+2*a*b*(vs1))) +
tf*(log(1.0-vs1)-log(1.0-vs2));
}
return(td);
}
double SIM_power_driver_size(double driving_cap, double desiredrisetime)
{
double nsize, psize;
double Rpdrive;
Rpdrive = desiredrisetime/(driving_cap*log(PARM_VSINV)*-1.0);
psize = SIM_power_restowidth(Rpdrive,PCH);
nsize = SIM_power_restowidth(Rpdrive,NCH);
if (psize > Wworddrivemax) {
psize = Wworddrivemax;
}
if (psize < 4.0 * LSCALE)
psize = 4.0 * LSCALE;
return (psize);
}

View file

@ -1,260 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 <stdio.h>
#include "mem/ruby/network/orion/power_router_init.hh"
#include "mem/ruby/network/orion/power_array.hh"
#include "mem/ruby/network/orion/power_arbiter.hh"
#include "mem/ruby/network/orion/power_crossbar.hh"
#include "mem/ruby/network/orion/power_ll.hh"
#include "mem/ruby/network/orion/parm_technology.hh"
#include "mem/ruby/network/orion/SIM_port.hh"
#include "mem/ruby/network/orion/power_static.hh"
#include "mem/ruby/network/orion/power_utils.hh"
/* -------------------------------------------------------------------------------------------- */
// Set buffer parameters
int buf_set_para(power_array_info *info, int is_fifo, unsigned n_read_port, unsigned n_write_port, unsigned n_entry, unsigned line_width, int outdrv)
{
//general parameters
info->share_rw = 0;
info->read_ports = n_read_port;
info->write_ports = n_write_port;
info->n_set = n_entry;
info->blk_bits = line_width;
info->assoc = 1;
info->data_width = line_width;
info->data_end = PARM_data_end;
//no array subpartition
info->data_ndwl = 1;
info->data_ndbl = 1;
info->data_nspd = 1;
info->data_n_share_amp =1;
//MODEL parameters
if(is_fifo) {
info->row_dec_model = SIM_NO_MODEL;
info->row_dec_pre_model = SIM_NO_MODEL;
}
else {
info->row_dec_model = PARM_row_dec_model;
info->row_dec_pre_model = PARM_row_dec_pre_model;
}
info->data_wordline_model = PARM_wordline_model;
info->data_bitline_model = PARM_bitline_model;
info->data_bitline_pre_model = PARM_bitline_pre_model;
info->data_mem_model = PARM_mem_model;
if(PARM_data_end == 2)
info->data_amp_model = PARM_amp_model;
else
info->data_amp_model = SIM_NO_MODEL;
if(outdrv)
info->outdrv_model = PARM_outdrv_model;
else
info->outdrv_model = SIM_NO_MODEL;
info->data_colsel_pre_model = SIM_NO_MODEL;
info->col_dec_model = SIM_NO_MODEL;
info->col_dec_pre_model = SIM_NO_MODEL;
info->mux_model = SIM_NO_MODEL;
//no tag array
info->tag_wordline_model = SIM_NO_MODEL;
info->tag_bitline_model = SIM_NO_MODEL;
info->tag_bitline_pre_model = SIM_NO_MODEL;
info->tag_mem_model = SIM_NO_MODEL;
info->tag_attach_mem_model = SIM_NO_MODEL;
info->tag_amp_model = SIM_NO_MODEL;
info->tag_colsel_pre_model = SIM_NO_MODEL;
info->comp_model = SIM_NO_MODEL;
info->comp_pre_model = SIM_NO_MODEL;
info->write_policy = 0; //no dirty bit
//derived
if(info->data_width != 0){
info->n_item = info->blk_bits / info->data_width;
}
else{
info->eff_data_cols = info->blk_bits * info->assoc * info->data_nspd;
}
return 0;
}
/* -------------------------------------------------------------------------------------------- */
/* --------------- Router init --------------------------------------*/
int power_router_init(power_router *router, power_router_info *info)
{
int outdrv;
double req_len = 0;
//general
// info->n_in = PARM_in_port;
info->n_total_in = info->n_in;
// info->n_out = PARM_out_port;
info->n_total_out = info->n_out;
// info->flit_width = PARM_flit_width;
//vc
// info->n_v_channel = MAX(PARM_v_channel, 1);
// info->n_v_class = MAX(info->n_v_channel, PARM_v_class);
if(info->n_v_class > 1) {
info->in_share_buf = PARM_in_share_buf;
info->out_share_buf = PARM_out_share_buf;
info->in_share_switch = PARM_in_share_switch;
info->out_share_switch = PARM_out_share_switch;
}
else {
info->in_share_buf = 0;
info->out_share_buf = 0;
info->in_share_switch = 0;
info->out_share_switch = 0;
}
//xbar
info->crossbar_model = PARM_crossbar_model;
info->degree = PARM_crsbar_degree;
info->connect_type = PARM_connect_type;
info->trans_type = PARM_trans_type;
info->crossbar_in_len = PARM_crossbar_in_len;
info->crossbar_out_len = PARM_crossbar_out_len;
//input buffer
info->in_buf = PARM_in_buf;
outdrv = !info->in_share_buf && info->in_share_switch;
buf_set_para(&info->in_buf_info, 0, PARM_in_buf_rport, 1, PARM_in_buf_set, info->flit_width, outdrv);
//vc arbiter
if(info->n_v_class > 1) {
info->vc_in_arb_model = PARM_vc_in_arb_model;
info->vc_out_arb_model = PARM_vc_out_arb_model;
if(info->vc_in_arb_model == QUEUE_ARBITER) {
buf_set_para(&info->vc_in_arb_queue_info, 1, 1, 1, info->n_v_class, SIM_power_logtwo(info->n_v_class), 0);
info->vc_in_arb_ff_model = SIM_NO_MODEL;
}
else
info->vc_in_arb_ff_model = PARM_vc_in_arb_ff_model;
if(info->vc_out_arb_model == QUEUE_ARBITER) {
buf_set_para(&info->vc_out_arb_queue_info, 1, 1, 1, info->n_total_in - 1, SIM_power_logtwo(info->n_total_in - 1), 0);
info->vc_out_arb_ff_model = SIM_NO_MODEL;
}
else
info->vc_out_arb_ff_model = PARM_vc_out_arb_ff_model;
}
else {
info->vc_in_arb_model = SIM_NO_MODEL;
info->vc_in_arb_ff_model = SIM_NO_MODEL;
info->vc_out_arb_model = SIM_NO_MODEL;
info->vc_out_arb_ff_model = SIM_NO_MODEL;
}
//switch arbiter
if (info->n_in > 2) {
info->sw_in_arb_model = PARM_sw_in_arb_model;
info->sw_out_arb_model = PARM_sw_out_arb_model;
if(info->sw_in_arb_model == QUEUE_ARBITER) {
buf_set_para(&info->sw_in_arb_queue_info, 1, 1, 1, info->n_v_class, SIM_power_logtwo(info->n_v_class), 0);
info->sw_in_arb_ff_model = SIM_NO_MODEL;
}
else
info->sw_in_arb_ff_model = PARM_sw_in_arb_ff_model;
if(info->sw_out_arb_model == QUEUE_ARBITER) {
buf_set_para(&info->sw_out_arb_queue_info, 1, 1, 1, info->n_total_in - 1, SIM_power_logtwo(info->n_total_in - 1), 0);
info->sw_out_arb_ff_model = SIM_NO_MODEL;
}
else
info->sw_out_arb_ff_model = PARM_sw_out_arb_ff_model;
}
else {
info->sw_in_arb_model = SIM_NO_MODEL;
info->sw_in_arb_ff_model = SIM_NO_MODEL;
info->sw_out_arb_model = SIM_NO_MODEL;
info->sw_out_arb_ff_model = SIM_NO_MODEL;
}
if(info->in_buf) {
if(info->in_share_buf)
info->in_n_switch = info->in_buf_info.read_ports;
else if(info->in_share_switch)
info->in_n_switch = 1;
else
info->in_n_switch = info->n_v_class;
}
else
info->in_n_switch = 1;
info->n_switch_in = info->n_in * info->in_n_switch;
info->n_switch_out = info->n_out;
//-------- call initialize functions -----------
router->i_leakage = 0;
//initialize crossbar
power_crossbar_init(&router->crossbar, info->crossbar_model, info->n_switch_in, info->n_switch_out, info->flit_width, info->degree, info->connect_type, info->trans_type, info->crossbar_in_len, info->crossbar_out_len, &req_len);
router->i_leakage += router->crossbar.i_leakage;
// printf("xbar_leak %g", router->crossbar.i_leakage);
//initialize input buffer
if(info->in_buf) {
power_array_init(&info->in_buf_info, &router->in_buf);
router->i_leakage += router->in_buf.i_leakage * info->n_in;
// printf("buffer_leak %g", router->in_buf.i_leakage);
}
// printf("initialize in buffer over\n");
//initialize vc arbiter
if(info->vc_in_arb_model)
power_arbiter_init(&router->vc_in_arb, info->vc_in_arb_model, info->vc_in_arb_ff_model, PARM_VC_per_MC, 0, &info->vc_in_arb_queue_info);
if(info->vc_out_arb_model)
power_arbiter_init(&router->vc_out_arb, info->vc_out_arb_model, info->vc_out_arb_ff_model, info->n_total_in - 1, req_len, &info->vc_out_arb_queue_info);
//initialize switch arbiter
if(info->sw_in_arb_model)
power_arbiter_init(&router->sw_in_arb, info->sw_in_arb_model, info->sw_in_arb_ff_model, info->n_v_class, 0, &info->sw_in_arb_queue_info);
if(info->sw_out_arb_model)
power_arbiter_init(&router->sw_out_arb, info->sw_out_arb_model, info->sw_out_arb_ff_model, info->n_total_in - 1, req_len, &info->sw_out_arb_queue_info);
return 0;
}

View file

@ -1,126 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 _POWER_ROUTER_INIT_H
#define _POWER_ROUTER_INIT_H
#include "mem/ruby/network/orion/power_array.hh"
#include "mem/ruby/network/orion/power_arbiter.hh"
#include "mem/ruby/network/orion/power_crossbar.hh"
/* ------------ Models ------------------------ */
/*typedef enum {
GENERIC_SEL = 1,
SEL_MAX_MODEL
} power_sel_model;
*/
/* ------------ Misc --------------------------- */
/*typedef struct {
int model;
unsigned width;
unsigned long long n_anyreq;
unsigned long long n_chgreq;
unsigned long long n_grant;
unsigned long long n_enc[MAX_SEL_LEVEL];
double e_anyreq;
double e_chgreq;
double e_grant;
double e_enc[MAX_SEL_LEVEL];
} power_sel;
*/
/* --------------- Loading --------------- */
typedef enum {
ACTUAL_LOADING =1,
HALF_LOADING,
MAX_LOADING
}loading;
/* ----------------- Router --------------- */
typedef struct {
power_crossbar crossbar;
power_array in_buf;
power_arbiter vc_in_arb;
power_arbiter vc_out_arb;
power_arbiter sw_in_arb;
power_arbiter sw_out_arb;
double i_leakage;
} power_router;
typedef struct {
//general
unsigned n_in;
unsigned n_out;
unsigned flit_width;
//vc
unsigned n_v_channel;
unsigned n_v_class;
int in_share_buf;
int out_share_buf;
int in_share_switch;
int out_share_switch;
//xbar
int crossbar_model;
int degree;
int connect_type;
int trans_type;
double crossbar_in_len;
double crossbar_out_len;
int in_buf;
//buffer
power_array_info in_buf_info;
unsigned pipe_depth;
//arbiter
int vc_in_arb_model;
int vc_out_arb_model;
int vc_in_arb_ff_model;
int vc_out_arb_ff_model;
int sw_in_arb_model;
int sw_out_arb_model;
int sw_in_arb_ff_model;
int sw_out_arb_ff_model;
power_array_info vc_in_arb_queue_info;
power_array_info vc_out_arb_queue_info;
power_array_info sw_in_arb_queue_info;
power_array_info sw_out_arb_queue_info;
//derived
unsigned n_total_in;
unsigned n_total_out;
unsigned in_n_switch;
unsigned n_switch_in;
unsigned n_switch_out;
} power_router_info;
extern int power_router_init(power_router *router, power_router_info *info);
#endif

View file

@ -1,164 +0,0 @@
/*
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* 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;
* neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* 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 <cassert>
#include <cmath>
#include <cstdio>
#include "base/types.hh"
#include "mem/ruby/network/orion/parm_technology.hh"
#include "mem/ruby/network/orion/power_utils.hh"
/* ----------- from SIM_power_util.c ------------ */
/* Hamming distance table */
static char h_tab[256] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8};
static uint32_t SIM_power_Hamming_slow( uint64_t old_val, uint64_t new_val, uint64_t mask )
{
/* old slow code, I don't understand the new fast code though */
/* uint64_t dist;
uint32_t Hamming = 0;
dist = ( old_val ^ new_val ) & mask;
mask = (mask >> 1) + 1;
while ( mask ) {
if ( mask & dist ) Hamming ++;
mask = mask >> 1;
}
return Hamming; */
#define TWO(k) (BIGONE << (k))
#define CYCL(k) (BIGNONE/(1 + (TWO(TWO(k)))))
#define BSUM(x,k) ((x)+=(x) >> TWO(k), (x) &= CYCL(k))
uint64_t x;
x = (old_val ^ new_val) & mask;
x = (x & CYCL(0)) + ((x>>TWO(0)) & CYCL(0));
x = (x & CYCL(1)) + ((x>>TWO(1)) & CYCL(1));
BSUM(x,2);
BSUM(x,3);
BSUM(x,4);
BSUM(x,5);
return x;
}
int SIM_power_init(void)
{
uint32_t i;
/* initialize Hamming distance table */
for (i = 0; i < 256; i++)
h_tab[i] = SIM_power_Hamming_slow(i, 0, 0xFF);
return 0;
}
uint32_t
SIM_power_Hamming(uint64_t old_val, uint64_t new_val, uint64_t mask)
{
union {
uint64_t x;
uint64_t id[8];
} u;
uint32_t rval;
u.x = (old_val ^ new_val) & mask;
rval = h_tab[u.id[0]];
rval += h_tab[u.id[1]];
rval += h_tab[u.id[2]];
rval += h_tab[u.id[3]];
rval += h_tab[u.id[4]];
rval += h_tab[u.id[5]];
rval += h_tab[u.id[6]];
rval += h_tab[u.id[7]];
return rval;
}
uint32_t
SIM_power_Hamming_group(uint64_t d1_new, uint64_t d1_old, uint64_t d2_new,
uint64_t d2_old, uint32_t width, uint32_t n_grp)
{
uint32_t rval = 0;
uint64_t g1_new, g1_old, g2_new, g2_old, mask;
mask = HAMM_MASK(width);
while (n_grp--) {
g1_new = d1_new & mask;
g1_old = d1_old & mask;
g2_new = d2_new & mask;
g2_old = d2_old & mask;
if (g1_new != g1_old || g2_new != g2_old)
rval ++;
d1_new >>= width;
d1_old >>= width;
d2_new >>= width;
d2_old >>= width;
}
return rval;
}
/* ---------------------------------------------- */
/* ----------------------------------------------- */
double logtwo(double x)
{
assert(x > 0);
return log10(x)/log10(2);
}
uint32_t
SIM_power_logtwo(uint64_t x)
{
uint32_t rval = 0;
while (x >> rval && rval < sizeof(uint64_t) << 3) rval++;
if (x == (BIGONE << rval - 1)) rval--;
return rval;
}

View file

@ -0,0 +1,146 @@
# Copyright (c) 2010 Massachusetts Institute of Technology
# 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;
# neither the name of the copyright holders nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# 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.
#
# Authors: Chia-Hsin Owen Chen
# Technology related parameters
# technology node in nm (90, 65, 45, 32)
TECH_NODE = 65
# transistor type (HVT, NVT, LVT)
TRANSISTOR_TYPE = NVT
# operating voltage supply in volt
VDD = 1.0
# operating frequency in Hz
FREQUENCY = 1.0e9
# router module parameters
# general parameters
# number of router input ports
NUM_INPUT_PORT = 0
# number of router output ports
NUM_OUTPUT_PORT = 0
# flit width in bit
FLIT_WIDTH = 0
# virtual channel parameters
# number of message classes per port
NUM_VIRTUAL_CLASS = 0
# number of virtual channels per message class
NUM_VIRTUAL_CHANNEL = 0
# Are input virtual channels managed in a shared buffer? (Private buffer otherwise)
IS_IN_SHARED_BUFFER = FALSE
# Are output virtual channels managed in a shared buffer? (Private buffer otherwise)
IS_OUT_SHARED_BUFFER = FALSE
# Are input virtual channels sharing the same crossbar input ports?
IS_IN_SHARED_SWITCH = TRUE
# Are output virtual channels sharing the same crossbar output ports?
IS_OUT_SHARED_SWITCH = TRUE
# crossbar parameters
# crossbar model
CROSSBAR_MODEL = MULTREE_CROSSBAR
CROSSBAR_CONNECT_TYPE = TRISTATE_GATE
CROSSBAR_TRANS_GATE_TYPE = NP_GATE
CROSSBAR_MUX_DEGREE = 4
CROSSBAR_NUM_IN_SEG = 1
CROSSBAR_NUM_OUT_SEG = 1
# crossbar input line length
CROSSBAR_LEN_IN_WIRE = 0
# crossbar output line length
CROSSBAR_LEN_OUT_WIRE = 0
# input buffer parameters
IS_INPUT_BUFFER = TRUE
# input buffer model (SRAM, REGISTER)
IN_BUF_MODEL = REGISTER
IN_BUF_NUM_SET = 0
IN_BUF_NUM_READ_PORT = 1
# output buffer parameters */
IS_OUTPUT_BUFFER = FALSE
# output buffer model (SRAM, REGISTER)
OUT_BUF_MODEL = SRAM
OUT_BUF_NUM_SET = 0
OUT_BUF_NUM_WRITE_PORT = 0
# array parameters shared by various sram buffers
SRAM_ROWDEC_MODEL = GENERIC_DEC
SRAM_ROWDEC_PRE_MODEL = SINGLE_OTHER
SRAM_WORDLINE_MODEL = RW_WORDLINE
SRAM_BITLINE_MODEL = RW_BITLINE
SRAM_OUTDRV_MODEL = REG_OUTDRV
# these 3 should be changed together
# use double-ended bitline because the array is too large
SRAM_NUM_DATA_END = 2
SRAM_AMP_MODEL = GENERIC_AMP
SRAM_BITLINE_PRE_MODEL = EQU_BITLINE
# SRAM_NUM_DATA_END = 1
# SRAM_AMP_MODEL = NO_MODEL
# SRAM_BITLINE_PRE_MODEL = SINGLE_OTHER
# switch allocator arbiter parameters
# arbiter mode (MATRIX_ARBITER, RR_ARBITER)
SA_IN_ARB_MODEL = RR_ARBITER
# flip-flop model
SA_IN_ARB_FF_MODEL = NEG_DFF
# arbiter mode (MATRIX_ARBITER, RR_ARBITER)
SA_OUT_ARB_MODEL = MATRIX_ARBITER
# flip-flop model
SA_OUT_ARB_FF_MODEL = NEG_DFF
# virtual channel allocator arbiter parameters
# allocator model (ONE_STAGE_ARB, TWO_STAGE_ARB, VC_SELECT)
VA_MODEL = TWO_STAGE_ARB
# arbiter mode (MATRIX_ARBITER, RR_ARBITER)
VA_IN_ARB_MODEL = RR_ARBITER
# flip-flop model
VA_IN_ARB_FF_MODEL = NEG_DFF
# arbiter mode (MATRIX_ARBITER, RR_ARBITER)
VA_OUT_ARB_MODEL = MATRIX_ARBITER
# flip-flop model
VA_OUT_ARB_FF_MODEL = NEG_DFF
# buffer model if VC_SELECT is used (SRAM, REGISTER)
VA_BUF_MODEL = REGISTER
# link wire parameters
#link length in metres
LINK_LENGTH = 1e-3
# wire layer model (INTERMEDIATE, GLOBAL)
WIRE_LAYER_TYPE = GLOBAL
# wire width spacing (SWIDTH_SSPACE, SWIDTH_DSPACE, DWIDTH_SSPACE, DWIDTH_DSPACE)
WIRE_WIDTH_SPACING = DWIDTH_DSPACE
# buffering model (MIN_DELAY, STAGGERED)
WIRE_BUFFERING_MODEL = MIN_DELAY
# is shielding
WIRE_IS_SHIELDING = FALSE
# clock power parameters
NUM_PIPELINE_STAGE = 3
IS_HTREE_CLOCK = FALSE
# router diagonal in um
ROUTER_DIAGONAL = 442