2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2024-01-03 23:32:44 +01:00
|
|
|
# Copyright (c) 2016-2024 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
|
|
|
#
|
2022-11-27 22:01:20 +01:00
|
|
|
from openram import debug
|
|
|
|
|
from openram.base import design
|
|
|
|
|
from openram.base import logical_effort
|
|
|
|
|
from openram.tech import parameter, drc, spice
|
|
|
|
|
from openram.tech import cell_properties as props
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2020-06-26 20:47:35 +02:00
|
|
|
|
2022-07-13 19:57:56 +02:00
|
|
|
class sense_amp(design):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""
|
|
|
|
|
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.
|
|
|
|
|
"""
|
|
|
|
|
|
2020-11-03 01:00:16 +01:00
|
|
|
def __init__(self, name="sense_amp"):
|
2020-11-14 17:08:42 +01:00
|
|
|
super().__init__(name, prop=props.sense_amp)
|
2020-11-03 01:00:16 +01:00
|
|
|
debug.info(2, "Create sense_amp")
|
|
|
|
|
|
2020-02-12 14:04:05 +01:00
|
|
|
def get_bl_names(self):
|
2020-11-16 20:04:03 +01:00
|
|
|
return "bl"
|
2020-02-12 14:04:05 +01:00
|
|
|
|
|
|
|
|
def get_br_names(self):
|
2020-11-16 20:04:03 +01:00
|
|
|
return "br"
|
2020-02-12 14:04:05 +01:00
|
|
|
|
2020-02-17 14:25:55 +01:00
|
|
|
@property
|
|
|
|
|
def dout_name(self):
|
2020-11-16 20:04:03 +01:00
|
|
|
return "dout"
|
2020-02-17 14:25:55 +01:00
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def en_name(self):
|
2020-11-16 20:04:03 +01:00
|
|
|
return "en"
|
2020-02-17 14:25:55 +01:00
|
|
|
|
2019-08-08 10:57:04 +02:00
|
|
|
def get_cin(self):
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-08-08 10:57:04 +02:00
|
|
|
# FIXME: This input load will be applied to both the s_en timing and bitline timing.
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-06-26 20:47:35 +02:00
|
|
|
# Input load for the bitlines which are connected to the source/drain of a TX. Not the selects.
|
2022-11-27 22:01:20 +01:00
|
|
|
from openram.tech import spice
|
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"
|
2020-06-26 20:47:35 +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 # ff
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-08-07 10:50:48 +02:00
|
|
|
def get_stage_effort(self, load):
|
2020-06-26 20:47:35 +02:00
|
|
|
# Delay of the sense amp will depend on the size of the amp and the output load.
|
2019-04-02 10:09:31 +02:00
|
|
|
parasitic_delay = 1
|
2020-06-26 20:47:35 +02:00
|
|
|
cin = (parameter["sa_inv_pmos_size"] + parameter["sa_inv_nmos_size"]) / drc("minwidth_tx")
|
|
|
|
|
sa_size = parameter["sa_inv_nmos_size"] / drc("minwidth_tx")
|
2019-04-02 10:09:31 +02:00
|
|
|
cc_inv_cin = cin
|
2022-07-13 19:57:56 +02:00
|
|
|
return 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"""
|
2020-06-26 20:47:35 +02:00
|
|
|
# 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
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-05-27 22:08:59 +02:00
|
|
|
def get_enable_name(self):
|
|
|
|
|
"""Returns name used for enable net"""
|
2020-06-26 20:47:35 +02:00
|
|
|
# FIXME: A better programmatic solution to designate pins
|
2020-02-17 14:25:55 +01:00
|
|
|
enable_name = self.en_name
|
2020-11-16 22:57:31 +01:00
|
|
|
debug.check(enable_name in self.pin_names, "Enable name {} not found in pin list".format(enable_name))
|
2019-05-27 22:08:59 +02:00
|
|
|
return enable_name
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-06-26 20:47:35 +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."""
|
2020-06-26 20:47:35 +02:00
|
|
|
self.add_graph_edges(graph, port_nets)
|
2022-07-22 18:52:38 +02:00
|
|
|
|
2020-11-18 00:05:07 +01:00
|
|
|
def is_non_inverting(self):
|
|
|
|
|
"""Return input to output polarity for module"""
|
2022-07-22 18:52:38 +02:00
|
|
|
|
2020-11-18 00:05:07 +01:00
|
|
|
#FIXME: This only applied to bl/br -> dout and not s_en->dout
|
2022-07-22 18:52:38 +02:00
|
|
|
return True
|
2021-07-12 23:25:37 +02:00
|
|
|
|
|
|
|
|
def get_on_resistance(self):
|
|
|
|
|
"""On resistance of pinv, defined by single nmos"""
|
2021-08-05 01:10:27 +02:00
|
|
|
is_nchannel = True
|
2021-07-12 23:25:37 +02:00
|
|
|
stack = 1
|
2022-07-22 18:52:38 +02:00
|
|
|
is_cell = False
|
|
|
|
|
return self.tr_r_on(parameter["sa_inv_nmos_size"], is_nchannel, stack, is_cell)
|
|
|
|
|
|
2021-07-21 21:24:08 +02:00
|
|
|
def get_input_capacitance(self):
|
|
|
|
|
"""Input cap of input, passes width of gates to gate cap function"""
|
2022-07-22 18:52:38 +02:00
|
|
|
return self.gate_c(parameter["sa_inv_nmos_size"])
|
|
|
|
|
|
2021-07-21 23:59:02 +02:00
|
|
|
def get_intrinsic_capacitance(self):
|
|
|
|
|
"""Get the drain capacitances of the TXs in the gate."""
|
|
|
|
|
stack = 1
|
|
|
|
|
mult = 1
|
|
|
|
|
# Add the inverter drain Cap and the bitline TX drain Cap
|
2022-07-22 18:52:38 +02:00
|
|
|
nmos_drain_c = self.drain_c_(parameter["sa_inv_nmos_size"]*mult,
|
2021-07-21 23:59:02 +02:00
|
|
|
stack,
|
|
|
|
|
mult)
|
2022-07-22 18:52:38 +02:00
|
|
|
pmos_drain_c = self.drain_c_(parameter["sa_inv_pmos_size"]*mult,
|
2021-07-21 23:59:02 +02:00
|
|
|
stack,
|
|
|
|
|
mult)
|
2022-07-22 18:52:38 +02:00
|
|
|
|
2021-07-21 23:59:02 +02:00
|
|
|
bitline_pmos_size = 8
|
2022-07-22 18:52:38 +02:00
|
|
|
bl_pmos_drain_c = self.drain_c_(drc("minwidth_tx")*bitline_pmos_size,
|
2021-07-21 23:59:02 +02:00
|
|
|
stack,
|
2022-07-22 18:52:38 +02:00
|
|
|
mult)
|
2021-07-21 23:59:02 +02:00
|
|
|
return nmos_drain_c + pmos_drain_c + bl_pmos_drain_c
|
2021-08-26 01:12:05 +02:00
|
|
|
|
2022-07-22 18:52:38 +02:00
|
|
|
def cacti_rc_delay(self, inputramptime, tf, vs1, vs2, rise, extra_param_dict):
|
2021-09-08 00:56:27 +02:00
|
|
|
""" Special RC delay function used by CACTI for sense amp delay
|
2021-08-26 01:12:05 +02:00
|
|
|
"""
|
|
|
|
|
import math
|
2022-07-22 18:52:38 +02:00
|
|
|
|
2021-09-01 23:27:13 +02:00
|
|
|
c_senseamp = extra_param_dict['load']
|
2022-07-22 18:52:38 +02:00
|
|
|
vdd = extra_param_dict['vdd']
|
2021-09-08 00:56:27 +02:00
|
|
|
tau = c_senseamp/spice["sa_transconductance"]
|
2021-09-01 23:27:13 +02:00
|
|
|
return tau*math.log(vdd/(0.1*vdd))
|