LATQ.cc revision 10447
12381SN/A#include "model/std_cells/LATQ.h"
210719SMarco.Balboni@ARM.com
38711SN/A#include <cmath>
48711SN/A
58711SN/A#include "model/PortInfo.h"
68711SN/A#include "model/TransitionInfo.h"
78711SN/A#include "model/EventInfo.h"
88711SN/A#include "model/std_cells/StdCellLib.h"
98711SN/A#include "model/std_cells/CellMacros.h"
108711SN/A#include "model/timing_graph/ElectricalNet.h"
118711SN/A#include "model/timing_graph/ElectricalDriver.h"
128711SN/A#include "model/timing_graph/ElectricalLoad.h"
138711SN/A#include "model/timing_graph/ElectricalDelay.h"
142381SN/A
152381SN/Anamespace DSENT
162381SN/A{
172381SN/A    using std::ceil;
182381SN/A    using std::max;
192381SN/A    using std::min;
202381SN/A
212381SN/A    LATQ::LATQ(const String& instance_name_, const TechModel* tech_model_)
222381SN/A        : StdCell(instance_name_, tech_model_)
232381SN/A    {
242381SN/A        initProperties();
252381SN/A    }
262381SN/A
272381SN/A    LATQ::~LATQ()
282381SN/A    {}
292381SN/A
302381SN/A    void LATQ::initProperties()
312381SN/A    {
322381SN/A        return;
332381SN/A    }
342381SN/A
352381SN/A    void LATQ::constructModel()
362381SN/A    {
372381SN/A        // All constructModel should do is create Area/NDDPower/Energy Results as
382381SN/A        // well as instantiate any sub-instances using only the hard parameters
392665SN/A
402665SN/A        createInputPort("D");
412772SN/A        createInputPort("G");
428715SN/A        createOutputPort("Q");
438922SN/A
442381SN/A        createLoad("D_Cap");
452381SN/A        createLoad("G_Cap");
462381SN/A        createDelay("D_to_Q_delay");
472982SN/A        createDelay("G_to_Q_delay");
4810405Sandreas.hansson@arm.com        createDriver("Q_Ron", true);
492381SN/A
502381SN/A        ElectricalLoad* d_cap = getLoad("D_Cap");
5110405Sandreas.hansson@arm.com        ElectricalLoad* g_cap = getLoad("G_Cap");
5210405Sandreas.hansson@arm.com        ElectricalDelay* d_to_q_delay = getDelay("D_to_Q_delay");
532381SN/A        ElectricalDelay* g_to_q_delay = getDelay("G_to_Q_delay");
5410402SN/A        ElectricalDriver* q_ron = getDriver("Q_Ron");
5510405Sandreas.hansson@arm.com
5610405Sandreas.hansson@arm.com        getNet("D")->addDownstreamNode(d_cap);
572381SN/A        getNet("G")->addDownstreamNode(g_cap);
589036SN/A        d_cap->addDownstreamNode(d_to_q_delay);
5910405Sandreas.hansson@arm.com        g_cap->addDownstreamNode(g_to_q_delay);
6010405Sandreas.hansson@arm.com        g_to_q_delay->addDownstreamNode(q_ron);
6110405Sandreas.hansson@arm.com        q_ron->addDownstreamNode(getNet("Q"));
6210405Sandreas.hansson@arm.com
639036SN/A        // Create Area result
6410405Sandreas.hansson@arm.com        // Create NDD Power result
6510405Sandreas.hansson@arm.com        createElectricalAtomicResults();
6610405Sandreas.hansson@arm.com        // Create G Event Energy Result
6710405Sandreas.hansson@arm.com        createElectricalEventAtomicResult("G");
689036SN/A        // Create DFF Event Energy Result
6910405Sandreas.hansson@arm.com        createElectricalEventAtomicResult("LATD");
702381SN/A        createElectricalEventAtomicResult("LATQ");
719031SN/A        // Create Idle event for leakage
729036SN/A        // G pin is assumed to be on all the time
739036SN/A        //createElectricalEventAtomicResult("Idle");
748922SN/A        getEventInfo("Idle")->setStaticTransitionInfos();
7510405Sandreas.hansson@arm.com        return;
7610405Sandreas.hansson@arm.com    }
779092SN/A
789715SN/A    void LATQ::updateModel()
799715SN/A    {
8010713Sandreas.hansson@arm.com        // Get parameters
819092SN/A        double drive_strength = getDrivingStrength();
829092SN/A        Map<double>* cache = getTechModel()->getStdCellLib()->getStdCellCache();
8310405Sandreas.hansson@arm.com
8410405Sandreas.hansson@arm.com        // Standard cell cache string
8510405Sandreas.hansson@arm.com        String cell_name = "LATQ_X" + (String) drive_strength;
868922SN/A
8710888Sandreas.hansson@arm.com        // Get timing parameters
882381SN/A        getLoad("D_Cap")->setLoadCap(cache->get(cell_name + "->Cap->D"));
899036SN/A        getLoad("G_Cap")->setLoadCap(cache->get(cell_name + "->Cap->G"));
908922SN/A        getDriver("Q_Ron")->setOutputRes(cache->get(cell_name + "->DriveRes->Q"));
919036SN/A        getDelay("G_to_Q_delay")->setDelay(cache->get(cell_name + "->Delay->G_to_Q"));
9210405Sandreas.hansson@arm.com        getDelay("D_to_Q_delay")->setDelay(cache->get(cell_name + "->Delay->D_to_Q"));
9310405Sandreas.hansson@arm.com
942381SN/A        // Set the cell area
9510888Sandreas.hansson@arm.com        getAreaResult("Active")->setValue(cache->get(cell_name + "->Area->Active"));
9610888Sandreas.hansson@arm.com        getAreaResult("Metal1Wire")->setValue(cache->get(cell_name + "->Area->Metal1Wire"));
9710888Sandreas.hansson@arm.com
982381SN/A        return;
992381SN/A    }
10010405Sandreas.hansson@arm.com
10110405Sandreas.hansson@arm.com    void LATQ::evaluateModel()
10210888Sandreas.hansson@arm.com    {
10310888Sandreas.hansson@arm.com        return;
1048922SN/A    }
1058922SN/A
1068922SN/A    void LATQ::useModel()
1078922SN/A    {
1088948SN/A        // Get parameters
10910405Sandreas.hansson@arm.com        double drive_strength = getDrivingStrength();
1108948SN/A        Map<double>* cache = getTechModel()->getStdCellLib()->getStdCellCache();
1118975SN/A
11210405Sandreas.hansson@arm.com        // Standard cell cache string
1138922SN/A        String cell_name = "LATQ_X" + (String) drive_strength;
1148948SN/A
11510405Sandreas.hansson@arm.com        // Propagate the transition info and get P_D, P_M, and P_Q
1168948SN/A        propagateTransitionInfo();
1178975SN/A        double P_D = getInputPort("D")->getTransitionInfo().getProbability1();
11810405Sandreas.hansson@arm.com        double P_G = getInputPort("G")->getTransitionInfo().getProbability1();
1198948SN/A        double P_Q = getOutputPort("Q")->getTransitionInfo().getProbability1();
1208948SN/A        double G_num_trans_01 = getInputPort("G")->getTransitionInfo().getNumberTransitions01();
12110405Sandreas.hansson@arm.com        double D_num_trans_01 = getInputPort("D")->getTransitionInfo().getNumberTransitions01();
1228948SN/A        double Q_num_trans_01 = getOutputPort("Q")->getTransitionInfo().getNumberTransitions01();
1238922SN/A
12410405Sandreas.hansson@arm.com        // Calculate leakage
1258922SN/A        double leakage = 0;
1268948SN/A        leakage += cache->get(cell_name + "->Leakage->!D!G!Q") * (1 - P_D) * (1 - P_G) * (1 - P_Q);
12710405Sandreas.hansson@arm.com        leakage += cache->get(cell_name + "->Leakage->!D!GQ") * (1 - P_D) * (1 - P_G) * P_Q;
1288948SN/A        leakage += cache->get(cell_name + "->Leakage->!DG!Q") * (1 - P_D) * P_G * (1 - P_Q);
1298922SN/A        leakage += cache->get(cell_name + "->Leakage->D!G!Q") * P_D * (1 - P_G) * (1 - P_Q);
13010405Sandreas.hansson@arm.com        leakage += cache->get(cell_name + "->Leakage->D!GQ") * P_D * (1 - P_G) * P_Q;
1318922SN/A        leakage += cache->get(cell_name + "->Leakage->DGQ") * P_D * P_G * P_Q;
1328948SN/A        getNddPowerResult("Leakage")->setValue(leakage);
13310405Sandreas.hansson@arm.com
1349036SN/A        // Get VDD
1359090SN/A        double vdd = getTechModel()->get("Vdd");
13610405Sandreas.hansson@arm.com
1379036SN/A        // Get capacitances
1389036SN/A        double g_b_cap = cache->get(cell_name + "->Cap->G_b");
1399036SN/A        double d_b_cap = cache->get(cell_name + "->Cap->D_b");
1409036SN/A        double q_i_cap = cache->get(cell_name + "->Cap->Q_i");
14110405Sandreas.hansson@arm.com        double q_b_cap = cache->get(cell_name + "->Cap->Q_b");
1429036SN/A        double q_cap = cache->get(cell_name + "->Cap->Q");
14310405Sandreas.hansson@arm.com        double q_load_cap = getNet("Q")->getTotalDownstreamCap();
1449036SN/A
14510405Sandreas.hansson@arm.com        // Calculate G Event energy
1469036SN/A        double g_event_energy = 0.0;
1479036SN/A        g_event_energy += (g_b_cap) * G_num_trans_01;
14810405Sandreas.hansson@arm.com        g_event_energy *= vdd * vdd;
14910405Sandreas.hansson@arm.com        getEventResult("G")->setValue(g_event_energy);
1509036SN/A        // Calculate LATD Event energy
1519036SN/A        double latd_event_energy = 0.0;
1529036SN/A        latd_event_energy += (d_b_cap) * D_num_trans_01;
15310405Sandreas.hansson@arm.com        latd_event_energy *= vdd * vdd;
15410405Sandreas.hansson@arm.com        getEventResult("LATD")->setValue(latd_event_energy);
15510405Sandreas.hansson@arm.com        // Calculate LATQ Event energy
1569036SN/A        double latq_event_energy = 0.0;
1579036SN/A        latq_event_energy += (q_i_cap + q_b_cap + q_cap + q_load_cap) * Q_num_trans_01;
1589036SN/A        latq_event_energy *= vdd * vdd;
1599036SN/A        getEventResult("LATQ")->setValue(latq_event_energy);
1609036SN/A
1619036SN/A        return;
16210405Sandreas.hansson@arm.com    }
1639036SN/A
1649036SN/A    void LATQ::propagateTransitionInfo()
1659036SN/A    {
1669036SN/A        const TransitionInfo& trans_G = getInputPort("G")->getTransitionInfo();
1679036SN/A        const TransitionInfo& trans_D = getInputPort("D")->getTransitionInfo();
1689036SN/A
1699036SN/A        double G_num_trans_01 = trans_G.getNumberTransitions01();
17010405Sandreas.hansson@arm.com        double G_num_trans_10 = G_num_trans_01;
1719036SN/A        double G_num_trans_00 = trans_G.getNumberTransitions00();
1729036SN/A        double D_freq_mult = trans_D.getFrequencyMultiplier();
17310405Sandreas.hansson@arm.com
1749036SN/A        // If the latch is sampling just as fast or faster than input data signal
1759036SN/A        // Then it can capture all transitions (though it should be normalized to clock)
17610405Sandreas.hansson@arm.com        if((G_num_trans_10 + G_num_trans_00) >= D_freq_mult)
1779036SN/A        {
1789036SN/A            const TransitionInfo& trans_Q = trans_D.scaleFrequencyMultiplier(G_num_trans_10 + G_num_trans_00);
17910405Sandreas.hansson@arm.com            getOutputPort("Q")->setTransitionInfo(trans_Q);
1809036SN/A        }
1819036SN/A        // If the latch is sampling slower than the input data signal, then input
18210405Sandreas.hansson@arm.com        // will look like they transition more
1839036SN/A        else
1849036SN/A        {
18510405Sandreas.hansson@arm.com            // Calculate scale ratio
1869036SN/A            double scale_ratio = (G_num_trans_10 + G_num_trans_00) / D_freq_mult;
1879036SN/A            // 00 and 11 transitions become fewer
18810405Sandreas.hansson@arm.com            double D_scaled_diff = 0.5 * (1 - scale_ratio) * (trans_D.getNumberTransitions00() + trans_D.getNumberTransitions11());
1899036SN/A            double D_scaled_num_trans_00 = trans_D.getNumberTransitions00() * scale_ratio;
1909036SN/A            double D_scaled_num_trans_11 = trans_D.getNumberTransitions11() * scale_ratio;
19110405Sandreas.hansson@arm.com            // 01 and 10 transitions become more frequent
1929036SN/A            double D_scaled_num_trans_10 = trans_D.getNumberTransitions01() + D_scaled_diff;
1939036SN/A
19410405Sandreas.hansson@arm.com            // Create final transition info, remembering to apply scaling ratio to normalize to G
1959036SN/A            const TransitionInfo trans_Q(   D_scaled_num_trans_00 * scale_ratio,
19610405Sandreas.hansson@arm.com                                            D_scaled_num_trans_10 * scale_ratio,
1979036SN/A                                            D_scaled_num_trans_11 * scale_ratio);
1989036SN/A            getOutputPort("Q")->setTransitionInfo(trans_Q);
19910405Sandreas.hansson@arm.com        }
20010713Sandreas.hansson@arm.com
20110713Sandreas.hansson@arm.com        return;
2028922SN/A    }
2038922SN/A
2048922SN/A    // Creates the standard cell, characterizes and abstracts away the details
2059716SN/A    void LATQ::cacheStdCell(StdCellLib* cell_lib_, double drive_strength_)
2069716SN/A    {
2079716SN/A        // Get parameters
2089716SN/A        double gate_pitch = cell_lib_->getTechModel()->get("Gate->PitchContacted");
2099716SN/A        Map<double>* cache = cell_lib_->getStdCellCache();
2109716SN/A
2119716SN/A        // Standard cell cache string
2129716SN/A        String cell_name = "LATQ_X" + (String) drive_strength_;
2139716SN/A
2149716SN/A        Log::printLine("=== " + cell_name + " ===");
2159716SN/A
21610888Sandreas.hansson@arm.com
2179716SN/A        // Now actually build the full standard cell model
2189716SN/A        createInputPort("D");
2199716SN/A        createInputPort("G");
2209716SN/A        createOutputPort("Q");
2219716SN/A
2229716SN/A        createNet("D_b");
22310888Sandreas.hansson@arm.com        createNet("Q_i");
22410405Sandreas.hansson@arm.com        createNet("Q_b");
2259778SN/A        createNet("G_b");
2269716SN/A
2279716SN/A        // Adds macros
2289716SN/A        CellMacros::addInverter(this, "INV1", false, true, "D", "D_b");
2299716SN/A        CellMacros::addInverter(this, "INV2", false, true, "Q_i", "Q_b");
2309716SN/A        CellMacros::addInverter(this, "INV3", false, true, "Q_b", "Q");
23110713Sandreas.hansson@arm.com        CellMacros::addInverter(this, "INV4", false, true, "G", "G_b");
23210713Sandreas.hansson@arm.com        CellMacros::addTristate(this, "INVZ1", false, true, false, false, "D_b", "G", "G_b", "Q_i");        //trace timing through A->ZN path only
23310713Sandreas.hansson@arm.com        CellMacros::addTristate(this, "INVZ2", false, false, false, false, "Q_b", "G_b", "G", "Q_i");       //don't trace timing through the feedback path
2349716SN/A
2359716SN/A        // Update macros
2369716SN/A        CellMacros::updateInverter(this, "INV1", drive_strength_ * 0.125);
2379716SN/A        CellMacros::updateInverter(this, "INV2", drive_strength_ * 0.5);
2389716SN/A        CellMacros::updateInverter(this, "INV3", drive_strength_ * 1.0);
23910713Sandreas.hansson@arm.com        CellMacros::updateInverter(this, "INV4", drive_strength_ * 0.125);
2409716SN/A        CellMacros::updateTristate(this, "INVZ1", drive_strength_ * 0.5);
2419716SN/A        CellMacros::updateTristate(this, "INVZ2", drive_strength_ * 0.0625);
2429716SN/A
2439716SN/A        // Cache area result
2449716SN/A        double area = 0.0;
2459716SN/A        area += gate_pitch * getTotalHeight() * 1;
2469716SN/A        area += gate_pitch * getTotalHeight() * getGenProperties()->get("INV1_GatePitches").toDouble();
2479716SN/A        area += gate_pitch * getTotalHeight() * getGenProperties()->get("INV2_GatePitches").toDouble();
2489716SN/A        area += gate_pitch * getTotalHeight() * getGenProperties()->get("INV3_GatePitches").toDouble();
2499716SN/A        area += gate_pitch * getTotalHeight() * getGenProperties()->get("INV4_GatePitches").toDouble();
2509716SN/A        area += gate_pitch * getTotalHeight() * getGenProperties()->get("INVZ1_GatePitches").toDouble();
2519716SN/A        area += gate_pitch * getTotalHeight() * getGenProperties()->get("INVZ2_GatePitches").toDouble();
2529716SN/A        cache->set(cell_name + "->Area->Active", area);
2539716SN/A        cache->set(cell_name + "->Area->Metal1Wire", area);     //Cover-block m1 area
25410888Sandreas.hansson@arm.com        Log::printLine(cell_name + "->Area->Active=" + (String) area);
2554475SN/A        Log::printLine(cell_name + "->Area->Metal1Wire=" + (String) area);
2568948SN/A
25710656Sandreas.hansson@arm.com        // --------------------------------------------------------------------
25810656Sandreas.hansson@arm.com        // Leakage Model Calculation
25910656Sandreas.hansson@arm.com        // --------------------------------------------------------------------
2608948SN/A        // Cache leakage power results (for every single signal combination)
26110656Sandreas.hansson@arm.com        double leakage_000 = 0;         //!D, !G, !Q
2628948SN/A        double leakage_001 = 0;         //!D, !G, Q
2639524SN/A        double leakage_010 = 0;         //!D, G, !Q
2649524SN/A        double leakage_100 = 0;         //D, !G, !Q
2659524SN/A        double leakage_101 = 0;         //D, !G, Q
2669524SN/A        double leakage_111 = 0;         //D, G, Q
2679524SN/A
2689524SN/A        //This is so painful...
26910402SN/A        leakage_000 += getGenProperties()->get("INV1_LeakagePower_0").toDouble();
27010402SN/A        leakage_000 += getGenProperties()->get("INV2_LeakagePower_0").toDouble();
27110402SN/A        leakage_000 += getGenProperties()->get("INV3_LeakagePower_1").toDouble();
27210402SN/A        leakage_000 += getGenProperties()->get("INV4_LeakagePower_0").toDouble();
27310719SMarco.Balboni@ARM.com        leakage_000 += getGenProperties()->get("INVZ1_LeakagePower_011_0").toDouble();
27410719SMarco.Balboni@ARM.com        leakage_000 += getGenProperties()->get("INVZ2_LeakagePower_101_0").toDouble();
27510719SMarco.Balboni@ARM.com
27610883Sali.jafri@arm.com        leakage_001 += getGenProperties()->get("INV1_LeakagePower_0").toDouble();
27710883Sali.jafri@arm.com        leakage_001 += getGenProperties()->get("INV2_LeakagePower_0").toDouble();
27810883Sali.jafri@arm.com        leakage_001 += getGenProperties()->get("INV3_LeakagePower_0").toDouble();
27910883Sali.jafri@arm.com        leakage_001 += getGenProperties()->get("INV4_LeakagePower_0").toDouble();
28010883Sali.jafri@arm.com        leakage_001 += getGenProperties()->get("INVZ1_LeakagePower_011_1").toDouble();
28110883Sali.jafri@arm.com        leakage_001 += getGenProperties()->get("INVZ2_LeakagePower_100_1").toDouble();
28210883Sali.jafri@arm.com
28310405Sandreas.hansson@arm.com        leakage_010 += getGenProperties()->get("INV1_LeakagePower_0").toDouble();
2848975SN/A        leakage_010 += getGenProperties()->get("INV2_LeakagePower_0").toDouble();
2859945SN/A        leakage_010 += getGenProperties()->get("INV3_LeakagePower_1").toDouble();
2868975SN/A        leakage_010 += getGenProperties()->get("INV4_LeakagePower_1").toDouble();
28710405Sandreas.hansson@arm.com        leakage_010 += getGenProperties()->get("INVZ1_LeakagePower_101_0").toDouble();
2888975SN/A        leakage_010 += getGenProperties()->get("INVZ2_LeakagePower_011_0").toDouble();
2899945SN/A
2904475SN/A        leakage_100 += getGenProperties()->get("INV1_LeakagePower_1").toDouble();
29110405Sandreas.hansson@arm.com        leakage_100 += getGenProperties()->get("INV2_LeakagePower_1").toDouble();
2928975SN/A        leakage_100 += getGenProperties()->get("INV3_LeakagePower_1").toDouble();
2939945SN/A        leakage_100 += getGenProperties()->get("INV4_LeakagePower_0").toDouble();
2948975SN/A        leakage_100 += getGenProperties()->get("INVZ1_LeakagePower_010_0").toDouble();
29510405Sandreas.hansson@arm.com        leakage_100 += getGenProperties()->get("INVZ2_LeakagePower_101_0").toDouble();
2968975SN/A
2979945SN/A        leakage_101 += getGenProperties()->get("INV1_LeakagePower_1").toDouble();
2988948SN/A        leakage_101 += getGenProperties()->get("INV2_LeakagePower_1").toDouble();
2999092SN/A        leakage_101 += getGenProperties()->get("INV3_LeakagePower_0").toDouble();
3009092SN/A        leakage_101 += getGenProperties()->get("INV4_LeakagePower_0").toDouble();
30110713Sandreas.hansson@arm.com        leakage_101 += getGenProperties()->get("INVZ1_LeakagePower_010_1").toDouble();
3029092SN/A        leakage_101 += getGenProperties()->get("INVZ2_LeakagePower_100_1").toDouble();
3038948SN/A
3048948SN/A        leakage_111 += getGenProperties()->get("INV1_LeakagePower_1").toDouble();
3058948SN/A        leakage_111 += getGenProperties()->get("INV2_LeakagePower_1").toDouble();
3068948SN/A        leakage_111 += getGenProperties()->get("INV3_LeakagePower_0").toDouble();
3078948SN/A        leakage_111 += getGenProperties()->get("INV4_LeakagePower_1").toDouble();
3088948SN/A        leakage_111 += getGenProperties()->get("INVZ1_LeakagePower_100_1").toDouble();
3098948SN/A        leakage_111 += getGenProperties()->get("INVZ2_LeakagePower_010_1").toDouble();
3108948SN/A
31110402SN/A        cache->set(cell_name + "->Leakage->!D!G!Q", leakage_000);
31210402SN/A        cache->set(cell_name + "->Leakage->!D!GQ", leakage_001);
31310402SN/A        cache->set(cell_name + "->Leakage->!DG!Q", leakage_010);
31410402SN/A        cache->set(cell_name + "->Leakage->D!G!Q", leakage_100);
31510402SN/A        cache->set(cell_name + "->Leakage->D!GQ", leakage_101);
31610402SN/A        cache->set(cell_name + "->Leakage->DGQ", leakage_111);
31710402SN/A        Log::printLine(cell_name + "->Leakage->!D!G!Q=" + (String) leakage_000);
31810402SN/A        Log::printLine(cell_name + "->Leakage->!D!GQ=" + (String) leakage_001);
31910402SN/A        Log::printLine(cell_name + "->Leakage->!DG!Q=" + (String) leakage_010);
32010402SN/A        Log::printLine(cell_name + "->Leakage->D!G!Q=" + (String) leakage_100);
32110402SN/A        Log::printLine(cell_name + "->Leakage->D!GQ=" + (String) leakage_101);
32210402SN/A        Log::printLine(cell_name + "->Leakage->DGQ=" + (String) leakage_111);
32310402SN/A        // --------------------------------------------------------------------
32410402SN/A
32510888Sandreas.hansson@arm.com        // --------------------------------------------------------------------
3268948SN/A        // Get Node Capacitances
32710405Sandreas.hansson@arm.com        // --------------------------------------------------------------------
3284475SN/A        double d_cap = getNet("D")->getTotalDownstreamCap();
3299032SN/A        double d_b_cap = getNet("D_b")->getTotalDownstreamCap();
3304475SN/A        double q_i_cap = getNet("Q_i")->getTotalDownstreamCap();
33110405Sandreas.hansson@arm.com        double q_b_cap = getNet("Q_b")->getTotalDownstreamCap();
3328948SN/A        double q_cap = getNet("Q")->getTotalDownstreamCap();
3339032SN/A        double g_cap = getNet("G")->getTotalDownstreamCap();
3348948SN/A        double g_b_cap = getNet("G_b")->getTotalDownstreamCap();
3358948SN/A
3368948SN/A        cache->set(cell_name + "->Cap->D", d_cap);
3378948SN/A        cache->set(cell_name + "->Cap->D_b", d_b_cap);
3388948SN/A        cache->set(cell_name + "->Cap->Q_i", q_i_cap);
3398948SN/A        cache->set(cell_name + "->Cap->Q_b", q_b_cap);
3408948SN/A        cache->set(cell_name + "->Cap->Q", q_cap);
3418948SN/A        cache->set(cell_name + "->Cap->G", g_cap);
3428948SN/A        cache->set(cell_name + "->Cap->G_b", g_b_cap);
3438948SN/A
3448948SN/A        Log::printLine(cell_name + "->Cap->D=" + (String) d_cap);
3458948SN/A        Log::printLine(cell_name + "->Cap->D_b=" + (String) d_b_cap);
34610402SN/A        Log::printLine(cell_name + "->Cap->Q_i=" + (String) q_i_cap);
34710402SN/A        Log::printLine(cell_name + "->Cap->Q_b=" + (String) q_b_cap);
34810888Sandreas.hansson@arm.com        Log::printLine(cell_name + "->Cap->Q=" + (String) q_cap);
34910888Sandreas.hansson@arm.com        Log::printLine(cell_name + "->Cap->G=" + (String) g_cap);
35010402SN/A        Log::printLine(cell_name + "->Cap->G_b=" + (String) g_b_cap);
35110402SN/A        // --------------------------------------------------------------------
35210402SN/A
35310402SN/A        // --------------------------------------------------------------------
35410402SN/A        // Build Internal Delay Model
35510402SN/A        // --------------------------------------------------------------------
35610402SN/A        double q_ron = getDriver("INV3_RonZN")->getOutputRes();
35710402SN/A
35810402SN/A        double d_to_q_delay = getDriver("INV1_RonZN")->calculateDelay() +
35910402SN/A                                getDriver("INVZ1_RonZN")->calculateDelay() +
36010402SN/A                                getDriver("INV2_RonZN")->calculateDelay() +
36110402SN/A                                getDriver("INV3_RonZN")->calculateDelay();
36210402SN/A        double g_to_q_delay = getDriver("INV4_RonZN")->calculateDelay() +
36310402SN/A                                getDriver("INVZ1_RonZN")->calculateDelay() +
36410402SN/A                                getDriver("INV2_RonZN")->calculateDelay() +
36510402SN/A                                getDriver("INV3_RonZN")->calculateDelay();
36610402SN/A
36710888Sandreas.hansson@arm.com        cache->set(cell_name + "->DriveRes->Q", q_ron);
36810888Sandreas.hansson@arm.com        cache->set(cell_name + "->Delay->D_to_Q", d_to_q_delay);
3698948SN/A        cache->set(cell_name + "->Delay->G_to_Q", g_to_q_delay);
37010405Sandreas.hansson@arm.com        Log::printLine(cell_name + "->DriveRes->Q=" + (String) q_ron);
3714475SN/A        Log::printLine(cell_name + "->Delay->D_to_Q=" + (String) d_to_q_delay);
3729032SN/A        Log::printLine(cell_name + "->Delay->G_to_Q=" + (String) g_to_q_delay);
3734475SN/A
37410405Sandreas.hansson@arm.com        return;
3758948SN/A        // --------------------------------------------------------------------
3769032SN/A
3778948SN/A    }
3788948SN/A
3798948SN/A} // namespace DSENT
3808948SN/A
3818948SN/A