# See LICENSE for licensing information. # # Copyright (c) 2016-2019 Regents of the University of California # All rights reserved. # import debug import bitcell_base_array from tech import drc, spice, cell_properties from vector import vector from globals import OPTS from sram_factory import factory class replica_bitcell_array(bitcell_base_array.bitcell_base_array): """ 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. Dummy are the outside columns/rows with WL and BL tied to gnd. Requires a regular bitcell array, replica bitcell, and dummy bitcell (Bl/BR disconnected). """ def __init__(self, rows, cols, left_rbl, right_rbl, bitcell_ports, name, add_replica=True): super().__init__(name, rows, cols, column_offset=0) 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 self.left_rbl = left_rbl self.right_rbl = right_rbl self.bitcell_ports = bitcell_ports # If set to false, we increase the height for the replica wordline row, but don't # actually add the column to this array. This is so the height matches other # banks that have the replica columns. # Number of replica columns to actually add if add_replica: self.add_left_rbl = self.left_rbl self.add_right_rbl = self.right_rbl else: self.add_left_rbl = 0 self.add_right_rbl = 0 debug.check(left_rbl + right_rbl <= len(self.all_ports), "Invalid number of RBLs for port configuration.") debug.check(left_rbl + right_rbl <= len(self.bitcell_ports), "Bitcell ports must match total RBLs.") # Two dummy rows plus replica even if we don't add the column self.extra_rows = 2 + self.left_rbl + self.right_rbl # Two dummy cols plus replica if we add the column self.extra_cols = 2 + self.add_left_rbl + self.add_right_rbl 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 # self.offset_all_coordinates() def create_netlist(self): """ Create and connect the netlist """ self.add_modules() self.add_pins() self.create_instances() def add_modules(self): """ Array and dummy/replica columns d or D = dummy cell (caps to distinguish grouping) r or R = replica cell (caps to distinguish grouping) b or B = bitcell replica columns 1 v v bdDDDDDDDDDDDDDDdb <- Dummy row bdDDDDDDDDDDDDDDrb <- Dummy row 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", column_offset=1 + self.add_left_rbl, cols=self.column_size, rows=self.row_size) self.add_mod(self.bitcell_array) # Replica bitlines self.replica_columns = {} for bit in range(self.add_left_rbl + self.add_right_rbl): # Creating left_rbl if bit