arbiter.cc revision 10152
110152Satgutier@umich.edu/***************************************************************************** 210152Satgutier@umich.edu * McPAT/CACTI 310152Satgutier@umich.edu * SOFTWARE LICENSE AGREEMENT 410152Satgutier@umich.edu * Copyright 2012 Hewlett-Packard Development Company, L.P. 510152Satgutier@umich.edu * All Rights Reserved 610152Satgutier@umich.edu * 710152Satgutier@umich.edu * Redistribution and use in source and binary forms, with or without 810152Satgutier@umich.edu * modification, are permitted provided that the following conditions are 910152Satgutier@umich.edu * met: redistributions of source code must retain the above copyright 1010152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer; 1110152Satgutier@umich.edu * redistributions in binary form must reproduce the above copyright 1210152Satgutier@umich.edu * notice, this list of conditions and the following disclaimer in the 1310152Satgutier@umich.edu * documentation and/or other materials provided with the distribution; 1410152Satgutier@umich.edu * neither the name of the copyright holders nor the names of its 1510152Satgutier@umich.edu * contributors may be used to endorse or promote products derived from 1610152Satgutier@umich.edu * this software without specific prior written permission. 1710152Satgutier@umich.edu 1810152Satgutier@umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1910152Satgutier@umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2010152Satgutier@umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2110152Satgutier@umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2210152Satgutier@umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2310152Satgutier@umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2410152Satgutier@umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2510152Satgutier@umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2610152Satgutier@umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2710152Satgutier@umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2810152Satgutier@umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.” 2910152Satgutier@umich.edu * 3010152Satgutier@umich.edu ***************************************************************************/ 3110152Satgutier@umich.edu 3210152Satgutier@umich.edu#include "arbiter.h" 3310152Satgutier@umich.edu 3410152Satgutier@umich.eduArbiter::Arbiter( 3510152Satgutier@umich.edu double n_req, 3610152Satgutier@umich.edu double flit_size_, 3710152Satgutier@umich.edu double output_len, 3810152Satgutier@umich.edu TechnologyParameter::DeviceType *dt 3910152Satgutier@umich.edu ):R(n_req), flit_size(flit_size_), 4010152Satgutier@umich.edu o_len (output_len), deviceType(dt) 4110152Satgutier@umich.edu{ 4210152Satgutier@umich.edu min_w_pmos = deviceType->n_to_p_eff_curr_drv_ratio*g_tp.min_w_nmos_; 4310152Satgutier@umich.edu Vdd = dt->Vdd; 4410152Satgutier@umich.edu double technology = g_ip->F_sz_um; 4510152Satgutier@umich.edu NTn1 = 13.5*technology/2; 4610152Satgutier@umich.edu PTn1 = 76*technology/2; 4710152Satgutier@umich.edu NTn2 = 13.5*technology/2; 4810152Satgutier@umich.edu PTn2 = 76*technology/2; 4910152Satgutier@umich.edu NTi = 12.5*technology/2; 5010152Satgutier@umich.edu PTi = 25*technology/2; 5110152Satgutier@umich.edu NTtr = 10*technology/2; /*Transmission gate's nmos tr. length*/ 5210152Satgutier@umich.edu PTtr = 20*technology/2; /* pmos tr. length*/ 5310152Satgutier@umich.edu} 5410152Satgutier@umich.edu 5510152Satgutier@umich.eduArbiter::~Arbiter(){} 5610152Satgutier@umich.edu 5710152Satgutier@umich.edudouble 5810152Satgutier@umich.eduArbiter::arb_req() { 5910152Satgutier@umich.edu double temp = ((R-1)*(2*gate_C(NTn1, 0)+gate_C(PTn1, 0)) + 2*gate_C(NTn2, 0) + 6010152Satgutier@umich.edu gate_C(PTn2, 0) + gate_C(NTi, 0) + gate_C(PTi, 0) + 6110152Satgutier@umich.edu drain_C_(NTi, 0, 1, 1, g_tp.cell_h_def) + drain_C_(PTi, 1, 1, 1, g_tp.cell_h_def)); 6210152Satgutier@umich.edu return temp; 6310152Satgutier@umich.edu} 6410152Satgutier@umich.edu 6510152Satgutier@umich.edudouble 6610152Satgutier@umich.eduArbiter::arb_pri() { 6710152Satgutier@umich.edu double temp = 2*(2*gate_C(NTn1, 0)+gate_C(PTn1, 0)); /* switching capacitance 6810152Satgutier@umich.edu of flip-flop is ignored */ 6910152Satgutier@umich.edu return temp; 7010152Satgutier@umich.edu} 7110152Satgutier@umich.edu 7210152Satgutier@umich.edu 7310152Satgutier@umich.edudouble 7410152Satgutier@umich.eduArbiter::arb_grant() { 7510152Satgutier@umich.edu double temp = drain_C_(NTn1, 0, 1, 1, g_tp.cell_h_def)*2 + drain_C_(PTn1, 1, 1, 1, g_tp.cell_h_def) + crossbar_ctrline(); 7610152Satgutier@umich.edu return temp; 7710152Satgutier@umich.edu} 7810152Satgutier@umich.edu 7910152Satgutier@umich.edudouble 8010152Satgutier@umich.eduArbiter::arb_int() { 8110152Satgutier@umich.edu double temp = (drain_C_(NTn1, 0, 1, 1, g_tp.cell_h_def)*2 + drain_C_(PTn1, 1, 1, 1, g_tp.cell_h_def) + 8210152Satgutier@umich.edu 2*gate_C(NTn2, 0) + gate_C(PTn2, 0)); 8310152Satgutier@umich.edu return temp; 8410152Satgutier@umich.edu} 8510152Satgutier@umich.edu 8610152Satgutier@umich.eduvoid 8710152Satgutier@umich.eduArbiter::compute_power() { 8810152Satgutier@umich.edu power.readOp.dynamic = (R*arb_req()*Vdd*Vdd/2 + R*arb_pri()*Vdd*Vdd/2 + 8910152Satgutier@umich.edu arb_grant()*Vdd*Vdd + arb_int()*0.5*Vdd*Vdd); 9010152Satgutier@umich.edu double nor1_leak = cmos_Isub_leakage(g_tp.min_w_nmos_*NTn1*2, min_w_pmos * PTn1*2, 2, nor); 9110152Satgutier@umich.edu double nor2_leak = cmos_Isub_leakage(g_tp.min_w_nmos_*NTn2*R, min_w_pmos * PTn2*R, 2, nor); 9210152Satgutier@umich.edu double not_leak = cmos_Isub_leakage(g_tp.min_w_nmos_*NTi, min_w_pmos * PTi, 1, inv); 9310152Satgutier@umich.edu double nor1_leak_gate = cmos_Ig_leakage(g_tp.min_w_nmos_*NTn1*2, min_w_pmos * PTn1*2, 2, nor); 9410152Satgutier@umich.edu double nor2_leak_gate = cmos_Ig_leakage(g_tp.min_w_nmos_*NTn2*R, min_w_pmos * PTn2*R, 2, nor); 9510152Satgutier@umich.edu double not_leak_gate = cmos_Ig_leakage(g_tp.min_w_nmos_*NTi, min_w_pmos * PTi, 1, inv); 9610152Satgutier@umich.edu power.readOp.leakage = (nor1_leak + nor2_leak + not_leak)*Vdd; //FIXME include priority table leakage 9710152Satgutier@umich.edu power.readOp.gate_leakage = nor1_leak_gate*Vdd + nor2_leak_gate*Vdd + not_leak_gate*Vdd; 9810152Satgutier@umich.edu} 9910152Satgutier@umich.edu 10010152Satgutier@umich.edudouble //wire cap with triple spacing 10110152Satgutier@umich.eduArbiter::Cw3(double length) { 10210152Satgutier@umich.edu Wire wc(g_ip->wt, length, 1, 3, 3); 10310152Satgutier@umich.edu double temp = (wc.wire_cap(length,true)); 10410152Satgutier@umich.edu return temp; 10510152Satgutier@umich.edu} 10610152Satgutier@umich.edu 10710152Satgutier@umich.edudouble 10810152Satgutier@umich.eduArbiter::crossbar_ctrline() { 10910152Satgutier@umich.edu double temp = (Cw3(o_len * 1e-6 /* m */) + 11010152Satgutier@umich.edu drain_C_(NTi, 0, 1, 1, g_tp.cell_h_def) + drain_C_(PTi, 1, 1, 1, g_tp.cell_h_def) + 11110152Satgutier@umich.edu gate_C(NTi, 0) + gate_C(PTi, 0)); 11210152Satgutier@umich.edu return temp; 11310152Satgutier@umich.edu} 11410152Satgutier@umich.edu 11510152Satgutier@umich.edudouble 11610152Satgutier@umich.eduArbiter::transmission_buf_ctrcap() { 11710152Satgutier@umich.edu double temp = gate_C(NTtr, 0)+gate_C(PTtr, 0); 11810152Satgutier@umich.edu return temp; 11910152Satgutier@umich.edu} 12010152Satgutier@umich.edu 12110152Satgutier@umich.edu 12210152Satgutier@umich.eduvoid Arbiter::print_arbiter() 12310152Satgutier@umich.edu{ 12410152Satgutier@umich.edu cout << "\nArbiter Stats (" << R << " input arbiter" << ")\n\n"; 12510152Satgutier@umich.edu cout << "Flit size : " << flit_size << " bits" << endl; 12610152Satgutier@umich.edu cout << "Dynamic Power : " << power.readOp.dynamic*1e9 << " (nJ)" << endl; 12710152Satgutier@umich.edu cout << "Leakage Power : " << power.readOp.leakage*1e3 << " (mW)" << endl; 12810152Satgutier@umich.edu} 12910152Satgutier@umich.edu 13010152Satgutier@umich.edu 131