2019-06-20 01:03:21 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2023-01-29 07:56:27 +01:00
|
|
|
# Copyright (c) 2016-2023 Regents of the University of California, Santa Cruz
|
2019-06-20 01:03:21 +02:00
|
|
|
# All rights reserved.
|
|
|
|
|
#
|
2022-11-27 22:01:20 +01:00
|
|
|
from openram import debug
|
|
|
|
|
from openram.base import vector
|
|
|
|
|
from openram.base import contact
|
|
|
|
|
from openram.sram_factory import factory
|
|
|
|
|
from openram.tech import drc, spice
|
|
|
|
|
from openram.tech import cell_properties as props
|
|
|
|
|
from openram import OPTS
|
2022-07-13 19:57:56 +02:00
|
|
|
from .bitcell_base_array import bitcell_base_array
|
2020-01-30 02:58:30 +01:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
|
2020-10-13 20:07:31 +02:00
|
|
|
class replica_bitcell_array(bitcell_base_array):
|
2019-06-20 01:03:21 +02:00
|
|
|
"""
|
2022-09-07 21:39:35 +02:00
|
|
|
Creates a bitcell array of cols x rows and then adds the replica
|
2023-06-06 23:43:18 +02:00
|
|
|
columns and dummy rows. Replica columns are on the left and
|
2019-07-15 20:29:29 +02:00
|
|
|
right, respectively and connected to the given bitcell ports.
|
2023-06-06 23:43:18 +02:00
|
|
|
Dummy rows are on the top and bottom passing through the RBL WLs.
|
|
|
|
|
Requires a regular bitcell array and (if using replica topology)
|
|
|
|
|
replica bitcell and dummy bitcell (BL/BR disconnected).
|
2019-06-20 01:03:21 +02:00
|
|
|
"""
|
2020-09-11 01:44:54 +02:00
|
|
|
def __init__(self, rows, cols, rbl=None, left_rbl=None, right_rbl=None, name=""):
|
2022-09-07 21:39:35 +02:00
|
|
|
super().__init__(name=name, rows=rows, cols=cols, column_offset=0)
|
2020-09-09 20:54:46 +02:00
|
|
|
debug.info(1, "Creating {0} {1} x {2} rbls: {3} left_rbl: {4} right_rbl: {5}".format(self.name,
|
|
|
|
|
rows,
|
|
|
|
|
cols,
|
|
|
|
|
rbl,
|
|
|
|
|
left_rbl,
|
|
|
|
|
right_rbl))
|
2019-06-20 01:03:21 +02:00
|
|
|
self.add_comment("rows: {0} cols: {1}".format(rows, cols))
|
2020-09-09 20:54:46 +02:00
|
|
|
self.add_comment("rbl: {0} left_rbl: {1} right_rbl: {2}".format(rbl, left_rbl, right_rbl))
|
2019-06-20 01:03:21 +02:00
|
|
|
|
|
|
|
|
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
|
2023-06-06 23:43:18 +02:00
|
|
|
# Even if the RBL is not placed in this array, the module still needs
|
|
|
|
|
# to place dummy rows with rbl wordlines so that they will have the same
|
|
|
|
|
# load as the regular wordlines (and so the arrays are the same size)
|
2023-03-09 19:07:02 +01:00
|
|
|
if rbl is not None:
|
|
|
|
|
self.rbl = rbl
|
|
|
|
|
else:
|
|
|
|
|
self.rbl = [0] * len(self.all_ports)
|
2023-06-06 23:43:18 +02:00
|
|
|
# This specifies how many RBLs to put on the left by port number.
|
|
|
|
|
# For example, left_rbl = [0, 1] means there will be two
|
|
|
|
|
# RBLs on the left, one for port 0 and another for port 1.
|
2022-10-18 05:51:42 +02:00
|
|
|
if left_rbl is not None:
|
|
|
|
|
self.left_rbl = left_rbl
|
|
|
|
|
else:
|
|
|
|
|
self.left_rbl = []
|
2023-06-06 23:43:18 +02:00
|
|
|
# Similar to left_rbl but on the right side of the array
|
2022-10-18 05:51:42 +02:00
|
|
|
if right_rbl is not None:
|
|
|
|
|
self.right_rbl = right_rbl
|
|
|
|
|
else:
|
2023-03-09 19:07:02 +01:00
|
|
|
self.right_rbl = []
|
2020-09-09 20:54:46 +02:00
|
|
|
self.rbls = self.left_rbl + self.right_rbl
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-09-11 00:11:48 +02:00
|
|
|
debug.check(sum(self.rbl) >= len(self.left_rbl) + len(self.right_rbl),
|
2023-06-06 23:43:18 +02:00
|
|
|
"Cannot have more left + right RBLs than total RBLs")
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
self.create_netlist()
|
|
|
|
|
if not OPTS.netlist_only:
|
|
|
|
|
self.create_layout()
|
|
|
|
|
|
|
|
|
|
def create_netlist(self):
|
|
|
|
|
""" Create and connect the netlist """
|
|
|
|
|
self.add_modules()
|
|
|
|
|
self.add_pins()
|
|
|
|
|
self.create_instances()
|
|
|
|
|
|
|
|
|
|
def add_modules(self):
|
2023-03-09 19:07:02 +01:00
|
|
|
""" Array and dummy/replica columns """
|
2019-06-20 01:03:21 +02:00
|
|
|
# Bitcell array
|
|
|
|
|
self.bitcell_array = factory.create(module_type="bitcell_array",
|
2022-09-08 04:32:25 +02:00
|
|
|
column_offset=1 + len(self.left_rbl),
|
2019-06-20 01:03:21 +02:00
|
|
|
cols=self.column_size,
|
|
|
|
|
rows=self.row_size)
|
|
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
# Replica bitlines
|
|
|
|
|
self.replica_columns = {}
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-09-09 20:54:46 +02:00
|
|
|
for port in self.all_ports:
|
2023-06-06 23:43:18 +02:00
|
|
|
# We will always have self.rbl[0] dummy rows below the array
|
|
|
|
|
# for the replica wordlines.
|
2020-09-09 20:54:46 +02:00
|
|
|
if port in self.left_rbl:
|
2023-06-06 23:43:18 +02:00
|
|
|
# These go top down starting from the bottom of the bitcell array.
|
2022-09-26 23:24:16 +02:00
|
|
|
replica_bit = self.rbl[0] - port - 1
|
2023-02-21 02:28:24 +01:00
|
|
|
column_offset = len(self.left_rbl)
|
2020-09-09 20:54:46 +02:00
|
|
|
elif port in self.right_rbl:
|
2023-06-06 23:43:18 +02:00
|
|
|
# These go bottom up starting from the top of the bitcell array.
|
2022-09-26 23:24:16 +02:00
|
|
|
replica_bit = self.rbl[0] + self.row_size + port - 1
|
2023-02-21 02:28:24 +01:00
|
|
|
column_offset = len(self.left_rbl) + self.column_size + 1
|
2020-09-09 20:54:46 +02:00
|
|
|
else:
|
|
|
|
|
continue
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-09-09 20:54:46 +02:00
|
|
|
self.replica_columns[port] = factory.create(module_type="replica_column",
|
|
|
|
|
rows=self.row_size,
|
|
|
|
|
rbl=self.rbl,
|
|
|
|
|
column_offset=column_offset,
|
|
|
|
|
replica_bit=replica_bit)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2023-06-06 23:43:18 +02:00
|
|
|
# Dummy row (for replica wordlines)
|
2020-09-30 16:34:05 +02:00
|
|
|
self.dummy_row = factory.create(module_type="dummy_array",
|
2020-09-23 15:24:52 +02:00
|
|
|
cols=self.column_size,
|
|
|
|
|
rows=1,
|
2023-03-09 19:07:02 +01:00
|
|
|
# cap column + left replica column
|
|
|
|
|
# FIXME: these col offsets should really start at 0 because
|
|
|
|
|
# this is the left edge of the array... but changing them all is work
|
2020-10-06 14:03:59 +02:00
|
|
|
column_offset=1 + len(self.left_rbl),
|
2020-09-23 15:24:52 +02:00
|
|
|
mirror=0)
|
2020-10-13 13:48:10 +02:00
|
|
|
|
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
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-08-19 00:47:52 +02:00
|
|
|
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):
|
2023-06-06 23:43:18 +02:00
|
|
|
# The bit represents which port the RBL is for
|
2020-09-09 20:54:46 +02:00
|
|
|
for bit in self.rbls:
|
2020-08-21 22:44:35 +02:00
|
|
|
for port in self.all_ports:
|
2020-09-09 20:54:46 +02:00
|
|
|
self.rbl_bitline_names[bit].append("rbl_bl_{0}_{1}".format(port, bit))
|
2020-09-09 22:38:13 +02:00
|
|
|
for port in self.all_ports:
|
2020-09-09 20:54:46 +02:00
|
|
|
self.rbl_bitline_names[bit].append("rbl_br_{0}_{1}".format(port, bit))
|
2020-08-21 22:44:35 +02:00
|
|
|
# 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
|
|
|
|
2023-02-07 20:32:02 +01:00
|
|
|
self.bitline_names = self.bitcell_array.bitline_names
|
2020-08-21 22:44:35 +02:00
|
|
|
# Make a flat list too
|
2023-02-07 20:32:02 +01:00
|
|
|
self.all_bitline_names = [x for sl in zip(*self.bitline_names) for x in sl]
|
2020-08-25 20:50:44 +02:00
|
|
|
|
2023-02-07 20:32:02 +01:00
|
|
|
self.bitline_pin_list = []
|
2020-09-09 20:54:46 +02:00
|
|
|
for port in self.left_rbl:
|
2023-02-07 20:32:02 +01:00
|
|
|
self.bitline_pin_list.extend(self.rbl_bitline_names[port])
|
|
|
|
|
self.bitline_pin_list.extend(self.all_bitline_names)
|
2020-09-09 20:54:46 +02:00
|
|
|
for port in self.right_rbl:
|
2023-02-07 20:32:02 +01:00
|
|
|
self.bitline_pin_list.extend(self.rbl_bitline_names[port])
|
2022-10-25 05:08:13 +02:00
|
|
|
|
2023-02-07 20:32:02 +01:00
|
|
|
self.add_pin_list(self.bitline_pin_list, "INOUT")
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-08-12 00:00:29 +02:00
|
|
|
def add_wordline_pins(self):
|
2022-10-25 05:08:13 +02:00
|
|
|
# Unused wordlines are connected to ground at the next level of hierarchy
|
|
|
|
|
self.unused_wordline_names = []
|
2020-08-19 20:35:55 +02:00
|
|
|
|
2020-09-09 20:54:46 +02:00
|
|
|
for port in self.all_ports:
|
2023-03-09 19:07:02 +01:00
|
|
|
if self.rbl[port] == 0:
|
|
|
|
|
continue # TODO: there's probably a better way to do this check
|
2020-09-09 20:54:46 +02:00
|
|
|
for bit in self.all_ports:
|
2020-10-09 00:28:01 +02:00
|
|
|
self.rbl_wordline_names[port].append("rbl_wl_{0}_{1}".format(port, bit))
|
2022-10-18 05:51:42 +02:00
|
|
|
if bit != port:
|
2022-10-25 05:08:13 +02:00
|
|
|
self.unused_wordline_names.append("rbl_wl_{0}_{1}".format(port, bit))
|
2020-09-04 22:06:58 +02:00
|
|
|
|
2020-08-21 22:44:35 +02:00
|
|
|
self.all_rbl_wordline_names = [x for sl in self.rbl_wordline_names for x in sl]
|
|
|
|
|
|
2023-02-07 20:32:02 +01:00
|
|
|
self.wordline_names = self.bitcell_array.wordline_names
|
|
|
|
|
self.all_wordline_names = self.bitcell_array.all_wordline_names
|
|
|
|
|
|
|
|
|
|
# All wordlines including RBL
|
|
|
|
|
self.wordline_pin_list = []
|
2020-10-08 12:34:16 +02:00
|
|
|
for bit in range(self.rbl[0]):
|
2023-02-07 20:32:02 +01:00
|
|
|
self.wordline_pin_list.extend(self.rbl_wordline_names[bit])
|
|
|
|
|
self.wordline_pin_list.extend(self.all_wordline_names)
|
2020-10-08 12:34:16 +02:00
|
|
|
for bit in range(self.rbl[1]):
|
2023-02-07 20:32:02 +01:00
|
|
|
self.wordline_pin_list.extend(self.rbl_wordline_names[self.rbl[0] + bit])
|
2020-10-06 14:03:59 +02:00
|
|
|
|
2022-10-25 05:08:13 +02:00
|
|
|
self.used_wordline_names = []
|
2020-10-08 12:34:16 +02:00
|
|
|
for port in range(self.rbl[0]):
|
2022-10-25 05:08:13 +02:00
|
|
|
self.used_wordline_names.append(self.rbl_wordline_names[port][port])
|
2023-02-07 20:32:02 +01:00
|
|
|
self.used_wordline_names.extend(self.all_wordline_names)
|
2020-10-08 12:34:16 +02:00
|
|
|
for port in range(self.rbl[0], self.rbl[0] + self.rbl[1]):
|
2022-10-25 05:08:13 +02:00
|
|
|
self.used_wordline_names.append(self.rbl_wordline_names[port][port])
|
|
|
|
|
|
2023-02-07 20:32:02 +01:00
|
|
|
self.add_pin_list(self.wordline_pin_list, "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 """
|
2020-10-13 13:48:10 +02:00
|
|
|
self.supplies = ["vdd", "gnd"]
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-10-13 13:48:10 +02:00
|
|
|
# Main array
|
|
|
|
|
self.bitcell_array_inst=self.add_inst(name="bitcell_array",
|
2022-10-20 02:13:54 +02:00
|
|
|
mod=self.bitcell_array)
|
2023-02-07 20:32:02 +01:00
|
|
|
self.connect_inst(self.all_bitline_names + self.all_wordline_names + self.supplies)
|
2019-06-20 01:03:21 +02:00
|
|
|
|
2020-10-13 13:48:10 +02:00
|
|
|
# Replica columns
|
|
|
|
|
self.replica_col_insts = []
|
|
|
|
|
for port in self.all_ports:
|
|
|
|
|
if port in self.rbls:
|
|
|
|
|
self.replica_col_insts.append(self.add_inst(name="replica_col_{}".format(port),
|
|
|
|
|
mod=self.replica_columns[port]))
|
2023-02-07 20:32:02 +01:00
|
|
|
self.connect_inst(self.rbl_bitline_names[port] + self.wordline_pin_list + self.supplies)
|
2020-10-13 13:48:10 +02:00
|
|
|
else:
|
|
|
|
|
self.replica_col_insts.append(None)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2022-10-20 02:13:54 +02:00
|
|
|
# Dummy rows above/below the bitcell array (connected with the replica cell wl)
|
2020-10-13 13:48:10 +02:00
|
|
|
self.dummy_row_replica_insts = []
|
|
|
|
|
# Note, this is the number of left and right even if we aren't adding the columns to this bitcell array!
|
2022-12-14 17:12:55 +01:00
|
|
|
for port in self.all_ports: # TODO: tie to self.rbl or whatever
|
2023-03-09 19:07:02 +01:00
|
|
|
if self.rbl[port] != 0:
|
|
|
|
|
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] + self.supplies)
|
|
|
|
|
else:
|
|
|
|
|
self.dummy_row_replica_insts.append(None)
|
2020-10-13 13:48:10 +02:00
|
|
|
|
2020-09-30 16:34:05 +02:00
|
|
|
def create_layout(self):
|
2019-06-20 01:03:21 +02:00
|
|
|
|
2022-04-05 22:51:55 +02:00
|
|
|
# This creates space for the unused wordline connections as well as the
|
|
|
|
|
# row-based or column based power and ground lines.
|
2022-07-20 19:27:30 +02:00
|
|
|
self.vertical_pitch = 1.1 * getattr(self, "{}_pitch".format(self.supply_stack[0]))
|
|
|
|
|
self.horizontal_pitch = 1.1 * getattr(self, "{}_pitch".format(self.supply_stack[2]))
|
2020-09-28 23:49:33 +02:00
|
|
|
|
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-10-13 13:48:10 +02:00
|
|
|
self.col_end_offset = vector(self.cell.width, self.cell.height)
|
|
|
|
|
self.row_end_offset = vector(self.cell.width, self.cell.height)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2022-04-05 22:51:55 +02:00
|
|
|
# Everything is computed with the main array
|
2022-09-26 23:24:16 +02:00
|
|
|
self.bitcell_array_inst.place(offset=0)
|
2019-07-11 00:56:51 +02:00
|
|
|
|
2020-07-28 01:22:21 +02:00
|
|
|
self.add_replica_columns()
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-07-28 01:22:21 +02:00
|
|
|
# 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
|
2020-11-21 16:03:59 +01:00
|
|
|
# Note that this doesn't include the row/col cap
|
2023-03-09 19:07:02 +01:00
|
|
|
array_offset = self.bitcell_offset.scale(-len(self.left_rbl), -self.rbl[0])
|
|
|
|
|
self.translate_all(array_offset)
|
2020-07-28 01:22:21 +02:00
|
|
|
|
|
|
|
|
self.add_layout_pins()
|
|
|
|
|
|
2022-10-20 02:13:54 +02:00
|
|
|
self.route_supplies()
|
|
|
|
|
|
2023-01-27 02:38:24 +01:00
|
|
|
self.height = (sum(self.rbl) + self.row_size) * self.cell.height
|
2022-12-14 17:12:55 +01:00
|
|
|
self.width = (len(self.rbls) + self.column_size) * self.cell.width
|
2022-05-03 00:43:14 +02:00
|
|
|
|
2020-07-28 01:22:21 +02:00
|
|
|
self.add_boundary()
|
|
|
|
|
|
|
|
|
|
self.DRC_LVS()
|
|
|
|
|
|
2020-09-11 01:44:54 +02:00
|
|
|
def get_main_array_top(self):
|
2022-05-13 19:46:00 +02:00
|
|
|
""" Return the top of the main bitcell array. """
|
2020-09-11 01:44:54 +02:00
|
|
|
return self.bitcell_array_inst.uy()
|
|
|
|
|
|
|
|
|
|
def get_main_array_bottom(self):
|
2022-05-13 19:46:00 +02:00
|
|
|
""" Return the bottom of the main bitcell array. """
|
2020-09-11 01:44:54 +02:00
|
|
|
return self.bitcell_array_inst.by()
|
|
|
|
|
|
|
|
|
|
def get_main_array_left(self):
|
2022-05-13 19:46:00 +02:00
|
|
|
""" Return the left of the main bitcell array. """
|
2020-09-11 01:44:54 +02:00
|
|
|
return self.bitcell_array_inst.lx()
|
|
|
|
|
|
|
|
|
|
def get_main_array_right(self):
|
2022-05-13 19:46:00 +02:00
|
|
|
""" Return the right of the main bitcell array. """
|
2020-09-11 01:44:54 +02:00
|
|
|
return self.bitcell_array_inst.rx()
|
2020-09-12 00:36:22 +02:00
|
|
|
|
|
|
|
|
def get_column_offsets(self):
|
|
|
|
|
"""
|
|
|
|
|
Return an array of the x offsets of all the regular bits
|
|
|
|
|
"""
|
2020-09-14 21:05:45 +02:00
|
|
|
offsets = [x + self.bitcell_array_inst.lx() for x in self.bitcell_array.get_column_offsets()]
|
|
|
|
|
return offsets
|
2020-09-12 00:36:22 +02:00
|
|
|
|
2020-07-28 01:22:21 +02:00
|
|
|
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-09-09 20:54:46 +02:00
|
|
|
for bit, port in enumerate(self.left_rbl):
|
2022-09-26 23:24:16 +02:00
|
|
|
offset = self.bitcell_offset.scale(-len(self.left_rbl) + bit, -self.rbl[0])
|
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-09-09 20:54:46 +02:00
|
|
|
for bit, port in enumerate(self.right_rbl):
|
2022-09-26 23:24:16 +02:00
|
|
|
offset = self.bitcell_array_inst.lr() + self.bitcell_offset.scale(bit, -self.rbl[0])
|
2020-10-09 01:40:53 +02:00
|
|
|
self.replica_col_insts[self.rbl[0] + 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-09-09 20:54:46 +02:00
|
|
|
for bit in range(self.rbl[0]):
|
2022-09-26 23:24:16 +02:00
|
|
|
dummy_offset = self.bitcell_offset.scale(0, -self.rbl[0] + bit + (-self.rbl[0] + bit) % 2)
|
2020-09-28 23:49:33 +02:00
|
|
|
self.dummy_row_replica_insts[bit].place(offset=dummy_offset,
|
2020-09-09 20:54:46 +02:00
|
|
|
mirror="MX" if (-self.rbl[0] + bit) % 2 else "R0")
|
2020-08-14 23:14:49 +02:00
|
|
|
# These grow up, away from the array
|
2020-09-09 20:54:46 +02:00
|
|
|
for bit in range(self.rbl[1]):
|
2020-09-28 23:49:33 +02:00
|
|
|
dummy_offset = self.bitcell_offset.scale(0, bit + bit % 2) + self.bitcell_array_inst.ul()
|
|
|
|
|
self.dummy_row_replica_insts[self.rbl[0] + bit].place(offset=dummy_offset,
|
2020-12-08 19:31:22 +01:00
|
|
|
mirror="MX" if (self.row_size + bit) % 2 else "R0")
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
def add_layout_pins(self):
|
|
|
|
|
""" Add the layout pins """
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2020-12-08 19:31:22 +01:00
|
|
|
# All wordlines
|
2022-12-11 04:03:55 +01:00
|
|
|
# Main array wl
|
2023-02-07 20:32:02 +01:00
|
|
|
for pin_name in self.all_wordline_names:
|
2020-10-13 13:48:10 +02:00
|
|
|
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,
|
2022-12-11 04:03:55 +01:00
|
|
|
offset=pin.ll().scale(0, 1),
|
2020-10-13 13:48:10 +02:00
|
|
|
width=self.width,
|
|
|
|
|
height=pin.height())
|
2021-11-22 19:51:40 +01:00
|
|
|
|
2020-10-13 13:48:10 +02:00
|
|
|
# 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)
|
|
|
|
|
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)
|
|
|
|
|
self.add_layout_pin(text=wl_name,
|
|
|
|
|
layer=pin.layer,
|
2022-12-11 04:03:55 +01:00
|
|
|
offset=pin.ll().scale(0, 1),
|
2020-10-13 13:48:10 +02:00
|
|
|
width=self.width,
|
|
|
|
|
height=pin.height())
|
|
|
|
|
|
2022-12-11 04:03:55 +01:00
|
|
|
# Main array bl/br
|
2023-02-07 20:32:02 +01:00
|
|
|
for pin_name in self.all_bitline_names:
|
2020-10-08 14:32:03 +02:00
|
|
|
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,
|
2022-12-11 04:03:55 +01:00
|
|
|
offset=pin.ll().scale(1, 0),
|
2020-10-08 14:32:03 +02:00
|
|
|
width=pin.width(),
|
|
|
|
|
height=self.height)
|
2020-08-12 00:00:29 +02:00
|
|
|
|
2019-07-11 00:56:51 +02:00
|
|
|
# Replica bitlines
|
2020-09-09 20:54:46 +02:00
|
|
|
if len(self.rbls) > 0:
|
|
|
|
|
for (names, inst) in zip(self.rbl_bitline_names, self.replica_col_insts):
|
2020-09-10 21:04:46 +02:00
|
|
|
pin_names = self.replica_columns[self.rbls[0]].all_bitline_names
|
|
|
|
|
for (bl_name, pin_name) in zip(names, pin_names):
|
2020-09-09 20:54:46 +02:00
|
|
|
pin = inst.get_pin(pin_name)
|
|
|
|
|
self.add_layout_pin(text=bl_name,
|
|
|
|
|
layer=pin.layer,
|
2022-12-11 04:03:55 +01:00
|
|
|
offset=pin.ll().scale(1, 0),
|
2020-09-09 20:54:46 +02:00
|
|
|
width=pin.width(),
|
|
|
|
|
height=self.height)
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2022-10-20 02:13:54 +02:00
|
|
|
def route_supplies(self):
|
2023-03-09 19:07:02 +01:00
|
|
|
""" just copy supply pins from all instances """
|
2022-10-20 02:13:54 +02:00
|
|
|
for inst in self.insts:
|
|
|
|
|
for pin_name in ["vdd", "gnd"]:
|
|
|
|
|
self.copy_layout_pin(inst, pin_name)
|
|
|
|
|
|
2022-04-05 22:51:55 +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()
|
|
|
|
|
cell_load = 2 * bl_wire.return_input_cap()
|
|
|
|
|
bl_swing = OPTS.rbl_delay_percentage
|
|
|
|
|
freq = spice["default_event_frequency"]
|
|
|
|
|
bitline_dynamic = self.calc_dynamic_power(corner, cell_load, freq, swing=bl_swing)
|
|
|
|
|
|
|
|
|
|
# Calculate the bitcell power which currently only includes leakage
|
|
|
|
|
cell_power = self.cell.analytical_power(corner, load)
|
|
|
|
|
|
|
|
|
|
# Leakage power grows with entire array and bitlines.
|
|
|
|
|
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
|
|
|
|
|
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2019-06-20 01:03:21 +02:00
|
|
|
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
|
|
|
|
|
|
2020-09-29 21:15:42 +02:00
|
|
|
def graph_exclude_bits(self, targ_row=None, targ_col=None):
|
2020-09-29 19:26:31 +02:00
|
|
|
"""
|
|
|
|
|
Excludes bits in column from being added to graph except target
|
|
|
|
|
"""
|
2019-07-12 17:42:36 +02:00
|
|
|
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):
|
2020-09-29 19:26:31 +02:00
|
|
|
"""
|
|
|
|
|
Exclude all replica/dummy cells in the replica columns except the replica bit.
|
|
|
|
|
"""
|
2020-05-28 05:03:11 +02:00
|
|
|
|
2020-09-09 22:03:05 +02:00
|
|
|
for port in 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):
|
2020-09-29 19:26:31 +02:00
|
|
|
"""
|
|
|
|
|
Gets the spice name of the target bitcell.
|
|
|
|
|
"""
|
2021-05-15 01:16:25 +02:00
|
|
|
return self.bitcell_array.get_cell_name(inst_name + "{}x".format(OPTS.hier_seperator) + self.bitcell_array_inst.name, row, col)
|
2020-09-29 19:26:31 +02:00
|
|
|
|
|
|
|
|
def clear_exclude_bits(self):
|
2020-11-03 15:29:17 +01:00
|
|
|
"""
|
2020-09-29 19:26:31 +02:00
|
|
|
Clears the bit exclusions
|
|
|
|
|
"""
|
|
|
|
|
self.bitcell_array.init_graph_params()
|