arbiter.cc revision 10234
1/***************************************************************************** 2 * McPAT/CACTI 3 * SOFTWARE LICENSE AGREEMENT 4 * Copyright 2012 Hewlett-Packard Development Company, L.P. 5 * Copyright (c) 2010-2013 Advanced Micro Devices, Inc. 6 * All Rights Reserved 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer; 12 * redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution; 15 * neither the name of the copyright holders nor the names of its 16 * contributors may be used to endorse or promote products derived from 17 * this software without specific prior written permission. 18 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * 31 ***************************************************************************/ 32 33#include "arbiter.h" 34 35Arbiter::Arbiter( 36 double n_req, 37 double flit_size_, 38 double output_len, 39 TechnologyParameter::DeviceType *dt 40 ): R(n_req), flit_size(flit_size_), 41 o_len (output_len), deviceType(dt) { 42 min_w_pmos = deviceType->n_to_p_eff_curr_drv_ratio * g_tp.min_w_nmos_; 43 Vdd = dt->Vdd; 44 double technology = g_ip->F_sz_um; 45 NTn1 = 13.5 * technology / 2; 46 PTn1 = 76 * technology / 2; 47 NTn2 = 13.5 * technology / 2; 48 PTn2 = 76 * technology / 2; 49 NTi = 12.5 * technology / 2; 50 PTi = 25 * technology / 2; 51 NTtr = 10 * technology / 2; /*Transmission gate's nmos tr. length*/ 52 PTtr = 20 * technology / 2; /* pmos tr. length*/ 53} 54 55Arbiter::~Arbiter() {} 56 57double 58Arbiter::arb_req() { 59 double temp = ((R - 1) * (2 * gate_C(NTn1, 0) + gate_C(PTn1, 0)) + 2 * 60 gate_C(NTn2, 0) + 61 gate_C(PTn2, 0) + gate_C(NTi, 0) + gate_C(PTi, 0) + 62 drain_C_(NTi, 0, 1, 1, g_tp.cell_h_def) + 63 drain_C_(PTi, 1, 1, 1, g_tp.cell_h_def)); 64 return temp; 65} 66 67double 68Arbiter::arb_pri() { 69 /* switching capacitance of flip-flop is ignored */ 70 double temp = 2 * (2 * gate_C(NTn1, 0) + gate_C(PTn1, 0)); 71 return temp; 72} 73 74 75double 76Arbiter::arb_grant() { 77 double temp = drain_C_(NTn1, 0, 1, 1, g_tp.cell_h_def) * 2 + 78 drain_C_(PTn1, 1, 1, 1, g_tp.cell_h_def) + crossbar_ctrline(); 79 return temp; 80} 81 82double 83Arbiter::arb_int() { 84 double temp = (drain_C_(NTn1, 0, 1, 1, g_tp.cell_h_def) * 2 + 85 drain_C_(PTn1, 1, 1, 1, g_tp.cell_h_def) + 86 2 * gate_C(NTn2, 0) + gate_C(PTn2, 0)); 87 return temp; 88} 89 90void 91Arbiter::compute_power() { 92 power.readOp.dynamic = (R * arb_req() * Vdd * Vdd / 2 + R * arb_pri() * 93 Vdd * Vdd / 2 + 94 arb_grant() * Vdd * Vdd + arb_int() * 0.5 * Vdd * 95 Vdd); 96 double nor1_leak = cmos_Isub_leakage(g_tp.min_w_nmos_ * NTn1 * 2, 97 min_w_pmos * PTn1 * 2, 2, nor); 98 double nor2_leak = cmos_Isub_leakage(g_tp.min_w_nmos_ * NTn2 * R, 99 min_w_pmos * PTn2 * R, 2, nor); 100 double not_leak = cmos_Isub_leakage(g_tp.min_w_nmos_ * NTi, 101 min_w_pmos * PTi, 1, inv); 102 double nor1_leak_gate = cmos_Ig_leakage(g_tp.min_w_nmos_ * NTn1 * 2, 103 min_w_pmos * PTn1 * 2, 2, nor); 104 double nor2_leak_gate = cmos_Ig_leakage(g_tp.min_w_nmos_ * NTn2 * R, 105 min_w_pmos * PTn2 * R, 2, nor); 106 double not_leak_gate = cmos_Ig_leakage(g_tp.min_w_nmos_ * NTi, 107 min_w_pmos * PTi, 1, inv); 108 //FIXME include priority table leakage 109 power.readOp.leakage = (nor1_leak + nor2_leak + not_leak) * Vdd; 110 power.readOp.gate_leakage = nor1_leak_gate * Vdd + nor2_leak_gate * Vdd + 111 not_leak_gate * Vdd; 112} 113 114double //wire cap with triple spacing 115Arbiter::Cw3(double length) { 116 Wire wc(g_ip->wt, length, 1, 3, 3); 117 double temp = (wc.wire_cap(length, true)); 118 return temp; 119} 120 121double 122Arbiter::crossbar_ctrline() { 123 double temp = (Cw3(o_len * 1e-6 /* m */) + 124 drain_C_(NTi, 0, 1, 1, g_tp.cell_h_def) + drain_C_(PTi, 1, 1, 1, g_tp.cell_h_def) + 125 gate_C(NTi, 0) + gate_C(PTi, 0)); 126 return temp; 127} 128 129double 130Arbiter::transmission_buf_ctrcap() { 131 double temp = gate_C(NTtr, 0) + gate_C(PTtr, 0); 132 return temp; 133} 134 135 136void Arbiter::print_arbiter() { 137 cout << "\nArbiter Stats (" << R << " input arbiter" << ")\n\n"; 138 cout << "Flit size : " << flit_size << " bits" << endl; 139 cout << "Dynamic Power : " << power.readOp.dynamic*1e9 << " (nJ)" << endl; 140 cout << "Leakage Power : " << power.readOp.leakage*1e3 << " (mW)" << endl; 141} 142 143 144