diff options
Diffstat (limited to 'src/mem/ruby/network/orion/Allocator')
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/Arbiter.cc | 93 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/Arbiter.hh | 87 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/MatrixArbiter.cc | 251 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/MatrixArbiter.hh | 70 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/RRArbiter.cc | 238 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/RRArbiter.hh | 72 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/SConscript | 38 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/SWAllocator.cc | 175 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/SWAllocator.hh | 95 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/VCAllocator.cc | 302 | ||||
-rw-r--r-- | src/mem/ruby/network/orion/Allocator/VCAllocator.hh | 123 |
11 files changed, 0 insertions, 1544 deletions
diff --git a/src/mem/ruby/network/orion/Allocator/Arbiter.cc b/src/mem/ruby/network/orion/Allocator/Arbiter.cc deleted file mode 100644 index d6124eb36..000000000 --- a/src/mem/ruby/network/orion/Allocator/Arbiter.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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 <iostream> - -#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; - } -} diff --git a/src/mem/ruby/network/orion/Allocator/Arbiter.hh b/src/mem/ruby/network/orion/Allocator/Arbiter.hh deleted file mode 100644 index e9849a901..000000000 --- a/src/mem/ruby/network/orion/Allocator/Arbiter.hh +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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 - diff --git a/src/mem/ruby/network/orion/Allocator/MatrixArbiter.cc b/src/mem/ruby/network/orion/Allocator/MatrixArbiter.cc deleted file mode 100644 index 2f7ffcb48..000000000 --- a/src/mem/ruby/network/orion/Allocator/MatrixArbiter.cc +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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; -} diff --git a/src/mem/ruby/network/orion/Allocator/MatrixArbiter.hh b/src/mem/ruby/network/orion/Allocator/MatrixArbiter.hh deleted file mode 100644 index a252a960f..000000000 --- a/src/mem/ruby/network/orion/Allocator/MatrixArbiter.hh +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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/Allocator/Arbiter.hh" -#include "mem/ruby/network/orion/Type.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 diff --git a/src/mem/ruby/network/orion/Allocator/RRArbiter.cc b/src/mem/ruby/network/orion/Allocator/RRArbiter.cc deleted file mode 100644 index 47963c938..000000000 --- a/src/mem/ruby/network/orion/Allocator/RRArbiter.cc +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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 <iostream> - -#include "mem/ruby/network/orion/Allocator/RRArbiter.hh" -#include "mem/ruby/network/orion/FlipFlop.hh" -#include "mem/ruby/network/orion/TechParameter.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; -} diff --git a/src/mem/ruby/network/orion/Allocator/RRArbiter.hh b/src/mem/ruby/network/orion/Allocator/RRArbiter.hh deleted file mode 100644 index 259803a8c..000000000 --- a/src/mem/ruby/network/orion/Allocator/RRArbiter.hh +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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/Allocator/Arbiter.hh" -#include "mem/ruby/network/orion/Type.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 diff --git a/src/mem/ruby/network/orion/Allocator/SConscript b/src/mem/ruby/network/orion/Allocator/SConscript deleted file mode 100644 index e85844bac..000000000 --- a/src/mem/ruby/network/orion/Allocator/SConscript +++ /dev/null @@ -1,38 +0,0 @@ -# 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 env['PROTOCOL'] == 'None': - Return() - -Source('Arbiter.cc') -Source('MatrixArbiter.cc') -Source('RRArbiter.cc') -Source('SWAllocator.cc') -Source('VCAllocator.cc') diff --git a/src/mem/ruby/network/orion/Allocator/SWAllocator.cc b/src/mem/ruby/network/orion/Allocator/SWAllocator.cc deleted file mode 100644 index f1b5f872d..000000000 --- a/src/mem/ruby/network/orion/Allocator/SWAllocator.cc +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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 <iostream> - -#include "mem/ruby/network/orion/Allocator/Arbiter.hh" -#include "mem/ruby/network/orion/Allocator/SWAllocator.hh" -#include "mem/ruby/network/orion/Crossbar/Crossbar.hh" -#include "mem/ruby/network/orion/OrionConfig.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); -} diff --git a/src/mem/ruby/network/orion/Allocator/SWAllocator.hh b/src/mem/ruby/network/orion/Allocator/SWAllocator.hh deleted file mode 100644 index fa47df0df..000000000 --- a/src/mem/ruby/network/orion/Allocator/SWAllocator.hh +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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 diff --git a/src/mem/ruby/network/orion/Allocator/VCAllocator.cc b/src/mem/ruby/network/orion/Allocator/VCAllocator.cc deleted file mode 100644 index 9bc833216..000000000 --- a/src/mem/ruby/network/orion/Allocator/VCAllocator.cc +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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 <cstdlib> -#include <iostream> - -#include "mem/ruby/network/orion/Allocator/Arbiter.hh" -#include "mem/ruby/network/orion/Allocator/VCAllocator.hh" -#include "mem/ruby/network/orion/Buffer/Buffer.hh" -#include "mem/ruby/network/orion/OrionConfig.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_); - } -} diff --git a/src/mem/ruby/network/orion/Allocator/VCAllocator.hh b/src/mem/ruby/network/orion/Allocator/VCAllocator.hh deleted file mode 100644 index 81ab6b8a0..000000000 --- a/src/mem/ruby/network/orion/Allocator/VCAllocator.hh +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2009 Princeton University - * Copyright (c) 2009 The 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 |