mirror of https://github.com/VLSIDA/OpenRAM.git
Small bug fixes related to new name mapping.
This commit is contained in:
parent
1d729e8f02
commit
86799ae3ff
|
|
@ -46,7 +46,7 @@ class _cell:
|
||||||
def port_order(self, x):
|
def port_order(self, x):
|
||||||
self._port_order = x
|
self._port_order = x
|
||||||
# Update ordered name list in the new order
|
# Update ordered name list in the new order
|
||||||
self._port_names = [getattr(self._pins, x) for x in self._port_order]
|
self._port_names = [self._port_map[x] for x in self._port_order]
|
||||||
# Update ordered type list in the new order
|
# Update ordered type list in the new order
|
||||||
self._port_types = [self._port_types_map[x] for x in self._port_order]
|
self._port_types = [self._port_types_map[x] for x in self._port_order]
|
||||||
|
|
||||||
|
|
@ -57,9 +57,8 @@ class _cell:
|
||||||
@port_map.setter
|
@port_map.setter
|
||||||
def port_map(self, x):
|
def port_map(self, x):
|
||||||
self._port_map = x
|
self._port_map = x
|
||||||
self._pins = _pins(x)
|
|
||||||
# Update ordered name list to use the new names
|
# Update ordered name list to use the new names
|
||||||
self._port_names = [getattr(self._pins, x) for x in self._port_order]
|
self._port_names = [self.port_map[x] for x in self._port_order]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def port_types(self):
|
def port_types(self):
|
||||||
|
|
@ -153,10 +152,6 @@ class cell_properties():
|
||||||
self._dff = _cell(["D", "Q", "clk", "vdd", "gnd"],
|
self._dff = _cell(["D", "Q", "clk", "vdd", "gnd"],
|
||||||
["INPUT", "OUTPUT", "INPUT", "POWER", "GROUND"])
|
["INPUT", "OUTPUT", "INPUT", "POWER", "GROUND"])
|
||||||
|
|
||||||
self._dff_buf = _cell(["D", "Q", "Qb", "clk", "vdd", "gnd"],
|
|
||||||
["INPUT", "OUTPUT", "OUTPUT", "INPUT", "POWER", "GROUND"],
|
|
||||||
hard_cell=False)
|
|
||||||
|
|
||||||
self._write_driver = _cell(['din', 'bl', 'br', 'en', 'vdd', 'gnd'],
|
self._write_driver = _cell(['din', 'bl', 'br', 'en', 'vdd', 'gnd'],
|
||||||
["INPUT", "OUTPUT", "OUTPUT", "INPUT", "POWER", "GROUND"])
|
["INPUT", "OUTPUT", "OUTPUT", "INPUT", "POWER", "GROUND"])
|
||||||
|
|
||||||
|
|
@ -169,6 +164,12 @@ class cell_properties():
|
||||||
self._bitcell_2port = _bitcell(["bl0", "br0", "bl1", "br1", "wl0", "wl1", "vdd", "gnd"],
|
self._bitcell_2port = _bitcell(["bl0", "br0", "bl1", "br1", "wl0", "wl1", "vdd", "gnd"],
|
||||||
["OUTPUT", "OUTPUT", "OUTPUT", "OUTPUT", "INPUT", "INPUT", "POWER", "GROUND"])
|
["OUTPUT", "OUTPUT", "OUTPUT", "OUTPUT", "INPUT", "INPUT", "POWER", "GROUND"])
|
||||||
|
|
||||||
|
self._col_cap_2port = _bitcell(["bl0", "br0", "bl1", "br1", "vdd"],
|
||||||
|
["OUTPUT", "OUTPUT", "OUTPUT", "OUTPUT", "POWER"])
|
||||||
|
|
||||||
|
self._row_cap_2port = _bitcell(["wl0", "wl1", "gnd"],
|
||||||
|
["INPUT", "INPUT", "POWER", "GROUND"])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ptx(self):
|
def ptx(self):
|
||||||
return self._ptx
|
return self._ptx
|
||||||
|
|
@ -197,10 +198,6 @@ class cell_properties():
|
||||||
def dff(self):
|
def dff(self):
|
||||||
return self._dff
|
return self._dff
|
||||||
|
|
||||||
@property
|
|
||||||
def dff_buf(self):
|
|
||||||
return self._dff_buf
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def write_driver(self):
|
def write_driver(self):
|
||||||
return self._write_driver
|
return self._write_driver
|
||||||
|
|
@ -217,3 +214,11 @@ class cell_properties():
|
||||||
def bitcell_2port(self):
|
def bitcell_2port(self):
|
||||||
return self._bitcell_2port
|
return self._bitcell_2port
|
||||||
|
|
||||||
|
@property
|
||||||
|
def col_cap_2port(self):
|
||||||
|
return self._col_cap_2port
|
||||||
|
|
||||||
|
@property
|
||||||
|
def row_cap_2port(self):
|
||||||
|
return self._row_cap_2port
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -275,16 +275,16 @@ class instance(geometry):
|
||||||
def calculate_transform(self, node):
|
def calculate_transform(self, node):
|
||||||
#set up the rotation matrix
|
#set up the rotation matrix
|
||||||
angle = math.radians(float(node.rotate))
|
angle = math.radians(float(node.rotate))
|
||||||
mRotate = np.array([[math.cos(angle),-math.sin(angle),0.0],
|
mRotate = np.array([[math.cos(angle), -math.sin(angle), 0.0],
|
||||||
[math.sin(angle),math.cos(angle),0.0],
|
[math.sin(angle), math.cos(angle), 0.0],
|
||||||
[0.0,0.0,1.0]])
|
[0.0, 0.0, 1.0]])
|
||||||
|
|
||||||
#set up translation matrix
|
#set up translation matrix
|
||||||
translateX = float(node.offset[0])
|
translateX = float(node.offset[0])
|
||||||
translateY = float(node.offset[1])
|
translateY = float(node.offset[1])
|
||||||
mTranslate = np.array([[1.0,0.0,translateX],
|
mTranslate = np.array([[1.0, 0.0, translateX],
|
||||||
[0.0,1.0,translateY],
|
[0.0, 1.0, translateY],
|
||||||
[0.0,0.0,1.0]])
|
[0.0, 0.0, 1.0]])
|
||||||
|
|
||||||
#set up the scale matrix (handles mirror X)
|
#set up the scale matrix (handles mirror X)
|
||||||
scaleX = 1.0
|
scaleX = 1.0
|
||||||
|
|
@ -292,27 +292,27 @@ class instance(geometry):
|
||||||
scaleY = -1.0
|
scaleY = -1.0
|
||||||
else:
|
else:
|
||||||
scaleY = 1.0
|
scaleY = 1.0
|
||||||
mScale = np.array([[scaleX,0.0,0.0],
|
mScale = np.array([[scaleX, 0.0, 0.0],
|
||||||
[0.0,scaleY,0.0],
|
[0.0, scaleY, 0.0],
|
||||||
[0.0,0.0,1.0]])
|
[0.0, 0.0, 1.0]])
|
||||||
|
|
||||||
return (mRotate, mScale, mTranslate)
|
return (mRotate, mScale, mTranslate)
|
||||||
|
|
||||||
def apply_transform(self, mtransforms, uVector, vVector, origin):
|
def apply_transform(self, mtransforms, uVector, vVector, origin):
|
||||||
origin = np.dot(mtransforms[0], origin) #rotate
|
origin = np.dot(mtransforms[0], origin) # rotate
|
||||||
uVector = np.dot(mtransforms[0], uVector) #rotate
|
uVector = np.dot(mtransforms[0], uVector) # rotate
|
||||||
vVector = np.dot(mtransforms[0], vVector) #rotate
|
vVector = np.dot(mtransforms[0], vVector) # rotate
|
||||||
origin = np.dot(mtransforms[1], origin) #scale
|
origin = np.dot(mtransforms[1], origin) # scale
|
||||||
uVector = np.dot(mtransforms[1], uVector) #scale
|
uVector = np.dot(mtransforms[1], uVector) # scale
|
||||||
vVector = np.dot(mtransforms[1], vVector) #scale
|
vVector = np.dot(mtransforms[1], vVector) # scale
|
||||||
origin = np.dot(mtransforms[2], origin)
|
origin = np.dot(mtransforms[2], origin)
|
||||||
|
|
||||||
return(uVector, vVector, origin)
|
return(uVector, vVector, origin)
|
||||||
|
|
||||||
def apply_path_transform(self, path):
|
def apply_path_transform(self, path):
|
||||||
uVector = np.array([[1.0],[0.0],[0.0]])
|
uVector = np.array([[1.0], [0.0], [0.0]])
|
||||||
vVector = np.array([[0.0],[1.0],[0.0]])
|
vVector = np.array([[0.0], [1.0], [0.0]])
|
||||||
origin = np.array([[0.0],[0.0],[1.0]])
|
origin = np.array([[0.0], [0.0], [1.0]])
|
||||||
|
|
||||||
while(path):
|
while(path):
|
||||||
instance = path.pop(-1)
|
instance = path.pop(-1)
|
||||||
|
|
@ -330,7 +330,7 @@ class instance(geometry):
|
||||||
bl_offsets = [] # bl to cell offset
|
bl_offsets = [] # bl to cell offset
|
||||||
br_offsets = [] # br to cell offset
|
br_offsets = [] # br to cell offset
|
||||||
bl_meta = [] # bl offset metadata (row,col,name)
|
bl_meta = [] # bl offset metadata (row,col,name)
|
||||||
br_meta = [] #br offset metadata (row,col,name)
|
br_meta = [] # br offset metadata (row,col,name)
|
||||||
|
|
||||||
def walk_subtree(node):
|
def walk_subtree(node):
|
||||||
path.append(node)
|
path.append(node)
|
||||||
|
|
@ -338,8 +338,6 @@ class instance(geometry):
|
||||||
if node.mod.name == cell_name:
|
if node.mod.name == cell_name:
|
||||||
cell_paths.append(copy.copy(path))
|
cell_paths.append(copy.copy(path))
|
||||||
|
|
||||||
inst_name = path[-1].name
|
|
||||||
|
|
||||||
# get the row and col names from the path
|
# get the row and col names from the path
|
||||||
row = int(path[-1].name.split('_')[-2][1:])
|
row = int(path[-1].name.split('_')[-2][1:])
|
||||||
col = int(path[-1].name.split('_')[-1][1:])
|
col = int(path[-1].name.split('_')[-1][1:])
|
||||||
|
|
@ -376,11 +374,9 @@ class instance(geometry):
|
||||||
normalized_br_offsets[pair] = (normalized_br_offsets[pair][0],
|
normalized_br_offsets[pair] = (normalized_br_offsets[pair][0],
|
||||||
-1 * normalized_br_offsets[pair][1])
|
-1 * normalized_br_offsets[pair][1])
|
||||||
|
|
||||||
|
|
||||||
Q_offsets.append([Q_x, Q_y])
|
Q_offsets.append([Q_x, Q_y])
|
||||||
Q_bar_offsets.append([Q_bar_x, Q_bar_y])
|
Q_bar_offsets.append([Q_bar_x, Q_bar_y])
|
||||||
|
|
||||||
|
|
||||||
bl_offsets.append(normalized_bl_offsets)
|
bl_offsets.append(normalized_bl_offsets)
|
||||||
br_offsets.append(normalized_br_offsets)
|
br_offsets.append(normalized_br_offsets)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,7 @@ class layout():
|
||||||
|
|
||||||
for pin in pins:
|
for pin in pins:
|
||||||
if new_name == "":
|
if new_name == "":
|
||||||
new_name = pin.name
|
new_name = pin_name
|
||||||
self.add_layout_pin(new_name,
|
self.add_layout_pin(new_name,
|
||||||
pin.layer,
|
pin.layer,
|
||||||
pin.ll(),
|
pin.ll(),
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,8 @@ class spice():
|
||||||
subckt_line = list(filter(subckt.search, self.lvs))[0]
|
subckt_line = list(filter(subckt.search, self.lvs))[0]
|
||||||
# parses line into ports and remove subckt
|
# parses line into ports and remove subckt
|
||||||
lvs_pins = subckt_line.split(" ")[2:]
|
lvs_pins = subckt_line.split(" ")[2:]
|
||||||
debug.check(lvs_pins == self.pins, "LVS and spice file pin mismatch.")
|
debug.check(lvs_pins == self.pins,
|
||||||
|
"Spice netlists for LVS and simulation have port mismatches: {0} (LVS) vs {1} (sim)".format(lvs_pins, self.pins))
|
||||||
|
|
||||||
def check_net_in_spice(self, net_name):
|
def check_net_in_spice(self, net_name):
|
||||||
"""Checks if a net name exists in the current. Intended to be check nets in hand-made cells."""
|
"""Checks if a net name exists in the current. Intended to be check nets in hand-made cells."""
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,8 @@ class bitcell_2port(bitcell_base.bitcell_base):
|
||||||
pin_dict = {pin: port for pin, port in zip(self.pins, port_nets)}
|
pin_dict = {pin: port for pin, port in zip(self.pins, port_nets)}
|
||||||
# Edges hardcoded here. Essentially wl->bl/br for both ports.
|
# Edges hardcoded here. Essentially wl->bl/br for both ports.
|
||||||
# Port 0 edges
|
# Port 0 edges
|
||||||
pins = props.bitcell_2port.pin
|
graph.add_edge(pin_dict["wl0"], pin_dict["bl0"], self)
|
||||||
graph.add_edge(pin_dict[pins.wl0], pin_dict[pins.bl0], self)
|
graph.add_edge(pin_dict["wl0"], pin_dict["br0"], self)
|
||||||
graph.add_edge(pin_dict[pins.wl0], pin_dict[pins.br0], self)
|
|
||||||
# Port 1 edges
|
# Port 1 edges
|
||||||
graph.add_edge(pin_dict[pins.wl1], pin_dict[pins.bl1], self)
|
graph.add_edge(pin_dict["wl1"], pin_dict["bl1"], self)
|
||||||
graph.add_edge(pin_dict[pins.wl1], pin_dict[pins.br1], self)
|
graph.add_edge(pin_dict["wl1"], pin_dict["br1"], self)
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ class col_cap_bitcell_2port(bitcell_base.bitcell_base):
|
||||||
Column end cap cell.
|
Column end cap cell.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name="col_cap_cell_1rw_1r"):
|
def __init__(self, name="col_cap_bitcell_2port"):
|
||||||
bitcell_base.bitcell_base.__init__(self, name, prop=props.bitcell_2port)
|
bitcell_base.bitcell_base.__init__(self, name, prop=props.col_cap_2port)
|
||||||
debug.info(2, "Create col_cap bitcell 2 port object")
|
debug.info(2, "Create col_cap bitcell 2 port object")
|
||||||
|
|
||||||
self.no_instances = True
|
self.no_instances = True
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ class row_cap_bitcell_2port(bitcell_base.bitcell_base):
|
||||||
Row end cap cell.
|
Row end cap cell.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name="row_cap_cell_1rw_1r"):
|
def __init__(self, name="row_cap_bitcell_2port"):
|
||||||
bitcell_base.bitcell_base.__init__(self, name, prop=props.bitcell_2port)
|
bitcell_base.bitcell_base.__init__(self, name, prop=props.row_cap_2port)
|
||||||
debug.info(2, "Create row_cap bitcell 1rw+1r object")
|
debug.info(2, "Create row_cap bitcell 2 port object")
|
||||||
|
|
||||||
self.no_instances = True
|
self.no_instances = True
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
from bitcell_base_array import bitcell_base_array
|
from bitcell_base_array import bitcell_base_array
|
||||||
from sram_factory import factory
|
from sram_factory import factory
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
from tech import cell_properties
|
|
||||||
|
|
||||||
|
|
||||||
class col_cap_array(bitcell_base_array):
|
class col_cap_array(bitcell_base_array):
|
||||||
|
|
@ -65,16 +64,14 @@ class col_cap_array(bitcell_base_array):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if len(self.all_ports) == 1:
|
if len(self.all_ports) == 1:
|
||||||
pin_name = cell_properties.bitcell.cell_6t.pin
|
bitcell_pins = ["bl0_{0}".format(col),
|
||||||
bitcell_pins = ["{0}_{1}".format(pin_name.bl0, col),
|
"br0_{0}".format(col),
|
||||||
"{0}_{1}".format(pin_name.br0, col),
|
|
||||||
"vdd"]
|
"vdd"]
|
||||||
else:
|
else:
|
||||||
pin_name = cell_properties.bitcell.cell_1rw1r.pin
|
bitcell_pins = ["bl0_{0}".format(col),
|
||||||
bitcell_pins = ["{0}_{1}".format(pin_name.bl0, col),
|
"br0_{0}".format(col),
|
||||||
"{0}_{1}".format(pin_name.br0, col),
|
"bl1_{0}".format(col),
|
||||||
"{0}_{1}".format(pin_name.bl1, col),
|
"br1_{0}".format(col),
|
||||||
"{0}_{1}".format(pin_name.br1, col),
|
|
||||||
"vdd"]
|
"vdd"]
|
||||||
|
|
||||||
return bitcell_pins
|
return bitcell_pins
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
import debug
|
import debug
|
||||||
import design
|
import design
|
||||||
from tech import layer
|
from tech import layer
|
||||||
from tech import cell_properties as props
|
|
||||||
from vector import vector
|
from vector import vector
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
from sram_factory import factory
|
from sram_factory import factory
|
||||||
|
|
@ -72,9 +71,8 @@ class dff_buf(design.design):
|
||||||
self.add_mod(self.inv2)
|
self.add_mod(self.inv2)
|
||||||
|
|
||||||
def add_pins(self):
|
def add_pins(self):
|
||||||
self.add_pin_names(props.dff_buf.port_map)
|
self.add_pin_list(["D", "Q", "Qb", "clk", "vdd", "gnd"],
|
||||||
self.add_pin_list(props.dff_buf.port_names,
|
["INPUT", "OUTPUT", "OUTPUT", "INPUT", "POWER", "GROUND"])
|
||||||
props.dff_buf.port_types)
|
|
||||||
|
|
||||||
def create_instances(self):
|
def create_instances(self):
|
||||||
self.dff_inst=self.add_inst(name="dff_buf_dff",
|
self.dff_inst=self.add_inst(name="dff_buf_dff",
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
#
|
#
|
||||||
import debug
|
import debug
|
||||||
from bitcell_base_array import bitcell_base_array
|
from bitcell_base_array import bitcell_base_array
|
||||||
from tech import cell_properties as props
|
|
||||||
from sram_factory import factory
|
from sram_factory import factory
|
||||||
from vector import vector
|
from vector import vector
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
|
|
@ -31,7 +30,14 @@ class replica_column(bitcell_base_array):
|
||||||
# left, right, regular rows plus top/bottom dummy cells
|
# left, right, regular rows plus top/bottom dummy cells
|
||||||
self.total_size = self.left_rbl + rows + self.right_rbl
|
self.total_size = self.left_rbl + rows + self.right_rbl
|
||||||
|
|
||||||
|
# Used for pin names and properties
|
||||||
|
self.cell = factory.create(module_type=OPTS.bitcell)
|
||||||
|
|
||||||
# For end caps
|
# For end caps
|
||||||
|
try:
|
||||||
|
if not self.cell.end_caps:
|
||||||
|
self.total_size += 2
|
||||||
|
except AttributeError:
|
||||||
self.total_size += 2
|
self.total_size += 2
|
||||||
|
|
||||||
self.column_offset = column_offset
|
self.column_offset = column_offset
|
||||||
|
|
@ -86,9 +92,6 @@ class replica_column(bitcell_base_array):
|
||||||
self.edge_cell = factory.create(module_type=edge_module_type + "_" + OPTS.bitcell)
|
self.edge_cell = factory.create(module_type=edge_module_type + "_" + OPTS.bitcell)
|
||||||
self.add_mod(self.edge_cell)
|
self.add_mod(self.edge_cell)
|
||||||
|
|
||||||
# Used for pin names only
|
|
||||||
self.cell = factory.create(module_type=OPTS.bitcell)
|
|
||||||
|
|
||||||
def create_instances(self):
|
def create_instances(self):
|
||||||
self.cell_inst = {}
|
self.cell_inst = {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
from bitcell_base_array import bitcell_base_array
|
from bitcell_base_array import bitcell_base_array
|
||||||
from sram_factory import factory
|
from sram_factory import factory
|
||||||
from globals import OPTS
|
from globals import OPTS
|
||||||
from tech import cell_properties
|
|
||||||
|
|
||||||
|
|
||||||
class row_cap_array(bitcell_base_array):
|
class row_cap_array(bitcell_base_array):
|
||||||
|
|
@ -61,9 +60,8 @@ class row_cap_array(bitcell_base_array):
|
||||||
indexed by column and row, for instance use in bitcell_array
|
indexed by column and row, for instance use in bitcell_array
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pin_name = cell_properties.bitcell.cell_1rw1r.pin
|
bitcell_pins = ["wl0_{0}".format(row),
|
||||||
bitcell_pins = ["{0}_{1}".format(pin_name.wl0, row),
|
"wl1_{0}".format(row),
|
||||||
"{0}_{1}".format(pin_name.wl1, row),
|
|
||||||
"gnd"]
|
"gnd"]
|
||||||
|
|
||||||
return bitcell_pins
|
return bitcell_pins
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue