wire.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 "wire.h"
3310152Satgutier@umich.edu#include "cmath"
3410152Satgutier@umich.edu// use this constructor to calculate wire stats
3510152Satgutier@umich.eduWire::Wire(
3610152Satgutier@umich.edu    enum Wire_type wire_model,
3710152Satgutier@umich.edu    double wl,
3810152Satgutier@umich.edu    int n,
3910152Satgutier@umich.edu    double w_s,
4010152Satgutier@umich.edu    double s_s,
4110152Satgutier@umich.edu    enum Wire_placement wp,
4210152Satgutier@umich.edu    double resistivity,
4310152Satgutier@umich.edu    TechnologyParameter::DeviceType *dt
4410152Satgutier@umich.edu    ):wt(wire_model), wire_length(wl*1e-6), nsense(n), w_scale(w_s), s_scale(s_s),
4510152Satgutier@umich.edu    resistivity(resistivity), deviceType(dt)
4610152Satgutier@umich.edu{
4710152Satgutier@umich.edu  wire_placement = wp;
4810152Satgutier@umich.edu  min_w_pmos     = deviceType->n_to_p_eff_curr_drv_ratio*g_tp.min_w_nmos_;
4910152Satgutier@umich.edu  in_rise_time   = 0;
5010152Satgutier@umich.edu  out_rise_time  = 0;
5110152Satgutier@umich.edu  if (initialized != 1) {
5210152Satgutier@umich.edu    cout << "Wire not initialized. Initializing it with default values\n";
5310152Satgutier@umich.edu    Wire winit;
5410152Satgutier@umich.edu  }
5510152Satgutier@umich.edu  calculate_wire_stats();
5610152Satgutier@umich.edu  // change everything back to seconds, microns, and Joules
5710152Satgutier@umich.edu  repeater_spacing *= 1e6;
5810152Satgutier@umich.edu  wire_length      *= 1e6;
5910152Satgutier@umich.edu  wire_width       *= 1e6;
6010152Satgutier@umich.edu  wire_spacing     *= 1e6;
6110152Satgutier@umich.edu  assert(wire_length > 0);
6210152Satgutier@umich.edu  assert(power.readOp.dynamic > 0);
6310152Satgutier@umich.edu  assert(power.readOp.leakage > 0);
6410152Satgutier@umich.edu  assert(power.readOp.gate_leakage > 0);
6510152Satgutier@umich.edu}
6610152Satgutier@umich.edu
6710152Satgutier@umich.edu    // the following values are for peripheral global technology
6810152Satgutier@umich.edu    // specified in the input config file
6910152Satgutier@umich.edu    Component Wire::global;
7010152Satgutier@umich.edu    Component Wire::global_5;
7110152Satgutier@umich.edu    Component Wire::global_10;
7210152Satgutier@umich.edu    Component Wire::global_20;
7310152Satgutier@umich.edu    Component Wire::global_30;
7410152Satgutier@umich.edu    Component Wire::low_swing;
7510152Satgutier@umich.edu
7610152Satgutier@umich.edu    int Wire::initialized;
7710152Satgutier@umich.edu    double Wire::wire_width_init;
7810152Satgutier@umich.edu    double Wire::wire_spacing_init;
7910152Satgutier@umich.edu
8010152Satgutier@umich.edu
8110152Satgutier@umich.eduWire::Wire(double w_s, double s_s, enum Wire_placement wp, double resis, TechnologyParameter::DeviceType *dt)
8210152Satgutier@umich.edu{
8310152Satgutier@umich.edu  w_scale        = w_s;
8410152Satgutier@umich.edu  s_scale        = s_s;
8510152Satgutier@umich.edu  deviceType     = dt;
8610152Satgutier@umich.edu  wire_placement = wp;
8710152Satgutier@umich.edu  resistivity    = resis;
8810152Satgutier@umich.edu  min_w_pmos     = deviceType->n_to_p_eff_curr_drv_ratio * g_tp.min_w_nmos_;
8910152Satgutier@umich.edu  in_rise_time   = 0;
9010152Satgutier@umich.edu  out_rise_time  = 0;
9110152Satgutier@umich.edu
9210152Satgutier@umich.edu  switch (wire_placement)
9310152Satgutier@umich.edu  {
9410152Satgutier@umich.edu    case outside_mat: wire_width = g_tp.wire_outside_mat.pitch; break;
9510152Satgutier@umich.edu    case inside_mat : wire_width = g_tp.wire_inside_mat.pitch;  break;
9610152Satgutier@umich.edu    default:          wire_width = g_tp.wire_local.pitch; break;
9710152Satgutier@umich.edu  }
9810152Satgutier@umich.edu
9910152Satgutier@umich.edu  wire_spacing = wire_width;
10010152Satgutier@umich.edu
10110152Satgutier@umich.edu  wire_width   *= (w_scale * 1e-6/2) /* (m) */;
10210152Satgutier@umich.edu  wire_spacing *= (s_scale * 1e-6/2) /* (m) */;
10310152Satgutier@umich.edu
10410152Satgutier@umich.edu  initialized = 1;
10510152Satgutier@umich.edu  init_wire();
10610152Satgutier@umich.edu  wire_width_init = wire_width;
10710152Satgutier@umich.edu  wire_spacing_init = wire_spacing;
10810152Satgutier@umich.edu
10910152Satgutier@umich.edu  assert(power.readOp.dynamic > 0);
11010152Satgutier@umich.edu  assert(power.readOp.leakage > 0);
11110152Satgutier@umich.edu  assert(power.readOp.gate_leakage > 0);
11210152Satgutier@umich.edu}
11310152Satgutier@umich.edu
11410152Satgutier@umich.edu
11510152Satgutier@umich.edu
11610152Satgutier@umich.eduWire::~Wire()
11710152Satgutier@umich.edu{
11810152Satgutier@umich.edu}
11910152Satgutier@umich.edu
12010152Satgutier@umich.edu
12110152Satgutier@umich.edu
12210152Satgutier@umich.eduvoid
12310152Satgutier@umich.eduWire::calculate_wire_stats()
12410152Satgutier@umich.edu{
12510152Satgutier@umich.edu
12610152Satgutier@umich.edu  if (wire_placement == outside_mat) {
12710152Satgutier@umich.edu    wire_width = g_tp.wire_outside_mat.pitch;
12810152Satgutier@umich.edu  }
12910152Satgutier@umich.edu  else if (wire_placement == inside_mat) {
13010152Satgutier@umich.edu    wire_width = g_tp.wire_inside_mat.pitch;
13110152Satgutier@umich.edu  }
13210152Satgutier@umich.edu  else {
13310152Satgutier@umich.edu    wire_width = g_tp.wire_local.pitch;
13410152Satgutier@umich.edu  }
13510152Satgutier@umich.edu
13610152Satgutier@umich.edu  wire_spacing = wire_width;
13710152Satgutier@umich.edu
13810152Satgutier@umich.edu  wire_width   *= (w_scale * 1e-6/2) /* (m) */;
13910152Satgutier@umich.edu  wire_spacing *= (s_scale * 1e-6/2) /* (m) */;
14010152Satgutier@umich.edu
14110152Satgutier@umich.edu
14210152Satgutier@umich.edu  if (wt != Low_swing) {
14310152Satgutier@umich.edu
14410152Satgutier@umich.edu          //    delay_optimal_wire();
14510152Satgutier@umich.edu
14610152Satgutier@umich.edu          if (wt == Global) {
14710152Satgutier@umich.edu                  delay = global.delay * wire_length;
14810152Satgutier@umich.edu                  power.readOp.dynamic = global.power.readOp.dynamic * wire_length;
14910152Satgutier@umich.edu                  power.readOp.leakage = global.power.readOp.leakage * wire_length;
15010152Satgutier@umich.edu                  power.readOp.gate_leakage = global.power.readOp.gate_leakage * wire_length;
15110152Satgutier@umich.edu                  repeater_spacing = global.area.w;
15210152Satgutier@umich.edu                  repeater_size = global.area.h;
15310152Satgutier@umich.edu                  area.set_area((wire_length/repeater_spacing) *
15410152Satgutier@umich.edu                                  compute_gate_area(INV, 1, min_w_pmos * repeater_size,
15510152Satgutier@umich.edu                                                  g_tp.min_w_nmos_ * repeater_size, g_tp.cell_h_def));
15610152Satgutier@umich.edu          }
15710152Satgutier@umich.edu          else if (wt == Global_5) {
15810152Satgutier@umich.edu                  delay = global_5.delay * wire_length;
15910152Satgutier@umich.edu                  power.readOp.dynamic = global_5.power.readOp.dynamic * wire_length;
16010152Satgutier@umich.edu                  power.readOp.leakage = global_5.power.readOp.leakage * wire_length;
16110152Satgutier@umich.edu                  power.readOp.gate_leakage = global_5.power.readOp.gate_leakage * wire_length;
16210152Satgutier@umich.edu                  repeater_spacing = global_5.area.w;
16310152Satgutier@umich.edu                  repeater_size = global_5.area.h;
16410152Satgutier@umich.edu                  area.set_area((wire_length/repeater_spacing) *
16510152Satgutier@umich.edu                                  compute_gate_area(INV, 1, min_w_pmos * repeater_size,
16610152Satgutier@umich.edu                                                  g_tp.min_w_nmos_ * repeater_size, g_tp.cell_h_def));
16710152Satgutier@umich.edu          }
16810152Satgutier@umich.edu          else if (wt == Global_10) {
16910152Satgutier@umich.edu                  delay = global_10.delay * wire_length;
17010152Satgutier@umich.edu                  power.readOp.dynamic = global_10.power.readOp.dynamic * wire_length;
17110152Satgutier@umich.edu                  power.readOp.leakage = global_10.power.readOp.leakage * wire_length;
17210152Satgutier@umich.edu                  power.readOp.gate_leakage = global_10.power.readOp.gate_leakage * wire_length;
17310152Satgutier@umich.edu                  repeater_spacing = global_10.area.w;
17410152Satgutier@umich.edu                  repeater_size = global_10.area.h;
17510152Satgutier@umich.edu                  area.set_area((wire_length/repeater_spacing) *
17610152Satgutier@umich.edu                                  compute_gate_area(INV, 1, min_w_pmos * repeater_size,
17710152Satgutier@umich.edu                                                  g_tp.min_w_nmos_ * repeater_size, g_tp.cell_h_def));
17810152Satgutier@umich.edu          }
17910152Satgutier@umich.edu          else if (wt == Global_20) {
18010152Satgutier@umich.edu                  delay = global_20.delay * wire_length;
18110152Satgutier@umich.edu                  power.readOp.dynamic = global_20.power.readOp.dynamic * wire_length;
18210152Satgutier@umich.edu                  power.readOp.leakage = global_20.power.readOp.leakage * wire_length;
18310152Satgutier@umich.edu                  power.readOp.gate_leakage = global_20.power.readOp.gate_leakage * wire_length;
18410152Satgutier@umich.edu                  repeater_spacing = global_20.area.w;
18510152Satgutier@umich.edu                  repeater_size = global_20.area.h;
18610152Satgutier@umich.edu                  area.set_area((wire_length/repeater_spacing) *
18710152Satgutier@umich.edu                                  compute_gate_area(INV, 1, min_w_pmos * repeater_size,
18810152Satgutier@umich.edu                                                  g_tp.min_w_nmos_ * repeater_size, g_tp.cell_h_def));
18910152Satgutier@umich.edu          }
19010152Satgutier@umich.edu          else if (wt == Global_30) {
19110152Satgutier@umich.edu                  delay = global_30.delay * wire_length;
19210152Satgutier@umich.edu                  power.readOp.dynamic = global_30.power.readOp.dynamic * wire_length;
19310152Satgutier@umich.edu                  power.readOp.leakage = global_30.power.readOp.leakage * wire_length;
19410152Satgutier@umich.edu                  power.readOp.gate_leakage = global_30.power.readOp.gate_leakage * wire_length;
19510152Satgutier@umich.edu                  repeater_spacing = global_30.area.w;
19610152Satgutier@umich.edu                  repeater_size = global_30.area.h;
19710152Satgutier@umich.edu                  area.set_area((wire_length/repeater_spacing) *
19810152Satgutier@umich.edu                                  compute_gate_area(INV, 1, min_w_pmos * repeater_size,
19910152Satgutier@umich.edu                                                  g_tp.min_w_nmos_ * repeater_size, g_tp.cell_h_def));
20010152Satgutier@umich.edu          }
20110152Satgutier@umich.edu    out_rise_time = delay*repeater_spacing/deviceType->Vth;
20210152Satgutier@umich.edu  }
20310152Satgutier@umich.edu  else if (wt == Low_swing) {
20410152Satgutier@umich.edu    low_swing_model ();
20510152Satgutier@umich.edu    repeater_spacing = wire_length;
20610152Satgutier@umich.edu    repeater_size = 1;
20710152Satgutier@umich.edu  }
20810152Satgutier@umich.edu  else {
20910152Satgutier@umich.edu    assert(0);
21010152Satgutier@umich.edu  }
21110152Satgutier@umich.edu}
21210152Satgutier@umich.edu
21310152Satgutier@umich.edu
21410152Satgutier@umich.edu
21510152Satgutier@umich.edu/*
21610152Satgutier@umich.edu * The fall time of an input signal to the first stage of a circuit is
21710152Satgutier@umich.edu * assumed to be same as the fall time of the output signal of two
21810152Satgutier@umich.edu * inverters connected in series (refer: CACTI 1 Technical report,
21910152Satgutier@umich.edu * section 6.1.3)
22010152Satgutier@umich.edu */
22110152Satgutier@umich.edu  double
22210152Satgutier@umich.eduWire::signal_fall_time ()
22310152Satgutier@umich.edu{
22410152Satgutier@umich.edu
22510152Satgutier@umich.edu  /* rise time of inverter 1's output */
22610152Satgutier@umich.edu  double rt;
22710152Satgutier@umich.edu  /* fall time of inverter 2's output */
22810152Satgutier@umich.edu  double ft;
22910152Satgutier@umich.edu  double timeconst;
23010152Satgutier@umich.edu
23110152Satgutier@umich.edu  timeconst = (drain_C_(g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def) +
23210152Satgutier@umich.edu      drain_C_(min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
23310152Satgutier@umich.edu      gate_C(min_w_pmos + g_tp.min_w_nmos_, 0)) *
23410152Satgutier@umich.edu    tr_R_on(min_w_pmos, PCH, 1);
23510152Satgutier@umich.edu  rt = horowitz (0, timeconst, deviceType->Vth/deviceType->Vdd, deviceType->Vth/deviceType->Vdd, FALL) / (deviceType->Vdd - deviceType->Vth);
23610152Satgutier@umich.edu  timeconst = (drain_C_(g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def) +
23710152Satgutier@umich.edu      drain_C_(min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
23810152Satgutier@umich.edu      gate_C(min_w_pmos + g_tp.min_w_nmos_, 0)) *
23910152Satgutier@umich.edu    tr_R_on(g_tp.min_w_nmos_, NCH, 1);
24010152Satgutier@umich.edu  ft = horowitz (rt, timeconst, deviceType->Vth/deviceType->Vdd, deviceType->Vth/deviceType->Vdd, RISE) / deviceType->Vth;
24110152Satgutier@umich.edu  return ft;
24210152Satgutier@umich.edu}
24310152Satgutier@umich.edu
24410152Satgutier@umich.edu
24510152Satgutier@umich.edu
24610152Satgutier@umich.edudouble Wire::signal_rise_time ()
24710152Satgutier@umich.edu{
24810152Satgutier@umich.edu
24910152Satgutier@umich.edu  /* rise time of inverter 1's output */
25010152Satgutier@umich.edu  double ft;
25110152Satgutier@umich.edu  /* fall time of inverter 2's output */
25210152Satgutier@umich.edu  double rt;
25310152Satgutier@umich.edu  double timeconst;
25410152Satgutier@umich.edu
25510152Satgutier@umich.edu  timeconst = (drain_C_(g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def) +
25610152Satgutier@umich.edu      drain_C_(min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
25710152Satgutier@umich.edu      gate_C(min_w_pmos + g_tp.min_w_nmos_, 0)) *
25810152Satgutier@umich.edu    tr_R_on(g_tp.min_w_nmos_, NCH, 1);
25910152Satgutier@umich.edu  rt = horowitz (0, timeconst, deviceType->Vth/deviceType->Vdd, deviceType->Vth/deviceType->Vdd, RISE) / deviceType->Vth;
26010152Satgutier@umich.edu  timeconst = (drain_C_(g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def) +
26110152Satgutier@umich.edu      drain_C_(min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
26210152Satgutier@umich.edu      gate_C(min_w_pmos + g_tp.min_w_nmos_, 0)) *
26310152Satgutier@umich.edu    tr_R_on(min_w_pmos, PCH, 1);
26410152Satgutier@umich.edu  ft = horowitz (rt, timeconst, deviceType->Vth/deviceType->Vdd, deviceType->Vth/deviceType->Vdd, FALL) / (deviceType->Vdd - deviceType->Vth);
26510152Satgutier@umich.edu  return ft; //sec
26610152Satgutier@umich.edu}
26710152Satgutier@umich.edu
26810152Satgutier@umich.edu
26910152Satgutier@umich.edu
27010152Satgutier@umich.edu/* Wire resistance and capacitance calculations
27110152Satgutier@umich.edu *   wire width
27210152Satgutier@umich.edu *
27310152Satgutier@umich.edu *    /__/
27410152Satgutier@umich.edu *   |  |
27510152Satgutier@umich.edu *   |  |  height = ASPECT_RATIO*wire width (ASPECT_RATIO = 2.2, ref: ITRS)
27610152Satgutier@umich.edu *   |__|/
27710152Satgutier@umich.edu *
27810152Satgutier@umich.edu *   spacing between wires in same level = wire width
27910152Satgutier@umich.edu *   spacing between wires in adjacent levels = wire width---this is incorrect,
28010152Satgutier@umich.edu *   according to R.Ho's paper and thesis. ILD != wire width
28110152Satgutier@umich.edu *
28210152Satgutier@umich.edu */
28310152Satgutier@umich.edu
28410152Satgutier@umich.edudouble Wire::wire_cap (double len /* in m */, bool call_from_outside)
28510152Satgutier@umich.edu{
28610152Satgutier@umich.edu        //TODO: this should be consistent with the wire_res in technology file
28710152Satgutier@umich.edu  double sidewall, adj, tot_cap;
28810152Satgutier@umich.edu  double wire_height;
28910152Satgutier@umich.edu  double epsilon0 = 8.8542e-12;
29010152Satgutier@umich.edu  double aspect_ratio, horiz_dielectric_constant, vert_dielectric_constant, miller_value,ild_thickness;
29110152Satgutier@umich.edu
29210152Satgutier@umich.edu  switch (wire_placement)
29310152Satgutier@umich.edu  {
29410152Satgutier@umich.edu    case outside_mat:
29510152Satgutier@umich.edu        {
29610152Satgutier@umich.edu                aspect_ratio = g_tp.wire_outside_mat.aspect_ratio;
29710152Satgutier@umich.edu                horiz_dielectric_constant = g_tp.wire_outside_mat.horiz_dielectric_constant;
29810152Satgutier@umich.edu                vert_dielectric_constant = g_tp.wire_outside_mat.vert_dielectric_constant;
29910152Satgutier@umich.edu                miller_value = g_tp.wire_outside_mat.miller_value;
30010152Satgutier@umich.edu                ild_thickness = g_tp.wire_outside_mat.ild_thickness;
30110152Satgutier@umich.edu                break;
30210152Satgutier@umich.edu        }
30310152Satgutier@umich.edu    case inside_mat :
30410152Satgutier@umich.edu        {
30510152Satgutier@umich.edu                aspect_ratio = g_tp.wire_inside_mat.aspect_ratio;
30610152Satgutier@umich.edu                horiz_dielectric_constant = g_tp.wire_inside_mat.horiz_dielectric_constant;
30710152Satgutier@umich.edu                vert_dielectric_constant = g_tp.wire_inside_mat.vert_dielectric_constant;
30810152Satgutier@umich.edu                miller_value = g_tp.wire_inside_mat.miller_value;
30910152Satgutier@umich.edu                ild_thickness = g_tp.wire_inside_mat.ild_thickness;
31010152Satgutier@umich.edu                break;
31110152Satgutier@umich.edu        }
31210152Satgutier@umich.edu    default:
31310152Satgutier@umich.edu        {
31410152Satgutier@umich.edu                aspect_ratio = g_tp.wire_local.aspect_ratio;
31510152Satgutier@umich.edu                horiz_dielectric_constant = g_tp.wire_local.horiz_dielectric_constant;
31610152Satgutier@umich.edu                vert_dielectric_constant = g_tp.wire_local.vert_dielectric_constant;
31710152Satgutier@umich.edu                miller_value = g_tp.wire_local.miller_value;
31810152Satgutier@umich.edu                ild_thickness = g_tp.wire_local.ild_thickness;
31910152Satgutier@umich.edu                break;
32010152Satgutier@umich.edu        }
32110152Satgutier@umich.edu  }
32210152Satgutier@umich.edu
32310152Satgutier@umich.edu  if (call_from_outside)
32410152Satgutier@umich.edu  {
32510152Satgutier@umich.edu          wire_width       *= 1e-6;
32610152Satgutier@umich.edu          wire_spacing     *= 1e-6;
32710152Satgutier@umich.edu  }
32810152Satgutier@umich.edu  wire_height = wire_width/w_scale*aspect_ratio;
32910152Satgutier@umich.edu  /*
33010152Satgutier@umich.edu   * assuming height does not change. wire_width = width_original*w_scale
33110152Satgutier@umich.edu   * So wire_height does not change as wire width increases
33210152Satgutier@umich.edu   */
33310152Satgutier@umich.edu
33410152Satgutier@umich.edu// capacitance between wires in the same level
33510152Satgutier@umich.edu//  sidewall = 2*miller_value * horiz_dielectric_constant * (wire_height/wire_spacing)
33610152Satgutier@umich.edu//    * epsilon0;
33710152Satgutier@umich.edu
33810152Satgutier@umich.edu  sidewall = miller_value * horiz_dielectric_constant * (wire_height/wire_spacing)
33910152Satgutier@umich.edu    * epsilon0;
34010152Satgutier@umich.edu
34110152Satgutier@umich.edu
34210152Satgutier@umich.edu  // capacitance between wires in adjacent levels
34310152Satgutier@umich.edu  //adj = miller_value * vert_dielectric_constant *w_scale * epsilon0;
34410152Satgutier@umich.edu  //adj = 2*vert_dielectric_constant *wire_width/(ild_thickness*1e-6) * epsilon0;
34510152Satgutier@umich.edu
34610152Satgutier@umich.edu  adj = miller_value *vert_dielectric_constant *wire_width/(ild_thickness*1e-6) * epsilon0;
34710152Satgutier@umich.edu  //Change ild_thickness from micron to M
34810152Satgutier@umich.edu
34910152Satgutier@umich.edu  //tot_cap =  (sidewall + adj + (deviceType->C_fringe * 1e6)); //F/m
35010152Satgutier@umich.edu  tot_cap =  (sidewall + adj + (g_tp.fringe_cap * 1e6)); //F/m
35110152Satgutier@umich.edu
35210152Satgutier@umich.edu  if (call_from_outside)
35310152Satgutier@umich.edu  {
35410152Satgutier@umich.edu          wire_width       *= 1e6;
35510152Satgutier@umich.edu          wire_spacing     *= 1e6;
35610152Satgutier@umich.edu  }
35710152Satgutier@umich.edu  return (tot_cap*len); // (F)
35810152Satgutier@umich.edu}
35910152Satgutier@umich.edu
36010152Satgutier@umich.edu
36110152Satgutier@umich.edu  double
36210152Satgutier@umich.eduWire::wire_res (double len /*(in m)*/)
36310152Satgutier@umich.edu{
36410152Satgutier@umich.edu
36510152Satgutier@umich.edu          double aspect_ratio,alpha_scatter =1.05, dishing_thickness=0, barrier_thickness=0;
36610152Satgutier@umich.edu          //TODO: this should be consistent with the wire_res in technology file
36710152Satgutier@umich.edu          //The whole computation should be consistent with the wire_res in technology.cc too!
36810152Satgutier@umich.edu
36910152Satgutier@umich.edu          switch (wire_placement)
37010152Satgutier@umich.edu          {
37110152Satgutier@umich.edu          case outside_mat:
37210152Satgutier@umich.edu          {
37310152Satgutier@umich.edu                  aspect_ratio = g_tp.wire_outside_mat.aspect_ratio;
37410152Satgutier@umich.edu                  break;
37510152Satgutier@umich.edu          }
37610152Satgutier@umich.edu          case inside_mat :
37710152Satgutier@umich.edu          {
37810152Satgutier@umich.edu                  aspect_ratio = g_tp.wire_inside_mat.aspect_ratio;
37910152Satgutier@umich.edu                  break;
38010152Satgutier@umich.edu          }
38110152Satgutier@umich.edu          default:
38210152Satgutier@umich.edu          {
38310152Satgutier@umich.edu                  aspect_ratio = g_tp.wire_local.aspect_ratio;
38410152Satgutier@umich.edu                  break;
38510152Satgutier@umich.edu          }
38610152Satgutier@umich.edu          }
38710152Satgutier@umich.edu          return (alpha_scatter * resistivity * 1e-6 * len/((aspect_ratio*wire_width/w_scale-dishing_thickness - barrier_thickness)*
38810152Satgutier@umich.edu                          (wire_width-2*barrier_thickness)));
38910152Satgutier@umich.edu}
39010152Satgutier@umich.edu
39110152Satgutier@umich.edu/*
39210152Satgutier@umich.edu * Calculates the delay, power and area of the transmitter circuit.
39310152Satgutier@umich.edu *
39410152Satgutier@umich.edu * The transmitter delay is the sum of nand gate delay, inverter delay
39510152Satgutier@umich.edu * low swing nmos delay, and the wire delay
39610152Satgutier@umich.edu * (ref: Technical report 6)
39710152Satgutier@umich.edu */
39810152Satgutier@umich.edu  void
39910152Satgutier@umich.eduWire::low_swing_model()
40010152Satgutier@umich.edu{
40110152Satgutier@umich.edu  double len = wire_length;
40210152Satgutier@umich.edu  double beta = pmos_to_nmos_sz_ratio();
40310152Satgutier@umich.edu
40410152Satgutier@umich.edu
40510152Satgutier@umich.edu  double inputrise = (in_rise_time == 0) ? signal_rise_time() : in_rise_time;
40610152Satgutier@umich.edu
40710152Satgutier@umich.edu  /* Final nmos low swing driver size calculation:
40810152Satgutier@umich.edu   * Try to size the driver such that the delay
40910152Satgutier@umich.edu   * is less than 8FO4.
41010152Satgutier@umich.edu   * If the driver size is greater than
41110152Satgutier@umich.edu   * the max allowable size, assume max size for the driver.
41210152Satgutier@umich.edu   * In either case, recalculate the delay using
41310152Satgutier@umich.edu   * the final driver size assuming slow input with
41410152Satgutier@umich.edu   * finite rise time instead of ideal step input
41510152Satgutier@umich.edu   *
41610152Satgutier@umich.edu   * (ref: Technical report 6)
41710152Satgutier@umich.edu   */
41810152Satgutier@umich.edu  double cwire = wire_cap(len); /* load capacitance */
41910152Satgutier@umich.edu  double rwire = wire_res(len);
42010152Satgutier@umich.edu
42110152Satgutier@umich.edu#define RES_ADJ (8.6) // Increase in resistance due to low driving vol.
42210152Satgutier@umich.edu
42310152Satgutier@umich.edu  double driver_res = (-8*g_tp.FO4/(log(0.5) * cwire))/RES_ADJ;
42410152Satgutier@umich.edu  double nsize = R_to_w(driver_res, NCH);
42510152Satgutier@umich.edu
42610152Satgutier@umich.edu  nsize = MIN(nsize, g_tp.max_w_nmos_);
42710152Satgutier@umich.edu  nsize = MAX(nsize, g_tp.min_w_nmos_);
42810152Satgutier@umich.edu
42910152Satgutier@umich.edu  if(rwire*cwire > 8*g_tp.FO4)
43010152Satgutier@umich.edu  {
43110152Satgutier@umich.edu    nsize = g_tp.max_w_nmos_;
43210152Satgutier@umich.edu  }
43310152Satgutier@umich.edu
43410152Satgutier@umich.edu  // size the inverter appropriately to minimize the transmitter delay
43510152Satgutier@umich.edu  // Note - In order to minimize leakage, we are not adding a set of inverters to
43610152Satgutier@umich.edu  // bring down delay. Instead, we are sizing the single gate
43710152Satgutier@umich.edu  // based on the logical effort.
43810152Satgutier@umich.edu  double st_eff   = sqrt((2+beta/1+beta)*gate_C(nsize, 0)/(gate_C(2*g_tp.min_w_nmos_, 0)
43910152Satgutier@umich.edu        + gate_C(2*min_w_pmos, 0)));
44010152Satgutier@umich.edu  double req_cin  = ((2+beta/1+beta)*gate_C(nsize, 0))/st_eff;
44110152Satgutier@umich.edu  double inv_size = req_cin/(gate_C(min_w_pmos, 0) + gate_C(g_tp.min_w_nmos_, 0));
44210152Satgutier@umich.edu  inv_size = MAX(inv_size, 1);
44310152Satgutier@umich.edu
44410152Satgutier@umich.edu  /* nand gate delay */
44510152Satgutier@umich.edu  double res_eq = (2 * tr_R_on(g_tp.min_w_nmos_, NCH, 1));
44610152Satgutier@umich.edu  double cap_eq = 2 * drain_C_(min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
44710152Satgutier@umich.edu    drain_C_(2*g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def) +
44810152Satgutier@umich.edu    gate_C(inv_size*g_tp.min_w_nmos_, 0) +
44910152Satgutier@umich.edu    gate_C(inv_size*min_w_pmos, 0);
45010152Satgutier@umich.edu
45110152Satgutier@umich.edu  double timeconst = res_eq * cap_eq;
45210152Satgutier@umich.edu
45310152Satgutier@umich.edu  delay = horowitz(inputrise, timeconst, deviceType->Vth/deviceType->Vdd,
45410152Satgutier@umich.edu      deviceType->Vth/deviceType->Vdd, RISE);
45510152Satgutier@umich.edu  double temp_power = cap_eq*deviceType->Vdd*deviceType->Vdd;
45610152Satgutier@umich.edu
45710152Satgutier@umich.edu  inputrise = delay / (deviceType->Vdd - deviceType->Vth); /* for the next stage */
45810152Satgutier@umich.edu
45910152Satgutier@umich.edu  /* Inverter delay:
46010152Satgutier@umich.edu   * The load capacitance of this inv depends on
46110152Satgutier@umich.edu   * the gate capacitance of the final stage nmos
46210152Satgutier@umich.edu   * transistor which in turn depends on nsize
46310152Satgutier@umich.edu   */
46410152Satgutier@umich.edu  res_eq = tr_R_on(inv_size*min_w_pmos, PCH, 1);
46510152Satgutier@umich.edu  cap_eq = drain_C_(inv_size*min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
46610152Satgutier@umich.edu    drain_C_(inv_size*g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def) +
46710152Satgutier@umich.edu    gate_C(nsize, 0);
46810152Satgutier@umich.edu  timeconst = res_eq * cap_eq;
46910152Satgutier@umich.edu
47010152Satgutier@umich.edu  delay += horowitz(inputrise, timeconst, deviceType->Vth/deviceType->Vdd,
47110152Satgutier@umich.edu      deviceType->Vth/deviceType->Vdd, FALL);
47210152Satgutier@umich.edu  temp_power += cap_eq*deviceType->Vdd*deviceType->Vdd;
47310152Satgutier@umich.edu
47410152Satgutier@umich.edu
47510152Satgutier@umich.edu  transmitter.delay = delay;
47610152Satgutier@umich.edu  transmitter.power.readOp.dynamic = temp_power*2; /* since it is a diff. model*/
47710152Satgutier@umich.edu  transmitter.power.readOp.leakage = deviceType->Vdd *
47810152Satgutier@umich.edu    (4 * cmos_Isub_leakage(g_tp.min_w_nmos_, min_w_pmos, 2, nand) +
47910152Satgutier@umich.edu     4 * cmos_Isub_leakage(g_tp.min_w_nmos_, min_w_pmos, 1, inv));
48010152Satgutier@umich.edu
48110152Satgutier@umich.edu  transmitter.power.readOp.gate_leakage = deviceType->Vdd *
48210152Satgutier@umich.edu    (4 * cmos_Ig_leakage(g_tp.min_w_nmos_, min_w_pmos, 2, nand) +
48310152Satgutier@umich.edu     4 * cmos_Ig_leakage(g_tp.min_w_nmos_, min_w_pmos, 1, inv));
48410152Satgutier@umich.edu
48510152Satgutier@umich.edu  inputrise = delay / deviceType->Vth;
48610152Satgutier@umich.edu
48710152Satgutier@umich.edu  /* nmos delay + wire delay */
48810152Satgutier@umich.edu  cap_eq = cwire + drain_C_(nsize, NCH, 1, 1, g_tp.cell_h_def)*2 +
48910152Satgutier@umich.edu    nsense * sense_amp_input_cap(); //+receiver cap
49010152Satgutier@umich.edu  /*
49110152Satgutier@umich.edu   * NOTE: nmos is used as both pull up and pull down transistor
49210152Satgutier@umich.edu   * in the transmitter. This is because for low voltage swing, drive
49310152Satgutier@umich.edu   * resistance of nmos is less than pmos
49410152Satgutier@umich.edu   * (for a detailed graph ref: On-Chip Wires: Scaling and Efficiency)
49510152Satgutier@umich.edu   */
49610152Satgutier@umich.edu  timeconst = (tr_R_on(nsize, NCH, 1)*RES_ADJ) * (cwire +
49710152Satgutier@umich.edu      drain_C_(nsize, NCH, 1, 1, g_tp.cell_h_def)*2) +
49810152Satgutier@umich.edu    rwire*cwire/2 +
49910152Satgutier@umich.edu    (tr_R_on(nsize, NCH, 1)*RES_ADJ + rwire) *
50010152Satgutier@umich.edu    nsense * sense_amp_input_cap();
50110152Satgutier@umich.edu
50210152Satgutier@umich.edu  /*
50310152Satgutier@umich.edu   * since we are pre-equalizing and overdriving the low
50410152Satgutier@umich.edu   * swing wires, the net time constant is less
50510152Satgutier@umich.edu   * than the actual value
50610152Satgutier@umich.edu   */
50710152Satgutier@umich.edu  delay += horowitz(inputrise, timeconst, deviceType->Vth/deviceType->Vdd, .25, 0);
50810152Satgutier@umich.edu#define VOL_SWING .1
50910152Satgutier@umich.edu  temp_power += cap_eq*VOL_SWING*.400; /* .4v is the over drive voltage */
51010152Satgutier@umich.edu  temp_power *= 2; /* differential wire */
51110152Satgutier@umich.edu
51210152Satgutier@umich.edu  l_wire.delay = delay - transmitter.delay;
51310152Satgutier@umich.edu  l_wire.power.readOp.dynamic = temp_power - transmitter.power.readOp.dynamic;
51410152Satgutier@umich.edu  l_wire.power.readOp.leakage = deviceType->Vdd*
51510152Satgutier@umich.edu    (4* cmos_Isub_leakage(nsize, 0, 1, nmos));
51610152Satgutier@umich.edu
51710152Satgutier@umich.edu  l_wire.power.readOp.gate_leakage = deviceType->Vdd*
51810152Satgutier@umich.edu    (4* cmos_Ig_leakage(nsize, 0, 1, nmos));
51910152Satgutier@umich.edu
52010152Satgutier@umich.edu  //double rt = horowitz(inputrise, timeconst, deviceType->Vth/deviceType->Vdd,
52110152Satgutier@umich.edu  //    deviceType->Vth/deviceType->Vdd, RISE)/deviceType->Vth;
52210152Satgutier@umich.edu
52310152Satgutier@umich.edu  delay += g_tp.sense_delay;
52410152Satgutier@umich.edu
52510152Satgutier@umich.edu  sense_amp.delay = g_tp.sense_delay;
52610152Satgutier@umich.edu  out_rise_time = g_tp.sense_delay/(deviceType->Vth);
52710152Satgutier@umich.edu  sense_amp.power.readOp.dynamic = g_tp.sense_dy_power;
52810152Satgutier@umich.edu  sense_amp.power.readOp.leakage = 0; //FIXME
52910152Satgutier@umich.edu  sense_amp.power.readOp.gate_leakage = 0;
53010152Satgutier@umich.edu
53110152Satgutier@umich.edu  power.readOp.dynamic = temp_power + sense_amp.power.readOp.dynamic;
53210152Satgutier@umich.edu  power.readOp.leakage = transmitter.power.readOp.leakage +
53310152Satgutier@umich.edu                         l_wire.power.readOp.leakage +
53410152Satgutier@umich.edu                         sense_amp.power.readOp.leakage;
53510152Satgutier@umich.edu  power.readOp.gate_leakage = transmitter.power.readOp.gate_leakage +
53610152Satgutier@umich.edu                         l_wire.power.readOp.gate_leakage +
53710152Satgutier@umich.edu                         sense_amp.power.readOp.gate_leakage;
53810152Satgutier@umich.edu}
53910152Satgutier@umich.edu
54010152Satgutier@umich.edu  double
54110152Satgutier@umich.eduWire::sense_amp_input_cap()
54210152Satgutier@umich.edu{
54310152Satgutier@umich.edu  return drain_C_(g_tp.w_iso, PCH, 1, 1, g_tp.cell_h_def) +
54410152Satgutier@umich.edu    gate_C(g_tp.w_sense_en + g_tp.w_sense_n, 0) +
54510152Satgutier@umich.edu    drain_C_(g_tp.w_sense_n, NCH, 1, 1, g_tp.cell_h_def) +
54610152Satgutier@umich.edu    drain_C_(g_tp.w_sense_p, PCH, 1, 1, g_tp.cell_h_def);
54710152Satgutier@umich.edu}
54810152Satgutier@umich.edu
54910152Satgutier@umich.edu
55010152Satgutier@umich.eduvoid Wire::delay_optimal_wire ()
55110152Satgutier@umich.edu{
55210152Satgutier@umich.edu  double len       = wire_length;
55310152Satgutier@umich.edu  //double min_wire_width = wire_width; //m
55410152Satgutier@umich.edu  double beta = pmos_to_nmos_sz_ratio();
55510152Satgutier@umich.edu  double switching = 0;  // switching energy
55610152Satgutier@umich.edu  double short_ckt = 0;  // short-circuit energy
55710152Satgutier@umich.edu  double tc        = 0;  // time constant
55810152Satgutier@umich.edu  // input cap of min sized driver
55910152Satgutier@umich.edu  double input_cap = gate_C(g_tp.min_w_nmos_ + min_w_pmos, 0);
56010152Satgutier@umich.edu
56110152Satgutier@umich.edu   // output parasitic capacitance of
56210152Satgutier@umich.edu   // the min. sized driver
56310152Satgutier@umich.edu  double out_cap = drain_C_(min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
56410152Satgutier@umich.edu    drain_C_(g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def);
56510152Satgutier@umich.edu  // drive resistance
56610152Satgutier@umich.edu  double out_res = (tr_R_on(g_tp.min_w_nmos_, NCH, 1) +
56710152Satgutier@umich.edu      tr_R_on(min_w_pmos, PCH, 1))/2;
56810152Satgutier@umich.edu  double wr = wire_res(len); //ohm
56910152Satgutier@umich.edu
57010152Satgutier@umich.edu  // wire cap /m
57110152Satgutier@umich.edu  double wc = wire_cap(len);
57210152Satgutier@umich.edu
57310152Satgutier@umich.edu  // size the repeater such that the delay of the wire is minimum
57410152Satgutier@umich.edu  double repeater_scaling = sqrt(out_res*wc/(wr*input_cap)); // len will cancel
57510152Satgutier@umich.edu
57610152Satgutier@umich.edu   // calc the optimum spacing between the repeaters (m)
57710152Satgutier@umich.edu
57810152Satgutier@umich.edu  repeater_spacing = sqrt(2 * out_res * (out_cap + input_cap)/
57910152Satgutier@umich.edu      ((wr/len)*(wc/len)));
58010152Satgutier@umich.edu  repeater_size = repeater_scaling;
58110152Satgutier@umich.edu
58210152Satgutier@umich.edu  switching = (repeater_scaling * (input_cap + out_cap) +
58310152Satgutier@umich.edu      repeater_spacing * (wc/len)) * deviceType->Vdd * deviceType->Vdd;
58410152Satgutier@umich.edu
58510152Satgutier@umich.edu  tc = out_res * (input_cap + out_cap) +
58610152Satgutier@umich.edu    out_res * wc/len * repeater_spacing/repeater_scaling +
58710152Satgutier@umich.edu    wr/len * repeater_spacing * input_cap * repeater_scaling +
58810152Satgutier@umich.edu    0.5 * (wr/len) * (wc/len)* repeater_spacing * repeater_spacing;
58910152Satgutier@umich.edu
59010152Satgutier@umich.edu  delay = 0.693 * tc * len/repeater_spacing;
59110152Satgutier@umich.edu
59210152Satgutier@umich.edu#define Ishort_ckt 65e-6 /* across all tech Ref:Banerjee et al. {IEEE TED} */
59310152Satgutier@umich.edu  short_ckt = deviceType->Vdd * g_tp.min_w_nmos_ * Ishort_ckt * 1.0986 *
59410152Satgutier@umich.edu    repeater_scaling * tc;
59510152Satgutier@umich.edu
59610152Satgutier@umich.edu  area.set_area((len/repeater_spacing) *
59710152Satgutier@umich.edu                compute_gate_area(INV, 1, min_w_pmos * repeater_scaling,
59810152Satgutier@umich.edu                                          g_tp.min_w_nmos_ * repeater_scaling, g_tp.cell_h_def));
59910152Satgutier@umich.edu  power.readOp.dynamic = ((len/repeater_spacing)*(switching + short_ckt));
60010152Satgutier@umich.edu  power.readOp.leakage = ((len/repeater_spacing)*
60110152Satgutier@umich.edu      deviceType->Vdd*
60210152Satgutier@umich.edu      cmos_Isub_leakage(g_tp.min_w_nmos_*repeater_scaling, beta*g_tp.min_w_nmos_*repeater_scaling, 1, inv));
60310152Satgutier@umich.edu  power.readOp.gate_leakage = ((len/repeater_spacing)*
60410152Satgutier@umich.edu      deviceType->Vdd*
60510152Satgutier@umich.edu      cmos_Ig_leakage(g_tp.min_w_nmos_*repeater_scaling, beta*g_tp.min_w_nmos_*repeater_scaling, 1, inv));
60610152Satgutier@umich.edu}
60710152Satgutier@umich.edu
60810152Satgutier@umich.edu
60910152Satgutier@umich.edu
61010152Satgutier@umich.edu// calculate power/delay values for wires with suboptimal repeater sizing/spacing
61110152Satgutier@umich.eduvoid
61210152Satgutier@umich.eduWire::init_wire(){
61310152Satgutier@umich.edu  wire_length = 1;
61410152Satgutier@umich.edu  delay_optimal_wire();
61510152Satgutier@umich.edu    double sp, si;
61610152Satgutier@umich.edu  powerDef pow;
61710152Satgutier@umich.edu  si = repeater_size;
61810152Satgutier@umich.edu  sp = repeater_spacing;
61910152Satgutier@umich.edu  sp *= 1e6; // in microns
62010152Satgutier@umich.edu
62110152Satgutier@umich.edu  double i, j, del;
62210152Satgutier@umich.edu  repeated_wire.push_back(Component());
62310152Satgutier@umich.edu  for (j=sp; j < 4*sp; j+=100) {
62410152Satgutier@umich.edu    for (i = si; i > 1; i--) {
62510152Satgutier@umich.edu      pow = wire_model(j*1e-6, i, &del);
62610152Satgutier@umich.edu      if (j == sp && i == si) {
62710152Satgutier@umich.edu        global.delay = del;
62810152Satgutier@umich.edu        global.power = pow;
62910152Satgutier@umich.edu        global.area.h = si;
63010152Satgutier@umich.edu        global.area.w = sp*1e-6; // m
63110152Satgutier@umich.edu      }
63210152Satgutier@umich.edu//      cout << "Repeater size - "<< i <<
63310152Satgutier@umich.edu//        " Repeater spacing - " << j <<
63410152Satgutier@umich.edu//        " Delay - " << del <<
63510152Satgutier@umich.edu//        " PowerD - " << pow.readOp.dynamic <<
63610152Satgutier@umich.edu//        " PowerL - " << pow.readOp.leakage <<endl;
63710152Satgutier@umich.edu      repeated_wire.back().delay = del;
63810152Satgutier@umich.edu      repeated_wire.back().power.readOp = pow.readOp;
63910152Satgutier@umich.edu      repeated_wire.back().area.w = j*1e-6; //m
64010152Satgutier@umich.edu      repeated_wire.back().area.h = i;
64110152Satgutier@umich.edu      repeated_wire.push_back(Component());
64210152Satgutier@umich.edu
64310152Satgutier@umich.edu    }
64410152Satgutier@umich.edu  }
64510152Satgutier@umich.edu  repeated_wire.pop_back();
64610152Satgutier@umich.edu  update_fullswing();
64710152Satgutier@umich.edu  Wire *l_wire = new Wire(Low_swing, 0.001/* 1 mm*/, 1);
64810152Satgutier@umich.edu  low_swing.delay = l_wire->delay;
64910152Satgutier@umich.edu  low_swing.power = l_wire->power;
65010152Satgutier@umich.edu  delete l_wire;
65110152Satgutier@umich.edu}
65210152Satgutier@umich.edu
65310152Satgutier@umich.edu
65410152Satgutier@umich.edu
65510152Satgutier@umich.eduvoid Wire::update_fullswing()
65610152Satgutier@umich.edu{
65710152Satgutier@umich.edu
65810152Satgutier@umich.edu  list<Component>::iterator citer;
65910152Satgutier@umich.edu  double del[4];
66010152Satgutier@umich.edu  del[3] = this->global.delay + this->global.delay*.3;
66110152Satgutier@umich.edu  del[2] = global.delay + global.delay*.2;
66210152Satgutier@umich.edu  del[1] = global.delay + global.delay*.1;
66310152Satgutier@umich.edu  del[0] = global.delay + global.delay*.05;
66410152Satgutier@umich.edu  double threshold;
66510152Satgutier@umich.edu  double ncost;
66610152Satgutier@umich.edu  double cost;
66710152Satgutier@umich.edu  int i = 4;
66810152Satgutier@umich.edu  while (i>0) {
66910152Satgutier@umich.edu    threshold = del[i-1];
67010152Satgutier@umich.edu    cost = BIGNUM;
67110152Satgutier@umich.edu    for (citer = repeated_wire.begin(); citer != repeated_wire.end(); citer++)
67210152Satgutier@umich.edu    {
67310152Satgutier@umich.edu      if (citer->delay > threshold) {
67410152Satgutier@umich.edu        citer = repeated_wire.erase(citer);
67510152Satgutier@umich.edu        citer --;
67610152Satgutier@umich.edu      }
67710152Satgutier@umich.edu      else {
67810152Satgutier@umich.edu        ncost = citer->power.readOp.dynamic/global.power.readOp.dynamic +
67910152Satgutier@umich.edu                citer->power.readOp.leakage/global.power.readOp.leakage;
68010152Satgutier@umich.edu        if(ncost < cost)
68110152Satgutier@umich.edu        {
68210152Satgutier@umich.edu          cost = ncost;
68310152Satgutier@umich.edu          if (i == 4) {
68410152Satgutier@umich.edu            global_30.delay = citer->delay;
68510152Satgutier@umich.edu            global_30.power = citer->power;
68610152Satgutier@umich.edu            global_30.area  = citer->area;
68710152Satgutier@umich.edu          }
68810152Satgutier@umich.edu          else if (i==3) {
68910152Satgutier@umich.edu            global_20.delay = citer->delay;
69010152Satgutier@umich.edu            global_20.power = citer->power;
69110152Satgutier@umich.edu            global_20.area  = citer->area;
69210152Satgutier@umich.edu          }
69310152Satgutier@umich.edu          else if(i==2) {
69410152Satgutier@umich.edu            global_10.delay = citer->delay;
69510152Satgutier@umich.edu            global_10.power = citer->power;
69610152Satgutier@umich.edu            global_10.area  = citer->area;
69710152Satgutier@umich.edu          }
69810152Satgutier@umich.edu          else if(i==1) {
69910152Satgutier@umich.edu            global_5.delay = citer->delay;
70010152Satgutier@umich.edu            global_5.power = citer->power;
70110152Satgutier@umich.edu            global_5.area  = citer->area;
70210152Satgutier@umich.edu          }
70310152Satgutier@umich.edu        }
70410152Satgutier@umich.edu      }
70510152Satgutier@umich.edu    }
70610152Satgutier@umich.edu    i--;
70710152Satgutier@umich.edu  }
70810152Satgutier@umich.edu}
70910152Satgutier@umich.edu
71010152Satgutier@umich.edu
71110152Satgutier@umich.edu
71210152Satgutier@umich.edupowerDef Wire::wire_model (double space, double size, double *delay)
71310152Satgutier@umich.edu{
71410152Satgutier@umich.edu  powerDef ptemp;
71510152Satgutier@umich.edu  double len = 1;
71610152Satgutier@umich.edu  //double min_wire_width = wire_width; //m
71710152Satgutier@umich.edu  double beta = pmos_to_nmos_sz_ratio();
71810152Satgutier@umich.edu  // switching energy
71910152Satgutier@umich.edu  double switching = 0;
72010152Satgutier@umich.edu  // short-circuit energy
72110152Satgutier@umich.edu  double short_ckt = 0;
72210152Satgutier@umich.edu  // time constant
72310152Satgutier@umich.edu  double tc = 0;
72410152Satgutier@umich.edu  // input cap of min sized driver
72510152Satgutier@umich.edu  double input_cap = gate_C (g_tp.min_w_nmos_ +
72610152Satgutier@umich.edu      min_w_pmos, 0);
72710152Satgutier@umich.edu
72810152Satgutier@umich.edu   // output parasitic capacitance of
72910152Satgutier@umich.edu   // the min. sized driver
73010152Satgutier@umich.edu  double out_cap = drain_C_(min_w_pmos, PCH, 1, 1, g_tp.cell_h_def) +
73110152Satgutier@umich.edu    drain_C_(g_tp.min_w_nmos_, NCH, 1, 1, g_tp.cell_h_def);
73210152Satgutier@umich.edu  // drive resistance
73310152Satgutier@umich.edu  double out_res = (tr_R_on(g_tp.min_w_nmos_, NCH, 1) +
73410152Satgutier@umich.edu      tr_R_on(min_w_pmos, PCH, 1))/2;
73510152Satgutier@umich.edu  double wr = wire_res(len); //ohm
73610152Satgutier@umich.edu
73710152Satgutier@umich.edu  // wire cap /m
73810152Satgutier@umich.edu  double wc = wire_cap(len);
73910152Satgutier@umich.edu
74010152Satgutier@umich.edu  repeater_spacing = space;
74110152Satgutier@umich.edu  repeater_size = size;
74210152Satgutier@umich.edu
74310152Satgutier@umich.edu  switching = (repeater_size * (input_cap + out_cap) +
74410152Satgutier@umich.edu      repeater_spacing * (wc/len)) * deviceType->Vdd * deviceType->Vdd;
74510152Satgutier@umich.edu
74610152Satgutier@umich.edu  tc = out_res * (input_cap + out_cap) +
74710152Satgutier@umich.edu    out_res * wc/len * repeater_spacing/repeater_size +
74810152Satgutier@umich.edu    wr/len * repeater_spacing * out_cap * repeater_size +
74910152Satgutier@umich.edu    0.5 * (wr/len) * (wc/len)* repeater_spacing * repeater_spacing;
75010152Satgutier@umich.edu
75110152Satgutier@umich.edu  *delay = 0.693 * tc * len/repeater_spacing;
75210152Satgutier@umich.edu
75310152Satgutier@umich.edu#define Ishort_ckt 65e-6 /* across all tech Ref:Banerjee et al. {IEEE TED} */
75410152Satgutier@umich.edu  short_ckt = deviceType->Vdd * g_tp.min_w_nmos_ * Ishort_ckt * 1.0986 *
75510152Satgutier@umich.edu    repeater_size * tc;
75610152Satgutier@umich.edu
75710152Satgutier@umich.edu  ptemp.readOp.dynamic = ((len/repeater_spacing)*(switching + short_ckt));
75810152Satgutier@umich.edu  ptemp.readOp.leakage = ((len/repeater_spacing)*
75910152Satgutier@umich.edu      deviceType->Vdd*
76010152Satgutier@umich.edu      cmos_Isub_leakage(g_tp.min_w_nmos_*repeater_size, beta*g_tp.min_w_nmos_*repeater_size, 1, inv));
76110152Satgutier@umich.edu
76210152Satgutier@umich.edu  ptemp.readOp.gate_leakage = ((len/repeater_spacing)*
76310152Satgutier@umich.edu      deviceType->Vdd*
76410152Satgutier@umich.edu      cmos_Ig_leakage(g_tp.min_w_nmos_*repeater_size, beta*g_tp.min_w_nmos_*repeater_size, 1, inv));
76510152Satgutier@umich.edu
76610152Satgutier@umich.edu  return ptemp;
76710152Satgutier@umich.edu}
76810152Satgutier@umich.edu
76910152Satgutier@umich.eduvoid
77010152Satgutier@umich.eduWire::print_wire()
77110152Satgutier@umich.edu{
77210152Satgutier@umich.edu
77310152Satgutier@umich.edu  cout << "\nWire Properties:\n\n";
77410152Satgutier@umich.edu  cout << "  Delay Optimal\n\tRepeater size - "<< global.area.h <<
77510152Satgutier@umich.edu    " \n\tRepeater spacing - " << global.area.w*1e3 << " (mm)"
77610152Satgutier@umich.edu    " \n\tDelay - " << global.delay*1e6 <<  " (ns/mm)"
77710152Satgutier@umich.edu    " \n\tPowerD - " << global.power.readOp.dynamic *1e6<< " (nJ/mm)"
77810152Satgutier@umich.edu    " \n\tPowerL - " << global.power.readOp.leakage << " (mW/mm)"
77910152Satgutier@umich.edu    " \n\tPowerLgate - " << global.power.readOp.gate_leakage << " (mW/mm)\n";
78010152Satgutier@umich.edu  cout << "\tWire width - " <<wire_width_init*1e6 << " microns\n";
78110152Satgutier@umich.edu  cout << "\tWire spacing - " <<wire_spacing_init*1e6 << " microns\n";
78210152Satgutier@umich.edu  cout <<endl;
78310152Satgutier@umich.edu
78410152Satgutier@umich.edu  cout << "  5% Overhead\n\tRepeater size - "<< global_5.area.h <<
78510152Satgutier@umich.edu    " \n\tRepeater spacing - " << global_5.area.w*1e3 << " (mm)"
78610152Satgutier@umich.edu    " \n\tDelay - " << global_5.delay *1e6<<  " (ns/mm)"
78710152Satgutier@umich.edu    " \n\tPowerD - " << global_5.power.readOp.dynamic *1e6<< " (nJ/mm)"
78810152Satgutier@umich.edu    " \n\tPowerL - " << global_5.power.readOp.leakage << " (mW/mm)"
78910152Satgutier@umich.edu    " \n\tPowerLgate - " << global_5.power.readOp.gate_leakage << " (mW/mm)\n";
79010152Satgutier@umich.edu  cout << "\tWire width - " <<wire_width_init*1e6 << " microns\n";
79110152Satgutier@umich.edu  cout << "\tWire spacing - " <<wire_spacing_init*1e6 << " microns\n";
79210152Satgutier@umich.edu  cout <<endl;
79310152Satgutier@umich.edu  cout << "  10% Overhead\n\tRepeater size - "<< global_10.area.h <<
79410152Satgutier@umich.edu    " \n\tRepeater spacing - " << global_10.area.w*1e3 << " (mm)"
79510152Satgutier@umich.edu    " \n\tDelay - " << global_10.delay *1e6<<  " (ns/mm)"
79610152Satgutier@umich.edu    " \n\tPowerD - " << global_10.power.readOp.dynamic *1e6<< " (nJ/mm)"
79710152Satgutier@umich.edu    " \n\tPowerL - " << global_10.power.readOp.leakage << " (mW/mm)"
79810152Satgutier@umich.edu    " \n\tPowerLgate - " << global_10.power.readOp.gate_leakage << " (mW/mm)\n";
79910152Satgutier@umich.edu  cout << "\tWire width - " <<wire_width_init*1e6 << " microns\n";
80010152Satgutier@umich.edu  cout << "\tWire spacing - " <<wire_spacing_init*1e6 << " microns\n";
80110152Satgutier@umich.edu  cout <<endl;
80210152Satgutier@umich.edu  cout << "  20% Overhead\n\tRepeater size - "<< global_20.area.h <<
80310152Satgutier@umich.edu    " \n\tRepeater spacing - " << global_20.area.w*1e3 << " (mm)"
80410152Satgutier@umich.edu    " \n\tDelay - " << global_20.delay *1e6<<  " (ns/mm)"
80510152Satgutier@umich.edu    " \n\tPowerD - " << global_20.power.readOp.dynamic *1e6<< " (nJ/mm)"
80610152Satgutier@umich.edu    " \n\tPowerL - " << global_20.power.readOp.leakage << " (mW/mm)"
80710152Satgutier@umich.edu    " \n\tPowerLgate - " << global_20.power.readOp.gate_leakage << " (mW/mm)\n";
80810152Satgutier@umich.edu  cout << "\tWire width - " <<wire_width_init*1e6 << " microns\n";
80910152Satgutier@umich.edu  cout << "\tWire spacing - " <<wire_spacing_init*1e6 << " microns\n";
81010152Satgutier@umich.edu  cout <<endl;
81110152Satgutier@umich.edu  cout << "  30% Overhead\n\tRepeater size - "<< global_30.area.h <<
81210152Satgutier@umich.edu    " \n\tRepeater spacing - " << global_30.area.w*1e3 << " (mm)"
81310152Satgutier@umich.edu    " \n\tDelay - " << global_30.delay *1e6<<  " (ns/mm)"
81410152Satgutier@umich.edu    " \n\tPowerD - " << global_30.power.readOp.dynamic *1e6<< " (nJ/mm)"
81510152Satgutier@umich.edu    " \n\tPowerL - " << global_30.power.readOp.leakage << " (mW/mm)"
81610152Satgutier@umich.edu    " \n\tPowerLgate - " << global_30.power.readOp.gate_leakage << " (mW/mm)\n";
81710152Satgutier@umich.edu  cout << "\tWire width - " <<wire_width_init*1e6 << " microns\n";
81810152Satgutier@umich.edu  cout << "\tWire spacing - " <<wire_spacing_init*1e6 << " microns\n";
81910152Satgutier@umich.edu  cout <<endl;
82010152Satgutier@umich.edu  cout << "  Low-swing wire (1 mm) - Note: Unlike repeated wires, \n\tdelay and power "
82110152Satgutier@umich.edu            "values of low-swing wires do not\n\thave a linear relationship with length." <<
82210152Satgutier@umich.edu      " \n\tdelay - " << low_swing.delay *1e9<<  " (ns)"
82310152Satgutier@umich.edu      " \n\tpowerD - " << low_swing.power.readOp.dynamic *1e9<< " (nJ)"
82410152Satgutier@umich.edu      " \n\tPowerL - " << low_swing.power.readOp.leakage << " (mW)"
82510152Satgutier@umich.edu      " \n\tPowerLgate - " << low_swing.power.readOp.gate_leakage << " (mW)\n";
82610152Satgutier@umich.edu  cout << "\tWire width - " <<wire_width_init * 2 /* differential */<< " microns\n";
82710152Satgutier@umich.edu  cout << "\tWire spacing - " <<wire_spacing_init * 2 /* differential */<< " microns\n";
82810152Satgutier@umich.edu  cout <<endl;
82910152Satgutier@umich.edu  cout <<endl;
83010152Satgutier@umich.edu
83110152Satgutier@umich.edu}
83210152Satgutier@umich.edu
833