2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2019-06-14 17:43:41 +02:00
|
|
|
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
|
|
|
|
# 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 design
|
|
|
|
|
import debug
|
|
|
|
|
import utils
|
2018-11-09 05:47:34 +01:00
|
|
|
from tech import GDS,layer, parameter,drc
|
2019-04-02 10:09:31 +02:00
|
|
|
import logical_effort
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
class sense_amp(design.design):
|
|
|
|
|
"""
|
|
|
|
|
This module implements the single sense amp cell used in the design. It
|
|
|
|
|
is a hand-made cell, so the layout and netlist should be available in
|
|
|
|
|
the technology library.
|
|
|
|
|
Sense amplifier to read a pair of bit-lines.
|
|
|
|
|
"""
|
|
|
|
|
|
2017-09-30 01:22:13 +02:00
|
|
|
pin_names = ["bl", "br", "dout", "en", "vdd", "gnd"]
|
2019-05-07 09:52:27 +02:00
|
|
|
type_list = ["INPUT", "INPUT", "OUTPUT", "INPUT", "POWER", "GROUND"]
|
2017-08-24 00:02:15 +02:00
|
|
|
(width,height) = utils.get_libcell_size("sense_amp", GDS["unit"], layer["boundary"])
|
2018-11-07 20:31:44 +01:00
|
|
|
pin_map = utils.get_libcell_pins(pin_names, "sense_amp", GDS["unit"])
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
def __init__(self, name):
|
|
|
|
|
design.design.__init__(self, name)
|
2017-11-14 22:24:14 +01:00
|
|
|
debug.info(2, "Create sense_amp")
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
self.width = sense_amp.width
|
|
|
|
|
self.height = sense_amp.height
|
|
|
|
|
self.pin_map = sense_amp.pin_map
|
2019-05-07 09:52:27 +02:00
|
|
|
self.add_pin_types(self.type_list)
|
|
|
|
|
|
2018-10-23 21:55:54 +02:00
|
|
|
def input_load(self):
|
|
|
|
|
#Input load for the bitlines which are connected to the source/drain of a TX. Not the selects.
|
2018-10-27 02:37:25 +02:00
|
|
|
from tech import spice, parameter
|
2018-11-08 01:09:50 +01:00
|
|
|
# Default is 8x. Per Samira and Hodges-Jackson book:
|
|
|
|
|
# "Column-mux transistors driven by the decoder must be sized for optimal speed"
|
2018-10-23 21:55:54 +02:00
|
|
|
bitline_pmos_size = 8 #FIXME: This should be set somewhere and referenced. Probably in tech file.
|
|
|
|
|
return spice["min_tx_drain_c"]*(bitline_pmos_size/parameter["min_tx_size"])#ff
|
|
|
|
|
|
2019-04-02 10:09:31 +02:00
|
|
|
def analytical_delay(self, corner, slew, load):
|
|
|
|
|
#Delay of the sense amp will depend on the size of the amp and the output load.
|
|
|
|
|
parasitic_delay = 1
|
|
|
|
|
cin = (parameter["sa_inv_pmos_size"] + parameter["sa_inv_nmos_size"])/drc("minwidth_tx")
|
|
|
|
|
sa_size = parameter["sa_inv_nmos_size"]/drc("minwidth_tx")
|
|
|
|
|
cc_inv_cin = cin
|
|
|
|
|
return logical_effort.logical_effort('column_mux', sa_size, cin, load+cc_inv_cin, parasitic_delay, False)
|
2017-05-30 21:50:07 +02: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"""
|
|
|
|
|
#Power in this module currently not defined. Returns 0 nW (leakage and dynamic).
|
2018-02-23 04:35:54 +01:00
|
|
|
total_power = self.return_power()
|
|
|
|
|
return total_power
|
2018-11-09 05:47:34 +01:00
|
|
|
|
|
|
|
|
def get_en_cin(self):
|
|
|
|
|
"""Get the relative capacitance of sense amp enable gate cin"""
|
|
|
|
|
pmos_cin = parameter["sa_en_pmos_size"]/drc("minwidth_tx")
|
|
|
|
|
nmos_cin = parameter["sa_en_nmos_size"]/drc("minwidth_tx")
|
2019-02-06 06:15:12 +01:00
|
|
|
#sen is connected to 2 pmos isolation TX and 1 nmos per sense amp.
|
2019-04-24 23:23:22 +02:00
|
|
|
return 2*pmos_cin + nmos_cin
|
2019-05-27 22:08:59 +02:00
|
|
|
|
|
|
|
|
def get_enable_name(self):
|
|
|
|
|
"""Returns name used for enable net"""
|
|
|
|
|
#FIXME: A better programmatic solution to designate pins
|
|
|
|
|
enable_name = "en"
|
|
|
|
|
debug.check(enable_name in self.pin_names, "Enable name {} not found in pin list".format(enable_name))
|
|
|
|
|
return enable_name
|
|
|
|
|
|
2019-04-24 23:23:22 +02:00
|
|
|
def build_graph(self, graph, inst_name, port_nets):
|
2019-05-07 09:52:27 +02:00
|
|
|
"""Adds edges based on inputs/outputs. Overrides base class function."""
|
|
|
|
|
self.add_graph_edges(graph, port_nets)
|
2019-04-24 23:23:22 +02:00
|
|
|
|