2019-06-20 01:03:21 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2020-05-28 05:03:11 +02:00
|
|
|
# Copyright (c) 2016-2019 Regents of the University of California
|
2019-06-20 01:03:21 +02:00
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
import debug
|
2020-08-06 20:17:49 +02:00
|
|
|
import bitcell_base_array
|
2020-05-28 05:03:11 +02:00
|
|
|
from tech import drc, spice, cell_properties
|
2019-06-20 01:03:21 +02:00
|
|
|
from vector import vector
|
|
|
|
|
from globals import OPTS
|
|
|
|
|
from sram_factory import factory
|
2020-01-30 02:58:30 +01:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
|
2020-08-06 20:17:49 +02:00
|
|
|
class replica_bitcell_array(bitcell_base_array.bitcell_base_array):
|
2019-06-20 01:03:21 +02:00
|
|
|
"""
|
2019-07-15 20:29:29 +02:00
|
|
|
Creates a bitcell arrow of cols x rows and then adds the replica
|
|
|
|
|
and dummy columns and rows. Replica columns are on the left and
|
|
|
|
|
right, respectively and connected to the given bitcell ports.
|
2019-06-20 01:03:21 +02:00
|
|
|
Dummy are the outside columns/rows with WL and BL tied to gnd.
|
2019-07-15 20:29:29 +02:00
|
|
|
Requires a regular bitcell array, replica bitcell, and dummy
|
|
|
|
|
bitcell (Bl/BR disconnected).
|
2019-06-20 01:03:21 +02:00
|
|
|
"""
|
2020-08-18 02:19:07 +02:00
|
|
|
def __init__(self, rows, cols, rbl, name, add_rbl=None):
|
2020-08-06 20:17:49 +02:00
|
|
|
super().__init__(name, rows, cols, column_offset=0)
|
2019-06-20 01:03:21 +02:00
|
|
|
debug.info(1, "Creating {0} {1} x {2}".format(self.name, rows, cols))
|
|
|
|
|
self.add_comment("rows: {0} cols: {1}".format(rows, cols))
|
|
|
|
|
|
|
|
|
|
self.column_size = cols
|
|
|
|
|
self.row_size = rows
|
2020-08-18 02:19:07 +02:00
|
|
|
# This is how many RBLs are in all the arrays
|
2020-08-18 18:14:50 +02:00
|
|
|
self.rbl = rbl
|
2020-08-18 02:19:07 +02:00
|
|
|
self.left_rbl = rbl[0]
|
|
|
|
|
self.right_rbl = rbl[1]
|
|
|
|
|
# This is how many RBLs are added to THIS array
|
|
|
|
|
if add_rbl == None:
|
|
|
|
|
self.add_left_rbl = rbl[0]
|
|
|
|
|
self.add_right_rbl = rbl[1]
|
2020-07-28 01:22:21 +02:00
|
|
|
else:
|
2020-08-18 02:19:07 +02:00
|
|
|
self.add_left_rbl = add_rbl[0]
|
|
|
|
|
self.add_right_rbl = add_rbl[1]
|
|
|
|
|
for a, b in zip(add_rbl, rbl):
|
|
|
|
|
debug.check(a <= b,
|
|
|
|
|
"Invalid number of RBLs for port configuration.")
|
2019-07-11 00:56:51 +02:00
|
|
|
|
2020-08-18 02:19:07 +02:00
|
|
|
debug.check(sum(rbl) <= len(self.all_ports),
|
2020-06-05 22:49:32 +02:00
|
|
|
"Invalid number of RBLs for port configuration.")
|
2020-09-23 15:24:52 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-09-23 15:24:52 +02:00
|
|
|
# Two dummy rows plus replica even if we don't add the column
|
|
|
|
|
self.extra_rows = 2 + sum(rbl)
|
|
|
|
|
# Two dummy cols plus replica if we add the column
|
|
|
|
|
self.extra_cols = 2 + self.add_left_rbl + self.add_right_rbl
|
2020-09-23 17:02:56 +02:00
|
|
|
else:
|
|
|
|
|
self.extra_rows = 0
|
|
|
|
|
self.extra_cols = 2 + self.add_left_rbl + self.add_right_rbl
|
2019-06-20 01:03:21 +02:00
|
|
|
self.create_netlist()
|
|
|
|
|
if not OPTS.netlist_only:
|
|
|
|
|
self.create_layout()
|
|
|
|
|
|
|
|
|
|
# We don't offset this because we need to align
|
|
|
|
|
# the replica bitcell in the control logic
|
2020-06-05 22:49:32 +02:00
|
|
|
# self.offset_all_coordinates()
|
2020-08-25 20:50:44 +02:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
def create_netlist(self):
|
|
|
|
|
""" Create and connect the netlist """
|
|
|
|
|
self.add_modules()
|
|
|
|
|
self.add_pins()
|
|
|
|
|
self.create_instances()
|
|
|
|
|
|
|
|
|
|
def add_modules(self):
|
2020-05-28 05:03:11 +02:00
|
|
|
""" Array and dummy/replica columns
|
2019-06-20 01:03:21 +02:00
|
|
|
|
|
|
|
|
d or D = dummy cell (caps to distinguish grouping)
|
|
|
|
|
r or R = replica cell (caps to distinguish grouping)
|
2020-05-28 05:03:11 +02:00
|
|
|
b or B = bitcell
|
|
|
|
|
replica columns 1
|
2019-06-20 01:03:21 +02:00
|
|
|
v v
|
2020-05-28 05:03:11 +02:00
|
|
|
bdDDDDDDDDDDDDDDdb <- Dummy row
|
|
|
|
|
bdDDDDDDDDDDDDDDrb <- Dummy row
|
2019-06-20 01:03:21 +02:00
|
|
|
br--------------rb
|
|
|
|
|
br| Array |rb
|
|
|
|
|
br| row x col |rb
|
|
|
|
|
br--------------rb
|
|
|
|
|
brDDDDDDDDDDDDDDdb <- Dummy row
|
|
|
|
|
bdDDDDDDDDDDDDDDdb <- Dummy row
|
|
|
|
|
|
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
dummy rows cols x 1
|
|
|
|
|
|
|
|
|
|
^ dummy columns ^
|
|
|
|
|
1 x (rows + 4)
|
|
|
|
|
"""
|
|
|
|
|
# Bitcell array
|
|
|
|
|
self.bitcell_array = factory.create(module_type="bitcell_array",
|
2020-07-28 01:22:21 +02:00
|
|
|
column_offset=1 + self.add_left_rbl,
|
2019-06-20 01:03:21 +02:00
|
|
|
cols=self.column_size,
|
|
|
|
|
rows=self.row_size)
|
|
|
|
|
self.add_mod(self.bitcell_array)
|
|
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
# Replica bitlines
|
|
|
|
|
self.replica_columns = {}
|
2020-07-28 01:22:21 +02:00
|
|
|
for bit in range(self.add_left_rbl + self.add_right_rbl):
|
2020-05-29 05:31:21 +02:00
|
|
|
# Creating left_rbl
|
2020-08-14 23:14:49 +02:00
|
|
|
if bit < self.add_left_rbl:
|
|
|
|
|
# These go from the top (where the bitcell array starts ) down
|
|
|
|
|
replica_bit = self.left_rbl - bit
|
2020-05-29 05:31:21 +02:00
|
|
|
# Creating right_rbl
|
2019-07-11 00:56:51 +02:00
|
|
|
else:
|
2020-08-14 23:14:49 +02:00
|
|
|
# These go from the bottom up
|
|
|
|
|
replica_bit = self.left_rbl + self.row_size + 1 + bit
|
|
|
|
|
# If we have an odd numer on the bottom
|
|
|
|
|
column_offset = self.left_rbl + 1
|
2020-09-15 03:11:38 +02:00
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
self.replica_columns[bit] = factory.create(module_type="replica_column",
|
|
|
|
|
rows=self.row_size,
|
2020-08-18 18:14:50 +02:00
|
|
|
rbl=self.rbl,
|
2020-01-27 17:17:06 +01:00
|
|
|
column_offset=column_offset,
|
2019-07-11 00:56:51 +02:00
|
|
|
replica_bit=replica_bit)
|
|
|
|
|
self.add_mod(self.replica_columns[bit])
|
2020-09-23 15:24:52 +02:00
|
|
|
# If there are bitcell end caps, replace the dummy cells on the edge of the bitcell array with end caps.
|
2020-05-28 05:03:11 +02:00
|
|
|
try:
|
|
|
|
|
end_caps_enabled = cell_properties.bitcell.end_caps
|
|
|
|
|
except AttributeError:
|
|
|
|
|
end_caps_enabled = False
|
2020-09-23 15:24:52 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
# Dummy row
|
|
|
|
|
self.dummy_row = factory.create(module_type="dummy_array",
|
|
|
|
|
cols=self.column_size,
|
|
|
|
|
rows=1,
|
|
|
|
|
# dummy column + left replica column
|
|
|
|
|
column_offset=1 + self.add_left_rbl,
|
|
|
|
|
mirror=0)
|
|
|
|
|
self.add_mod(self.dummy_row)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-09-23 15:24:52 +02:00
|
|
|
# Dummy Row or Col Cap, depending on bitcell array properties
|
|
|
|
|
col_cap_module_type = ("col_cap_array" if end_caps_enabled else "dummy_array")
|
|
|
|
|
self.col_cap = factory.create(module_type=col_cap_module_type,
|
|
|
|
|
cols=self.column_size,
|
|
|
|
|
rows=1,
|
|
|
|
|
# dummy column + left replica column(s)
|
|
|
|
|
column_offset=1 + self.add_left_rbl,
|
|
|
|
|
mirror=0)
|
|
|
|
|
self.add_mod(self.col_cap)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-09-23 17:02:56 +02:00
|
|
|
# Dummy Col or Row Cap, depending on bitcell array properties
|
|
|
|
|
row_cap_module_type = ("row_cap_array" if end_caps_enabled else "dummy_array")
|
|
|
|
|
|
|
|
|
|
self.row_cap_left = factory.create(module_type=row_cap_module_type,
|
|
|
|
|
cols=1,
|
|
|
|
|
column_offset=0,
|
|
|
|
|
rows=self.row_size + self.extra_rows,
|
|
|
|
|
mirror=(self.left_rbl + 1) % 2)
|
|
|
|
|
self.add_mod(self.row_cap_left)
|
|
|
|
|
|
|
|
|
|
self.row_cap_right = factory.create(module_type=row_cap_module_type,
|
|
|
|
|
cols=1,
|
|
|
|
|
# dummy column
|
|
|
|
|
# + left replica column(s)
|
|
|
|
|
# + bitcell columns
|
|
|
|
|
# + right replica column(s)
|
|
|
|
|
column_offset = 1 + self.add_left_rbl + self.column_size + self.add_right_rbl,
|
|
|
|
|
rows=self.row_size + self.extra_rows,
|
|
|
|
|
mirror=(self.left_rbl + 1) %2)
|
|
|
|
|
self.add_mod(self.row_cap_right)
|
|
|
|
|
else:
|
|
|
|
|
# Dummy Col or Row Cap, depending on bitcell array properties
|
|
|
|
|
row_cap_module_type = ("s8_row_cap_array" if end_caps_enabled else "dummy_array")
|
|
|
|
|
|
|
|
|
|
self.row_cap_left = factory.create(module_type=row_cap_module_type,
|
|
|
|
|
cols=1,
|
|
|
|
|
column_offset=0,
|
|
|
|
|
rows=self.row_size + self.extra_rows,
|
|
|
|
|
mirror=0)
|
|
|
|
|
self.add_mod(self.row_cap_left)
|
|
|
|
|
|
|
|
|
|
self.row_cap_right = factory.create(module_type=row_cap_module_type,
|
|
|
|
|
cols=1,
|
|
|
|
|
# dummy column
|
|
|
|
|
# + left replica column(s)
|
|
|
|
|
# + bitcell columns
|
|
|
|
|
# + right replica column(s)
|
|
|
|
|
column_offset = 1 + self.add_left_rbl + self.column_size + self.add_right_rbl,
|
|
|
|
|
rows=self.row_size + self.extra_rows,
|
|
|
|
|
mirror=0)
|
|
|
|
|
self.add_mod(self.row_cap_right)
|
2019-06-20 01:03:21 +02:00
|
|
|
|
|
|
|
|
def add_pins(self):
|
2020-08-12 00:00:29 +02:00
|
|
|
|
2020-08-19 00:47:52 +02:00
|
|
|
# Arrays are always:
|
2020-08-25 20:50:44 +02:00
|
|
|
# bitlines (column first then port order)
|
|
|
|
|
# word lines (row first then port order)
|
2020-08-21 22:44:35 +02:00
|
|
|
# dummy wordlines
|
|
|
|
|
# replica wordlines
|
|
|
|
|
# regular wordlines (bottom to top)
|
|
|
|
|
# # dummy bitlines
|
|
|
|
|
# replica bitlines (port order)
|
|
|
|
|
# regular bitlines (left to right port order)
|
|
|
|
|
#
|
2020-08-19 00:47:52 +02:00
|
|
|
# vdd
|
|
|
|
|
# gnd
|
|
|
|
|
|
|
|
|
|
self.add_bitline_pins()
|
2020-08-25 20:50:44 +02:00
|
|
|
self.add_wordline_pins()
|
2020-08-12 00:00:29 +02:00
|
|
|
self.add_pin("vdd", "POWER")
|
|
|
|
|
self.add_pin("gnd", "GROUND")
|
|
|
|
|
|
|
|
|
|
def add_bitline_pins(self):
|
2020-08-21 22:44:35 +02:00
|
|
|
# Regular bitline names by port
|
2020-08-12 00:00:29 +02:00
|
|
|
self.bitline_names = []
|
2020-08-21 22:44:35 +02:00
|
|
|
# Replica bitlines by port
|
|
|
|
|
self.rbl_bitline_names = []
|
|
|
|
|
# Dummy bitlines by left/right
|
|
|
|
|
self.dummy_col_bitline_names = []
|
2020-09-23 17:02:56 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-09-23 17:02:56 +02:00
|
|
|
for loc in ["left", "right"]:
|
|
|
|
|
self.dummy_col_bitline_names.append([])
|
|
|
|
|
for port in self.all_ports:
|
|
|
|
|
bitline_names = ["dummy_{0}_{1}".format(x, loc) for x in self.row_cap_left.get_bitline_names(port)]
|
|
|
|
|
self.dummy_col_bitline_names[-1].extend(bitline_names)
|
|
|
|
|
self.all_dummy_col_bitline_names = [x for sl in self.dummy_col_bitline_names for x in sl]
|
2020-08-21 22:44:35 +02:00
|
|
|
for port in range(self.add_left_rbl + self.add_right_rbl):
|
|
|
|
|
left_names=["rbl_bl_{0}_{1}".format(x, port) for x in self.all_ports]
|
|
|
|
|
right_names=["rbl_br_{0}_{1}".format(x, port) for x in self.all_ports]
|
2020-08-19 00:47:52 +02:00
|
|
|
bitline_names = [x for t in zip(left_names, right_names) for x in t]
|
2020-08-21 22:44:35 +02:00
|
|
|
self.rbl_bitline_names.append(bitline_names)
|
|
|
|
|
# Make a flat list too
|
|
|
|
|
self.all_rbl_bitline_names = [x for sl in self.rbl_bitline_names for x in sl]
|
2020-08-27 23:03:05 +02:00
|
|
|
|
2020-08-21 22:44:35 +02:00
|
|
|
for port in self.all_ports:
|
|
|
|
|
bitline_names = self.bitcell_array.get_bitline_names(port)
|
|
|
|
|
self.bitline_names.append(bitline_names)
|
|
|
|
|
# Make a flat list too
|
2020-08-25 20:50:44 +02:00
|
|
|
self.all_bitline_names = [x for sl in zip(*self.bitline_names) for x in sl]
|
2020-09-23 17:02:56 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
self.add_pin_list(self.dummy_col_bitline_names[0], "INOUT")
|
|
|
|
|
for port in range(self.add_left_rbl):
|
|
|
|
|
self.add_pin_list(self.rbl_bitline_names[port], "INOUT")
|
|
|
|
|
self.add_pin_list(self.all_bitline_names, "INOUT")
|
|
|
|
|
for port in range(self.add_left_rbl, self.add_left_rbl + self.add_right_rbl):
|
|
|
|
|
self.add_pin_list(self.rbl_bitline_names[port], "INOUT")
|
|
|
|
|
self.add_pin_list(self.dummy_col_bitline_names[1], "INOUT")
|
2020-08-25 20:50:44 +02:00
|
|
|
|
2020-08-12 00:00:29 +02:00
|
|
|
def add_wordline_pins(self):
|
2020-08-19 20:35:55 +02:00
|
|
|
|
2020-08-21 22:44:35 +02:00
|
|
|
# Regular wordlines by port
|
2020-08-12 00:00:29 +02:00
|
|
|
self.wordline_names = []
|
|
|
|
|
# Replica wordlines by port
|
2020-08-21 22:44:35 +02:00
|
|
|
self.rbl_wordline_names = []
|
|
|
|
|
# Dummy wordlines by bot/top
|
|
|
|
|
self.dummy_row_wordline_names = []
|
2020-09-23 17:02:56 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
dummy_row_wordline_names = ["dummy_" + x for x in self.col_cap.get_wordline_names()]
|
|
|
|
|
for loc in ["bot", "top"]:
|
|
|
|
|
wordline_names = ["{0}_{1}".format(wl_name, loc) for wl_name in dummy_row_wordline_names]
|
|
|
|
|
self.dummy_row_wordline_names.append(wordline_names)
|
|
|
|
|
self.all_dummy_row_wordline_names = [x for sl in self.dummy_row_wordline_names for x in sl]
|
2019-07-12 23:39:56 +02:00
|
|
|
|
2020-07-28 01:22:21 +02:00
|
|
|
for port in range(self.left_rbl + self.right_rbl):
|
2020-08-21 22:44:35 +02:00
|
|
|
wordline_names=["rbl_wl_{0}_{1}".format(x, port) for x in self.all_ports]
|
|
|
|
|
self.rbl_wordline_names.append(wordline_names)
|
|
|
|
|
self.all_rbl_wordline_names = [x for sl in self.rbl_wordline_names for x in sl]
|
|
|
|
|
|
|
|
|
|
for port in self.all_ports:
|
|
|
|
|
wordline_names = self.bitcell_array.get_wordline_names(port)
|
|
|
|
|
self.wordline_names.append(wordline_names)
|
|
|
|
|
self.all_wordline_names = [x for sl in zip(*self.wordline_names) for x in sl]
|
|
|
|
|
|
|
|
|
|
# All wordlines including dummy and RBL
|
|
|
|
|
self.replica_array_wordline_names = []
|
2020-09-23 17:02:56 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
self.replica_array_wordline_names.extend(self.dummy_row_wordline_names[0])
|
2020-08-21 22:44:35 +02:00
|
|
|
for p in range(self.left_rbl):
|
|
|
|
|
self.replica_array_wordline_names.extend(self.rbl_wordline_names[p])
|
|
|
|
|
self.replica_array_wordline_names.extend(self.all_wordline_names)
|
|
|
|
|
for p in range(self.left_rbl, self.left_rbl + self.right_rbl):
|
|
|
|
|
self.replica_array_wordline_names.extend(self.rbl_wordline_names[p])
|
2020-09-23 17:02:56 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
self.replica_array_wordline_names.extend(self.dummy_row_wordline_names[1])
|
|
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
self.add_pin_list(self.dummy_row_wordline_names[0], "INPUT")
|
2020-08-25 20:50:44 +02:00
|
|
|
for port in range(self.left_rbl):
|
|
|
|
|
self.add_pin_list(self.rbl_wordline_names[port], "INPUT")
|
2020-08-27 23:03:05 +02:00
|
|
|
self.add_pin_list(self.all_wordline_names, "INPUT")
|
2020-08-25 20:50:44 +02:00
|
|
|
for port in range(self.left_rbl, self.left_rbl + self.right_rbl):
|
|
|
|
|
self.add_pin_list(self.rbl_wordline_names[port], "INPUT")
|
2020-09-23 17:02:56 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
self.add_pin_list(self.dummy_row_wordline_names[1], "INPUT")
|
2020-08-25 20:50:44 +02:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
def create_instances(self):
|
|
|
|
|
""" Create the module instances used in this design """
|
|
|
|
|
|
|
|
|
|
supplies = ["vdd", "gnd"]
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
# Used for names/dimensions only
|
2020-09-23 17:37:32 +02:00
|
|
|
if not cell_properties.compare_ports(cell_properties.bitcell_array.use_custom_cell_arrangement):
|
|
|
|
|
self.cell = factory.create(module_type="bitcell")
|
|
|
|
|
else:
|
|
|
|
|
self.cell = factory.create(module_type="s8_bitcell", version = "opt1")
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
# Main array
|
|
|
|
|
self.bitcell_array_inst=self.add_inst(name="bitcell_array",
|
|
|
|
|
mod=self.bitcell_array)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.connect_inst(self.all_bitline_names + self.all_wordline_names + supplies)
|
2019-06-20 01:03:21 +02:00
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
# Replica columns
|
2020-08-21 22:44:35 +02:00
|
|
|
self.replica_col_insts = []
|
2020-07-28 01:22:21 +02:00
|
|
|
for port in range(self.add_left_rbl + self.add_right_rbl):
|
2020-08-21 22:44:35 +02:00
|
|
|
self.replica_col_insts.append(self.add_inst(name="replica_col_{}".format(port),
|
|
|
|
|
mod=self.replica_columns[port]))
|
|
|
|
|
self.connect_inst(self.rbl_bitline_names[port] + self.replica_array_wordline_names + supplies)
|
2020-07-28 01:22:21 +02:00
|
|
|
|
2019-07-12 23:39:56 +02:00
|
|
|
# Dummy rows under the bitcell array (connected with with the replica cell wl)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_replica_insts = []
|
2020-07-28 01:22:21 +02:00
|
|
|
# Note, this is the number of left and right even if we aren't adding the columns to this bitcell array!
|
2020-06-05 22:49:32 +02:00
|
|
|
for port in range(self.left_rbl + self.right_rbl):
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_replica_insts.append(self.add_inst(name="dummy_row_{}".format(port),
|
|
|
|
|
mod=self.dummy_row))
|
|
|
|
|
self.connect_inst(self.all_bitline_names + self.rbl_wordline_names[port] + supplies)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
|
|
|
|
# Top/bottom dummy rows or col caps
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_insts = []
|
|
|
|
|
self.dummy_row_insts.append(self.add_inst(name="dummy_row_bot",
|
|
|
|
|
mod=self.col_cap))
|
|
|
|
|
self.connect_inst(self.all_bitline_names
|
|
|
|
|
+ self.dummy_row_wordline_names[0]
|
2020-08-12 00:00:29 +02:00
|
|
|
+ supplies)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_insts.append(self.add_inst(name="dummy_row_top",
|
|
|
|
|
mod=self.col_cap))
|
|
|
|
|
self.connect_inst(self.all_bitline_names
|
|
|
|
|
+ self.dummy_row_wordline_names[1]
|
2020-08-12 00:00:29 +02:00
|
|
|
+ supplies)
|
2019-06-20 01:03:21 +02:00
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
# Left/right Dummy columns
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_col_insts = []
|
|
|
|
|
self.dummy_col_insts.append(self.add_inst(name="dummy_col_left",
|
|
|
|
|
mod=self.row_cap_left))
|
|
|
|
|
self.connect_inst(self.dummy_col_bitline_names[0] + self.replica_array_wordline_names + supplies)
|
|
|
|
|
self.dummy_col_insts.append(self.add_inst(name="dummy_col_right",
|
|
|
|
|
mod=self.row_cap_right))
|
|
|
|
|
self.connect_inst(self.dummy_col_bitline_names[1] + self.replica_array_wordline_names + supplies)
|
2019-06-20 01:03:21 +02:00
|
|
|
|
|
|
|
|
def create_layout(self):
|
|
|
|
|
|
2020-06-05 22:49:32 +02:00
|
|
|
self.height = (self.row_size + self.extra_rows) * self.dummy_row.height
|
|
|
|
|
self.width = (self.column_size + self.extra_cols) * self.cell.width
|
2019-06-20 01:03:21 +02:00
|
|
|
|
|
|
|
|
# This is a bitcell x bitcell offset to scale
|
2020-07-28 01:22:21 +02:00
|
|
|
self.bitcell_offset = vector(self.cell.width, self.cell.height)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-07-28 01:22:21 +02:00
|
|
|
# Everything is computed with the main array at (0, 0) to start
|
2020-06-05 22:49:32 +02:00
|
|
|
self.bitcell_array_inst.place(offset=[0, 0])
|
2019-07-11 00:56:51 +02:00
|
|
|
|
2020-07-28 01:22:21 +02:00
|
|
|
self.add_replica_columns()
|
|
|
|
|
|
|
|
|
|
self.add_end_caps()
|
|
|
|
|
|
|
|
|
|
# Array was at (0, 0) but move everything so it is at the lower left
|
|
|
|
|
# We move DOWN the number of left RBL even if we didn't add the column to this bitcell array
|
|
|
|
|
self.translate_all(self.bitcell_offset.scale(-1 - self.add_left_rbl, -1 - self.left_rbl))
|
|
|
|
|
|
|
|
|
|
self.add_layout_pins()
|
|
|
|
|
|
|
|
|
|
self.add_boundary()
|
|
|
|
|
|
|
|
|
|
self.DRC_LVS()
|
|
|
|
|
|
|
|
|
|
def add_replica_columns(self):
|
|
|
|
|
""" Add replica columns on left and right of array """
|
|
|
|
|
|
2020-08-14 23:14:49 +02:00
|
|
|
# Grow from left to right, toward the array
|
2020-07-28 01:22:21 +02:00
|
|
|
for bit in range(self.add_left_rbl):
|
2020-08-19 00:47:52 +02:00
|
|
|
offset = self.bitcell_offset.scale(-self.add_left_rbl + bit, -self.left_rbl - 1)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.replica_col_insts[bit].place(offset)
|
2020-08-14 23:14:49 +02:00
|
|
|
# Grow to the right of the bitcell array, array outward
|
2020-07-28 01:22:21 +02:00
|
|
|
for bit in range(self.add_right_rbl):
|
2020-08-19 00:47:52 +02:00
|
|
|
offset = self.bitcell_array_inst.lr() + self.bitcell_offset.scale(bit, -self.left_rbl - 1)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.replica_col_insts[self.add_left_rbl + bit].place(offset)
|
2020-07-28 01:22:21 +02:00
|
|
|
|
|
|
|
|
# Replica dummy rows
|
|
|
|
|
# Add the dummy rows even if we aren't adding the replica column to this bitcell array
|
2020-08-14 23:14:49 +02:00
|
|
|
# These grow up, toward the array
|
2020-07-28 01:22:21 +02:00
|
|
|
for bit in range(self.left_rbl):
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_replica_insts[bit].place(offset=self.bitcell_offset.scale(0, -self.left_rbl + bit + (-self.left_rbl + bit) % 2),
|
2020-08-14 23:14:49 +02:00
|
|
|
mirror="MX" if (-self.left_rbl + bit) % 2 else "R0")
|
|
|
|
|
# These grow up, away from the array
|
2019-07-11 00:56:51 +02:00
|
|
|
for bit in range(self.right_rbl):
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_replica_insts[self.left_rbl + bit].place(offset=self.bitcell_offset.scale(0, bit + bit % 2) + self.bitcell_array_inst.ul(),
|
2020-07-28 01:22:21 +02:00
|
|
|
mirror="MX" if bit % 2 else "R0")
|
|
|
|
|
|
|
|
|
|
def add_end_caps(self):
|
|
|
|
|
""" Add dummy cells or end caps around the array """
|
2019-07-11 00:56:51 +02:00
|
|
|
|
2020-06-05 22:49:32 +02:00
|
|
|
# FIXME: These depend on the array size itself
|
2019-07-11 00:56:51 +02:00
|
|
|
# Far top dummy row (first row above array is NOT flipped)
|
2020-06-05 22:49:32 +02:00
|
|
|
flip_dummy = self.right_rbl % 2
|
2020-07-28 01:22:21 +02:00
|
|
|
dummy_row_offset = self.bitcell_offset.scale(0, self.right_rbl + flip_dummy) + self.bitcell_array_inst.ul()
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_insts[1].place(offset=dummy_row_offset,
|
2020-07-28 01:22:21 +02:00
|
|
|
mirror="MX" if flip_dummy else "R0")
|
2020-06-05 22:49:32 +02:00
|
|
|
# FIXME: These depend on the array size itself
|
2019-07-11 00:56:51 +02:00
|
|
|
# Far bottom dummy row (first row below array IS flipped)
|
2020-06-05 22:49:32 +02:00
|
|
|
flip_dummy = (self.left_rbl + 1) % 2
|
2020-07-28 01:22:21 +02:00
|
|
|
dummy_row_offset = self.bitcell_offset.scale(0, -self.left_rbl - 1 + flip_dummy)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_row_insts[0].place(offset=dummy_row_offset,
|
|
|
|
|
mirror="MX" if flip_dummy else "R0")
|
2019-07-11 00:56:51 +02:00
|
|
|
# Far left dummy col
|
2020-07-28 01:22:21 +02:00
|
|
|
# Shifted down by the number of left RBLs even if we aren't adding replica column to this bitcell array
|
|
|
|
|
dummy_col_offset = self.bitcell_offset.scale(-self.add_left_rbl - 1, -self.left_rbl - 1)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_col_insts[0].place(offset=dummy_col_offset)
|
2019-07-11 00:56:51 +02:00
|
|
|
# Far right dummy col
|
2020-07-28 01:22:21 +02:00
|
|
|
# Shifted down by the number of left RBLs even if we aren't adding replica column to this bitcell array
|
|
|
|
|
dummy_col_offset = self.bitcell_offset.scale(self.add_right_rbl, -self.left_rbl - 1) + self.bitcell_array_inst.lr()
|
2020-08-21 22:44:35 +02:00
|
|
|
self.dummy_col_insts[1].place(offset=dummy_col_offset)
|
2019-06-20 01:03:21 +02:00
|
|
|
|
|
|
|
|
def add_layout_pins(self):
|
|
|
|
|
""" Add the layout pins """
|
|
|
|
|
|
2020-08-12 00:00:29 +02:00
|
|
|
# All wordlines
|
2019-06-20 01:03:21 +02:00
|
|
|
# Main array wl and bl/br
|
2020-08-21 22:44:35 +02:00
|
|
|
for pin_name in self.all_wordline_names:
|
|
|
|
|
pin_list = self.bitcell_array_inst.get_pins(pin_name)
|
|
|
|
|
for pin in pin_list:
|
|
|
|
|
self.add_layout_pin(text=pin_name,
|
|
|
|
|
layer=pin.layer,
|
|
|
|
|
offset=pin.ll().scale(0, 1),
|
|
|
|
|
width=self.width,
|
|
|
|
|
height=pin.height())
|
|
|
|
|
for pin_name in self.all_bitline_names:
|
|
|
|
|
pin_list = self.bitcell_array_inst.get_pins(pin_name)
|
|
|
|
|
for pin in pin_list:
|
|
|
|
|
self.add_layout_pin(text=pin_name,
|
|
|
|
|
layer=pin.layer,
|
|
|
|
|
offset=pin.ll().scale(1, 0),
|
|
|
|
|
width=pin.width(),
|
|
|
|
|
height=self.height)
|
2019-07-11 00:56:51 +02:00
|
|
|
|
2020-08-12 00:00:29 +02:00
|
|
|
# Dummy wordlines
|
2020-08-21 22:44:35 +02:00
|
|
|
for (names, inst) in zip(self.dummy_row_wordline_names, self.dummy_row_insts):
|
|
|
|
|
for (wl_name, pin_name) in zip(names, self.dummy_row.get_wordline_names()):
|
2020-08-12 00:00:29 +02:00
|
|
|
# It's always a single row
|
2020-08-21 22:44:35 +02:00
|
|
|
pin = inst.get_pin(pin_name)
|
2020-08-12 00:00:29 +02:00
|
|
|
self.add_layout_pin(text=wl_name,
|
|
|
|
|
layer=pin.layer,
|
|
|
|
|
offset=pin.ll().scale(0, 1),
|
|
|
|
|
width=self.width,
|
|
|
|
|
height=pin.height())
|
|
|
|
|
|
|
|
|
|
# Replica wordlines (go by the row instead of replica column because we may have to add a pin
|
|
|
|
|
# even though the column is in another local bitcell array)
|
2020-08-21 22:44:35 +02:00
|
|
|
for (names, inst) in zip(self.rbl_wordline_names, self.dummy_row_replica_insts):
|
|
|
|
|
for (wl_name, pin_name) in zip(names, self.dummy_row.get_wordline_names()):
|
|
|
|
|
pin = inst.get_pin(pin_name)
|
2020-08-12 00:00:29 +02:00
|
|
|
self.add_layout_pin(text=wl_name,
|
|
|
|
|
layer=pin.layer,
|
|
|
|
|
offset=pin.ll().scale(0, 1),
|
|
|
|
|
width=self.width,
|
|
|
|
|
height=pin.height())
|
|
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
# Replica bitlines
|
2020-08-21 22:44:35 +02:00
|
|
|
for (names, inst) in zip(self.rbl_bitline_names, self.replica_col_insts):
|
|
|
|
|
for (bl_name, pin_name) in zip(names, self.replica_columns[0].all_bitline_names):
|
2019-07-11 00:56:51 +02:00
|
|
|
pin = inst.get_pin(pin_name)
|
2020-08-21 22:44:35 +02:00
|
|
|
self.add_layout_pin(text=bl_name,
|
2019-07-15 20:29:29 +02:00
|
|
|
layer=pin.layer,
|
2020-05-07 21:35:21 +02:00
|
|
|
offset=pin.ll().scale(1, 0),
|
2019-07-15 20:29:29 +02:00
|
|
|
width=pin.width(),
|
|
|
|
|
height=self.height)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-06-29 19:03:24 +02:00
|
|
|
# vdd/gnd are only connected in the perimeter cells
|
|
|
|
|
# replica column should only have a vdd/gnd in the dummy cell on top/bottom
|
2020-08-21 22:44:35 +02:00
|
|
|
supply_insts = self.dummy_col_insts + self.dummy_row_insts
|
2020-05-07 21:35:21 +02:00
|
|
|
for pin_name in ["vdd", "gnd"]:
|
2020-06-25 23:03:59 +02:00
|
|
|
for inst in supply_insts:
|
2019-06-20 01:03:21 +02:00
|
|
|
pin_list = inst.get_pins(pin_name)
|
|
|
|
|
for pin in pin_list:
|
2020-06-25 23:03:59 +02:00
|
|
|
self.add_power_pin(name=pin_name,
|
|
|
|
|
loc=pin.center(),
|
|
|
|
|
directions=("V", "V"),
|
|
|
|
|
start_layer=pin.layer)
|
2020-08-12 00:00:29 +02:00
|
|
|
|
2020-08-21 22:44:35 +02:00
|
|
|
for inst in self.replica_col_insts:
|
2020-06-30 00:28:55 +02:00
|
|
|
self.copy_layout_pin(inst, pin_name)
|
2019-07-12 23:39:56 +02:00
|
|
|
|
2020-08-13 23:29:10 +02:00
|
|
|
def get_rbl_wordline_names(self, port=None):
|
|
|
|
|
"""
|
|
|
|
|
Return the ACTIVE WL for the given RBL port.
|
|
|
|
|
Inactive will be set to gnd.
|
|
|
|
|
"""
|
|
|
|
|
if port == None:
|
2020-08-25 20:50:44 +02:00
|
|
|
return self.all_rbl_wordline_names
|
2020-08-13 23:29:10 +02:00
|
|
|
else:
|
2020-08-25 20:50:44 +02:00
|
|
|
return self.rbl_wordline_names[port]
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-08-13 23:29:10 +02:00
|
|
|
def get_rbl_bitline_names(self, port=None):
|
2019-07-15 20:29:29 +02:00
|
|
|
""" Return the BL for the given RBL port """
|
2020-08-13 23:29:10 +02:00
|
|
|
if port == None:
|
2020-08-25 20:50:44 +02:00
|
|
|
return self.all_rbl_bitline_names
|
2020-08-13 23:29:10 +02:00
|
|
|
else:
|
2020-08-25 20:50:44 +02:00
|
|
|
return self.rbl_bitline_names[port]
|
2020-08-12 18:49:14 +02:00
|
|
|
|
2020-08-25 20:50:44 +02:00
|
|
|
def get_bitline_names(self, port=None):
|
2020-08-26 02:08:48 +02:00
|
|
|
""" Return the regular bitlines for the given port or all"""
|
2020-08-19 20:35:55 +02:00
|
|
|
if port == None:
|
2020-08-25 20:50:44 +02:00
|
|
|
return self.all_bitline_names
|
2020-08-19 20:35:55 +02:00
|
|
|
else:
|
2020-08-25 20:50:44 +02:00
|
|
|
return self.bitline_names[port]
|
|
|
|
|
|
2020-08-26 02:08:48 +02:00
|
|
|
def get_all_bitline_names(self):
|
|
|
|
|
""" Return ALL the bitline names (including dummy and rbl) """
|
|
|
|
|
temp = []
|
|
|
|
|
temp.extend(self.get_dummy_bitline_names(0))
|
2020-08-27 23:03:05 +02:00
|
|
|
if self.add_left_rbl > 0:
|
|
|
|
|
temp.extend(self.get_rbl_bitline_names(0))
|
2020-08-26 02:08:48 +02:00
|
|
|
temp.extend(self.get_bitline_names())
|
2020-08-27 23:03:05 +02:00
|
|
|
if self.add_right_rbl > 0:
|
|
|
|
|
temp.extend(self.get_rbl_bitline_names(self.add_left_rbl))
|
2020-08-26 02:08:48 +02:00
|
|
|
temp.extend(self.get_dummy_bitline_names(1))
|
|
|
|
|
return temp
|
|
|
|
|
|
|
|
|
|
def get_wordline_names(self, port=None):
|
|
|
|
|
""" Return the regular wordline names """
|
|
|
|
|
if port == None:
|
|
|
|
|
return self.all_wordline_names
|
|
|
|
|
else:
|
|
|
|
|
return self.wordline_names[port]
|
|
|
|
|
|
2020-08-26 18:54:41 +02:00
|
|
|
def get_all_wordline_names(self, port=None):
|
2020-08-26 02:08:48 +02:00
|
|
|
""" Return all the wordline names """
|
|
|
|
|
temp = []
|
|
|
|
|
temp.extend(self.get_dummy_wordline_names(0))
|
|
|
|
|
temp.extend(self.get_rbl_wordline_names(0))
|
2020-08-26 18:54:41 +02:00
|
|
|
if port == None:
|
|
|
|
|
temp.extend(self.all_wordline_names)
|
|
|
|
|
else:
|
|
|
|
|
temp.extend(self.wordline_names[port])
|
2020-08-26 02:08:48 +02:00
|
|
|
if len(self.all_ports) > 1:
|
2020-08-26 18:54:41 +02:00
|
|
|
temp.extend(self.get_rbl_wordline_names(1))
|
2020-08-26 02:08:48 +02:00
|
|
|
temp.extend(self.get_dummy_wordline_names(1))
|
|
|
|
|
return temp
|
|
|
|
|
|
2020-08-25 20:50:44 +02:00
|
|
|
def get_dummy_wordline_names(self, port=None):
|
|
|
|
|
"""
|
|
|
|
|
Return the ACTIVE WL for the given dummy port.
|
|
|
|
|
"""
|
|
|
|
|
if port == None:
|
|
|
|
|
return self.all_dummy_row_wordline_names
|
|
|
|
|
else:
|
|
|
|
|
return self.dummy_row_wordline_names[port]
|
2019-08-08 11:33:51 +02:00
|
|
|
|
2020-08-25 20:50:44 +02:00
|
|
|
def get_dummy_bitline_names(self, port=None):
|
|
|
|
|
""" Return the BL for the given dummy port """
|
|
|
|
|
if port == None:
|
|
|
|
|
return self.all_dummy_col_bitline_names
|
|
|
|
|
else:
|
|
|
|
|
return self.dummy_col_bitline_names[port]
|
|
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
def analytical_power(self, corner, load):
|
|
|
|
|
"""Power of Bitcell array and bitline in nW."""
|
|
|
|
|
# Dynamic Power from Bitline
|
|
|
|
|
bl_wire = self.gen_bl_wire()
|
2020-05-07 21:35:21 +02:00
|
|
|
cell_load = 2 * bl_wire.return_input_cap()
|
2019-07-25 23:18:08 +02:00
|
|
|
bl_swing = OPTS.rbl_delay_percentage
|
2019-09-05 01:08:18 +02:00
|
|
|
freq = spice["default_event_frequency"]
|
2019-06-20 01:03:21 +02:00
|
|
|
bitline_dynamic = self.calc_dynamic_power(corner, cell_load, freq, swing=bl_swing)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-06-05 22:49:32 +02:00
|
|
|
# Calculate the bitcell power which currently only includes leakage
|
2019-06-20 01:03:21 +02:00
|
|
|
cell_power = self.cell.analytical_power(corner, load)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-06-05 22:49:32 +02:00
|
|
|
# Leakage power grows with entire array and bitlines.
|
2019-06-20 01:03:21 +02:00
|
|
|
total_power = self.return_power(cell_power.dynamic + bitline_dynamic * self.column_size,
|
|
|
|
|
cell_power.leakage * self.column_size * self.row_size)
|
|
|
|
|
return total_power
|
|
|
|
|
|
|
|
|
|
def gen_bl_wire(self):
|
|
|
|
|
if OPTS.netlist_only:
|
|
|
|
|
height = 0
|
|
|
|
|
else:
|
|
|
|
|
height = self.height
|
|
|
|
|
bl_pos = 0
|
2020-06-05 22:49:32 +02:00
|
|
|
bl_wire = self.generate_rc_net(int(self.row_size - bl_pos), height, drc("minwidth_m1"))
|
2019-06-20 01:03:21 +02:00
|
|
|
bl_wire.wire_c =spice["min_tx_drain_c"] + bl_wire.wire_c # 1 access tx d/s per cell
|
|
|
|
|
return bl_wire
|
|
|
|
|
|
|
|
|
|
def get_wordline_cin(self):
|
|
|
|
|
"""Get the relative input capacitance from the wordline connections in all the bitcell"""
|
2020-06-05 22:49:32 +02:00
|
|
|
# A single wordline is connected to all the bitcells in a single row meaning the capacitance depends on the # of columns
|
2019-06-20 01:03:21 +02:00
|
|
|
bitcell_wl_cin = self.cell.get_wl_cin()
|
|
|
|
|
total_cin = bitcell_wl_cin * self.column_size
|
|
|
|
|
return total_cin
|
2019-07-12 17:42:36 +02:00
|
|
|
|
|
|
|
|
def graph_exclude_bits(self, targ_row, targ_col):
|
|
|
|
|
"""Excludes bits in column from being added to graph except target"""
|
|
|
|
|
self.bitcell_array.graph_exclude_bits(targ_row, targ_col)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2019-07-17 08:47:34 +02:00
|
|
|
def graph_exclude_replica_col_bits(self):
|
2019-07-31 05:31:32 +02:00
|
|
|
"""Exclude all replica/dummy cells in the replica columns except the replica bit."""
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-06-05 22:49:32 +02:00
|
|
|
for port in range(self.left_rbl + self.right_rbl):
|
2019-07-31 05:31:32 +02:00
|
|
|
self.replica_columns[port].exclude_all_but_replica()
|
2019-07-17 08:47:34 +02:00
|
|
|
|
|
|
|
|
def get_cell_name(self, inst_name, row, col):
|
|
|
|
|
"""Gets the spice name of the target bitcell."""
|
2020-06-05 22:49:32 +02:00
|
|
|
return self.bitcell_array.get_cell_name(inst_name + '.x' + self.bitcell_array_inst.name, row, col)
|