2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2021-01-22 20:23:28 +01:00
|
|
|
# Copyright (c) 2016-2021 Regents of the University of California and The Board
|
2019-06-14 17:43:41 +02:00
|
|
|
# of Regents for the Oklahoma Agricultural and Mechanical College
|
|
|
|
|
# (acting for and on behalf of Oklahoma State University)
|
|
|
|
|
# All rights reserved.
|
2019-04-26 21:21:50 +02:00
|
|
|
#
|
2016-11-08 18:57:35 +01:00
|
|
|
import contact
|
2017-12-12 23:53:19 +01:00
|
|
|
import pgate
|
2016-11-08 18:57:35 +01:00
|
|
|
import debug
|
2020-04-18 14:26:39 +02:00
|
|
|
import operator
|
2018-10-12 18:44:36 +02:00
|
|
|
from tech import drc, parameter, spice
|
2016-11-08 18:57:35 +01:00
|
|
|
from vector import vector
|
|
|
|
|
from math import ceil
|
|
|
|
|
from globals import OPTS
|
2017-11-30 21:15:20 +01:00
|
|
|
from utils import round_to_grid
|
2018-11-08 09:10:51 +01:00
|
|
|
import logical_effort
|
2019-01-17 01:30:31 +01:00
|
|
|
from sram_factory import factory
|
2020-04-09 01:45:28 +02:00
|
|
|
from errors import drc_error
|
2020-10-28 17:54:15 +01:00
|
|
|
from tech import cell_properties as cell_props
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2019-10-06 19:30:16 +02:00
|
|
|
|
2017-12-12 23:53:19 +01:00
|
|
|
class pinv(pgate.pgate):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""
|
2017-11-30 01:11:15 +01:00
|
|
|
Pinv generates gds of a parametrically sized inverter. The
|
|
|
|
|
size is specified as the drive size (relative to minimum NMOS) and
|
|
|
|
|
a beta value for choosing the pmos size. The inverter's cell
|
|
|
|
|
height is usually the same as the 6t library cell and is measured
|
2020-04-23 23:43:54 +02:00
|
|
|
from center of rail to rail.
|
2016-11-08 18:57:35 +01:00
|
|
|
"""
|
2020-06-25 15:32:07 +02:00
|
|
|
# binning %error tracker
|
|
|
|
|
bin_count = 0
|
|
|
|
|
bin_error = 0
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2020-05-12 01:22:08 +02:00
|
|
|
def __init__(self, name, size=1, beta=parameter["beta"], height=None, add_wells=True):
|
2019-04-26 20:57:29 +02:00
|
|
|
|
2019-10-06 19:30:16 +02:00
|
|
|
debug.info(2,
|
|
|
|
|
"creating pinv structure {0} with size of {1}".format(name,
|
|
|
|
|
size))
|
2019-01-24 02:27:15 +01:00
|
|
|
self.add_comment("size: {}".format(size))
|
2019-04-26 20:57:29 +02:00
|
|
|
|
2018-11-08 09:10:51 +01:00
|
|
|
self.size = size
|
2020-05-14 01:54:26 +02:00
|
|
|
debug.check(self.size >= 1, "Must have a size greater than or equal to 1.")
|
2017-11-29 21:31:00 +01:00
|
|
|
self.nmos_size = size
|
2019-10-06 19:30:16 +02:00
|
|
|
self.pmos_size = beta * size
|
2016-11-08 18:57:35 +01:00
|
|
|
self.beta = beta
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-08-06 20:33:26 +02:00
|
|
|
super().__init__(name, height, add_wells)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-08-27 23:18:32 +02:00
|
|
|
def create_netlist(self):
|
|
|
|
|
""" Calls all functions related to the generation of the netlist """
|
|
|
|
|
self.add_pins()
|
2018-08-28 01:42:48 +02:00
|
|
|
self.determine_tx_mults()
|
|
|
|
|
self.add_ptx()
|
2019-10-06 19:30:16 +02:00
|
|
|
self.create_ptx()
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
def create_layout(self):
|
2017-12-01 17:31:16 +01:00
|
|
|
""" Calls all functions related to the generation of the layout """
|
2018-08-28 01:42:48 +02:00
|
|
|
self.place_ptx()
|
2020-05-12 01:22:08 +02:00
|
|
|
if self.add_wells:
|
|
|
|
|
self.add_well_contacts()
|
2020-02-25 18:09:07 +01:00
|
|
|
self.determine_width()
|
2020-02-06 17:20:09 +01:00
|
|
|
self.extend_wells()
|
2019-10-06 19:30:16 +02:00
|
|
|
self.route_input_gate(self.pmos_inst,
|
|
|
|
|
self.nmos_inst,
|
|
|
|
|
self.output_pos.y,
|
|
|
|
|
"A",
|
|
|
|
|
position="farleft")
|
2017-12-12 23:53:19 +01:00
|
|
|
self.route_outputs()
|
2020-05-13 23:46:42 +02:00
|
|
|
self.route_supply_rails()
|
|
|
|
|
self.connect_rails()
|
2020-04-22 00:21:57 +02:00
|
|
|
self.add_boundary()
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-08-28 01:42:48 +02:00
|
|
|
def add_pins(self):
|
|
|
|
|
""" Adds pins for spice netlist """
|
2019-05-07 09:52:27 +02:00
|
|
|
pin_list = ["A", "Z", "vdd", "gnd"]
|
2019-08-06 23:14:09 +02:00
|
|
|
dir_list = ["INPUT", "OUTPUT", "POWER", "GROUND"]
|
2019-05-07 09:52:27 +02:00
|
|
|
self.add_pin_list(pin_list, dir_list)
|
2018-08-28 01:42:48 +02:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
def determine_tx_mults(self):
|
2017-11-29 21:31:00 +01:00
|
|
|
"""
|
|
|
|
|
Determines the number of fingers needed to achieve the size within
|
|
|
|
|
the height constraint. This may fail if the user has a tight height.
|
|
|
|
|
"""
|
2018-08-28 01:42:48 +02:00
|
|
|
|
|
|
|
|
# This may make the result differ when the layout is created...
|
|
|
|
|
if OPTS.netlist_only:
|
|
|
|
|
self.tx_mults = 1
|
2019-10-06 19:30:16 +02:00
|
|
|
self.nmos_width = self.nmos_size * drc("minwidth_tx")
|
|
|
|
|
self.pmos_width = self.pmos_size * drc("minwidth_tx")
|
2020-10-28 17:54:15 +01:00
|
|
|
if cell_props.ptx.bin_spice_models:
|
2020-10-13 02:08:32 +02:00
|
|
|
(self.nmos_width, self.tx_mults) = pgate.pgate.best_bin("nmos", self.nmos_width)
|
|
|
|
|
(self.pmos_width, self.tx_mults) = pgate.pgate.best_bin("pmos", self.pmos_width)
|
2018-08-28 01:42:48 +02:00
|
|
|
return
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2017-11-29 21:31:00 +01:00
|
|
|
# Do a quick sanity check and bail if unlikely feasible height
|
2019-10-06 19:30:16 +02:00
|
|
|
# Sanity check. can we make an inverter in the height
|
|
|
|
|
# with minimum tx sizes?
|
|
|
|
|
# Assume we need 3 metal 1 pitches (2 power rails, one
|
|
|
|
|
# between the tx for the drain)
|
2017-11-29 21:31:00 +01:00
|
|
|
# plus the tx height
|
2020-01-30 02:45:33 +01:00
|
|
|
nmos = factory.create(module_type="ptx",
|
|
|
|
|
tx_type="nmos")
|
2019-10-06 19:30:16 +02:00
|
|
|
pmos = factory.create(module_type="ptx",
|
|
|
|
|
width=drc("minwidth_tx"),
|
|
|
|
|
tx_type="pmos")
|
2017-12-01 00:58:16 +01:00
|
|
|
tx_height = nmos.poly_height + pmos.poly_height
|
2017-11-30 22:42:55 +01:00
|
|
|
# rotated m1 pitch or poly to active spacing
|
2020-01-30 02:45:33 +01:00
|
|
|
min_channel = max(contact.poly_contact.width + self.m1_space,
|
|
|
|
|
contact.poly_contact.width + 2 * self.poly_to_active)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-04-09 01:45:28 +02:00
|
|
|
total_height = tx_height + min_channel + 2 * self.top_bottom_space
|
|
|
|
|
# debug.check(self.height > total_height,
|
|
|
|
|
# "Cell height {0} too small for simple min height {1}.".format(self.height,
|
|
|
|
|
# total_height))
|
|
|
|
|
if total_height > self.height:
|
|
|
|
|
msg = "Cell height {0} too small for simple min height {1}.".format(self.height, total_height)
|
|
|
|
|
raise drc_error(msg)
|
2019-10-06 19:30:16 +02:00
|
|
|
|
|
|
|
|
# Determine the height left to the transistors to determine
|
|
|
|
|
# the number of fingers
|
|
|
|
|
tx_height_available = self.height - min_channel - 2 * self.top_bottom_space
|
|
|
|
|
# Divide the height in half. Could divide proportional to beta,
|
|
|
|
|
# but this makes connecting wells of multiple cells easier.
|
2017-12-01 00:58:16 +01:00
|
|
|
# Subtract the poly space under the rail of the tx
|
2019-12-13 23:13:41 +01:00
|
|
|
nmos_height_available = 0.5 * tx_height_available - 0.5 * self.poly_space
|
|
|
|
|
pmos_height_available = 0.5 * tx_height_available - 0.5 * self.poly_space
|
2019-10-06 19:30:16 +02:00
|
|
|
|
|
|
|
|
debug.info(2,
|
|
|
|
|
"Height avail {0:.4f} PMOS {1:.4f} NMOS {2:.4f}".format(tx_height_available,
|
|
|
|
|
nmos_height_available,
|
|
|
|
|
pmos_height_available))
|
|
|
|
|
|
|
|
|
|
# Determine the number of mults for each to fit width
|
|
|
|
|
# into available space
|
2020-10-28 17:54:15 +01:00
|
|
|
if not cell_props.ptx.bin_spice_models:
|
2020-04-18 14:26:39 +02:00
|
|
|
self.nmos_width = self.nmos_size * drc("minwidth_tx")
|
|
|
|
|
self.pmos_width = self.pmos_size * drc("minwidth_tx")
|
|
|
|
|
nmos_required_mults = max(int(ceil(self.nmos_width / nmos_height_available)), 1)
|
|
|
|
|
pmos_required_mults = max(int(ceil(self.pmos_width / pmos_height_available)), 1)
|
|
|
|
|
# The mults must be the same for easy connection of poly
|
|
|
|
|
self.tx_mults = max(nmos_required_mults, pmos_required_mults)
|
|
|
|
|
|
|
|
|
|
# Recompute each mult width and check it isn't too small
|
|
|
|
|
# This could happen if the height is narrow and the size is small
|
|
|
|
|
# User should pick a bigger size to fix it...
|
|
|
|
|
# We also need to round the width to the grid or we will end up
|
|
|
|
|
# with LVS property mismatch errors when fingers are not a grid
|
|
|
|
|
# length and get rounded in the offset geometry.
|
|
|
|
|
self.nmos_width = round_to_grid(self.nmos_width / self.tx_mults)
|
|
|
|
|
# debug.check(self.nmos_width >= drc("minwidth_tx"),
|
|
|
|
|
# "Cannot finger NMOS transistors to fit cell height.")
|
|
|
|
|
if self.nmos_width < drc("minwidth_tx"):
|
|
|
|
|
raise drc_error("Cannot finger NMOS transistors to fit cell height.")
|
|
|
|
|
|
|
|
|
|
self.pmos_width = round_to_grid(self.pmos_width / self.tx_mults)
|
|
|
|
|
#debug.check(self.pmos_width >= drc("minwidth_tx"),
|
|
|
|
|
# "Cannot finger PMOS transistors to fit cell height.")
|
|
|
|
|
if self.pmos_width < drc("minwidth_tx"):
|
|
|
|
|
raise drc_error("Cannot finger NMOS transistors to fit cell height.")
|
|
|
|
|
else:
|
|
|
|
|
self.nmos_width = self.nmos_size * drc("minwidth_tx")
|
|
|
|
|
self.pmos_width = self.pmos_size * drc("minwidth_tx")
|
2020-07-16 02:15:42 +02:00
|
|
|
nmos_bins = self.scaled_bins("nmos", self.nmos_width)
|
|
|
|
|
pmos_bins = self.scaled_bins("pmos", self.pmos_width)
|
2020-04-18 14:26:39 +02:00
|
|
|
|
|
|
|
|
valid_pmos = []
|
|
|
|
|
for bin in pmos_bins:
|
2020-06-25 15:44:07 +02:00
|
|
|
if abs(self.bin_accuracy(self.pmos_width, bin[0])) > OPTS.accuracy_requirement and abs(self.bin_accuracy(self.pmos_width, bin[0])) <= 1:
|
2020-04-18 14:26:39 +02:00
|
|
|
valid_pmos.append(bin)
|
|
|
|
|
valid_pmos.sort(key = operator.itemgetter(1))
|
|
|
|
|
|
|
|
|
|
valid_nmos = []
|
|
|
|
|
for bin in nmos_bins:
|
2020-06-25 15:44:07 +02:00
|
|
|
if abs(self.bin_accuracy(self.nmos_width, bin[0])) > OPTS.accuracy_requirement and abs(self.bin_accuracy(self.nmos_width, bin[0])) <= 1:
|
2020-04-18 14:26:39 +02:00
|
|
|
valid_nmos.append(bin)
|
|
|
|
|
valid_nmos.sort(key = operator.itemgetter(1))
|
|
|
|
|
|
|
|
|
|
for bin in valid_pmos:
|
|
|
|
|
if bin[0]/bin[1] < pmos_height_available:
|
2020-04-18 14:34:55 +02:00
|
|
|
self.pmos_width = bin[0]/bin[1]
|
2020-06-25 15:32:07 +02:00
|
|
|
pmos_mults = bin[1]
|
2020-04-18 14:26:39 +02:00
|
|
|
break
|
|
|
|
|
|
|
|
|
|
for bin in valid_nmos:
|
|
|
|
|
if bin[0]/bin[1] < nmos_height_available:
|
2020-04-18 14:34:55 +02:00
|
|
|
self.nmos_width = bin[0]/bin[1]
|
2020-06-25 15:32:07 +02:00
|
|
|
nmos_mults = bin[1]
|
2020-04-18 14:26:39 +02:00
|
|
|
break
|
2020-04-18 14:34:55 +02:00
|
|
|
|
|
|
|
|
self.tx_mults = max(pmos_mults, nmos_mults)
|
2020-06-25 15:32:07 +02:00
|
|
|
debug.info(2, "prebinning {0} tx, target: {4}, found {1} x {2} = {3}".format("pmos", self.pmos_width, pmos_mults, self.pmos_width * pmos_mults, self.pmos_size * drc("minwidth_tx")))
|
|
|
|
|
debug.info(2, "prebinning {0} tx, target: {4}, found {1} x {2} = {3}".format("nmos", self.nmos_width, nmos_mults, self.nmos_width * nmos_mults, self.nmos_size * drc("minwidth_tx")))
|
|
|
|
|
pinv.bin_count += 1
|
2020-06-25 17:02:08 +02:00
|
|
|
pinv.bin_error += abs(((self.pmos_width * pmos_mults) - (self.pmos_size * drc("minwidth_tx")))/(self.pmos_size * drc("minwidth_tx")))
|
2020-06-25 15:32:07 +02:00
|
|
|
pinv.bin_count += 1
|
2020-06-25 17:02:08 +02:00
|
|
|
pinv.bin_error += abs(((self.nmos_width * nmos_mults) - (self.nmos_size * drc("minwidth_tx")))/(self.nmos_size * drc("minwidth_tx")))
|
2020-06-25 15:32:07 +02:00
|
|
|
debug.info(2, "pinv bin count: {0} pinv bin error: {1} percent error {2}".format(pinv.bin_count, pinv.bin_error, pinv.bin_error/pinv.bin_count))
|
|
|
|
|
|
2018-08-28 01:42:48 +02:00
|
|
|
def add_ptx(self):
|
2017-11-30 01:11:15 +01:00
|
|
|
""" Create the PMOS and NMOS transistors. """
|
2019-01-17 01:30:31 +01:00
|
|
|
self.nmos = factory.create(module_type="ptx",
|
|
|
|
|
width=self.nmos_width,
|
|
|
|
|
mults=self.tx_mults,
|
|
|
|
|
tx_type="nmos",
|
2020-05-07 21:35:21 +02:00
|
|
|
add_source_contact=self.route_layer,
|
2020-04-23 23:43:54 +02:00
|
|
|
add_drain_contact=self.route_layer,
|
2019-01-17 01:30:31 +01:00
|
|
|
connect_poly=True,
|
2020-04-23 23:43:54 +02:00
|
|
|
connect_drain_active=True)
|
2016-11-08 18:57:35 +01:00
|
|
|
self.add_mod(self.nmos)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-01-17 01:30:31 +01:00
|
|
|
self.pmos = factory.create(module_type="ptx",
|
|
|
|
|
width=self.pmos_width,
|
|
|
|
|
mults=self.tx_mults,
|
|
|
|
|
tx_type="pmos",
|
2020-05-07 21:35:21 +02:00
|
|
|
add_source_contact=self.route_layer,
|
2020-04-23 23:43:54 +02:00
|
|
|
add_drain_contact=self.route_layer,
|
2019-01-17 01:30:31 +01:00
|
|
|
connect_poly=True,
|
2020-04-23 23:43:54 +02:00
|
|
|
connect_drain_active=True)
|
2016-11-08 18:57:35 +01:00
|
|
|
self.add_mod(self.pmos)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-08-28 01:42:48 +02:00
|
|
|
def create_ptx(self):
|
2019-10-06 19:30:16 +02:00
|
|
|
"""
|
2018-08-28 01:42:48 +02:00
|
|
|
Create the PMOS and NMOS netlist.
|
|
|
|
|
"""
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-10-06 19:30:16 +02:00
|
|
|
self.pmos_inst = self.add_inst(name="pinv_pmos",
|
|
|
|
|
mod=self.pmos)
|
2018-08-28 01:42:48 +02:00
|
|
|
self.connect_inst(["Z", "A", "vdd", "vdd"])
|
|
|
|
|
|
2019-10-06 19:30:16 +02:00
|
|
|
self.nmos_inst = self.add_inst(name="pinv_nmos",
|
|
|
|
|
mod=self.nmos)
|
2018-08-28 01:42:48 +02:00
|
|
|
self.connect_inst(["Z", "A", "gnd", "gnd"])
|
|
|
|
|
|
|
|
|
|
def place_ptx(self):
|
2019-10-06 19:30:16 +02:00
|
|
|
"""
|
2018-08-28 01:42:48 +02:00
|
|
|
Place PMOS and NMOS to the layout at the upper-most and lowest position
|
2017-11-30 01:11:15 +01:00
|
|
|
to provide maximum routing in channel
|
|
|
|
|
"""
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2017-11-30 01:11:15 +01:00
|
|
|
# place PMOS so it is half a poly spacing down from the top
|
2019-10-06 19:30:16 +02:00
|
|
|
self.pmos_pos = self.pmos.active_offset.scale(1, 0) \
|
|
|
|
|
+ vector(0,
|
|
|
|
|
self.height - self.pmos.active_height - self.top_bottom_space)
|
2018-08-28 02:25:39 +02:00
|
|
|
self.pmos_inst.place(self.pmos_pos)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2017-11-30 01:11:15 +01:00
|
|
|
# place NMOS so that it is half a poly spacing up from the bottom
|
2019-10-06 19:30:16 +02:00
|
|
|
self.nmos_pos = self.nmos.active_offset.scale(1, 0) \
|
|
|
|
|
+ vector(0, self.top_bottom_space)
|
2018-08-28 02:25:39 +02:00
|
|
|
self.nmos_inst.place(self.nmos_pos)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-01-26 21:39:00 +01:00
|
|
|
# Output position will be in between the PMOS and NMOS drains
|
|
|
|
|
pmos_drain_pos = self.pmos_inst.get_pin("D").ll()
|
|
|
|
|
nmos_drain_pos = self.nmos_inst.get_pin("D").ul()
|
2019-10-06 19:30:16 +02:00
|
|
|
self.output_pos = vector(0, 0.5 * (pmos_drain_pos.y + nmos_drain_pos.y))
|
2017-12-12 23:53:19 +01:00
|
|
|
|
|
|
|
|
def route_outputs(self):
|
2019-10-06 19:30:16 +02:00
|
|
|
"""
|
|
|
|
|
Route the output (drains) together.
|
|
|
|
|
Optionally, routes output to edge.
|
|
|
|
|
"""
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2017-11-30 01:11:15 +01:00
|
|
|
# Get the drain pins
|
|
|
|
|
nmos_drain_pin = self.nmos_inst.get_pin("D")
|
|
|
|
|
pmos_drain_pin = self.pmos_inst.get_pin("D")
|
|
|
|
|
|
2017-12-01 00:58:16 +01:00
|
|
|
# Pick point at right most of NMOS and connect down to PMOS
|
2019-04-17 22:41:35 +02:00
|
|
|
nmos_drain_pos = nmos_drain_pin.bc()
|
2019-04-01 23:23:47 +02:00
|
|
|
pmos_drain_pos = vector(nmos_drain_pos.x, pmos_drain_pin.uc().y)
|
2020-04-23 23:43:54 +02:00
|
|
|
self.add_path(self.route_layer, [nmos_drain_pos, pmos_drain_pos])
|
2017-11-30 01:11:15 +01:00
|
|
|
|
|
|
|
|
# Remember the mid for the output
|
2019-10-06 19:30:16 +02:00
|
|
|
mid_drain_offset = vector(nmos_drain_pos.x, self.output_pos.y)
|
2017-12-12 23:53:19 +01:00
|
|
|
|
2020-04-23 23:43:54 +02:00
|
|
|
# This leaves the output as an internal pin (min sized)
|
|
|
|
|
output_offset = mid_drain_offset + vector(0.5 * self.route_layer_width, 0)
|
|
|
|
|
self.add_layout_pin_rect_center(text="Z",
|
|
|
|
|
layer=self.route_layer,
|
|
|
|
|
offset=output_offset)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
def add_well_contacts(self):
|
2017-12-01 17:31:16 +01:00
|
|
|
""" Add n/p well taps to the layout and connect to supplies """
|
2017-11-30 01:11:15 +01:00
|
|
|
|
2018-01-11 19:24:44 +01:00
|
|
|
self.add_nwell_contact(self.pmos, self.pmos_pos)
|
2017-11-30 01:11:15 +01:00
|
|
|
|
2018-01-11 19:24:44 +01:00
|
|
|
self.add_pwell_contact(self.nmos, self.nmos_pos)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
def connect_rails(self):
|
2017-11-30 01:11:15 +01:00
|
|
|
""" Connect the nmos and pmos to its respective power rails """
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2019-10-06 19:30:16 +02:00
|
|
|
self.connect_pin_to_rail(self.nmos_inst, "S", "gnd")
|
2017-12-12 23:53:19 +01:00
|
|
|
|
2019-10-06 19:30:16 +02:00
|
|
|
self.connect_pin_to_rail(self.pmos_inst, "S", "vdd")
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-03-05 04:27:53 +01:00
|
|
|
def analytical_power(self, corner, load):
|
2018-03-02 08:34:15 +01:00
|
|
|
"""Returns dynamic and leakage power. Results in nW"""
|
2018-02-22 04:51:21 +01:00
|
|
|
c_eff = self.calculate_effective_capacitance(load)
|
2019-09-05 01:08:18 +02:00
|
|
|
freq = spice["default_event_frequency"]
|
2019-03-05 04:27:53 +01:00
|
|
|
power_dyn = self.calc_dynamic_power(corner, c_eff, freq)
|
2018-02-22 04:51:21 +01:00
|
|
|
power_leak = spice["inv_leakage"]
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-02-22 04:51:21 +01:00
|
|
|
total_power = self.return_power(power_dyn, power_leak)
|
|
|
|
|
return total_power
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-02-22 04:51:21 +01:00
|
|
|
def calculate_effective_capacitance(self, load):
|
2018-03-02 08:34:15 +01:00
|
|
|
"""Computes effective capacitance. Results in fF"""
|
2018-02-22 04:51:21 +01:00
|
|
|
c_load = load
|
2019-10-06 19:30:16 +02:00
|
|
|
# In fF
|
|
|
|
|
c_para = spice["min_tx_drain_c"] * (self.nmos_size / parameter["min_tx_size"])
|
2019-09-05 01:08:18 +02:00
|
|
|
transition_prob = 0.5
|
2019-10-06 19:30:16 +02:00
|
|
|
return transition_prob * (c_load + c_para)
|
2018-11-08 09:10:51 +01:00
|
|
|
|
2019-08-07 10:50:48 +02:00
|
|
|
def input_load(self):
|
2019-10-06 19:30:16 +02:00
|
|
|
"""
|
|
|
|
|
Return the capacitance of the gate connection in generic capacitive
|
|
|
|
|
units relative to the minimum width of a transistor
|
|
|
|
|
"""
|
2019-08-07 10:50:48 +02:00
|
|
|
return self.nmos_size + self.pmos_size
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-01-23 21:03:52 +01:00
|
|
|
def get_stage_effort(self, cout, inp_is_rise=True):
|
2018-11-15 08:34:53 +01:00
|
|
|
"""
|
2019-10-06 19:30:16 +02:00
|
|
|
Returns an object representing the parameters for delay in tau units.
|
|
|
|
|
Optional is_rise refers to the input direction rise/fall.
|
|
|
|
|
Input inverted by this stage.
|
|
|
|
|
"""
|
|
|
|
|
parasitic_delay = 1
|
|
|
|
|
return logical_effort.logical_effort(self.name,
|
|
|
|
|
self.size,
|
|
|
|
|
self.input_load(),
|
|
|
|
|
cout,
|
|
|
|
|
parasitic_delay,
|
2019-05-07 09:52:27 +02:00
|
|
|
not inp_is_rise)
|
|
|
|
|
|
2019-10-06 19:30:16 +02:00
|
|
|
def build_graph(self, graph, inst_name, port_nets):
|
|
|
|
|
"""
|
|
|
|
|
Adds edges based on inputs/outputs.
|
|
|
|
|
Overrides base class function.
|
|
|
|
|
"""
|
|
|
|
|
self.add_graph_edges(graph, port_nets)
|
2020-11-18 00:05:07 +01:00
|
|
|
|
|
|
|
|
def is_non_inverting(self):
|
|
|
|
|
"""Return input to output polarity for module"""
|
|
|
|
|
|
|
|
|
|
return False
|