MUX2.cc revision 10447
110447Snilay@cs.wisc.edu#include "model/std_cells/MUX2.h" 210447Snilay@cs.wisc.edu 310447Snilay@cs.wisc.edu#include <cmath> 410447Snilay@cs.wisc.edu 510447Snilay@cs.wisc.edu#include "model/PortInfo.h" 610447Snilay@cs.wisc.edu#include "model/TransitionInfo.h" 710447Snilay@cs.wisc.edu#include "model/EventInfo.h" 810447Snilay@cs.wisc.edu#include "model/std_cells/StdCellLib.h" 910447Snilay@cs.wisc.edu#include "model/std_cells/CellMacros.h" 1010447Snilay@cs.wisc.edu#include "model/timing_graph/ElectricalNet.h" 1110447Snilay@cs.wisc.edu#include "model/timing_graph/ElectricalDriver.h" 1210447Snilay@cs.wisc.edu#include "model/timing_graph/ElectricalLoad.h" 1310447Snilay@cs.wisc.edu#include "model/timing_graph/ElectricalDelay.h" 1410447Snilay@cs.wisc.edu 1510447Snilay@cs.wisc.edunamespace DSENT 1610447Snilay@cs.wisc.edu{ 1710447Snilay@cs.wisc.edu using std::ceil; 1810447Snilay@cs.wisc.edu using std::max; 1910447Snilay@cs.wisc.edu 2010447Snilay@cs.wisc.edu MUX2::MUX2(const String& instance_name_, const TechModel* tech_model_) 2110447Snilay@cs.wisc.edu : StdCell(instance_name_, tech_model_) 2210447Snilay@cs.wisc.edu { 2310447Snilay@cs.wisc.edu initProperties(); 2410447Snilay@cs.wisc.edu } 2510447Snilay@cs.wisc.edu 2610447Snilay@cs.wisc.edu MUX2::~MUX2() 2710447Snilay@cs.wisc.edu {} 2810447Snilay@cs.wisc.edu 2910447Snilay@cs.wisc.edu void MUX2::initProperties() 3010447Snilay@cs.wisc.edu { 3110447Snilay@cs.wisc.edu return; 3210447Snilay@cs.wisc.edu } 3310447Snilay@cs.wisc.edu 3410447Snilay@cs.wisc.edu void MUX2::constructModel() 3510447Snilay@cs.wisc.edu { 3610447Snilay@cs.wisc.edu // All constructModel should do is create Area/NDDPower/Energy Results as 3710447Snilay@cs.wisc.edu // well as instantiate any sub-instances using only the hard parameters 3810447Snilay@cs.wisc.edu 3910447Snilay@cs.wisc.edu createInputPort("A"); 4010447Snilay@cs.wisc.edu createInputPort("B"); 4110447Snilay@cs.wisc.edu createInputPort("S0"); 4210447Snilay@cs.wisc.edu createOutputPort("Y"); 4310447Snilay@cs.wisc.edu 4410447Snilay@cs.wisc.edu createLoad("A_Cap"); 4510447Snilay@cs.wisc.edu createLoad("B_Cap"); 4610447Snilay@cs.wisc.edu createLoad("S0_Cap"); 4710447Snilay@cs.wisc.edu createDelay("A_to_Y_delay"); 4810447Snilay@cs.wisc.edu createDelay("B_to_Y_delay"); 4910447Snilay@cs.wisc.edu createDelay("S0_to_Y_delay"); 5010447Snilay@cs.wisc.edu createDriver("Y_Ron", true); 5110447Snilay@cs.wisc.edu 5210447Snilay@cs.wisc.edu ElectricalLoad* a_cap = getLoad("A_Cap"); 5310447Snilay@cs.wisc.edu ElectricalLoad* b_cap = getLoad("B_Cap"); 5410447Snilay@cs.wisc.edu ElectricalLoad* s0_cap = getLoad("S0_Cap"); 5510447Snilay@cs.wisc.edu ElectricalDelay* a_to_y_delay = getDelay("A_to_Y_delay"); 5610447Snilay@cs.wisc.edu ElectricalDelay* b_to_y_delay = getDelay("B_to_Y_delay"); 5710447Snilay@cs.wisc.edu ElectricalDelay* s0_to_y_delay = getDelay("S0_to_Y_delay"); 5810447Snilay@cs.wisc.edu ElectricalDriver* y_ron = getDriver("Y_Ron"); 5910447Snilay@cs.wisc.edu 6010447Snilay@cs.wisc.edu getNet("A")->addDownstreamNode(a_cap); 6110447Snilay@cs.wisc.edu getNet("B")->addDownstreamNode(b_cap); 6210447Snilay@cs.wisc.edu getNet("S0")->addDownstreamNode(s0_cap); 6310447Snilay@cs.wisc.edu a_cap->addDownstreamNode(a_to_y_delay); 6410447Snilay@cs.wisc.edu b_cap->addDownstreamNode(b_to_y_delay); 6510447Snilay@cs.wisc.edu s0_cap->addDownstreamNode(s0_to_y_delay); 6610447Snilay@cs.wisc.edu a_to_y_delay->addDownstreamNode(y_ron); 6710447Snilay@cs.wisc.edu b_to_y_delay->addDownstreamNode(y_ron); 6810447Snilay@cs.wisc.edu s0_to_y_delay->addDownstreamNode(y_ron); 6910447Snilay@cs.wisc.edu y_ron->addDownstreamNode(getNet("Y")); 7010447Snilay@cs.wisc.edu 7110447Snilay@cs.wisc.edu // Create Area result 7210447Snilay@cs.wisc.edu createElectricalAtomicResults(); 7310447Snilay@cs.wisc.edu getEventInfo("Idle")->setStaticTransitionInfos(); 7410447Snilay@cs.wisc.edu // Create MUX2 Event Energy Result 7510447Snilay@cs.wisc.edu createElectricalEventAtomicResult("MUX2"); 7610447Snilay@cs.wisc.edu 7710447Snilay@cs.wisc.edu 7810447Snilay@cs.wisc.edu return; 7910447Snilay@cs.wisc.edu } 8010447Snilay@cs.wisc.edu 8110447Snilay@cs.wisc.edu void MUX2::updateModel() 8210447Snilay@cs.wisc.edu { 8310447Snilay@cs.wisc.edu // Get parameters 8410447Snilay@cs.wisc.edu double drive_strength = getDrivingStrength(); 8510447Snilay@cs.wisc.edu Map<double>* cache = getTechModel()->getStdCellLib()->getStdCellCache(); 8610447Snilay@cs.wisc.edu 8710447Snilay@cs.wisc.edu // Standard cell cache string 8810447Snilay@cs.wisc.edu String cell_name = "MUX2_X" + (String) drive_strength; 8910447Snilay@cs.wisc.edu 9010447Snilay@cs.wisc.edu // Get timing parameters 9110447Snilay@cs.wisc.edu getLoad("A_Cap")->setLoadCap(cache->get(cell_name + "->Cap->A")); 9210447Snilay@cs.wisc.edu getLoad("B_Cap")->setLoadCap(cache->get(cell_name + "->Cap->B")); 9310447Snilay@cs.wisc.edu getLoad("S0_Cap")->setLoadCap(cache->get(cell_name + "->Cap->S0")); 9410447Snilay@cs.wisc.edu 9510447Snilay@cs.wisc.edu getDelay("A_to_Y_delay")->setDelay(cache->get(cell_name + "->Delay->A_to_Y")); 9610447Snilay@cs.wisc.edu getDelay("B_to_Y_delay")->setDelay(cache->get(cell_name + "->Delay->B_to_Y")); 9710447Snilay@cs.wisc.edu getDelay("S0_to_Y_delay")->setDelay(cache->get(cell_name + "->Delay->S0_to_Y")); 9810447Snilay@cs.wisc.edu 9910447Snilay@cs.wisc.edu getDriver("Y_Ron")->setOutputRes(cache->get(cell_name + "->DriveRes->Y")); 10010447Snilay@cs.wisc.edu 10110447Snilay@cs.wisc.edu // Set the cell area 10210447Snilay@cs.wisc.edu getAreaResult("Active")->setValue(cache->get(cell_name + "->ActiveArea")); 10310447Snilay@cs.wisc.edu getAreaResult("Metal1Wire")->setValue(cache->get(cell_name + "->ActiveArea")); 10410447Snilay@cs.wisc.edu 10510447Snilay@cs.wisc.edu return; 10610447Snilay@cs.wisc.edu } 10710447Snilay@cs.wisc.edu 10810447Snilay@cs.wisc.edu void MUX2::evaluateModel() 10910447Snilay@cs.wisc.edu { 11010447Snilay@cs.wisc.edu return; 11110447Snilay@cs.wisc.edu } 11210447Snilay@cs.wisc.edu 11310447Snilay@cs.wisc.edu void MUX2::useModel() 11410447Snilay@cs.wisc.edu { 11510447Snilay@cs.wisc.edu // Get parameters 11610447Snilay@cs.wisc.edu double drive_strength = getDrivingStrength(); 11710447Snilay@cs.wisc.edu Map<double>* cache = getTechModel()->getStdCellLib()->getStdCellCache(); 11810447Snilay@cs.wisc.edu 11910447Snilay@cs.wisc.edu // Standard cell cache string 12010447Snilay@cs.wisc.edu String cell_name = "MUX2_X" + (String) drive_strength; 12110447Snilay@cs.wisc.edu 12210447Snilay@cs.wisc.edu // Propagate the transition and get the 0->1 transition count 12310447Snilay@cs.wisc.edu propagateTransitionInfo(); 12410447Snilay@cs.wisc.edu double P_A = getInputPort("A")->getTransitionInfo().getProbability1(); 12510447Snilay@cs.wisc.edu double P_B = getInputPort("B")->getTransitionInfo().getProbability1(); 12610447Snilay@cs.wisc.edu double P_S0 = getInputPort("S0")->getTransitionInfo().getProbability1(); 12710447Snilay@cs.wisc.edu double S0_num_trans_01 = getInputPort("S0")->getTransitionInfo().getNumberTransitions01(); 12810447Snilay@cs.wisc.edu double Y_num_trans_01 = getOutputPort("Y")->getTransitionInfo().getNumberTransitions01(); 12910447Snilay@cs.wisc.edu 13010447Snilay@cs.wisc.edu // Calculate leakage 13110447Snilay@cs.wisc.edu double leakage = 0; 13210447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->!A!B!S0") * (1 - P_A) * (1 - P_B) * (1 - P_S0); 13310447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->!A!BS0") * (1 - P_A) * (1 - P_B) * P_S0; 13410447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->!AB!S0") * (1 - P_A) * P_B * (1 - P_S0); 13510447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->!ABS0") * (1 - P_A) * P_B * P_S0; 13610447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->A!B!S0") * P_A * (1 - P_B) * (1 - P_S0); 13710447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->A!BS0") * P_A * (1 - P_B) * P_S0; 13810447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->AB!S0") * P_A * P_B * (1 - P_S0); 13910447Snilay@cs.wisc.edu leakage += cache->get(cell_name + "->Leakage->ABS0") * P_A * P_B * P_S0; 14010447Snilay@cs.wisc.edu getNddPowerResult("Leakage")->setValue(leakage); 14110447Snilay@cs.wisc.edu 14210447Snilay@cs.wisc.edu // Get VDD 14310447Snilay@cs.wisc.edu double vdd = getTechModel()->get("Vdd"); 14410447Snilay@cs.wisc.edu 14510447Snilay@cs.wisc.edu // Get capacitances 14610447Snilay@cs.wisc.edu double s0_b_cap = cache->get(cell_name + "->Cap->S0_b"); 14710447Snilay@cs.wisc.edu double y_bar_cap = cache->get(cell_name + "->Cap->Y_b"); 14810447Snilay@cs.wisc.edu double y_cap = cache->get(cell_name + "->Cap->Y"); 14910447Snilay@cs.wisc.edu double y_load_cap = getNet("Y")->getTotalDownstreamCap(); 15010447Snilay@cs.wisc.edu // Create mux2 event energy 15110447Snilay@cs.wisc.edu double mux2_event_energy = 0.0; 15210447Snilay@cs.wisc.edu mux2_event_energy += (s0_b_cap) * S0_num_trans_01; 15310447Snilay@cs.wisc.edu mux2_event_energy += (y_bar_cap + y_cap + y_load_cap) * Y_num_trans_01; 15410447Snilay@cs.wisc.edu mux2_event_energy *= vdd * vdd; 15510447Snilay@cs.wisc.edu getEventResult("MUX2")->setValue(mux2_event_energy); 15610447Snilay@cs.wisc.edu 15710447Snilay@cs.wisc.edu return; 15810447Snilay@cs.wisc.edu } 15910447Snilay@cs.wisc.edu 16010447Snilay@cs.wisc.edu void MUX2::propagateTransitionInfo() 16110447Snilay@cs.wisc.edu { 16210447Snilay@cs.wisc.edu // Get input signal transition info 16310447Snilay@cs.wisc.edu const TransitionInfo& trans_A = getInputPort("A")->getTransitionInfo(); 16410447Snilay@cs.wisc.edu const TransitionInfo& trans_B = getInputPort("B")->getTransitionInfo(); 16510447Snilay@cs.wisc.edu const TransitionInfo& trans_S0 = getInputPort("S0")->getTransitionInfo(); 16610447Snilay@cs.wisc.edu 16710447Snilay@cs.wisc.edu // Scale all transition information to the highest freq multiplier 16810447Snilay@cs.wisc.edu double max_freq_mult = max(max(trans_A.getFrequencyMultiplier(), trans_B.getFrequencyMultiplier()), trans_S0.getFrequencyMultiplier()); 16910447Snilay@cs.wisc.edu const TransitionInfo& scaled_trans_A = trans_A.scaleFrequencyMultiplier(max_freq_mult); 17010447Snilay@cs.wisc.edu const TransitionInfo& scaled_trans_B = trans_B.scaleFrequencyMultiplier(max_freq_mult); 17110447Snilay@cs.wisc.edu const TransitionInfo& scaled_trans_S0 = trans_S0.scaleFrequencyMultiplier(max_freq_mult); 17210447Snilay@cs.wisc.edu 17310447Snilay@cs.wisc.edu // Compute the probability of each transition on a given cycle 17410447Snilay@cs.wisc.edu double A_prob_00 = scaled_trans_A.getNumberTransitions00() / max_freq_mult; 17510447Snilay@cs.wisc.edu double A_prob_01 = scaled_trans_A.getNumberTransitions01() / max_freq_mult; 17610447Snilay@cs.wisc.edu double A_prob_10 = A_prob_01; 17710447Snilay@cs.wisc.edu double A_prob_11 = scaled_trans_A.getNumberTransitions11() / max_freq_mult; 17810447Snilay@cs.wisc.edu double B_prob_00 = scaled_trans_B.getNumberTransitions00() / max_freq_mult; 17910447Snilay@cs.wisc.edu double B_prob_01 = scaled_trans_B.getNumberTransitions01() / max_freq_mult; 18010447Snilay@cs.wisc.edu double B_prob_10 = B_prob_01; 18110447Snilay@cs.wisc.edu double B_prob_11 = scaled_trans_B.getNumberTransitions11() / max_freq_mult; 18210447Snilay@cs.wisc.edu double S0_prob_00 = scaled_trans_S0.getNumberTransitions00() / max_freq_mult; 18310447Snilay@cs.wisc.edu double S0_prob_01 = scaled_trans_S0.getNumberTransitions01() / max_freq_mult; 18410447Snilay@cs.wisc.edu double S0_prob_10 = S0_prob_01; 18510447Snilay@cs.wisc.edu double S0_prob_11 = scaled_trans_S0.getNumberTransitions11() / max_freq_mult; 18610447Snilay@cs.wisc.edu 18710447Snilay@cs.wisc.edu // Compute output probabilities 18810447Snilay@cs.wisc.edu double Y_prob_00 = S0_prob_00 * A_prob_00 + 18910447Snilay@cs.wisc.edu S0_prob_01 * (A_prob_00 + A_prob_01) * (B_prob_00 + B_prob_10) + 19010447Snilay@cs.wisc.edu S0_prob_10 * (A_prob_00 + A_prob_10) * (B_prob_00 + B_prob_01) + 19110447Snilay@cs.wisc.edu S0_prob_11 * B_prob_00; 19210447Snilay@cs.wisc.edu double Y_prob_01 = S0_prob_00 * A_prob_01 + 19310447Snilay@cs.wisc.edu S0_prob_01 * (A_prob_00 + A_prob_01) * (B_prob_01 + B_prob_11) + 19410447Snilay@cs.wisc.edu S0_prob_10 * (A_prob_01 + A_prob_11) * (B_prob_00 + B_prob_01) + 19510447Snilay@cs.wisc.edu S0_prob_11 * B_prob_01; 19610447Snilay@cs.wisc.edu double Y_prob_11 = S0_prob_00 * A_prob_11 + 19710447Snilay@cs.wisc.edu S0_prob_01 * (A_prob_10 + A_prob_11) * (B_prob_01 + B_prob_11) + 19810447Snilay@cs.wisc.edu S0_prob_10 * (A_prob_01 + A_prob_11) * (B_prob_10 + B_prob_11) + 19910447Snilay@cs.wisc.edu S0_prob_11 * B_prob_11; 20010447Snilay@cs.wisc.edu 20110447Snilay@cs.wisc.edu // Check that probabilities add up to 1.0 with some finite tolerance 20210447Snilay@cs.wisc.edu ASSERT(LibUtil::Math::isEqual((Y_prob_00 + Y_prob_01 + Y_prob_01 + Y_prob_11), 1.0), 20310447Snilay@cs.wisc.edu "[Error] " + getInstanceName() + "Output transition probabilities must add up to 1 (" + 20410447Snilay@cs.wisc.edu (String) Y_prob_00 + ", " + (String) Y_prob_01 + ", " + (String) Y_prob_11 + ")!"); 20510447Snilay@cs.wisc.edu 20610447Snilay@cs.wisc.edu // Turn probability of transitions per cycle into number of transitions per time unit 20710447Snilay@cs.wisc.edu TransitionInfo trans_Y(Y_prob_00 * max_freq_mult, Y_prob_01 * max_freq_mult, Y_prob_11 * max_freq_mult); 20810447Snilay@cs.wisc.edu getOutputPort("Y")->setTransitionInfo(trans_Y); 20910447Snilay@cs.wisc.edu 21010447Snilay@cs.wisc.edu return; 21110447Snilay@cs.wisc.edu } 21210447Snilay@cs.wisc.edu 21310447Snilay@cs.wisc.edu // Creates the standard cell, characterizes and abstracts away the details 21410447Snilay@cs.wisc.edu void MUX2::cacheStdCell(StdCellLib* cell_lib_, double drive_strength_) 21510447Snilay@cs.wisc.edu { 21610447Snilay@cs.wisc.edu // Get parameters 21710447Snilay@cs.wisc.edu double gate_pitch = cell_lib_->getTechModel()->get("Gate->PitchContacted"); 21810447Snilay@cs.wisc.edu Map<double>* cache = cell_lib_->getStdCellCache(); 21910447Snilay@cs.wisc.edu 22010447Snilay@cs.wisc.edu // Standard cell cache string 22110447Snilay@cs.wisc.edu String cell_name = "MUX2_X" + (String) drive_strength_; 22210447Snilay@cs.wisc.edu 22310447Snilay@cs.wisc.edu Log::printLine("=== " + cell_name + " ==="); 22410447Snilay@cs.wisc.edu 22510447Snilay@cs.wisc.edu // Now actually build the full standard cell model 22610447Snilay@cs.wisc.edu createInputPort("A"); 22710447Snilay@cs.wisc.edu createInputPort("B"); 22810447Snilay@cs.wisc.edu createInputPort("S0"); 22910447Snilay@cs.wisc.edu createOutputPort("Y"); 23010447Snilay@cs.wisc.edu 23110447Snilay@cs.wisc.edu createNet("S0_b"); 23210447Snilay@cs.wisc.edu createNet("Y_b"); 23310447Snilay@cs.wisc.edu 23410447Snilay@cs.wisc.edu // Adds macros 23510447Snilay@cs.wisc.edu CellMacros::addInverter(this, "INV1", false, true, "S0", "S0_b"); 23610447Snilay@cs.wisc.edu CellMacros::addInverter(this, "INV2", false, true, "Y_b", "Y"); 23710447Snilay@cs.wisc.edu CellMacros::addTristate(this, "INVZ1", true, true, true, true, "A", "S0_b", "S0", "Y_b"); 23810447Snilay@cs.wisc.edu CellMacros::addTristate(this, "INVZ2", true, true, true, true, "B", "S0", "S0_b", "Y_b"); 23910447Snilay@cs.wisc.edu 24010447Snilay@cs.wisc.edu // I have no idea how to size each of the parts haha 24110447Snilay@cs.wisc.edu CellMacros::updateInverter(this, "INV1", drive_strength_ * 0.250); 24210447Snilay@cs.wisc.edu CellMacros::updateInverter(this, "INV2", drive_strength_ * 1.000); 24310447Snilay@cs.wisc.edu CellMacros::updateTristate(this, "INVZ1", drive_strength_ * 0.500); 24410447Snilay@cs.wisc.edu CellMacros::updateTristate(this, "INVZ2", drive_strength_ * 0.500); 24510447Snilay@cs.wisc.edu 24610447Snilay@cs.wisc.edu // Cache area result 24710447Snilay@cs.wisc.edu double area = 0.0; 24810447Snilay@cs.wisc.edu area += gate_pitch * getTotalHeight() * 1; 24910447Snilay@cs.wisc.edu area += gate_pitch * getTotalHeight() * getGenProperties()->get("INV1_GatePitches").toDouble(); 25010447Snilay@cs.wisc.edu area += gate_pitch * getTotalHeight() * getGenProperties()->get("INV2_GatePitches").toDouble(); 25110447Snilay@cs.wisc.edu area += gate_pitch * getTotalHeight() * getGenProperties()->get("INVZ1_GatePitches").toDouble(); 25210447Snilay@cs.wisc.edu area += gate_pitch * getTotalHeight() * getGenProperties()->get("INVZ2_GatePitches").toDouble(); 25310447Snilay@cs.wisc.edu cache->set(cell_name + "->ActiveArea", area); 25410447Snilay@cs.wisc.edu Log::printLine(cell_name + "->ActiveArea=" + (String) area); 25510447Snilay@cs.wisc.edu 25610447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 25710447Snilay@cs.wisc.edu // Cache Leakage Power (for every single signal combination) 25810447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 25910447Snilay@cs.wisc.edu double leakage_000 = 0; //!A, !B, !S0 26010447Snilay@cs.wisc.edu double leakage_001 = 0; //!A, !B, S0 26110447Snilay@cs.wisc.edu double leakage_010 = 0; //!A, B, !S0 26210447Snilay@cs.wisc.edu double leakage_011 = 0; //!A, B, S0 26310447Snilay@cs.wisc.edu double leakage_100 = 0; //A, !B, !S0 26410447Snilay@cs.wisc.edu double leakage_101 = 0; //A, !B, S0 26510447Snilay@cs.wisc.edu double leakage_110 = 0; //A, B, !S0 26610447Snilay@cs.wisc.edu double leakage_111 = 0; //A, B, S0 26710447Snilay@cs.wisc.edu 26810447Snilay@cs.wisc.edu //This is so painful... 26910447Snilay@cs.wisc.edu leakage_000 += getGenProperties()->get("INV1_LeakagePower_0").toDouble(); 27010447Snilay@cs.wisc.edu leakage_000 += getGenProperties()->get("INV2_LeakagePower_1").toDouble(); 27110447Snilay@cs.wisc.edu leakage_000 += getGenProperties()->get("INVZ1_LeakagePower_100_1").toDouble(); 27210447Snilay@cs.wisc.edu leakage_000 += getGenProperties()->get("INVZ2_LeakagePower_010_1").toDouble(); 27310447Snilay@cs.wisc.edu 27410447Snilay@cs.wisc.edu leakage_001 += getGenProperties()->get("INV1_LeakagePower_1").toDouble(); 27510447Snilay@cs.wisc.edu leakage_001 += getGenProperties()->get("INV2_LeakagePower_1").toDouble(); 27610447Snilay@cs.wisc.edu leakage_001 += getGenProperties()->get("INVZ1_LeakagePower_010_1").toDouble(); 27710447Snilay@cs.wisc.edu leakage_001 += getGenProperties()->get("INVZ2_LeakagePower_100_1").toDouble(); 27810447Snilay@cs.wisc.edu 27910447Snilay@cs.wisc.edu leakage_010 += getGenProperties()->get("INV1_LeakagePower_0").toDouble(); 28010447Snilay@cs.wisc.edu leakage_010 += getGenProperties()->get("INV2_LeakagePower_1").toDouble(); 28110447Snilay@cs.wisc.edu leakage_010 += getGenProperties()->get("INVZ1_LeakagePower_100_1").toDouble(); 28210447Snilay@cs.wisc.edu leakage_010 += getGenProperties()->get("INVZ2_LeakagePower_011_1").toDouble(); 28310447Snilay@cs.wisc.edu 28410447Snilay@cs.wisc.edu leakage_011 += getGenProperties()->get("INV1_LeakagePower_1").toDouble(); 28510447Snilay@cs.wisc.edu leakage_011 += getGenProperties()->get("INV2_LeakagePower_0").toDouble(); 28610447Snilay@cs.wisc.edu leakage_011 += getGenProperties()->get("INVZ1_LeakagePower_010_0").toDouble(); 28710447Snilay@cs.wisc.edu leakage_011 += getGenProperties()->get("INVZ2_LeakagePower_101_0").toDouble(); 28810447Snilay@cs.wisc.edu 28910447Snilay@cs.wisc.edu leakage_100 += getGenProperties()->get("INV1_LeakagePower_0").toDouble(); 29010447Snilay@cs.wisc.edu leakage_100 += getGenProperties()->get("INV2_LeakagePower_0").toDouble(); 29110447Snilay@cs.wisc.edu leakage_100 += getGenProperties()->get("INVZ1_LeakagePower_101_0").toDouble(); 29210447Snilay@cs.wisc.edu leakage_100 += getGenProperties()->get("INVZ2_LeakagePower_010_0").toDouble(); 29310447Snilay@cs.wisc.edu 29410447Snilay@cs.wisc.edu leakage_101 += getGenProperties()->get("INV1_LeakagePower_1").toDouble(); 29510447Snilay@cs.wisc.edu leakage_101 += getGenProperties()->get("INV2_LeakagePower_0").toDouble(); 29610447Snilay@cs.wisc.edu leakage_101 += getGenProperties()->get("INVZ1_LeakagePower_011_1").toDouble(); 29710447Snilay@cs.wisc.edu leakage_101 += getGenProperties()->get("INVZ2_LeakagePower_100_1").toDouble(); 29810447Snilay@cs.wisc.edu 29910447Snilay@cs.wisc.edu leakage_110 += getGenProperties()->get("INV1_LeakagePower_1").toDouble(); 30010447Snilay@cs.wisc.edu leakage_110 += getGenProperties()->get("INV2_LeakagePower_1").toDouble(); 30110447Snilay@cs.wisc.edu leakage_110 += getGenProperties()->get("INVZ1_LeakagePower_101_0").toDouble(); 30210447Snilay@cs.wisc.edu leakage_110 += getGenProperties()->get("INVZ2_LeakagePower_011_0").toDouble(); 30310447Snilay@cs.wisc.edu 30410447Snilay@cs.wisc.edu leakage_111 += getGenProperties()->get("INV1_LeakagePower_1").toDouble(); 30510447Snilay@cs.wisc.edu leakage_111 += getGenProperties()->get("INV2_LeakagePower_1").toDouble(); 30610447Snilay@cs.wisc.edu leakage_111 += getGenProperties()->get("INVZ1_LeakagePower_011_0").toDouble(); 30710447Snilay@cs.wisc.edu leakage_111 += getGenProperties()->get("INVZ2_LeakagePower_101_0").toDouble(); 30810447Snilay@cs.wisc.edu 30910447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->!A!B!S0", leakage_000); 31010447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->!A!BS0", leakage_001); 31110447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->!AB!S0", leakage_010); 31210447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->!ABS0", leakage_011); 31310447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->A!B!S0", leakage_100); 31410447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->A!BS0", leakage_101); 31510447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->AB!S0", leakage_110); 31610447Snilay@cs.wisc.edu cache->set(cell_name + "->Leakage->ABS0", leakage_111); 31710447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->!A!B!S0=" + (String) leakage_000); 31810447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->!A!BS0=" + (String) leakage_001); 31910447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->!AB!S0=" + (String) leakage_010); 32010447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->!ABS0=" + (String) leakage_011); 32110447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->A!B!S0=" + (String) leakage_100); 32210447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->A!BS0=" + (String) leakage_101); 32310447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->AB!S0=" + (String) leakage_110); 32410447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Leakage->ABS0=" + (String) leakage_111); 32510447Snilay@cs.wisc.edu 32610447Snilay@cs.wisc.edu // Cache event energy results 32710447Snilay@cs.wisc.edu /* 32810447Snilay@cs.wisc.edu double event_a_flip = 0.0; 32910447Snilay@cs.wisc.edu event_a_flip += getGenProperties()->get("INVZ1_A_Flip").toDouble(); 33010447Snilay@cs.wisc.edu cache->set(cell_name + "->Event_A_Flip", event_a_flip); 33110447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Event_A_Flip=" + (String) event_a_flip); 33210447Snilay@cs.wisc.edu 33310447Snilay@cs.wisc.edu double event_b_flip = 0.0; 33410447Snilay@cs.wisc.edu event_b_flip += getGenProperties()->get("INVZ1_A_Flip").toDouble(); 33510447Snilay@cs.wisc.edu cache->set(cell_name + "->Event_B_Flip", event_b_flip); 33610447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Event_B_Flip=" + (String) event_b_flip); 33710447Snilay@cs.wisc.edu 33810447Snilay@cs.wisc.edu double event_s0_flip = 0.0; 33910447Snilay@cs.wisc.edu event_s0_flip += getGenProperties()->get("INV1_A_Flip").toDouble(); 34010447Snilay@cs.wisc.edu event_s0_flip += getGenProperties()->get("INV1_ZN_Flip").toDouble(); 34110447Snilay@cs.wisc.edu event_s0_flip += getGenProperties()->get("INVZ1_OE_Flip").toDouble() + getGenProperties()->get("INVZ1_OEN_Flip").toDouble(); 34210447Snilay@cs.wisc.edu event_s0_flip += getGenProperties()->get("INVZ2_OE_Flip").toDouble() + getGenProperties()->get("INVZ2_OEN_Flip").toDouble(); 34310447Snilay@cs.wisc.edu cache->set(cell_name + "->Event_S0_Flip", event_s0_flip); 34410447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Event_S0_Flip=" + (String) event_s0_flip); 34510447Snilay@cs.wisc.edu 34610447Snilay@cs.wisc.edu double event_y_flip = 0.0; 34710447Snilay@cs.wisc.edu event_y_flip += getGenProperties()->get("INVZ1_ZN_Flip").toDouble(); 34810447Snilay@cs.wisc.edu event_y_flip += getGenProperties()->get("INVZ2_ZN_Flip").toDouble(); 34910447Snilay@cs.wisc.edu event_y_flip += getGenProperties()->get("INV2_A_Flip").toDouble(); 35010447Snilay@cs.wisc.edu event_y_flip += getGenProperties()->get("INV2_ZN_Flip").toDouble(); 35110447Snilay@cs.wisc.edu cache->set(cell_name + "->Event_Y_Flip", event_y_flip); 35210447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Event_Y_Flip=" + (String) event_y_flip); 35310447Snilay@cs.wisc.edu 35410447Snilay@cs.wisc.edu double a_cap = getLoad("INVZ1_CgA")->getLoadCap(); 35510447Snilay@cs.wisc.edu double b_cap = getLoad("INVZ2_CgA")->getLoadCap(); 35610447Snilay@cs.wisc.edu double s0_cap = getLoad("INV1_CgA")->getLoadCap() + getLoad("INVZ1_CgOEN")->getLoadCap() + getLoad("INVZ2_CgOE")->getLoadCap(); 35710447Snilay@cs.wisc.edu double y_ron = getDriver("INV2_RonZN")->getOutputRes(); 35810447Snilay@cs.wisc.edu */ 35910447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 36010447Snilay@cs.wisc.edu 36110447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 36210447Snilay@cs.wisc.edu // Get Node capacitances 36310447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 36410447Snilay@cs.wisc.edu double a_cap = getNet("A")->getTotalDownstreamCap(); 36510447Snilay@cs.wisc.edu double b_cap = getNet("B")->getTotalDownstreamCap(); 36610447Snilay@cs.wisc.edu double s0_cap = getNet("S0")->getTotalDownstreamCap(); 36710447Snilay@cs.wisc.edu double s0_b_cap = getNet("S0_b")->getTotalDownstreamCap(); 36810447Snilay@cs.wisc.edu double y_b_cap = getNet("Y_b")->getTotalDownstreamCap(); 36910447Snilay@cs.wisc.edu double y_cap = getNet("Y")->getTotalDownstreamCap(); 37010447Snilay@cs.wisc.edu 37110447Snilay@cs.wisc.edu cache->set(cell_name + "->Cap->A", a_cap); 37210447Snilay@cs.wisc.edu cache->set(cell_name + "->Cap->B", b_cap); 37310447Snilay@cs.wisc.edu cache->set(cell_name + "->Cap->S0", s0_cap); 37410447Snilay@cs.wisc.edu cache->set(cell_name + "->Cap->S0_b", s0_b_cap); 37510447Snilay@cs.wisc.edu cache->set(cell_name + "->Cap->Y_b", y_b_cap); 37610447Snilay@cs.wisc.edu cache->set(cell_name + "->Cap->Y", y_cap); 37710447Snilay@cs.wisc.edu 37810447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Cap->A=" + (String) a_cap); 37910447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Cap->B=" + (String) b_cap); 38010447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Cap->S0=" + (String) s0_cap); 38110447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Cap->S0_b=" + (String) s0_b_cap); 38210447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Cap->Y_b=" + (String) y_b_cap); 38310447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Cap->Y=" + (String) y_cap); 38410447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 38510447Snilay@cs.wisc.edu 38610447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 38710447Snilay@cs.wisc.edu // Build Internal Delay Model 38810447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 38910447Snilay@cs.wisc.edu // Build abstracted timing model 39010447Snilay@cs.wisc.edu double y_ron = getDriver("INV2_RonZN")->getOutputRes(); 39110447Snilay@cs.wisc.edu 39210447Snilay@cs.wisc.edu double a_to_y_delay = 0.0; 39310447Snilay@cs.wisc.edu a_to_y_delay += getDriver("INVZ1_RonZN")->calculateDelay(); 39410447Snilay@cs.wisc.edu a_to_y_delay += getDriver("INV2_RonZN")->calculateDelay(); 39510447Snilay@cs.wisc.edu 39610447Snilay@cs.wisc.edu double b_to_y_delay = 0.0; 39710447Snilay@cs.wisc.edu b_to_y_delay += getDriver("INVZ1_RonZN")->calculateDelay(); 39810447Snilay@cs.wisc.edu b_to_y_delay += getDriver("INV2_RonZN")->calculateDelay(); 39910447Snilay@cs.wisc.edu 40010447Snilay@cs.wisc.edu double s0_to_y_delay = 0.0; 40110447Snilay@cs.wisc.edu s0_to_y_delay += getDriver("INV1_RonZN")->calculateDelay(); 40210447Snilay@cs.wisc.edu s0_to_y_delay += max(getDriver("INVZ1_RonZN")->calculateDelay(), getDriver("INVZ1_RonZN")->calculateDelay()); 40310447Snilay@cs.wisc.edu s0_to_y_delay += getDriver("INV2_RonZN")->calculateDelay(); 40410447Snilay@cs.wisc.edu 40510447Snilay@cs.wisc.edu cache->set(cell_name + "->DriveRes->Y", y_ron); 40610447Snilay@cs.wisc.edu cache->set(cell_name + "->Delay->A_to_Y", a_to_y_delay); 40710447Snilay@cs.wisc.edu cache->set(cell_name + "->Delay->B_to_Y", b_to_y_delay); 40810447Snilay@cs.wisc.edu cache->set(cell_name + "->Delay->S0_to_Y", s0_to_y_delay); 40910447Snilay@cs.wisc.edu 41010447Snilay@cs.wisc.edu Log::printLine(cell_name + "->DriveRes->Y=" + (String) y_ron); 41110447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Delay->A_to_Y=" + (String) a_to_y_delay); 41210447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Delay->B_to_Y=" + (String) b_to_y_delay); 41310447Snilay@cs.wisc.edu Log::printLine(cell_name + "->Delay->S0_to_Y=" + (String) s0_to_y_delay); 41410447Snilay@cs.wisc.edu // -------------------------------------------------------------------- 41510447Snilay@cs.wisc.edu 41610447Snilay@cs.wisc.edu return; 41710447Snilay@cs.wisc.edu } 41810447Snilay@cs.wisc.edu 41910447Snilay@cs.wisc.edu} // namespace DSENT 42010447Snilay@cs.wisc.edu 421