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
|
|
|
|
|
from tech import drc
|
|
|
|
|
from vector import vector
|
2019-01-17 01:15:38 +01:00
|
|
|
from sram_factory import factory
|
2016-11-08 18:57:35 +01:00
|
|
|
import debug
|
|
|
|
|
from globals import OPTS
|
2019-04-04 01:19:49 +02:00
|
|
|
import logical_effort
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2020-03-31 19:15:46 +02:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
class sense_amp_array(design.design):
|
|
|
|
|
"""
|
|
|
|
|
Array of sense amplifiers to read the bitlines through the column mux.
|
|
|
|
|
Dynamically generated sense amp array for all bitlines.
|
|
|
|
|
"""
|
|
|
|
|
|
2020-06-07 18:27:25 +02:00
|
|
|
def __init__(self, name, word_size, words_per_row, num_spare_cols=None, column_offset=0):
|
|
|
|
|
|
2019-01-17 01:15:38 +01:00
|
|
|
design.design.__init__(self, name)
|
2016-11-08 18:57:35 +01:00
|
|
|
debug.info(1, "Creating {0}".format(self.name))
|
2020-03-31 05:00:32 +02:00
|
|
|
self.add_comment("word_size {0}".format(word_size))
|
2019-01-26 00:00:00 +01:00
|
|
|
self.add_comment("words_per_row: {0}".format(words_per_row))
|
2016-11-08 18:57:35 +01:00
|
|
|
|
|
|
|
|
self.word_size = word_size
|
2020-06-07 18:27:25 +02:00
|
|
|
self.words_per_row = words_per_row
|
2020-04-14 05:09:10 +02:00
|
|
|
if not num_spare_cols:
|
|
|
|
|
self.num_spare_cols = 0
|
|
|
|
|
else:
|
|
|
|
|
self.num_spare_cols = num_spare_cols
|
|
|
|
|
|
2020-06-05 20:29:31 +02:00
|
|
|
self.column_offset = column_offset
|
2017-08-24 00:02:15 +02:00
|
|
|
self.row_size = self.word_size * self.words_per_row
|
|
|
|
|
|
2018-08-28 19:24:09 +02:00
|
|
|
self.create_netlist()
|
|
|
|
|
if not OPTS.netlist_only:
|
|
|
|
|
self.create_layout()
|
|
|
|
|
|
2020-02-17 14:09:50 +01:00
|
|
|
def get_bl_name(self):
|
2020-02-17 14:27:35 +01:00
|
|
|
bl_name = "bl"
|
2020-02-17 14:09:50 +01:00
|
|
|
return bl_name
|
2020-02-12 14:04:05 +01:00
|
|
|
|
2020-02-17 14:09:50 +01:00
|
|
|
def get_br_name(self):
|
2020-02-17 14:27:35 +01:00
|
|
|
br_name = "br"
|
2020-02-17 14:09:50 +01:00
|
|
|
return br_name
|
2020-02-12 14:04:05 +01:00
|
|
|
|
2020-02-17 14:25:55 +01:00
|
|
|
@property
|
|
|
|
|
def data_name(self):
|
|
|
|
|
return "data"
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def en_name(self):
|
|
|
|
|
return "en"
|
|
|
|
|
|
2018-08-28 19:24:09 +02:00
|
|
|
def create_netlist(self):
|
|
|
|
|
self.add_modules()
|
|
|
|
|
self.add_pins()
|
|
|
|
|
self.create_sense_amp_array()
|
|
|
|
|
|
|
|
|
|
def create_layout(self):
|
2017-08-24 00:02:15 +02:00
|
|
|
self.height = self.amp.height
|
2020-03-31 05:00:32 +02:00
|
|
|
|
2018-09-01 08:28:06 +02:00
|
|
|
if self.bitcell.width > self.amp.width:
|
2020-04-14 05:09:10 +02:00
|
|
|
self.width = self.bitcell.width * (self.word_size * self.words_per_row + self.num_spare_cols)
|
2018-09-01 08:28:06 +02:00
|
|
|
else:
|
2020-04-14 05:09:10 +02:00
|
|
|
self.width = self.amp.width * (self.word_size * self.words_per_row + self.num_spare_cols)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-08-28 19:24:09 +02:00
|
|
|
self.place_sense_amp_array()
|
|
|
|
|
self.add_layout_pins()
|
|
|
|
|
self.route_rails()
|
2019-05-28 01:32:38 +02:00
|
|
|
self.add_boundary()
|
2016-11-08 18:57:35 +01:00
|
|
|
self.DRC_LVS()
|
|
|
|
|
|
|
|
|
|
def add_pins(self):
|
2020-04-14 05:09:10 +02:00
|
|
|
for i in range(0,self.word_size + self.num_spare_cols):
|
2020-02-17 14:25:55 +01:00
|
|
|
self.add_pin(self.data_name + "_{0}".format(i), "OUTPUT")
|
|
|
|
|
self.add_pin(self.get_bl_name() + "_{0}".format(i), "INPUT")
|
|
|
|
|
self.add_pin(self.get_br_name() + "_{0}".format(i), "INPUT")
|
|
|
|
|
self.add_pin(self.en_name, "INPUT")
|
2019-08-06 23:14:09 +02:00
|
|
|
self.add_pin("vdd", "POWER")
|
|
|
|
|
self.add_pin("gnd", "GROUND")
|
2020-03-31 05:00:32 +02:00
|
|
|
|
2018-08-28 19:24:09 +02:00
|
|
|
def add_modules(self):
|
2019-01-17 01:15:38 +01:00
|
|
|
self.amp = factory.create(module_type="sense_amp")
|
2020-03-31 05:00:32 +02:00
|
|
|
|
2018-08-28 19:24:09 +02:00
|
|
|
self.add_mod(self.amp)
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-09-04 20:55:22 +02:00
|
|
|
# This is just used for measurements,
|
|
|
|
|
# so don't add the module
|
2019-01-17 01:15:38 +01:00
|
|
|
self.bitcell = factory.create(module_type="bitcell")
|
2020-03-31 05:00:32 +02:00
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
def create_sense_amp_array(self):
|
|
|
|
|
self.local_insts = []
|
2020-04-14 05:09:10 +02:00
|
|
|
for i in range(0,self.word_size + self.num_spare_cols):
|
2017-08-24 00:02:15 +02:00
|
|
|
name = "sa_d{0}".format(i)
|
2018-08-27 20:13:34 +02:00
|
|
|
self.local_insts.append(self.add_inst(name=name,
|
|
|
|
|
mod=self.amp))
|
2020-02-17 14:25:55 +01:00
|
|
|
self.connect_inst([self.get_bl_name() + "_{0}".format(i),
|
|
|
|
|
self.get_br_name() + "_{0}".format(i),
|
|
|
|
|
self.data_name + "_{0}".format(i),
|
|
|
|
|
self.en_name, "vdd", "gnd"])
|
2017-08-24 00:02:15 +02:00
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
def place_sense_amp_array(self):
|
2020-01-27 17:20:48 +01:00
|
|
|
from tech import cell_properties
|
2018-09-01 08:28:06 +02:00
|
|
|
if self.bitcell.width > self.amp.width:
|
2020-06-07 18:27:25 +02:00
|
|
|
amp_spacing = self.bitcell.width
|
2018-09-01 08:28:06 +02:00
|
|
|
else:
|
2020-06-05 20:29:31 +02:00
|
|
|
amp_spacing = self.amp.width
|
2020-01-27 17:20:48 +01:00
|
|
|
|
2020-06-05 20:29:31 +02:00
|
|
|
for i in range(0, self.row_size, self.words_per_row):
|
|
|
|
|
index = int(i / self.words_per_row)
|
2020-06-07 18:27:25 +02:00
|
|
|
xoffset = i * amp_spacing
|
|
|
|
|
|
|
|
|
|
if cell_properties.bitcell.mirror.y and (i + self.column_offset) % 2:
|
2020-04-14 05:09:10 +02:00
|
|
|
mirror = "MY"
|
|
|
|
|
xoffset = xoffset + self.amp.width
|
|
|
|
|
else:
|
|
|
|
|
mirror = ""
|
2020-01-27 17:20:48 +01:00
|
|
|
|
2020-04-14 05:09:10 +02:00
|
|
|
amp_position = vector(xoffset, 0)
|
2020-06-07 18:27:25 +02:00
|
|
|
self.local_insts[index].place(offset=amp_position, mirror=mirror)
|
2020-04-14 05:09:10 +02:00
|
|
|
|
|
|
|
|
# place spare sense amps (will share the same enable as regular sense amps)
|
|
|
|
|
for i in range(0,self.num_spare_cols):
|
|
|
|
|
index = self.word_size + i
|
2020-06-07 18:27:25 +02:00
|
|
|
xoffset = ((self.word_size * self.words_per_row) + i) * amp_spacing
|
2020-01-27 17:20:48 +01:00
|
|
|
|
2020-06-05 20:29:31 +02:00
|
|
|
if cell_properties.bitcell.mirror.y and (i + self.column_offset) % 2:
|
2020-01-27 17:20:48 +01:00
|
|
|
mirror = "MY"
|
|
|
|
|
xoffset = xoffset + self.amp.width
|
|
|
|
|
else:
|
|
|
|
|
mirror = ""
|
|
|
|
|
|
|
|
|
|
amp_position = vector(xoffset, 0)
|
2020-06-05 20:29:31 +02:00
|
|
|
self.local_insts[index].place(offset=amp_position, mirror=mirror)
|
2018-08-27 20:13:34 +02:00
|
|
|
|
|
|
|
|
def add_layout_pins(self):
|
|
|
|
|
for i in range(len(self.local_insts)):
|
|
|
|
|
inst = self.local_insts[i]
|
2019-12-23 16:37:16 +01:00
|
|
|
|
2020-04-16 20:27:26 +02:00
|
|
|
gnd_pin = inst.get_pin("gnd")
|
2020-03-31 19:15:46 +02:00
|
|
|
self.add_power_pin(name="gnd",
|
2020-04-16 20:27:26 +02:00
|
|
|
loc=gnd_pin.center(),
|
|
|
|
|
start_layer=gnd_pin.layer,
|
2020-05-07 21:35:21 +02:00
|
|
|
directions=("V", "V"))
|
2020-04-16 20:27:26 +02:00
|
|
|
|
|
|
|
|
vdd_pin = inst.get_pin("vdd")
|
2020-03-31 19:15:46 +02:00
|
|
|
self.add_power_pin(name="vdd",
|
2020-04-16 20:27:26 +02:00
|
|
|
loc=vdd_pin.center(),
|
|
|
|
|
start_layer=vdd_pin.layer,
|
2020-05-07 21:35:21 +02:00
|
|
|
directions=("V", "V"))
|
2018-08-27 20:13:34 +02:00
|
|
|
|
2020-02-17 14:25:55 +01:00
|
|
|
bl_pin = inst.get_pin(inst.mod.get_bl_names())
|
|
|
|
|
br_pin = inst.get_pin(inst.mod.get_br_names())
|
|
|
|
|
dout_pin = inst.get_pin(inst.mod.dout_name)
|
|
|
|
|
|
|
|
|
|
self.add_layout_pin(text=self.get_bl_name() + "_{0}".format(i),
|
2020-03-31 05:00:32 +02:00
|
|
|
layer=bl_pin.layer,
|
2018-08-27 20:13:34 +02:00
|
|
|
offset=bl_pin.ll(),
|
2017-08-24 00:02:15 +02:00
|
|
|
width=bl_pin.width(),
|
|
|
|
|
height=bl_pin.height())
|
2020-02-17 14:25:55 +01:00
|
|
|
self.add_layout_pin(text=self.get_br_name() + "_{0}".format(i),
|
2020-03-31 05:00:32 +02:00
|
|
|
layer=br_pin.layer,
|
2018-08-27 20:13:34 +02:00
|
|
|
offset=br_pin.ll(),
|
2017-08-24 00:02:15 +02:00
|
|
|
width=br_pin.width(),
|
|
|
|
|
height=br_pin.height())
|
2020-02-17 14:25:55 +01:00
|
|
|
|
|
|
|
|
self.add_layout_pin(text=self.data_name + "_{0}".format(i),
|
2020-03-31 05:00:32 +02:00
|
|
|
layer=dout_pin.layer,
|
2018-08-27 20:13:34 +02:00
|
|
|
offset=dout_pin.ll(),
|
2017-08-24 00:02:15 +02:00
|
|
|
width=dout_pin.width(),
|
|
|
|
|
height=dout_pin.height())
|
2020-03-31 05:00:32 +02:00
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
def route_rails(self):
|
2016-11-08 18:57:35 +01:00
|
|
|
# add sclk rail across entire array
|
2020-03-31 05:00:32 +02:00
|
|
|
sclk = self.amp.get_pin(self.amp.en_name)
|
2020-03-31 19:15:46 +02:00
|
|
|
sclk_offset = self.amp.get_pin(self.amp.en_name).ll().scale(0, 1)
|
2020-02-17 14:25:55 +01:00
|
|
|
self.add_layout_pin(text=self.en_name,
|
2020-03-31 19:15:46 +02:00
|
|
|
layer=sclk.layer,
|
|
|
|
|
offset=sclk_offset,
|
|
|
|
|
width=self.width,
|
|
|
|
|
height=drc("minwidth_" + sclk.layer))
|
2017-05-30 21:50:07 +02:00
|
|
|
|
2018-10-23 21:55:54 +02:00
|
|
|
def input_load(self):
|
|
|
|
|
return self.amp.input_load()
|
2020-03-31 05:00:32 +02:00
|
|
|
|
2018-11-09 05:47:34 +01:00
|
|
|
def get_en_cin(self):
|
|
|
|
|
"""Get the relative capacitance of all the sense amp enable connections in the array"""
|
|
|
|
|
sense_amp_en_cin = self.amp.get_en_cin()
|
2019-02-06 06:15:12 +01:00
|
|
|
return sense_amp_en_cin * self.word_size
|
2020-03-31 05:00:32 +02:00
|
|
|
|
2019-04-04 01:19:49 +02:00
|
|
|
def get_drain_cin(self):
|
|
|
|
|
"""Get the relative capacitance of the drain of the PMOS isolation TX"""
|
2019-04-09 10:56:32 +02:00
|
|
|
from tech import parameter
|
2020-03-31 19:15:46 +02:00
|
|
|
# Bitcell drain load being used to estimate PMOS drain load
|
2019-04-09 10:56:32 +02:00
|
|
|
drain_load = logical_effort.convert_farad_to_relative_c(parameter['bitcell_drain_cap'])
|
|
|
|
|
return drain_load
|