mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-08-29 01:24:39 +02:00
placement working for sp capped rba, need fix rowcap patterns
This commit is contained in:
@@ -22,4 +22,4 @@ class sky130_capped_replica_bitcell_array(capped_replica_bitcell_array, sky130_b
|
||||
"""
|
||||
def __init__(self, rows, cols, rbl=None, left_rbl=None, right_rbl=None, name=""):
|
||||
super().__init__(rows, cols, rbl, left_rbl, right_rbl, name)
|
||||
|
||||
|
||||
|
||||
@@ -11,13 +11,15 @@ from openram.tech import layer
|
||||
from openram import OPTS
|
||||
from openram.modules.col_cap_array import col_cap_array
|
||||
from .sky130_bitcell_base_array import sky130_bitcell_base_array
|
||||
from openram.modules import pattern
|
||||
from math import ceil
|
||||
|
||||
class sky130_col_cap_array(col_cap_array, sky130_bitcell_base_array):
|
||||
"""
|
||||
Generate a dummy row/column for the replica array.
|
||||
"""
|
||||
def __init__(self, rows, cols, column_offset=0, mirror=0, location="", name=""):
|
||||
super().__init__(rows, cols, column_offset=0, mirror=0, location="", name="")
|
||||
super().__init__(rows, cols, column_offset=column_offset, mirror=mirror, location=location, name=name)
|
||||
|
||||
def add_modules(self):
|
||||
""" Add the modules used in this design """
|
||||
@@ -33,4 +35,53 @@ class sky130_col_cap_array(col_cap_array, sky130_bitcell_base_array):
|
||||
self.cell = factory.create(module_type=OPTS.bitcell, version="opt1")
|
||||
|
||||
def create_instances(self):
|
||||
|
||||
self.all_inst={}
|
||||
self.cell_inst={}
|
||||
|
||||
bit_row = [geometry.instance("00_colend", mod=self.colend1, is_bitcell=True)] \
|
||||
+ [geometry.instance("01_strap_p_cent", mod=self.colend2, is_bitcell=False)]\
|
||||
+ [geometry.instance("02_colend", mod=self.colend1, is_bitcell=True, mirror="MY")] \
|
||||
+ [geometry.instance("03_strap_p", mod=self.colend3, is_bitcell=False)]
|
||||
|
||||
bit_row = pattern.rotate_list(bit_row, self.column_offset * 2)
|
||||
bit_block = []
|
||||
pattern.append_row_to_block(bit_block, bit_row)
|
||||
self.pattern = pattern(self, "col_cap_array_" + self.location , bit_block, num_rows=self.row_size, num_cols=self.column_size, num_cores_x=ceil(self.column_size/2), num_cores_y=ceil(self.row_size/2), name_template="col_cap_array" + self.location + "_r{0}_c{1}")
|
||||
self.pattern.connect_array()
|
||||
|
||||
|
||||
def get_bitcell_pins(self, row, col):
|
||||
"""
|
||||
Creates a list of connections in the bitcell,
|
||||
indexed by column and row, for instance use in bitcell_array
|
||||
"""
|
||||
bitcell_pins = []
|
||||
for port in self.all_ports:
|
||||
bitcell_pins.extend([x for x in self.get_bitline_names(port) if x.endswith("_{0}".format(col))])
|
||||
bitcell_pins.append("vdd") # vdd
|
||||
bitcell_pins.append("gnd") # gnd
|
||||
bitcell_pins.append("vdd") # vpb
|
||||
bitcell_pins.append("gnd") # vnb
|
||||
#bitcell_pins.extend([x for x in self.all_wordline_names if x.endswith("_{0}".format(row))])
|
||||
|
||||
return bitcell_pins
|
||||
|
||||
def get_strap_pins(self, row, col):
|
||||
|
||||
strap_pins = []
|
||||
if col % 2 == 0 and col % 4 != 0:
|
||||
strap_pins.append("vdd") # vdd
|
||||
else:
|
||||
strap_pins.append("gnd") # gnd
|
||||
strap_pins.append("vdd") # vpb
|
||||
strap_pins.append("gnd") # vnb
|
||||
|
||||
return strap_pins
|
||||
|
||||
def create_layout(self):
|
||||
|
||||
self.place_array()
|
||||
self.add_layout_pins()
|
||||
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
@@ -7,27 +7,21 @@
|
||||
|
||||
from openram import debug
|
||||
from openram.base import design
|
||||
from openram.base import get_libcell_size
|
||||
from openram.tech import layer, GDS
|
||||
from openram.tech import cell_properties as props
|
||||
|
||||
|
||||
class sky130_corner(design):
|
||||
|
||||
def __init__(self, location, name=""):
|
||||
super().__init__(name)
|
||||
|
||||
if location == "ul":
|
||||
self.name = "sky130_fd_bd_sram__sram_sp_corner"
|
||||
cell_name = "sky130_fd_bd_sram__sram_sp_corner"
|
||||
elif location == "ur":
|
||||
self.name = "sky130_fd_bd_sram__sram_sp_cornerb"
|
||||
cell_name = "sky130_fd_bd_sram__sram_sp_cornerb"
|
||||
elif location == "ll":
|
||||
self.name = "sky130_fd_bd_sram__sram_sp_cornera"
|
||||
cell_name = "sky130_fd_bd_sram__sram_sp_cornera"
|
||||
elif location == "lr":
|
||||
self.name = "sky130_fd_bd_sram__sram_sp_cornera"
|
||||
cell_name = "sky130_fd_bd_sram__sram_sp_cornera"
|
||||
else:
|
||||
debug.error("Invalid sky130_corner location", -1)
|
||||
design.__init__(self, name=self.name)
|
||||
(self.width, self.height) = get_libcell_size(self.name,
|
||||
GDS["unit"],
|
||||
layer["mem"])
|
||||
# pin_map = get_libcell_pins(pin_names, self.name, GDS["unit"])
|
||||
super().__init__(name=name, cell_name=cell_name, prop=props.col_cap_1port_strap_power)
|
||||
|
||||
@@ -5,140 +5,100 @@
|
||||
# All rights reserved.
|
||||
#
|
||||
|
||||
from openram.base import geometry
|
||||
from openram.sram_factory import factory
|
||||
from openram import OPTS
|
||||
from .sky130_bitcell_base_array import sky130_bitcell_base_array
|
||||
from openram.modules.row_cap_array import row_cap_array
|
||||
from openram.modules.pattern import pattern
|
||||
from math import ceil
|
||||
|
||||
|
||||
class sky130_row_cap_array(sky130_bitcell_base_array):
|
||||
class sky130_row_cap_array(row_cap_array, sky130_bitcell_base_array):
|
||||
"""
|
||||
Generate a dummy row/column for the replica array.
|
||||
"""
|
||||
def __init__(self, rows, cols, column_offset=0, mirror=0, name=""):
|
||||
# Don't call the regular col-cap_array constructor since we don't want its constructor, just
|
||||
# some of it's useful member functions
|
||||
sky130_bitcell_base_array.__init__(self, rows=rows, cols=cols, column_offset=column_offset, name=name)
|
||||
self.rows = rows
|
||||
self.cols = cols
|
||||
self.column_offset = column_offset
|
||||
def __init__(self, rows, cols, column_offset=0, mirror=0, location="", name=""):
|
||||
super().__init__(rows, cols, column_offset=column_offset, location=location, name=name)
|
||||
self.mirror = mirror
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
""" Create and connect the netlist """
|
||||
self.create_all_wordline_names()
|
||||
# This module has no bitlines
|
||||
# self.create_all_bitline_names()
|
||||
|
||||
self.add_modules()
|
||||
self.add_pins()
|
||||
self.create_instances()
|
||||
|
||||
def create_layout(self):
|
||||
|
||||
self.place_array("dummy_r{0}_c{1}", self.mirror)
|
||||
self.add_layout_pins()
|
||||
|
||||
self.width = max([x.rx() for x in self.insts])
|
||||
self.height = max([x.uy() for x in self.insts])
|
||||
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
self.location = location
|
||||
def add_modules(self):
|
||||
""" Add the modules used in this design """
|
||||
if self.column_offset == 0:
|
||||
self.top_corner = factory.create(module_type="corner", location="ul")
|
||||
self.bottom_corner =factory.create(module_type="corner", location="ll")
|
||||
self.rowend1 = factory.create(module_type="row_cap", version="rowend_replica")
|
||||
self.rowend2 = factory.create(module_type="row_cap", version="rowenda_replica")
|
||||
#self.rowend1 = factory.create(module_type="row_cap", version="rowend_replica")
|
||||
#self.rowend2 = factory.create(module_type="row_cap", version="rowenda_replica")
|
||||
|
||||
else:
|
||||
self.top_corner = factory.create(module_type="corner", location="ur")
|
||||
self.bottom_corner = factory.create(module_type="corner", location="lr")
|
||||
|
||||
self.rowend1 = factory.create(module_type="row_cap", version="rowend")
|
||||
self.rowend2 = factory.create(module_type="row_cap", version="rowenda")
|
||||
|
||||
#self.rowend1 = factory.create(module_type="row_cap", version="rowend")
|
||||
#self.rowend2 = factory.create(module_type="row_cap", version="rowenda")
|
||||
self.rowend = factory.create(module_type="row_cap", version="rowend")
|
||||
self.rowenda = factory.create(module_type="row_cap", version="rowenda")
|
||||
self.cell = factory.create(module_type=OPTS.bitcell, version="opt1")
|
||||
|
||||
def create_instances(self):
|
||||
""" Create the module instances used in this design """
|
||||
self.cell_inst = {}
|
||||
self.array_layout = []
|
||||
alternate_bitcell = (self.rows + 1) % 2
|
||||
for row in range(self.rows + 2):
|
||||
row_layout = []
|
||||
name="rca_{0}".format(row)
|
||||
# Top/bottom cell are always dummy cells.
|
||||
# Regular array cells are replica cells (>left_rbl and <rows-right_rbl)
|
||||
# Replic bit specifies which other bit (in the full range (0,rows) to make a replica cell.
|
||||
|
||||
if (row < self.rows + 1 and row > 0):
|
||||
|
||||
if alternate_bitcell == 0:
|
||||
row_layout.append(self.rowend1)
|
||||
self.cell_inst[row]=self.add_inst(name=name, mod=self.rowend1)
|
||||
self.connect_inst(["wl_0_{}".format(row - 1), "vdd"])
|
||||
alternate_bitcell = 1
|
||||
|
||||
else:
|
||||
row_layout.append(self.rowend2)
|
||||
self.cell_inst[row] = self.add_inst(name=name, mod=self.rowend2)
|
||||
self.connect_inst(["wl_0_{}".format(row - 1), "vdd"])
|
||||
alternate_bitcell = 0
|
||||
|
||||
elif (row == 0):
|
||||
row_layout.append(self.bottom_corner)
|
||||
self.cell_inst[row]=self.add_inst(name=name, mod=self.bottom_corner)
|
||||
self.connect_inst(self.get_corner_pins())
|
||||
|
||||
elif (row == self.rows + 1):
|
||||
row_layout.append(self.top_corner)
|
||||
self.cell_inst[row]=self.add_inst(name=name, mod=self.top_corner)
|
||||
self.connect_inst(self.get_corner_pins())
|
||||
|
||||
self.array_layout.append(row_layout)
|
||||
|
||||
def place_array(self, name_template, row_offset=0):
|
||||
xoffset = 0.0
|
||||
yoffset = 0.0
|
||||
for row in range(len(self.insts)):
|
||||
inst = self.insts[row]
|
||||
if row == 0:
|
||||
inst.place(offset=[xoffset, yoffset + inst.height], mirror="MX")
|
||||
elif row == len(self.insts)-1:
|
||||
inst.place(offset=[xoffset, yoffset])
|
||||
self.all_inst={}
|
||||
self.cell_inst={}
|
||||
|
||||
bit_block = []
|
||||
top_corner = geometry.instance("row_cap_top_corner", mod=self.top_corner, is_bitcell=False, mirror="XY")
|
||||
bottom_corner = geometry.instance("row_cap_bottom_corner", mod=self.bottom_corner, is_bitcell=False)
|
||||
rowend = geometry.instance("row_cap_rowend", mod=self.rowend, is_bitcell=True)
|
||||
rowenda = geometry.instance("row_cap_rowenda", mod=self.rowenda, is_bitcell=True, mirror="XY")
|
||||
|
||||
pattern.append_row_to_block(bit_block, [top_corner])
|
||||
for row in range(1,self.row_size-1):
|
||||
if row % 2 == 0:
|
||||
pattern.append_row_to_block(bit_block, [rowend])
|
||||
else:
|
||||
if row % 2 ==0:
|
||||
inst.place(offset=[xoffset, yoffset + inst.height], mirror="MX")
|
||||
else:
|
||||
inst.place(offset=[xoffset, yoffset])
|
||||
yoffset += inst.height
|
||||
pattern.append_row_to_block(bit_block, [rowenda])
|
||||
pattern.append_row_to_block(bit_block, [bottom_corner])
|
||||
self.pattern = pattern(self, "row_cap_array_" + self.location, bit_block, num_rows=self.row_size, num_cols=self.column_size, num_cores_x=ceil(self.column_size/2), num_cores_y=ceil(self.row_size/2), name_template="row_cap_array" + self.location + "_r{0}_c{1}")
|
||||
self.pattern.connect_array_raw()
|
||||
|
||||
|
||||
def get_bitcell_pins(self, row, col):
|
||||
"""
|
||||
Creates a list of connections in the bitcell,
|
||||
indexed by column and row, for instance use in bitcell_array
|
||||
"""
|
||||
|
||||
def add_pins(self):
|
||||
for row in range(self.rows + 2):
|
||||
bitcell_pins = []
|
||||
bitcell_pins.append("vdd") # vdd
|
||||
bitcell_pins.extend([x for x in self.all_wordline_names if x.endswith("_{0}".format(row))])
|
||||
|
||||
#bitcell_pins.extend([x for x in self.all_wordline_names if x.endswith("_{0}".format(row))])
|
||||
|
||||
return bitcell_pins
|
||||
|
||||
def get_strap_pins(self, row, col):
|
||||
|
||||
strap_pins = []
|
||||
|
||||
strap_pins.append("vdd") # vdd
|
||||
strap_pins.append("vdd") # vpb
|
||||
strap_pins.append("gnd") # vnb
|
||||
|
||||
return strap_pins
|
||||
|
||||
def create_all_wordline_names(self, row_size=None, start_row=0):
|
||||
if row_size == None:
|
||||
row_size = self.row_size
|
||||
row_size = row_size - 2
|
||||
for row in range(start_row, row_size):
|
||||
for port in self.all_ports:
|
||||
self.add_pin("wl_{}_{}".format(port, row), "OUTPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
self.wordline_names[port].append("wl_{0}_{1}".format(port, row))
|
||||
|
||||
def add_layout_pins(self):
|
||||
""" Add the layout pins """
|
||||
for row in range(0, self.rows + 1):
|
||||
if row > 0 and row < self.rows + 1:
|
||||
wl_pin = self.cell_inst[row].get_pin("wl")
|
||||
self.add_layout_pin(text="wl_0_{0}".format(row -1),
|
||||
layer=wl_pin.layer,
|
||||
offset=wl_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=wl_pin.height())
|
||||
self.all_wordline_names = [x for sl in zip(*self.wordline_names) for x in sl]
|
||||
|
||||
def create_layout(self):
|
||||
|
||||
# Add vdd/gnd via stacks
|
||||
for row in range(1, self.rows):
|
||||
inst = self.cell_inst[row]
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
for pin in inst.get_pins(pin_name):
|
||||
self.copy_layout_pin(inst, pin_name)
|
||||
self.place_array()
|
||||
self.add_layout_pins()
|
||||
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
|
||||
@@ -114,13 +114,12 @@ cell_properties.bitcell_2port.vdd_dir = "H"
|
||||
cell_properties.bitcell_2port.gnd_layer = "m2"
|
||||
cell_properties.bitcell_2port.gnd_dir = "H"
|
||||
|
||||
cell_properties.col_cap_1port_bitcell = d.cell(['bl', 'vdd', 'gnd', 'br', 'gate', 'vpb', 'vnb'],
|
||||
['INPUT', 'POWER', 'GROUND', 'INPUT', 'INPUT', 'BIAS', 'BIAS'],
|
||||
cell_properties.col_cap_1port_bitcell = d.cell(['bl', 'br', 'vdd', 'gnd', 'vpb', 'vnb'],
|
||||
['INPUT', 'INPUT','POWER', 'GROUND', 'BIAS', 'BIAS'],
|
||||
{'bl': 'bl',
|
||||
'br': 'br',
|
||||
'vdd': 'vdd',
|
||||
'gnd': 'gnd',
|
||||
'gate': 'gate',
|
||||
'vnb': 'vnb',
|
||||
'vpb': 'vpb'})
|
||||
cell_properties.col_cap_1port_bitcell.boundary_layer = "mem"
|
||||
|
||||
Reference in New Issue
Block a user