mirror of https://github.com/VLSIDA/OpenRAM.git
Merge branch 'dev' into discrete_models
This commit is contained in:
commit
9857a3f7e7
|
|
@ -1,7 +1,7 @@
|
|||
before_script:
|
||||
- . /home/gitlab-runner/setup-paths.sh
|
||||
- export OPENRAM_HOME="`pwd`/compiler"
|
||||
- export OPENRAM_TECH="`pwd`/technology"
|
||||
- export OPENRAM_TECH="`pwd`/technology:/home/PDKs/skywater-tech"
|
||||
|
||||
stages:
|
||||
- test
|
||||
|
|
@ -25,6 +25,15 @@ scn4m_subm:
|
|||
- .coverage.*
|
||||
expire_in: 1 week
|
||||
|
||||
# s8:
|
||||
# stage: test
|
||||
# script:
|
||||
# - coverage run -p $OPENRAM_HOME/tests/regress.py -t s8
|
||||
# artifacts:
|
||||
# paths:
|
||||
# - .coverage.*
|
||||
# expire_in: 1 week
|
||||
|
||||
coverage:
|
||||
stage: coverage
|
||||
script:
|
||||
|
|
|
|||
|
|
@ -47,8 +47,20 @@ class contact(hierarchy_design.hierarchy_design):
|
|||
|
||||
self.layer_stack = layer_stack
|
||||
self.dimensions = dimensions
|
||||
if directions:
|
||||
|
||||
# Non-preferred directions
|
||||
if directions == "nonpref":
|
||||
first_dir = "H" if self.get_preferred_direction(layer_stack[0])=="V" else "V"
|
||||
second_dir = "H" if self.get_preferred_direction(layer_stack[2])=="V" else "V"
|
||||
self.directions = (first_dir, second_dir)
|
||||
# Preferred directions
|
||||
elif directions == "pref":
|
||||
self.directions = (tech.preferred_directions[layer_stack[0]],
|
||||
tech.preferred_directions[layer_stack[2]])
|
||||
# User directions
|
||||
elif directions:
|
||||
self.directions = directions
|
||||
# Preferred directions
|
||||
else:
|
||||
self.directions = (tech.preferred_directions[layer_stack[0]],
|
||||
tech.preferred_directions[layer_stack[2]])
|
||||
|
|
@ -141,7 +153,7 @@ class contact(hierarchy_design.hierarchy_design):
|
|||
self.first_layer_vertical_enclosure = max(self.first_layer_enclosure,
|
||||
(self.first_layer_minwidth - self.contact_array_height) / 2)
|
||||
else:
|
||||
debug.error("Invalid first layer direction.", -1)
|
||||
debug.error("Invalid first layer direction: ".format(self.directions[0]), -1)
|
||||
|
||||
# In some technologies, the minimum width may be larger
|
||||
# than the overlap requirement around the via, so
|
||||
|
|
@ -157,7 +169,7 @@ class contact(hierarchy_design.hierarchy_design):
|
|||
self.second_layer_vertical_enclosure = max(self.second_layer_enclosure,
|
||||
(self.second_layer_minwidth - self.contact_array_width) / 2)
|
||||
else:
|
||||
debug.error("Invalid second layer direction.", -1)
|
||||
debug.error("Invalid secon layer direction: ".format(self.directions[1]), -1)
|
||||
|
||||
def create_contact_array(self):
|
||||
""" Create the contact array at the origin"""
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
# All rights reserved.
|
||||
#
|
||||
from hierarchy_design import hierarchy_design
|
||||
from utils import round_to_grid
|
||||
import contact
|
||||
from globals import OPTS
|
||||
import re
|
||||
|
|
@ -31,48 +32,98 @@ class design(hierarchy_design):
|
|||
in many places in the compiler.
|
||||
"""
|
||||
|
||||
from tech import layer_indices
|
||||
import tech
|
||||
for key in dir(tech):
|
||||
# Single layer width rules
|
||||
match = re.match(r".*_stack$", key)
|
||||
if match:
|
||||
for layer in layer_indices:
|
||||
key = "{}_stack".format(layer)
|
||||
|
||||
# Set the stack as a local helper
|
||||
try:
|
||||
layer_stack = getattr(tech, key)
|
||||
|
||||
# Set the stack as a local helper
|
||||
setattr(self, key, layer_stack)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# Add the pitch
|
||||
setattr(self,
|
||||
"{}_pitch".format(layer_stack[0]),
|
||||
self.compute_pitch(layer_stack))
|
||||
|
||||
# Skip computing the pitch for active
|
||||
if layer == "active":
|
||||
continue
|
||||
|
||||
# Add the pitch
|
||||
setattr(self,
|
||||
"{}_pitch".format(layer),
|
||||
self.compute_pitch(layer, True))
|
||||
|
||||
# Add the non-preferrd pitch (which has vias in the "wrong" way)
|
||||
setattr(self,
|
||||
"{}_nonpref_pitch".format(layer),
|
||||
self.compute_pitch(layer, False))
|
||||
|
||||
if False:
|
||||
print("m1_pitch", self.m1_pitch)
|
||||
print("m2_pitch", self.m2_pitch)
|
||||
print("m3_pitch", self.m3_pitch)
|
||||
from tech import preferred_directions
|
||||
print(preferred_directions)
|
||||
from tech import layer, layer_indices
|
||||
for name in layer_indices:
|
||||
if name == "active":
|
||||
continue
|
||||
try:
|
||||
print("{0} width {1} space {2}".format(name,
|
||||
getattr(self, "{}_width".format(name)),
|
||||
getattr(self, "{}_space".format(name))))
|
||||
|
||||
print("pitch {0} nonpref {1}".format(getattr(self, "{}_pitch".format(name)),
|
||||
getattr(self, "{}_nonpref_pitch".format(name))))
|
||||
except AttributeError:
|
||||
pass
|
||||
import sys
|
||||
sys.exit(1)
|
||||
|
||||
def compute_pitch(self, layer_stack):
|
||||
def compute_pitch(self, layer, preferred=True):
|
||||
|
||||
"""
|
||||
This is contact direction independent pitch,
|
||||
i.e. we take the maximum contact dimension
|
||||
This is the preferred direction pitch
|
||||
i.e. we take the minimum or maximum contact dimension
|
||||
"""
|
||||
# Find the layer stacks this is used in
|
||||
from tech import layer_stacks
|
||||
pitches = []
|
||||
for stack in layer_stacks:
|
||||
# Compute the pitch with both vias above and below (if they exist)
|
||||
if stack[0] == layer:
|
||||
pitches.append(self.compute_layer_pitch(stack, preferred))
|
||||
if stack[2] == layer:
|
||||
pitches.append(self.compute_layer_pitch(stack[::-1], True))
|
||||
|
||||
return max(pitches)
|
||||
|
||||
def compute_layer_pitch(self, layer_stack, preferred):
|
||||
|
||||
(layer1, via, layer2) = layer_stack
|
||||
try:
|
||||
if layer1 == "poly" or layer1 == "active":
|
||||
contact1 = getattr(contact, layer1 + "_contact")
|
||||
else:
|
||||
contact1 = getattr(contact, layer1 + "_via")
|
||||
except AttributeError:
|
||||
contact1 = getattr(contact, layer2 + "_via")
|
||||
|
||||
if layer1 == "poly" or layer1 == "active":
|
||||
contact1 = getattr(contact, layer1 + "_contact")
|
||||
if preferred:
|
||||
if self.get_preferred_direction(layer1) == "V":
|
||||
contact_width = contact1.first_layer_width
|
||||
else:
|
||||
contact_width = contact1.first_layer_height
|
||||
else:
|
||||
contact1 = getattr(contact, layer1 + "_via")
|
||||
max_contact = max(contact1.width, contact1.height)
|
||||
|
||||
layer1_space = getattr(self, layer1 + "_space")
|
||||
layer2_space = getattr(self, layer2 + "_space")
|
||||
pitch = max_contact + max(layer1_space, layer2_space)
|
||||
if self.get_preferred_direction(layer1) == "V":
|
||||
contact_width = contact1.first_layer_height
|
||||
else:
|
||||
contact_width = contact1.first_layer_width
|
||||
layer_space = getattr(self, layer1 + "_space")
|
||||
|
||||
return pitch
|
||||
|
||||
#print(layer_stack)
|
||||
#print(contact1)
|
||||
pitch = contact_width + layer_space
|
||||
|
||||
return round_to_grid(pitch)
|
||||
|
||||
def setup_drc_constants(self):
|
||||
"""
|
||||
These are some DRC constants used in many places
|
||||
|
|
|
|||
|
|
@ -66,14 +66,17 @@ class geometry:
|
|||
self.compute_boundary(self.offset, self.mirror, self.rotate)
|
||||
|
||||
def compute_boundary(self, offset=vector(0, 0), mirror="", rotate=0):
|
||||
""" Transform with offset, mirror and rotation to get the absolute pin location.
|
||||
We must then re-find the ll and ur. The master is the cell instance. """
|
||||
"""
|
||||
Transform with offset, mirror and rotation to get the absolute pin location.
|
||||
We must then re-find the ll and ur. The master is the cell instance.
|
||||
"""
|
||||
if OPTS.netlist_only:
|
||||
self.boundary = [vector(0,0), vector(0,0)]
|
||||
self.boundary = [vector(0, 0), vector(0, 0)]
|
||||
return
|
||||
|
||||
(ll, ur) = [vector(0, 0), vector(self.width, self.height)]
|
||||
|
||||
# Mirroring is performed before rotation
|
||||
if mirror == "MX":
|
||||
ll = ll.scale(1, -1)
|
||||
ur = ur.scale(1, -1)
|
||||
|
|
@ -83,8 +86,14 @@ class geometry:
|
|||
elif mirror == "XY":
|
||||
ll = ll.scale(-1, -1)
|
||||
ur = ur.scale(-1, -1)
|
||||
elif mirror == "" or mirror == "R0":
|
||||
pass
|
||||
else:
|
||||
debug.error("Invalid mirroring: {}".format(mirror), -1)
|
||||
|
||||
if rotate == 90:
|
||||
if rotate == 0:
|
||||
pass
|
||||
elif rotate == 90:
|
||||
ll = ll.rotate_scale(-1, 1)
|
||||
ur = ur.rotate_scale(-1, 1)
|
||||
elif rotate == 180:
|
||||
|
|
@ -93,6 +102,8 @@ class geometry:
|
|||
elif rotate == 270:
|
||||
ll = ll.rotate_scale(1, -1)
|
||||
ur = ur.rotate_scale(1, -1)
|
||||
else:
|
||||
debug.error("Invalid rotation: {}".format(rotate), -1)
|
||||
|
||||
self.boundary = [offset + ll, offset + ur]
|
||||
self.normalize()
|
||||
|
|
@ -136,6 +147,10 @@ class geometry:
|
|||
def cy(self):
|
||||
""" Return the center y """
|
||||
return 0.5 * (self.boundary[0].y + self.boundary[1].y)
|
||||
|
||||
def center(self):
|
||||
""" Return the center coordinate """
|
||||
return vector(self.cx(), self.cy())
|
||||
|
||||
|
||||
class instance(geometry):
|
||||
|
|
@ -195,14 +210,13 @@ class instance(geometry):
|
|||
blockages = []
|
||||
blockages = self.mod.gds.getBlockages(lpp)
|
||||
for b in blockages:
|
||||
new_blockages.append(self.transform_coords(b,self.offset, mirr, angle))
|
||||
new_blockages.append(self.transform_coords(b, self.offset, mirr, angle))
|
||||
else:
|
||||
blockages = self.mod.get_blockages(lpp)
|
||||
for b in blockages:
|
||||
new_blockages.append(self.transform_coords(b,self.offset, mirr, angle))
|
||||
new_blockages.append(self.transform_coords(b, self.offset, mirr, angle))
|
||||
return new_blockages
|
||||
|
||||
|
||||
def gds_write_file(self, new_layout):
|
||||
"""Recursively writes all the sub-modules in this instance"""
|
||||
debug.info(4, "writing instance: " + self.name)
|
||||
|
|
@ -225,26 +239,25 @@ class instance(geometry):
|
|||
self.update_boundary()
|
||||
debug.info(3, "placing instance {}".format(self))
|
||||
|
||||
|
||||
def get_pin(self,name,index=-1):
|
||||
def get_pin(self, name, index=-1):
|
||||
""" Return an absolute pin that is offset and transformed based on
|
||||
this instance location. Index will return one of several pins."""
|
||||
|
||||
import copy
|
||||
if index == -1:
|
||||
pin = copy.deepcopy(self.mod.get_pin(name))
|
||||
pin.transform(self.offset,self.mirror,self.rotate)
|
||||
pin.transform(self.offset, self.mirror, self.rotate)
|
||||
return pin
|
||||
else:
|
||||
pins = copy.deepcopy(self.mod.get_pin(name))
|
||||
pin.transform(self.offset,self.mirror,self.rotate)
|
||||
pins.transform(self.offset, self.mirror, self.rotate)
|
||||
return pin[index]
|
||||
|
||||
def get_num_pins(self, name):
|
||||
""" Return the number of pins of a given name """
|
||||
return len(self.mod.get_pins(name))
|
||||
|
||||
def get_pins(self,name):
|
||||
def get_pins(self, name):
|
||||
""" Return an absolute pin that is offset and transformed based on
|
||||
this instance location. """
|
||||
|
||||
|
|
@ -253,7 +266,7 @@ class instance(geometry):
|
|||
|
||||
new_pins = []
|
||||
for p in pin:
|
||||
p.transform(self.offset,self.mirror,self.rotate)
|
||||
p.transform(self.offset, self.mirror, self.rotate)
|
||||
new_pins.append(p)
|
||||
return new_pins
|
||||
|
||||
|
|
@ -265,6 +278,7 @@ class instance(geometry):
|
|||
""" override print function output """
|
||||
return "( inst: " + self.name + " @" + str(self.offset) + " mod=" + self.mod.name + " " + self.mirror + " R=" + str(self.rotate) + ")"
|
||||
|
||||
|
||||
class path(geometry):
|
||||
"""Represents a Path"""
|
||||
|
||||
|
|
@ -322,7 +336,7 @@ class label(geometry):
|
|||
|
||||
self.size = 0
|
||||
|
||||
debug.info(4,"creating label " + self.text + " " + str(self.layerNumber) + " " + str(self.offset))
|
||||
debug.info(4, "creating label " + self.text + " " + str(self.layerNumber) + " " + str(self.offset))
|
||||
|
||||
def gds_write_file(self, new_layout):
|
||||
"""Writes the text label to GDS"""
|
||||
|
|
@ -340,7 +354,7 @@ class label(geometry):
|
|||
|
||||
def __str__(self):
|
||||
""" override print function output """
|
||||
return "label: " + self.text + " layer=" + str(self.layerNumber) + " purpose=" + str(self.layerPurpose)
|
||||
return "label: " + self.text + " layer=" + str(self.layerNumber) + " purpose=" + str(self.layerPurpose)
|
||||
|
||||
def __repr__(self):
|
||||
""" override print function output """
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import debug
|
|||
from math import sqrt
|
||||
from tech import drc, GDS
|
||||
from tech import layer as techlayer
|
||||
from tech import layer_indices
|
||||
from tech import layer_stacks
|
||||
import os
|
||||
from globals import OPTS
|
||||
|
|
@ -41,12 +42,15 @@ class layout():
|
|||
self.visited = [] # List of modules we have already visited
|
||||
self.is_library_cell = False # Flag for library cells
|
||||
self.gds_read()
|
||||
|
||||
try:
|
||||
from tech import power_grid
|
||||
self.pwr_grid_layer = power_grid[0]
|
||||
except ImportError:
|
||||
self.pwr_grid_layer = "m3"
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
# GDS layout
|
||||
############################################################
|
||||
|
|
@ -240,25 +244,27 @@ class layout():
|
|||
height))
|
||||
return self.objs[-1]
|
||||
|
||||
def add_segment_center(self, layer, start, end):
|
||||
def add_segment_center(self, layer, start, end, width=None):
|
||||
"""
|
||||
Add a min-width rectanglular segment using center
|
||||
line on the start to end point
|
||||
"""
|
||||
minwidth_layer = drc["minwidth_{}".format(layer)]
|
||||
if not width:
|
||||
width = drc["minwidth_{}".format(layer)]
|
||||
|
||||
if start.x != end.x and start.y != end.y:
|
||||
debug.error("Nonrectilinear center rect!", -1)
|
||||
elif start.x != end.x:
|
||||
offset = vector(0, 0.5 * minwidth_layer)
|
||||
offset = vector(0, 0.5 * width)
|
||||
return self.add_rect(layer,
|
||||
start - offset,
|
||||
end.x - start.x,
|
||||
minwidth_layer)
|
||||
width)
|
||||
else:
|
||||
offset = vector(0.5 * minwidth_layer, 0)
|
||||
offset = vector(0.5 * width, 0)
|
||||
return self.add_rect(layer,
|
||||
start - offset,
|
||||
minwidth_layer,
|
||||
width,
|
||||
end.y - start.y)
|
||||
|
||||
def get_pin(self, text):
|
||||
|
|
@ -318,7 +324,7 @@ class layout():
|
|||
for pin_name in self.pin_map.keys():
|
||||
self.copy_layout_pin(instance, pin_name, prefix + pin_name)
|
||||
|
||||
def add_layout_pin_segment_center(self, text, layer, start, end):
|
||||
def add_layout_pin_segment_center(self, text, layer, start, end, width=None):
|
||||
"""
|
||||
Creates a path like pin with center-line convention
|
||||
"""
|
||||
|
|
@ -327,27 +333,27 @@ class layout():
|
|||
self.gds_write(file_name)
|
||||
debug.error("Cannot have a non-manhatten layout pin: {}".format(file_name), -1)
|
||||
|
||||
minwidth_layer = drc["minwidth_{}".format(layer)]
|
||||
if not width:
|
||||
layer_width = drc["minwidth_{}".format(layer)]
|
||||
else:
|
||||
layer_width = width
|
||||
|
||||
# one of these will be zero
|
||||
width = max(start.x, end.x) - min(start.x, end.x)
|
||||
height = max(start.y, end.y) - min(start.y, end.y)
|
||||
bbox_width = max(start.x, end.x) - min(start.x, end.x)
|
||||
bbox_height = max(start.y, end.y) - min(start.y, end.y)
|
||||
ll_offset = vector(min(start.x, end.x), min(start.y, end.y))
|
||||
|
||||
# Shift it down 1/2 a width in the 0 dimension
|
||||
if height == 0:
|
||||
ll_offset -= vector(0, 0.5 * minwidth_layer)
|
||||
if width == 0:
|
||||
ll_offset -= vector(0.5 * minwidth_layer, 0)
|
||||
# This makes sure it is long enough, but also it is not 0 width!
|
||||
height = max(minwidth_layer, height)
|
||||
width = max(minwidth_layer, width)
|
||||
if bbox_height == 0:
|
||||
ll_offset -= vector(0, 0.5 * layer_width)
|
||||
if bbox_width == 0:
|
||||
ll_offset -= vector(0.5 * layer_width, 0)
|
||||
|
||||
return self.add_layout_pin(text,
|
||||
layer,
|
||||
ll_offset,
|
||||
width,
|
||||
height)
|
||||
return self.add_layout_pin(text=text,
|
||||
layer=layer,
|
||||
offset=ll_offset,
|
||||
width=bbox_width,
|
||||
height=bbox_height)
|
||||
|
||||
def add_layout_pin_rect_center(self, text, layer, offset, width=None, height=None):
|
||||
""" Creates a path like pin with center-line convention """
|
||||
|
|
@ -444,7 +450,46 @@ class layout():
|
|||
path=coordinates,
|
||||
layer_widths=layer_widths)
|
||||
|
||||
def add_wire(self, layers, coordinates):
|
||||
def add_zjog(self, layer, start, end, first_direction="H", fixed_offset=None):
|
||||
"""
|
||||
Add a simple jog at the halfway point.
|
||||
If layer is a single value, it is a path.
|
||||
If layer is a tuple, it is a wire with preferred directions.
|
||||
"""
|
||||
|
||||
# vertical first
|
||||
if first_direction == "V":
|
||||
if fixed_offset:
|
||||
mid1 = vector(start.x, fixed_offset)
|
||||
else:
|
||||
mid1 = vector(start.x, 0.5 * start.y + 0.5 * end.y)
|
||||
mid2 = vector(end.x, mid1.y)
|
||||
# horizontal first
|
||||
elif first_direction == "H":
|
||||
if fixed_offset:
|
||||
mid1 = vector(fixed_offset, start.y)
|
||||
else:
|
||||
mid1 = vector(0.5 * start.x + 0.5 * end.x, start.y)
|
||||
mid2 = vector(mid1, end.y)
|
||||
else:
|
||||
debug.error("Invalid direction for jog -- must be H or V.")
|
||||
|
||||
if layer in layer_stacks:
|
||||
self.add_wire(layer, [start, mid1, mid2, end])
|
||||
elif layer in techlayer:
|
||||
self.add_path(layer, [start, mid1, mid2, end])
|
||||
else:
|
||||
debug.error("Could not find layer {}".format(layer))
|
||||
|
||||
def add_horizontal_zjog_path(self, layer, start, end):
|
||||
""" Add a simple jog at the halfway point """
|
||||
|
||||
# horizontal first
|
||||
mid1 = vector(0.5 * start.x + 0.5 * end.x, start.y)
|
||||
mid2 = vector(mid1, end.y)
|
||||
self.add_path(layer, [start, mid1, mid2, end])
|
||||
|
||||
def add_wire(self, layers, coordinates, widen_short_wires=True):
|
||||
"""Connects a routing path on given layer,coordinates,width.
|
||||
The layers are the (horizontal, via, vertical). """
|
||||
import wire
|
||||
|
|
@ -452,7 +497,8 @@ class layout():
|
|||
# into rectangles and contacts
|
||||
wire.wire(obj=self,
|
||||
layer_stack=layers,
|
||||
position_list=coordinates)
|
||||
position_list=coordinates,
|
||||
widen_short_wires=widen_short_wires)
|
||||
|
||||
def get_preferred_direction(self, layer):
|
||||
""" Return the preferred routing directions """
|
||||
|
|
@ -461,11 +507,6 @@ class layout():
|
|||
|
||||
def add_via(self, layers, offset, size=[1, 1], directions=None, implant_type=None, well_type=None):
|
||||
""" Add a three layer via structure. """
|
||||
|
||||
if not directions:
|
||||
directions = (self.get_preferred_direction(layers[0]),
|
||||
self.get_preferred_direction(layers[2]))
|
||||
|
||||
from sram_factory import factory
|
||||
via = factory.create(module_type="contact",
|
||||
layer_stack=layers,
|
||||
|
|
@ -486,11 +527,6 @@ class layout():
|
|||
Add a three layer via structure by the center coordinate
|
||||
accounting for mirroring and rotation.
|
||||
"""
|
||||
|
||||
if not directions:
|
||||
directions = (self.get_preferred_direction(layers[0]),
|
||||
self.get_preferred_direction(layers[2]))
|
||||
|
||||
from sram_factory import factory
|
||||
via = factory.create(module_type="contact",
|
||||
layer_stack=layers,
|
||||
|
|
@ -513,36 +549,47 @@ class layout():
|
|||
return inst
|
||||
|
||||
def add_via_stack(self, offset, from_layer, to_layer,
|
||||
direction=None,
|
||||
size=[1, 1]):
|
||||
directions=None,
|
||||
size=[1, 1],
|
||||
implant_type=None,
|
||||
well_type=None):
|
||||
"""
|
||||
Punch a stack of vias from a start layer to a target layer.
|
||||
"""
|
||||
return self.__add_via_stack_internal(offset=offset,
|
||||
direction=direction,
|
||||
directions=directions,
|
||||
from_layer=from_layer,
|
||||
to_layer=to_layer,
|
||||
via_func=self.add_via,
|
||||
last_via=None,
|
||||
size=size)
|
||||
size=size,
|
||||
implant_type=implant_type,
|
||||
well_type=well_type)
|
||||
|
||||
def add_via_stack_center(self, offset, from_layer, to_layer,
|
||||
direction=None,
|
||||
size=[1, 1]):
|
||||
def add_via_stack_center(self,
|
||||
offset,
|
||||
from_layer,
|
||||
to_layer,
|
||||
directions=None,
|
||||
size=[1, 1],
|
||||
implant_type=None,
|
||||
well_type=None):
|
||||
"""
|
||||
Punch a stack of vias from a start layer to a target layer by the center
|
||||
coordinate accounting for mirroring and rotation.
|
||||
"""
|
||||
return self.__add_via_stack_internal(offset=offset,
|
||||
direction=direction,
|
||||
directions=directions,
|
||||
from_layer=from_layer,
|
||||
to_layer=to_layer,
|
||||
via_func=self.add_via_center,
|
||||
last_via=None,
|
||||
size=size)
|
||||
size=size,
|
||||
implant_type=implant_type,
|
||||
well_type=well_type)
|
||||
|
||||
def __add_via_stack_internal(self, offset, direction, from_layer, to_layer,
|
||||
via_func, last_via, size):
|
||||
def __add_via_stack_internal(self, offset, directions, from_layer, to_layer,
|
||||
via_func, last_via, size, implant_type=None, well_type=None):
|
||||
"""
|
||||
Punch a stack of vias from a start layer to a target layer. Here we
|
||||
figure out whether to punch it up or down the stack.
|
||||
|
|
@ -551,8 +598,8 @@ class layout():
|
|||
if from_layer == to_layer:
|
||||
return last_via
|
||||
|
||||
from_id = int(from_layer[1])
|
||||
to_id = int(to_layer[1])
|
||||
from_id = layer_indices[from_layer]
|
||||
to_id = layer_indices[to_layer]
|
||||
|
||||
if from_id < to_id: # grow the stack up
|
||||
search_id = 0
|
||||
|
|
@ -563,18 +610,24 @@ class layout():
|
|||
|
||||
curr_stack = next(filter(lambda stack: stack[search_id] == from_layer, layer_stacks), None)
|
||||
if curr_stack is None:
|
||||
raise ValueError("Cannot create via from '{0}' to '{1}'." \
|
||||
"Layer '{0}' not defined"
|
||||
.format(from_layer, to_layer))
|
||||
raise ValueError("Cannot create via from '{0}' to '{1}'."
|
||||
"Layer '{0}' not defined".format(from_layer, to_layer))
|
||||
|
||||
via = via_func(layers=curr_stack, size=size, offset=offset, directions=direction)
|
||||
return self.__add_via_stack_internal(offset=offset,
|
||||
direction=direction,
|
||||
from_layer=curr_stack[next_id],
|
||||
to_layer=to_layer,
|
||||
via_func=via_func,
|
||||
last_via=via,
|
||||
size=size)
|
||||
via = via_func(layers=curr_stack,
|
||||
size=size,
|
||||
offset=offset,
|
||||
directions=directions,
|
||||
implant_type=implant_type,
|
||||
well_type=well_type)
|
||||
|
||||
via = self.__add_via_stack_internal(offset=offset,
|
||||
directions=directions,
|
||||
from_layer=curr_stack[next_id],
|
||||
to_layer=to_layer,
|
||||
via_func=via_func,
|
||||
last_via=via,
|
||||
size=size)
|
||||
return via
|
||||
|
||||
def add_ptx(self, offset, mirror="R0", rotate=0, width=1, mults=1, tx_type="nmos"):
|
||||
"""Adds a ptx module to the design."""
|
||||
|
|
@ -647,6 +700,8 @@ class layout():
|
|||
boundary_layer = "stdc"
|
||||
boundary = [self.find_lowest_coords(),
|
||||
self.find_highest_coords()]
|
||||
debug.check(boundary[0] and boundary[1], "No shapes to make a boundary.")
|
||||
|
||||
height = boundary[1][1] - boundary[0][1]
|
||||
width = boundary[1][0] - boundary[0][0]
|
||||
(layer_number, layer_purpose) = techlayer[boundary_layer]
|
||||
|
|
@ -729,47 +784,47 @@ class layout():
|
|||
|
||||
return blockages
|
||||
|
||||
def create_horizontal_pin_bus(self, layer, pitch, offset, names, length):
|
||||
def create_horizontal_pin_bus(self, layer, offset, names, length, pitch=None):
|
||||
""" Create a horizontal bus of pins. """
|
||||
return self.create_bus(layer,
|
||||
pitch,
|
||||
offset,
|
||||
names,
|
||||
length,
|
||||
vertical=False,
|
||||
make_pins=True)
|
||||
make_pins=True,
|
||||
pitch=pitch)
|
||||
|
||||
def create_vertical_pin_bus(self, layer, pitch, offset, names, length):
|
||||
def create_vertical_pin_bus(self, layer, offset, names, length, pitch=None):
|
||||
""" Create a horizontal bus of pins. """
|
||||
return self.create_bus(layer,
|
||||
pitch,
|
||||
offset,
|
||||
names,
|
||||
length,
|
||||
vertical=True,
|
||||
make_pins=True)
|
||||
make_pins=True,
|
||||
pitch=pitch)
|
||||
|
||||
def create_vertical_bus(self, layer, pitch, offset, names, length):
|
||||
def create_vertical_bus(self, layer, offset, names, length, pitch=None):
|
||||
""" Create a horizontal bus. """
|
||||
return self.create_bus(layer,
|
||||
pitch,
|
||||
offset,
|
||||
names,
|
||||
length,
|
||||
vertical=True,
|
||||
make_pins=False)
|
||||
make_pins=False,
|
||||
pitch=pitch)
|
||||
|
||||
def create_horizontal_bus(self, layer, pitch, offset, names, length):
|
||||
def create_horizontal_bus(self, layer, offset, names, length, pitch=None):
|
||||
""" Create a horizontal bus. """
|
||||
return self.create_bus(layer,
|
||||
pitch,
|
||||
offset,
|
||||
names,
|
||||
length,
|
||||
vertical=False,
|
||||
make_pins=False)
|
||||
make_pins=False,
|
||||
pitch=pitch)
|
||||
|
||||
def create_bus(self, layer, pitch, offset, names, length, vertical, make_pins):
|
||||
def create_bus(self, layer, offset, names, length, vertical, make_pins, pitch=None):
|
||||
"""
|
||||
Create a horizontal or vertical bus. It can be either just rectangles, or actual
|
||||
layout pins. It returns an map of line center line positions indexed by name.
|
||||
|
|
@ -779,11 +834,14 @@ class layout():
|
|||
|
||||
# half minwidth so we can return the center line offsets
|
||||
half_minwidth = 0.5 * drc["minwidth_{}".format(layer)]
|
||||
if not pitch:
|
||||
pitch = getattr(self, "{}_pitch".format(layer))
|
||||
|
||||
line_positions = {}
|
||||
if vertical:
|
||||
for i in range(len(names)):
|
||||
line_offset = offset + vector(i * pitch, 0)
|
||||
line_offset = offset + vector(i * pitch,
|
||||
0)
|
||||
if make_pins:
|
||||
self.add_layout_pin(text=names[i],
|
||||
layer=layer,
|
||||
|
|
@ -848,8 +906,10 @@ class layout():
|
|||
# left/right then up/down
|
||||
mid_pos = vector(bus_pos.x, pin_pos.y)
|
||||
|
||||
# Don't widen short wires because pin_pos and mid_pos could be really close
|
||||
self.add_wire(layer_stack,
|
||||
[bus_pos, mid_pos, pin_pos])
|
||||
[bus_pos, mid_pos, pin_pos],
|
||||
widen_short_wires=False)
|
||||
|
||||
# Connect to the pin on the instances with a via if it is
|
||||
# not on the right layer
|
||||
|
|
@ -866,32 +926,75 @@ class layout():
|
|||
offset=bus_pos,
|
||||
rotate=90)
|
||||
|
||||
def connect_vbus(self, src_pin, dest_pin, hlayer="m3", vlayer="m2"):
|
||||
"""
|
||||
Helper routine to connect an instance to a vertical bus.
|
||||
Routes horizontal then vertical L shape.
|
||||
"""
|
||||
|
||||
if src_pin.cx()<dest_pin.cx():
|
||||
in_pos = src_pin.rc()
|
||||
else:
|
||||
in_pos = src_pin.lc()
|
||||
if src_pin.cy() < dest_pin.cy():
|
||||
out_pos = dest_pin.bc()
|
||||
else:
|
||||
out_pos = dest_pin.uc()
|
||||
|
||||
# move horizontal first on layer stack
|
||||
mid_pos = vector(out_pos.x, in_pos.y)
|
||||
self.add_via_stack_center(from_layer=src_pin.layer,
|
||||
to_layer=hlayer,
|
||||
offset=in_pos)
|
||||
self.add_path(hlayer, [in_pos, mid_pos])
|
||||
self.add_via_stack_center(from_layer=hlayer,
|
||||
to_layer=vlayer,
|
||||
offset=mid_pos)
|
||||
self.add_path(vlayer, [mid_pos, out_pos])
|
||||
self.add_via_stack_center(from_layer=vlayer,
|
||||
to_layer=dest_pin.layer,
|
||||
offset=out_pos)
|
||||
|
||||
def connect_hbus(self, src_pin, dest_pin, hlayer="m3", vlayer="m2"):
|
||||
"""
|
||||
Helper routine to connect an instance to a horizontal bus.
|
||||
Routes horizontal then vertical L shape.
|
||||
"""
|
||||
|
||||
if src_pin.cx()<dest_pin.cx():
|
||||
in_pos = src_pin.rc()
|
||||
else:
|
||||
in_pos = src_pin.lc()
|
||||
if src_pin.cy() < dest_pin.cy():
|
||||
out_pos = dest_pin.lc()
|
||||
else:
|
||||
out_pos = dest_pin.rc()
|
||||
|
||||
# move horizontal first
|
||||
mid_pos = vector(out_pos.x, in_pos.y)
|
||||
self.add_via_stack_center(from_layer=src_pin.layer,
|
||||
to_layer=hlayer,
|
||||
offset=in_pos)
|
||||
self.add_path(hlayer, [in_pos, mid_pos])
|
||||
self.add_via_stack_center(from_layer=hlayer,
|
||||
to_layer=vlayer,
|
||||
offset=mid_pos)
|
||||
self.add_path(vlayer, [mid_pos, out_pos])
|
||||
self.add_via_stack_center(from_layer=vlayer,
|
||||
to_layer=dest_pin.layer,
|
||||
offset=out_pos)
|
||||
|
||||
def get_layer_pitch(self, layer):
|
||||
""" Return the track pitch on a given layer """
|
||||
if layer == "m1":
|
||||
return (self.m1_pitch,
|
||||
self.m1_pitch - self.m1_space,
|
||||
self.m1_space)
|
||||
elif layer == "m2":
|
||||
return (self.m2_pitch,
|
||||
self.m2_pitch - self.m2_space,
|
||||
self.m2_space)
|
||||
elif layer == "m3":
|
||||
return (self.m3_pitch,
|
||||
self.m3_pitch - self.m3_space,
|
||||
self.m3_space)
|
||||
elif layer == "m4":
|
||||
from tech import layer as tech_layer
|
||||
if "m4" in tech_layer:
|
||||
return (self.m3_pitch,
|
||||
self.m3_pitch - self.m4_space,
|
||||
self.m4_space)
|
||||
else:
|
||||
return (self.m3_pitch,
|
||||
self.m3_pitch - self.m3_space,
|
||||
self.m3_space)
|
||||
else:
|
||||
debug.error("Cannot find layer pitch.")
|
||||
try:
|
||||
# FIXME: Using non-pref pitch here due to overlap bug in VCG constraints.
|
||||
# It should just result in inefficient channel width but will work.
|
||||
pitch = getattr(self, "{}_pitch".format(layer))
|
||||
nonpref_pitch = getattr(self, "{}_nonpref_pitch".format(layer))
|
||||
space = getattr(self, "{}_space".format(layer))
|
||||
except AttributeError:
|
||||
debug.error("Cannot find layer pitch.", -1)
|
||||
return (nonpref_pitch, pitch, pitch - space, space)
|
||||
|
||||
def add_horizontal_trunk_route(self,
|
||||
pins,
|
||||
|
|
@ -906,7 +1009,7 @@ class layout():
|
|||
min_x = min([pin.center().x for pin in pins])
|
||||
|
||||
# if we are less than a pitch, just create a non-preferred layer jog
|
||||
if max_x-min_x <= pitch:
|
||||
if max_x - min_x <= pitch:
|
||||
half_layer_width = 0.5 * drc["minwidth_{0}".format(self.vertical_layer)]
|
||||
|
||||
# Add the horizontal trunk on the vertical layer!
|
||||
|
|
@ -975,14 +1078,15 @@ class layout():
|
|||
def create_channel_route(self, netlist,
|
||||
offset,
|
||||
layer_stack,
|
||||
layer_dirs=None,
|
||||
directions=None,
|
||||
vertical=False):
|
||||
"""
|
||||
The net list is a list of the nets. Each net is a list of pins
|
||||
to be connected. Offset is the lower-left of where the
|
||||
The net list is a list of the nets with each net being a list of pins
|
||||
to be connected. The offset is the lower-left of where the
|
||||
routing channel will start. This does NOT try to minimize the
|
||||
number of tracks -- instead, it picks an order to avoid the
|
||||
vertical conflicts between pins.
|
||||
vertical conflicts between pins. The track size must be the number of
|
||||
nets times the *nonpreferred* routing of the non-track layer pitch.
|
||||
|
||||
"""
|
||||
def remove_net_from_graph(pin, g):
|
||||
|
|
@ -999,12 +1103,17 @@ class layout():
|
|||
g[other_pin]=conflicts
|
||||
return g
|
||||
|
||||
def vcg_nets_overlap(net1, net2, vertical, pitch):
|
||||
def vcg_nets_overlap(net1, net2, vertical):
|
||||
"""
|
||||
Check all the pin pairs on two nets and return a pin
|
||||
overlap if any pin overlaps.
|
||||
"""
|
||||
|
||||
if vertical:
|
||||
pitch = self.horizontal_nonpref_pitch
|
||||
else:
|
||||
pitch = self.vertical_nonpref_pitch
|
||||
|
||||
for pin1 in net1:
|
||||
for pin2 in net2:
|
||||
if vcg_pin_overlap(pin1, pin2, vertical, pitch):
|
||||
|
|
@ -1014,11 +1123,10 @@ class layout():
|
|||
|
||||
def vcg_pin_overlap(pin1, pin2, vertical, pitch):
|
||||
""" Check for vertical or horizontal overlap of the two pins """
|
||||
|
||||
|
||||
# FIXME: If the pins are not in a row, this may break.
|
||||
# However, a top pin shouldn't overlap another top pin,
|
||||
# for example, so the
|
||||
# extra comparison *shouldn't* matter.
|
||||
# for example, so the extra comparison *shouldn't* matter.
|
||||
|
||||
# Pin 1 must be in the "BOTTOM" set
|
||||
x_overlap = pin1.by() < pin2.by() and abs(pin1.center().x - pin2.center().x) < pitch
|
||||
|
|
@ -1028,7 +1136,7 @@ class layout():
|
|||
overlaps = (not vertical and x_overlap) or (vertical and y_overlap)
|
||||
return overlaps
|
||||
|
||||
if not layer_dirs:
|
||||
if not directions:
|
||||
# Use the preferred layer directions
|
||||
if self.get_preferred_direction(layer_stack[0]) == "V":
|
||||
self.vertical_layer = layer_stack[0]
|
||||
|
|
@ -1039,8 +1147,8 @@ class layout():
|
|||
else:
|
||||
# Use the layer directions specified to the router rather than
|
||||
# the preferred directions
|
||||
debug.check(layer_dirs[0] != layer_dirs[1], "Must have unique layer directions.")
|
||||
if layer_dirs[0] == "V":
|
||||
debug.check(directions[0] != directions[1], "Must have unique layer directions.")
|
||||
if directions[0] == "V":
|
||||
self.vertical_layer = layer_stack[0]
|
||||
self.horizontal_layer = layer_stack[2]
|
||||
else:
|
||||
|
|
@ -1048,9 +1156,10 @@ class layout():
|
|||
self.vertical_layer = layer_stack[2]
|
||||
|
||||
layer_stuff = self.get_layer_pitch(self.vertical_layer)
|
||||
(self.vertical_pitch, self.vertical_width, self.vertical_space) = layer_stuff
|
||||
(self.vertical_nonpref_pitch, self.vertical_pitch, self.vertical_width, self.vertical_space) = layer_stuff
|
||||
|
||||
layer_stuff = self.get_layer_pitch(self.horizontal_layer)
|
||||
(self.horizontal_pitch, self.horizontal_width, self.horizontal_space) = layer_stuff
|
||||
(self.horizontal_nonpref_pitch, self.horizontal_pitch, self.horizontal_width, self.horizontal_space) = layer_stuff
|
||||
|
||||
# FIXME: Must extend this to a horizontal conflict graph
|
||||
# too if we want to minimize the
|
||||
|
|
@ -1070,6 +1179,10 @@ class layout():
|
|||
index += 1
|
||||
nets[net_name] = pin_list
|
||||
|
||||
# print("Nets:")
|
||||
# for net_name in nets:
|
||||
# print(net_name, [x.name for x in nets[net_name]])
|
||||
|
||||
# Find the vertical pin conflicts
|
||||
# FIXME: O(n^2) but who cares for now
|
||||
for net_name1 in nets:
|
||||
|
|
@ -1081,21 +1194,15 @@ class layout():
|
|||
# Skip yourself
|
||||
if net_name1 == net_name2:
|
||||
continue
|
||||
if vertical and vcg_nets_overlap(nets[net_name1],
|
||||
nets[net_name2],
|
||||
vertical,
|
||||
self.vertical_pitch):
|
||||
vcg[net_name2].append(net_name1)
|
||||
elif not vertical and vcg_nets_overlap(nets[net_name1],
|
||||
nets[net_name2],
|
||||
vertical,
|
||||
self.horizontal_pitch):
|
||||
if vcg_nets_overlap(nets[net_name1],
|
||||
nets[net_name2],
|
||||
vertical):
|
||||
vcg[net_name2].append(net_name1)
|
||||
|
||||
# list of routes to do
|
||||
while vcg:
|
||||
# from pprint import pformat
|
||||
# print("VCG:\n",pformat(vcg))
|
||||
# print("VCG:\n", pformat(vcg))
|
||||
# get a route from conflict graph with empty fanout set
|
||||
net_name = None
|
||||
for net_name, conflicts in vcg.items():
|
||||
|
|
@ -1119,26 +1226,28 @@ class layout():
|
|||
self.add_vertical_trunk_route(pin_list,
|
||||
offset,
|
||||
layer_stack,
|
||||
self.vertical_pitch)
|
||||
offset += vector(self.vertical_pitch, 0)
|
||||
self.vertical_nonpref_pitch)
|
||||
# This accounts for the via-to-via spacings
|
||||
offset += vector(self.horizontal_nonpref_pitch, 0)
|
||||
else:
|
||||
self.add_horizontal_trunk_route(pin_list,
|
||||
offset,
|
||||
layer_stack,
|
||||
self.horizontal_pitch)
|
||||
offset += vector(0, self.horizontal_pitch)
|
||||
self.horizontal_nonpref_pitch)
|
||||
# This accounts for the via-to-via spacings
|
||||
offset += vector(0, self.vertical_nonpref_pitch)
|
||||
|
||||
def create_vertical_channel_route(self, netlist, offset, layer_stack, layer_dirs=None):
|
||||
def create_vertical_channel_route(self, netlist, offset, layer_stack, directions=None):
|
||||
"""
|
||||
Wrapper to create a vertical channel route
|
||||
"""
|
||||
self.create_channel_route(netlist, offset, layer_stack, layer_dirs, vertical=True)
|
||||
self.create_channel_route(netlist, offset, layer_stack, directions, vertical=True)
|
||||
|
||||
def create_horizontal_channel_route(self, netlist, offset, layer_stack, layer_dirs=None):
|
||||
def create_horizontal_channel_route(self, netlist, offset, layer_stack, directions=None):
|
||||
"""
|
||||
Wrapper to create a horizontal channel route
|
||||
"""
|
||||
self.create_channel_route(netlist, offset, layer_stack, layer_dirs, vertical=False)
|
||||
self.create_channel_route(netlist, offset, layer_stack, directions, vertical=False)
|
||||
|
||||
def add_boundary(self, ll=vector(0, 0), ur=None):
|
||||
""" Add boundary for debugging dimensions """
|
||||
|
|
@ -1200,32 +1309,23 @@ class layout():
|
|||
"supply router."
|
||||
.format(name, inst.name, self.pwr_grid_layer))
|
||||
|
||||
def add_power_pin(self, name, loc, size=[1, 1], vertical=False, start_layer="m1"):
|
||||
def add_power_pin(self, name, loc, size=[1, 1], directions=None, start_layer="m1"):
|
||||
"""
|
||||
Add a single power pin from the lowest power_grid layer down to M1 (or li) at
|
||||
the given center location. The starting layer is specified to determine
|
||||
which vias are needed.
|
||||
"""
|
||||
|
||||
# Force vdd/gnd via stack to be vertically or horizontally oriented
|
||||
# Default: None, uses prefered metal directions
|
||||
if vertical:
|
||||
direction = ("V", "V")
|
||||
elif not vertical and vertical is not None:
|
||||
direction = ("H", "H")
|
||||
else:
|
||||
direction = None
|
||||
|
||||
via = self.add_via_stack_center(from_layer=start_layer,
|
||||
to_layer=self.pwr_grid_layer,
|
||||
size=size,
|
||||
offset=loc,
|
||||
direction=direction)
|
||||
if start_layer == self.pwr_grid_layer:
|
||||
self.add_layout_pin_rect_center(text=name,
|
||||
layer=self.pwr_grid_layer,
|
||||
offset=loc)
|
||||
else:
|
||||
via = self.add_via_stack_center(from_layer=start_layer,
|
||||
to_layer=self.pwr_grid_layer,
|
||||
size=size,
|
||||
offset=loc,
|
||||
directions=directions)
|
||||
# Hack for min area
|
||||
if OPTS.tech_name == "s8":
|
||||
width = round_to_grid(sqrt(drc["minarea_m3"]))
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ class spice():
|
|||
# parses line into ports and remove subckt
|
||||
self.pins = subckt_line.split(" ")[2:]
|
||||
else:
|
||||
debug.info(4, "no spfile {0}".format(self.sp_file))
|
||||
self.spice = []
|
||||
|
||||
# We don't define self.lvs and will use self.spice if dynamically created
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@ class wire(wire_path):
|
|||
not, it will always go down first.
|
||||
The points are the center of the wire.
|
||||
The layer stack is the vertical, contact/via, and horizontal layers, respectively.
|
||||
The widen option will avoid via-to-via spacing problems for really short segments
|
||||
(added as an option so we can disable it in bus connections)
|
||||
"""
|
||||
def __init__(self, obj, layer_stack, position_list):
|
||||
def __init__(self, obj, layer_stack, position_list, widen_short_wires=True):
|
||||
self.obj = obj
|
||||
self.layer_stack = layer_stack
|
||||
self.position_list = position_list
|
||||
self.widen_short_wires = widen_short_wires
|
||||
self.pins = [] # used for matching parm lengths
|
||||
self.switch_pos_list = []
|
||||
|
||||
|
|
@ -114,7 +117,7 @@ class wire(wire_path):
|
|||
line_length = pl[index + 1][0] - pl[index][0]
|
||||
# Make the wire wider to avoid via-to-via spacing problems
|
||||
# But don't make it wider if it is shorter than one via
|
||||
if abs(line_length) < self.pitch and abs(line_length) > self.horiz_layer_contact_width:
|
||||
if self.widen_short_wires and abs(line_length) < self.pitch and abs(line_length) > self.horiz_layer_contact_width:
|
||||
width = self.horiz_layer_contact_width
|
||||
else:
|
||||
width = self.horiz_layer_width
|
||||
|
|
@ -134,7 +137,7 @@ class wire(wire_path):
|
|||
line_length = pl[index + 1][1] - pl[index][1]
|
||||
# Make the wire wider to avoid via-to-via spacing problems
|
||||
# But don't make it wider if it is shorter than one via
|
||||
if abs(line_length) < self.pitch and abs(line_length) > self.vert_layer_contact_width:
|
||||
if self.widen_short_wires and abs(line_length) < self.pitch and abs(line_length) > self.vert_layer_contact_width:
|
||||
width = self.vert_layer_contact_width
|
||||
else:
|
||||
width = self.vert_layer_width
|
||||
|
|
|
|||
|
|
@ -24,11 +24,12 @@ def create_rectilinear_route(my_list):
|
|||
my_list.append(vector(pl[index][0], pl[index + 1][1]))
|
||||
my_list.append(vector(pl[-1]))
|
||||
return my_list
|
||||
|
||||
|
||||
|
||||
class wire_path():
|
||||
"""
|
||||
Object metal wire_path; given the layer type
|
||||
Add a wire_path of minimium metal width between a set of points.
|
||||
Add a wire_path of minimium metal width between a set of points.
|
||||
The points should be rectilinear to control the bend points. If
|
||||
not, it will always go down first. The points are the center of the wire_path.
|
||||
If width is not given, it uses minimum layer width.
|
||||
|
|
@ -37,7 +38,7 @@ class wire_path():
|
|||
self.obj = obj
|
||||
self.layer_name = layer
|
||||
self.layer_id = techlayer[layer]
|
||||
if width==None:
|
||||
if width == None:
|
||||
self.layer_width = drc["minwidth_{0}".format(layer)]
|
||||
else:
|
||||
self.layer_width = width
|
||||
|
|
@ -46,7 +47,6 @@ class wire_path():
|
|||
self.switch_pos_list = []
|
||||
self.create_layout()
|
||||
|
||||
|
||||
def create_layout(self):
|
||||
self.create_rectilinear()
|
||||
self.connect_corner()
|
||||
|
|
@ -60,9 +60,9 @@ class wire_path():
|
|||
|
||||
def connect_corner(self):
|
||||
""" Add a corner square at every corner of the wire_path."""
|
||||
from itertools import tee,islice
|
||||
nwise = lambda g,n=2: zip(*(islice(g,i,None) for i,g in enumerate(tee(g,n))))
|
||||
threewise=nwise(self.position_list,3)
|
||||
from itertools import tee, islice
|
||||
nwise = lambda g, n=2: zip(*(islice(g, i, None) for i, g in enumerate(tee(g, n))))
|
||||
threewise=nwise(self.position_list, 3)
|
||||
|
||||
for (a, offset, c) in list(threewise):
|
||||
# add a exceptions to prevent a corner when we retrace back in the same direction
|
||||
|
|
@ -74,7 +74,6 @@ class wire_path():
|
|||
offset[1] - 0.5 * self.layer_width]
|
||||
self.draw_corner_wire(corner_offset)
|
||||
|
||||
|
||||
def draw_corner_wire(self, offset):
|
||||
""" This function adds the corner squares since the center
|
||||
line convention only draws to the center of the corner."""
|
||||
|
|
@ -117,7 +116,7 @@ class wire_path():
|
|||
|
||||
def add_line(self, layer_name, length, offset, orientation, layer_width):
|
||||
"""
|
||||
straight line object with layer_minwidth
|
||||
straight line object with layer_minwidth
|
||||
(orientation: "vertical" or "horizontal") default is vertical
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
import debug
|
||||
import utils
|
||||
from tech import GDS, layer, parameter
|
||||
from tech import GDS, layer
|
||||
from tech import cell_properties as props
|
||||
import bitcell_base
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ class bitcell(bitcell_base.bitcell_base):
|
|||
self.pin_map = bitcell.pin_map
|
||||
self.add_pin_types(self.type_list)
|
||||
self.nets_match = self.do_nets_exist(self.storage_nets)
|
||||
|
||||
|
||||
def get_all_wl_names(self):
|
||||
""" Creates a list of all wordline pin names """
|
||||
if props.bitcell.split_wl:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
import utils
|
||||
from tech import GDS, layer
|
||||
from tech import cell_properties as props
|
||||
import bitcell_base
|
||||
|
||||
|
||||
class col_cap_bitcell_1rw_1r(bitcell_base.bitcell_base):
|
||||
"""
|
||||
todo"""
|
||||
|
||||
pin_names = [props.bitcell.cell_1rw1r.pin.bl0,
|
||||
props.bitcell.cell_1rw1r.pin.br0,
|
||||
props.bitcell.cell_1rw1r.pin.bl1,
|
||||
props.bitcell.cell_1rw1r.pin.br1,
|
||||
props.bitcell.cell_1rw1r.pin.vdd]
|
||||
|
||||
type_list = ["OUTPUT", "OUTPUT", "OUTPUT", "OUTPUT",
|
||||
"POWER", "GROUND"]
|
||||
|
||||
(width, height) = utils.get_libcell_size("col_cap_cell_1rw_1r",
|
||||
GDS["unit"],
|
||||
layer["boundary"])
|
||||
pin_map = utils.get_libcell_pins(pin_names,
|
||||
"col_cap_cell_1rw_1r",
|
||||
GDS["unit"])
|
||||
|
||||
def __init__(self, name=""):
|
||||
# Ignore the name argument
|
||||
bitcell_base.bitcell_base.__init__(self, "col_cap_cell_1rw_1r")
|
||||
debug.info(2, "Create col_cap bitcell 1rw+1r object")
|
||||
|
||||
self.width = col_cap_bitcell_1rw_1r.width
|
||||
self.height = col_cap_bitcell_1rw_1r.height
|
||||
self.pin_map = col_cap_bitcell_1rw_1r.pin_map
|
||||
self.add_pin_types(self.type_list)
|
||||
|
|
@ -264,7 +264,7 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
+ 2 * self.implant_enclose_active \
|
||||
+ 0.5*(self.inverter_pmos.active_contact.height - self.m1_width)
|
||||
metal1_constraint = max(inverter_pmos_contact_extension, 0) + self.m1_space
|
||||
self.vdd_offset = max(implant_constraint, metal1_constraint) + 0.5*self.m1_width
|
||||
self.vdd_offset = max(implant_constraint, metal1_constraint) + self.m1_width
|
||||
|
||||
# read port dimensions
|
||||
width_reduction = self.read_nmos.active_width - self.read_nmos.get_pin("D").cx()
|
||||
|
|
@ -275,7 +275,7 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
Calculate positions that describe the edges
|
||||
and dimensions of the cell
|
||||
"""
|
||||
self.botmost_ypos = self.m1_offset - self.total_ports * self.m1_pitch
|
||||
self.botmost_ypos = self.m1_offset - self.total_ports * self.m1_nonpref_pitch
|
||||
self.topmost_ypos = self.inverter_nmos_ypos \
|
||||
+ self.inverter_nmos.active_height \
|
||||
+ self.inverter_gap \
|
||||
|
|
@ -378,14 +378,15 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
+ 0.5 * contact.poly_contact.height,
|
||||
self.cross_couple_upper_ypos)
|
||||
self.add_via_center(layers=self.poly_stack,
|
||||
offset=contact_offset_left)
|
||||
|
||||
offset=contact_offset_left,
|
||||
directions=("H", "H"))
|
||||
|
||||
contact_offset_right = vector(self.inverter_nmos_right.get_pin("S").lc().x \
|
||||
- 0.5*contact.poly_contact.height,
|
||||
self.cross_couple_lower_ypos)
|
||||
self.add_via_center(layers=self.poly_stack,
|
||||
offset=contact_offset_right)
|
||||
offset=contact_offset_right,
|
||||
directions=("H", "H"))
|
||||
|
||||
# connect contacts to gate poly (cross couple connections)
|
||||
gate_offset_right = vector(self.inverter_nmos_right.get_pin("G").lc().x,
|
||||
|
|
@ -399,12 +400,12 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
def route_rails(self):
|
||||
""" Adds gnd and vdd rails and connects them to the inverters """
|
||||
# Add rails for vdd and gnd
|
||||
gnd_ypos = self.m1_offset - self.total_ports * self.m1_pitch
|
||||
gnd_ypos = self.m1_offset - self.total_ports * self.m1_nonpref_pitch
|
||||
self.gnd_position = vector(0, gnd_ypos)
|
||||
self.add_rect_center(layer="m1",
|
||||
offset=self.gnd_position,
|
||||
width=self.width)
|
||||
self.add_power_pin("gnd", vector(0, gnd_ypos))
|
||||
self.add_power_pin("gnd", vector(0, gnd_ypos), directions=("H", "H"))
|
||||
|
||||
|
||||
vdd_ypos = self.inverter_nmos_ypos \
|
||||
|
|
@ -416,7 +417,7 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
self.add_rect_center(layer="m1",
|
||||
offset=self.vdd_position,
|
||||
width=self.width)
|
||||
self.add_power_pin("vdd", vector(0, vdd_ypos))
|
||||
self.add_power_pin("vdd", vector(0, vdd_ypos), directions=("H", "H"))
|
||||
|
||||
def create_readwrite_ports(self):
|
||||
"""
|
||||
|
|
@ -483,7 +484,7 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
self.port_ypos])
|
||||
|
||||
# add pin for RWWL
|
||||
rwwl_ypos = self.m1_offset - k * self.m1_pitch
|
||||
rwwl_ypos = self.m1_offset - k * self.m1_nonpref_pitch
|
||||
self.rwwl_positions[k] = vector(0, rwwl_ypos)
|
||||
self.add_layout_pin_rect_center(text=self.rw_wl_names[k],
|
||||
layer="m1",
|
||||
|
|
@ -579,8 +580,8 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
|
||||
# add pin for WWL
|
||||
wwl_ypos = rwwl_ypos = self.m1_offset \
|
||||
- self.num_rw_ports * self.m1_pitch \
|
||||
- k * self.m1_pitch
|
||||
- self.num_rw_ports * self.m1_nonpref_pitch \
|
||||
- k * self.m1_nonpref_pitch
|
||||
self.wwl_positions[k] = vector(0, wwl_ypos)
|
||||
self.add_layout_pin_rect_center(text=self.w_wl_names[k],
|
||||
layer="m1",
|
||||
|
|
@ -705,9 +706,9 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
|
||||
# add pin for RWL
|
||||
rwl_ypos = rwwl_ypos = self.m1_offset \
|
||||
- self.num_rw_ports * self.m1_pitch \
|
||||
- self.num_w_ports * self.m1_pitch \
|
||||
- k * self.m1_pitch
|
||||
- self.num_rw_ports * self.m1_nonpref_pitch \
|
||||
- self.num_w_ports * self.m1_nonpref_pitch \
|
||||
- k * self.m1_nonpref_pitch
|
||||
self.rwl_positions[k] = vector(0, rwl_ypos)
|
||||
self.add_layout_pin_rect_center(text=self.r_wl_names[k],
|
||||
layer="m1",
|
||||
|
|
@ -771,6 +772,7 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
self.add_via_center(layers=self.poly_stack,
|
||||
offset=port_contact_offset)
|
||||
|
||||
|
||||
self.add_path("poly", [gate_offset, port_contact_offset])
|
||||
self.add_path("m1",
|
||||
[port_contact_offset, wl_contact_offset])
|
||||
|
|
@ -821,7 +823,8 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
# Leave bitline disconnected if a dummy cell
|
||||
if not self.dummy_bitcell:
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=port_contact_offest)
|
||||
offset=port_contact_offest,
|
||||
directions="nonpref")
|
||||
|
||||
self.add_path("m2",
|
||||
[port_contact_offest, bl_offset], width=contact.m1_via.height)
|
||||
|
|
@ -833,7 +836,8 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
# Leave bitline disconnected if a dummy cell
|
||||
if not self.dummy_bitcell:
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=port_contact_offest)
|
||||
offset=port_contact_offest,
|
||||
directions="nonpref")
|
||||
|
||||
self.add_path("m2",
|
||||
[port_contact_offest, br_offset], width=contact.m1_via.height)
|
||||
|
|
@ -850,7 +854,9 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
|
||||
for position in nmos_contact_positions:
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=position)
|
||||
offset=position,
|
||||
directions=("V", "V"))
|
||||
|
||||
|
||||
if position.x > 0:
|
||||
contact_correct = 0.5 * contact.m1_via.height
|
||||
|
|
@ -859,7 +865,8 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
supply_offset = vector(position.x + contact_correct,
|
||||
self.gnd_position.y)
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=supply_offset)
|
||||
offset=supply_offset,
|
||||
directions=("H", "H"))
|
||||
|
||||
self.add_path("m2", [position, supply_offset])
|
||||
|
||||
|
|
@ -924,13 +931,16 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
- self.poly_to_contact - 0.5*contact.poly_contact.width,
|
||||
self.cross_couple_upper_ypos)
|
||||
self.add_via_center(layers=self.poly_stack,
|
||||
offset=left_storage_contact)
|
||||
offset=left_storage_contact,
|
||||
directions=("H", "H"))
|
||||
|
||||
|
||||
right_storage_contact = vector(self.inverter_nmos_right.get_pin("G").rc().x \
|
||||
+ self.poly_to_contact + 0.5*contact.poly_contact.width,
|
||||
self.cross_couple_upper_ypos)
|
||||
self.add_via_center(layers=self.poly_stack,
|
||||
offset=right_storage_contact)
|
||||
offset=right_storage_contact,
|
||||
directions=("H", "H"))
|
||||
|
||||
inverter_gate_offset_left = vector(self.inverter_nmos_left.get_pin("G").lc().x, self.cross_couple_upper_ypos)
|
||||
self.add_path("poly", [left_storage_contact, inverter_gate_offset_left])
|
||||
|
|
@ -1007,8 +1017,7 @@ class pbitcell(bitcell_base.bitcell_base):
|
|||
well_height = self.vdd_position.y - inverter_well_ypos \
|
||||
+ self.nwell_enclose_active + drc["minwidth_tx"]
|
||||
|
||||
# FIXME fudge factor xpos
|
||||
offset = [inverter_well_xpos + 2*self.nwell_enclose_active, inverter_well_ypos]
|
||||
offset = [inverter_well_xpos, inverter_well_ypos]
|
||||
self.add_rect(layer="nwell",
|
||||
offset=offset,
|
||||
width=well_width,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
import utils
|
||||
from tech import GDS, layer
|
||||
from tech import cell_properties as props
|
||||
import bitcell_base
|
||||
|
||||
|
||||
class row_cap_bitcell_1rw_1r(bitcell_base.bitcell_base):
|
||||
"""
|
||||
A single bit cell which is forced to store a 0.
|
||||
This module implements the single memory cell used in the design. It
|
||||
is a hand-made cell, so the layout and netlist should be available in
|
||||
the technology library. """
|
||||
|
||||
pin_names = [props.bitcell.cell_1rw1r.pin.wl0,
|
||||
props.bitcell.cell_1rw1r.pin.wl1,
|
||||
props.bitcell.cell_1rw1r.pin.gnd]
|
||||
|
||||
type_list = ["INPUT", "INPUT", "GROUND"]
|
||||
|
||||
(width, height) = utils.get_libcell_size("row_cap_cell_1rw_1r",
|
||||
GDS["unit"],
|
||||
layer["boundary"])
|
||||
pin_map = utils.get_libcell_pins(pin_names,
|
||||
"row_cap_cell_1rw_1r",
|
||||
GDS["unit"])
|
||||
|
||||
def __init__(self, name=""):
|
||||
# Ignore the name argument
|
||||
bitcell_base.bitcell_base.__init__(self, "row_cap_cell_1rw_1r")
|
||||
debug.info(2, "Create row_cap bitcell 1rw+1r object")
|
||||
|
||||
self.width = row_cap_bitcell_1rw_1r.width
|
||||
self.height = row_cap_bitcell_1rw_1r.height
|
||||
self.pin_map = row_cap_bitcell_1rw_1r.pin_map
|
||||
self.add_pin_types(self.type_list)
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
from vector import vector
|
||||
import design
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
from tech import layer
|
||||
|
||||
|
||||
class and2_dec(design.design):
|
||||
"""
|
||||
This is an AND with configurable drive strength.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None, add_wells=True):
|
||||
|
||||
design.design.__init__(self, name)
|
||||
|
||||
debug.info(1, "Creating and2_dec {}".format(name))
|
||||
self.add_comment("size: {}".format(size))
|
||||
self.size = size
|
||||
self.height = height
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
self.create_modules()
|
||||
self.create_insts()
|
||||
|
||||
def create_modules(self):
|
||||
self.nand = factory.create(module_type="nand2_dec",
|
||||
height=self.height)
|
||||
|
||||
self.inv = factory.create(module_type="inv_dec",
|
||||
height=self.height,
|
||||
size=self.size)
|
||||
|
||||
self.add_mod(self.nand)
|
||||
self.add_mod(self.inv)
|
||||
|
||||
def create_layout(self):
|
||||
|
||||
if "li" in layer:
|
||||
self.route_layer = "li"
|
||||
else:
|
||||
self.route_layer = "m1"
|
||||
self.width = self.nand.width + self.inv.width
|
||||
self.height = self.nand.height
|
||||
|
||||
self.place_insts()
|
||||
self.add_wires()
|
||||
self.add_layout_pins()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
self.add_pin("A", "INPUT")
|
||||
self.add_pin("B", "INPUT")
|
||||
self.add_pin("Z", "OUTPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def create_insts(self):
|
||||
self.nand_inst = self.add_inst(name="pand2_dec_nand",
|
||||
mod=self.nand)
|
||||
self.connect_inst(["A", "B", "zb_int", "vdd", "gnd"])
|
||||
|
||||
self.inv_inst = self.add_inst(name="pand2_dec_inv",
|
||||
mod=self.inv)
|
||||
self.connect_inst(["zb_int", "Z", "vdd", "gnd"])
|
||||
|
||||
def place_insts(self):
|
||||
# Add NAND to the right
|
||||
self.nand_inst.place(offset=vector(0, 0))
|
||||
|
||||
# Add INV to the right
|
||||
self.inv_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top, (middle), and bottom. """
|
||||
if OPTS.tech_name == "s8":
|
||||
for name in ["vdd", "gnd"]:
|
||||
for inst in [self.nand_inst, self.inv_inst]:
|
||||
self.copy_layout_pin(inst, name)
|
||||
else:
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
def add_wires(self):
|
||||
# nand Z to inv A
|
||||
z1_pin = self.nand_inst.get_pin("Z")
|
||||
a2_pin = self.inv_inst.get_pin("A")
|
||||
if OPTS.tech_name == "s8":
|
||||
mid1_point = vector(a2_pin.cx(), z1_pin.cy())
|
||||
else:
|
||||
mid1_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path(self.route_layer,
|
||||
[z1_pin.center(), mid1_point, a2_pin.center()])
|
||||
|
||||
def add_layout_pins(self):
|
||||
pin = self.inv_inst.get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
for pin_name in ["A", "B"]:
|
||||
pin = self.nand_inst.get_pin(pin_name)
|
||||
self.add_layout_pin_rect_center(text=pin_name,
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
def get_stage_efforts(self, external_cout, inp_is_rise=False):
|
||||
"""Get the stage efforts of the A or B -> Z path"""
|
||||
stage_effort_list = []
|
||||
stage1_cout = self.inv.get_cin()
|
||||
stage1 = self.nand.get_stage_effort(stage1_cout, inp_is_rise)
|
||||
stage_effort_list.append(stage1)
|
||||
last_stage_is_rise = stage1.is_rise
|
||||
|
||||
stage2 = self.inv.get_stage_effort(external_cout, last_stage_is_rise)
|
||||
stage_effort_list.append(stage2)
|
||||
|
||||
return stage_effort_list
|
||||
|
||||
def get_cin(self):
|
||||
"""Return the relative input capacitance of a single input"""
|
||||
return self.nand.get_cin()
|
||||
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
from vector import vector
|
||||
import design
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
from tech import layer
|
||||
|
||||
|
||||
class and3_dec(design.design):
|
||||
"""
|
||||
This is an AND with configurable drive strength.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None, add_wells=True):
|
||||
design.design.__init__(self, name)
|
||||
debug.info(1, "Creating and3_dec {}".format(name))
|
||||
self.add_comment("size: {}".format(size))
|
||||
self.size = size
|
||||
self.height = height
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
self.create_modules()
|
||||
self.create_insts()
|
||||
|
||||
def create_modules(self):
|
||||
self.nand = factory.create(module_type="nand3_dec",
|
||||
height=self.height)
|
||||
|
||||
self.inv = factory.create(module_type="inv_dec",
|
||||
height=self.height,
|
||||
size=self.size)
|
||||
|
||||
self.add_mod(self.nand)
|
||||
self.add_mod(self.inv)
|
||||
|
||||
def create_layout(self):
|
||||
if "li" in layer:
|
||||
self.route_layer = "li"
|
||||
else:
|
||||
self.route_layer = "m1"
|
||||
|
||||
self.width = self.nand.width + self.inv.width
|
||||
self.height = self.nand.height
|
||||
|
||||
self.place_insts()
|
||||
self.add_wires()
|
||||
self.add_layout_pins()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
self.add_pin("A", "INPUT")
|
||||
self.add_pin("B", "INPUT")
|
||||
self.add_pin("C", "INPUT")
|
||||
self.add_pin("Z", "OUTPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def create_insts(self):
|
||||
self.nand_inst = self.add_inst(name="pand3_dec_nand",
|
||||
mod=self.nand)
|
||||
self.connect_inst(["A", "B", "C", "zb_int", "vdd", "gnd"])
|
||||
|
||||
self.inv_inst = self.add_inst(name="pand3_dec_inv",
|
||||
mod=self.inv)
|
||||
self.connect_inst(["zb_int", "Z", "vdd", "gnd"])
|
||||
|
||||
def place_insts(self):
|
||||
# Add NAND to the right
|
||||
self.nand_inst.place(offset=vector(0, 0))
|
||||
|
||||
# Add INV to the right
|
||||
self.inv_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top, (middle), and bottom. """
|
||||
if OPTS.tech_name == "s8":
|
||||
for name in ["vdd", "gnd"]:
|
||||
for inst in [self.nand_inst, self.inv_inst]:
|
||||
self.copy_layout_pin(inst, name)
|
||||
else:
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
def add_wires(self):
|
||||
# nand Z to inv A
|
||||
z1_pin = self.nand_inst.get_pin("Z")
|
||||
a2_pin = self.inv_inst.get_pin("A")
|
||||
if OPTS.tech_name == "s8":
|
||||
mid1_point = vector(a2_pin.cx(), z1_pin.cy())
|
||||
else:
|
||||
mid1_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path(self.route_layer,
|
||||
[z1_pin.center(), mid1_point, a2_pin.center()])
|
||||
|
||||
def add_layout_pins(self):
|
||||
pin = self.inv_inst.get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
for pin_name in ["A", "B", "C"]:
|
||||
pin = self.nand_inst.get_pin(pin_name)
|
||||
self.add_layout_pin_rect_center(text=pin_name,
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
def analytical_delay(self, corner, slew, load=0.0):
|
||||
""" Calculate the analytical delay of DFF-> INV -> INV """
|
||||
nand_delay = self.nand.analytical_delay(corner,
|
||||
slew=slew,
|
||||
load=self.inv.input_load())
|
||||
inv_delay = self.inv.analytical_delay(corner,
|
||||
slew=nand_delay.slew,
|
||||
load=load)
|
||||
return nand_delay + inv_delay
|
||||
|
||||
def get_stage_efforts(self, external_cout, inp_is_rise=False):
|
||||
"""Get the stage efforts of the A or B -> Z path"""
|
||||
stage_effort_list = []
|
||||
stage1_cout = self.inv.get_cin()
|
||||
stage1 = self.nand.get_stage_effort(stage1_cout, inp_is_rise)
|
||||
stage_effort_list.append(stage1)
|
||||
last_stage_is_rise = stage1.is_rise
|
||||
|
||||
stage2 = self.inv.get_stage_effort(external_cout, last_stage_is_rise)
|
||||
stage_effort_list.append(stage2)
|
||||
|
||||
return stage_effort_list
|
||||
|
||||
def get_cin(self):
|
||||
"""Return the relative input capacitance of a single input"""
|
||||
return self.nand.get_cin()
|
||||
|
||||
|
|
@ -0,0 +1,159 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
from vector import vector
|
||||
import design
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
from tech import layer
|
||||
|
||||
|
||||
class and4_dec(design.design):
|
||||
"""
|
||||
This is an AND with configurable drive strength.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None, add_wells=True):
|
||||
|
||||
design.design.__init__(self, name)
|
||||
|
||||
debug.info(1, "Creating and4_dec {}".format(name))
|
||||
self.add_comment("size: {}".format(size))
|
||||
self.size = size
|
||||
self.height = height
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
self.create_modules()
|
||||
self.create_insts()
|
||||
|
||||
def create_modules(self):
|
||||
self.nand = factory.create(module_type="nand4_dec",
|
||||
height=self.height)
|
||||
|
||||
self.inv = factory.create(module_type="inv_dec",
|
||||
height=self.height,
|
||||
size=self.size)
|
||||
|
||||
self.add_mod(self.nand)
|
||||
self.add_mod(self.inv)
|
||||
|
||||
def create_layout(self):
|
||||
if "li" in layer:
|
||||
self.route_layer = "li"
|
||||
else:
|
||||
self.route_layer = "m1"
|
||||
|
||||
self.width = self.nand.width + self.inv.width
|
||||
self.height = self.nand.height
|
||||
|
||||
self.place_insts()
|
||||
self.add_wires()
|
||||
self.add_layout_pins()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
self.add_pin("A", "INPUT")
|
||||
self.add_pin("B", "INPUT")
|
||||
self.add_pin("C", "INPUT")
|
||||
self.add_pin("D", "INPUT")
|
||||
self.add_pin("Z", "OUTPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def create_insts(self):
|
||||
self.nand_inst = self.add_inst(name="pand4_dec_nand",
|
||||
mod=self.nand)
|
||||
self.connect_inst(["A", "B", "C", "D", "zb_int", "vdd", "gnd"])
|
||||
|
||||
self.inv_inst = self.add_inst(name="pand4_dec_inv",
|
||||
mod=self.inv)
|
||||
self.connect_inst(["zb_int", "Z", "vdd", "gnd"])
|
||||
|
||||
def place_insts(self):
|
||||
# Add NAND to the right
|
||||
self.nand_inst.place(offset=vector(0, 0))
|
||||
|
||||
# Add INV to the right
|
||||
self.inv_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top, (middle), and bottom. """
|
||||
if OPTS.tech_name == "s8":
|
||||
for name in ["vdd", "gnd"]:
|
||||
for inst in [self.nand_inst, self.inv_inst]:
|
||||
self.copy_layout_pin(inst, name)
|
||||
else:
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
def add_wires(self):
|
||||
# nand Z to inv A
|
||||
z1_pin = self.nand_inst.get_pin("Z")
|
||||
a2_pin = self.inv_inst.get_pin("A")
|
||||
if OPTS.tech_name == "s8":
|
||||
mid1_point = vector(a2_pin.cx(), z1_pin.cy())
|
||||
else:
|
||||
mid1_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path(self.route_layer,
|
||||
[z1_pin.center(), mid1_point, a2_pin.center()])
|
||||
|
||||
def add_layout_pins(self):
|
||||
pin = self.inv_inst.get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
for pin_name in ["A", "B", "C"]:
|
||||
pin = self.nand_inst.get_pin(pin_name)
|
||||
self.add_layout_pin_rect_center(text=pin_name,
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
def analytical_delay(self, corner, slew, load=0.0):
|
||||
""" Calculate the analytical delay of DFF-> INV -> INV """
|
||||
nand_delay = self.nand.analytical_delay(corner,
|
||||
slew=slew,
|
||||
load=self.inv.input_load())
|
||||
inv_delay = self.inv.analytical_delay(corner,
|
||||
slew=nand_delay.slew,
|
||||
load=load)
|
||||
return nand_delay + inv_delay
|
||||
|
||||
def get_stage_efforts(self, external_cout, inp_is_rise=False):
|
||||
"""Get the stage efforts of the A or B -> Z path"""
|
||||
stage_effort_list = []
|
||||
stage1_cout = self.inv.get_cin()
|
||||
stage1 = self.nand.get_stage_effort(stage1_cout, inp_is_rise)
|
||||
stage_effort_list.append(stage1)
|
||||
last_stage_is_rise = stage1.is_rise
|
||||
|
||||
stage2 = self.inv.get_stage_effort(external_cout, last_stage_is_rise)
|
||||
stage_effort_list.append(stage2)
|
||||
|
||||
return stage_effort_list
|
||||
|
||||
def get_cin(self):
|
||||
"""Return the relative input capacitance of a single input"""
|
||||
return self.nand.get_cin()
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class dff(design.design):
|
|||
#Calculated in the tech file by summing the widths of all the gates and dividing by the minimum width.
|
||||
return parameter["dff_clk_cin"]
|
||||
|
||||
def build_graph(self, graph, inst_name, port_nets):
|
||||
def build_graph(self, graph, inst_name, port_nets):
|
||||
"""Adds edges based on inputs/outputs. Overrides base class function."""
|
||||
self.add_graph_edges(graph, port_nets)
|
||||
self.add_graph_edges(graph, port_nets)
|
||||
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import design
|
||||
from tech import GDS, layer, spice, parameter
|
||||
import logical_effort
|
||||
import utils
|
||||
import debug
|
||||
|
||||
|
||||
class inv_dec(design.design):
|
||||
"""
|
||||
INV for address decoders.
|
||||
"""
|
||||
|
||||
pin_names = ["A", "Z", "vdd", "gnd"]
|
||||
type_list = ["INPUT", "OUTPUT", "POWER", "GROUND"]
|
||||
|
||||
(width, height) = utils.get_libcell_size("inv_dec",
|
||||
GDS["unit"],
|
||||
layer["boundary"])
|
||||
pin_map = utils.get_libcell_pins(pin_names, "inv_dec", GDS["unit"])
|
||||
|
||||
def __init__(self, name="inv_dec", height=None):
|
||||
design.design.__init__(self, name)
|
||||
|
||||
self.width = inv_dec.width
|
||||
self.height = inv_dec.height
|
||||
self.pin_map = inv_dec.pin_map
|
||||
self.add_pin_types(self.type_list)
|
||||
|
||||
def analytical_power(self, corner, load):
|
||||
"""Returns dynamic and leakage power. Results in nW"""
|
||||
c_eff = self.calculate_effective_capacitance(load)
|
||||
freq = spice["default_event_frequency"]
|
||||
power_dyn = self.calc_dynamic_power(corner, c_eff, freq)
|
||||
power_leak = spice["inv_leakage"]
|
||||
|
||||
total_power = self.return_power(power_dyn, power_leak)
|
||||
return total_power
|
||||
|
||||
def calculate_effective_capacitance(self, load):
|
||||
"""Computes effective capacitance. Results in fF"""
|
||||
c_load = load
|
||||
# In fF
|
||||
c_para = spice["min_tx_drain_c"] * (self.nmos_size / parameter["min_tx_size"])
|
||||
|
||||
return transition_prob * (c_load + c_para)
|
||||
|
||||
def input_load(self):
|
||||
"""
|
||||
Return the capacitance of the gate connection in generic capacitive
|
||||
units relative to the minimum width of a transistor
|
||||
"""
|
||||
return self.nmos_size + self.pmos_size
|
||||
|
||||
def get_stage_effort(self, cout, inp_is_rise=True):
|
||||
"""
|
||||
Returns an object representing the parameters for delay in tau units.
|
||||
Optional is_rise refers to the input direction rise/fall.
|
||||
Input inverted by this stage.
|
||||
"""
|
||||
parasitic_delay = 1
|
||||
return logical_effort.logical_effort(self.name,
|
||||
self.size,
|
||||
self.input_load(),
|
||||
cout,
|
||||
parasitic_delay,
|
||||
not inp_is_rise)
|
||||
|
||||
def build_graph(self, graph, inst_name, port_nets):
|
||||
"""
|
||||
Adds edges based on inputs/outputs.
|
||||
Overrides base class function.
|
||||
"""
|
||||
self.add_graph_edges(graph, port_nets)
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import design
|
||||
from tech import GDS, layer, spice, parameter, drc
|
||||
import logical_effort
|
||||
import utils
|
||||
|
||||
|
||||
class nand2_dec(design.design):
|
||||
"""
|
||||
2-input NAND decoder for address decoders.
|
||||
"""
|
||||
|
||||
pin_names = ["A", "B", "Z", "vdd", "gnd"]
|
||||
type_list = ["INPUT", "INPUT", "OUTPUT", "POWER", "GROUND"]
|
||||
|
||||
(width, height) = utils.get_libcell_size("nand2_dec",
|
||||
GDS["unit"],
|
||||
layer["boundary"])
|
||||
pin_map = utils.get_libcell_pins(pin_names, "nand2_dec", GDS["unit"])
|
||||
|
||||
def __init__(self, name="nand2_dec", height=None):
|
||||
design.design.__init__(self, name)
|
||||
|
||||
self.width = nand2_dec.width
|
||||
self.height = nand2_dec.height
|
||||
self.pin_map = nand2_dec.pin_map
|
||||
self.add_pin_types(self.type_list)
|
||||
|
||||
# FIXME: For now...
|
||||
size = 1
|
||||
self.size = size
|
||||
self.nmos_size = 2 * size
|
||||
self.pmos_size = parameter["beta"] * size
|
||||
self.nmos_width = self.nmos_size * drc("minwidth_tx")
|
||||
self.pmos_width = self.pmos_size * drc("minwidth_tx")
|
||||
|
||||
def analytical_power(self, corner, load):
|
||||
"""Returns dynamic and leakage power. Results in nW"""
|
||||
c_eff = self.calculate_effective_capacitance(load)
|
||||
freq = spice["default_event_frequency"]
|
||||
power_dyn = self.calc_dynamic_power(corner, c_eff, freq)
|
||||
power_leak = spice["nand2_leakage"]
|
||||
|
||||
total_power = self.return_power(power_dyn, power_leak)
|
||||
return total_power
|
||||
|
||||
def calculate_effective_capacitance(self, load):
|
||||
"""Computes effective capacitance. Results in fF"""
|
||||
c_load = load
|
||||
# In fF
|
||||
c_para = spice["min_tx_drain_c"] * (self.nmos_size / parameter["min_tx_size"])
|
||||
transition_prob = 0.1875
|
||||
return transition_prob * (c_load + c_para)
|
||||
|
||||
def input_load(self):
|
||||
"""Return the relative input capacitance of a single input"""
|
||||
return self.nmos_size + self.pmos_size
|
||||
|
||||
def get_stage_effort(self, cout, inp_is_rise=True):
|
||||
"""
|
||||
Returns an object representing the parameters for delay in tau units.
|
||||
Optional is_rise refers to the input direction rise/fall.
|
||||
Input inverted by this stage.
|
||||
"""
|
||||
parasitic_delay = 2
|
||||
return logical_effort.logical_effort(self.name,
|
||||
self.size,
|
||||
self.input_load(),
|
||||
cout,
|
||||
parasitic_delay,
|
||||
not inp_is_rise)
|
||||
|
||||
def build_graph(self, graph, inst_name, port_nets):
|
||||
"""
|
||||
Adds edges based on inputs/outputs.
|
||||
Overrides base class function.
|
||||
"""
|
||||
self.add_graph_edges(graph, port_nets)
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import design
|
||||
from tech import GDS, layer, spice, parameter, drc
|
||||
import logical_effort
|
||||
import utils
|
||||
|
||||
|
||||
class nand3_dec(design.design):
|
||||
"""
|
||||
3-input NAND decoder for address decoders.
|
||||
"""
|
||||
|
||||
pin_names = ["A", "B", "C", "Z", "vdd", "gnd"]
|
||||
type_list = ["INPUT", "INPUT", "INPUT", "OUTPUT", "POWER", "GROUND"]
|
||||
|
||||
(width, height) = utils.get_libcell_size("nand3_dec",
|
||||
GDS["unit"],
|
||||
layer["boundary"])
|
||||
pin_map = utils.get_libcell_pins(pin_names, "nand3_dec", GDS["unit"])
|
||||
|
||||
def __init__(self, name="nand3_dec", height=None):
|
||||
design.design.__init__(self, name)
|
||||
|
||||
self.width = nand3_dec.width
|
||||
self.height = nand3_dec.height
|
||||
self.pin_map = nand3_dec.pin_map
|
||||
self.add_pin_types(self.type_list)
|
||||
|
||||
# FIXME: For now...
|
||||
size = 1
|
||||
self.size = size
|
||||
self.nmos_size = 2 * size
|
||||
self.pmos_size = parameter["beta"] * size
|
||||
self.nmos_width = self.nmos_size * drc("minwidth_tx")
|
||||
self.pmos_width = self.pmos_size * drc("minwidth_tx")
|
||||
|
||||
def analytical_power(self, corner, load):
|
||||
"""Returns dynamic and leakage power. Results in nW"""
|
||||
c_eff = self.calculate_effective_capacitance(load)
|
||||
freq = spice["default_event_frequency"]
|
||||
power_dyn = self.calc_dynamic_power(corner, c_eff, freq)
|
||||
power_leak = spice["nand3_leakage"]
|
||||
|
||||
total_power = self.return_power(power_dyn, power_leak)
|
||||
return total_power
|
||||
|
||||
def calculate_effective_capacitance(self, load):
|
||||
"""Computes effective capacitance. Results in fF"""
|
||||
c_load = load
|
||||
# In fF
|
||||
c_para = spice["min_tx_drain_c"] * (self.nmos_size / parameter["min_tx_size"])
|
||||
transition_prob = 0.1875
|
||||
return transition_prob * (c_load + c_para)
|
||||
|
||||
def input_load(self):
|
||||
"""Return the relative input capacitance of a single input"""
|
||||
return self.nmos_size + self.pmos_size
|
||||
|
||||
def get_stage_effort(self, cout, inp_is_rise=True):
|
||||
"""
|
||||
Returns an object representing the parameters for delay in tau units.
|
||||
Optional is_rise refers to the input direction rise/fall.
|
||||
Input inverted by this stage.
|
||||
"""
|
||||
parasitic_delay = 2
|
||||
return logical_effort.logical_effort(self.name,
|
||||
self.size,
|
||||
self.input_load(),
|
||||
cout,
|
||||
parasitic_delay,
|
||||
not inp_is_rise)
|
||||
|
||||
def build_graph(self, graph, inst_name, port_nets):
|
||||
"""
|
||||
Adds edges based on inputs/outputs.
|
||||
Overrides base class function.
|
||||
"""
|
||||
self.add_graph_edges(graph, port_nets)
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import design
|
||||
from tech import GDS, layer, spice, parameter, drc
|
||||
import logical_effort
|
||||
import utils
|
||||
|
||||
|
||||
class nand4_dec(design.design):
|
||||
"""
|
||||
2-input NAND decoder for address decoders.
|
||||
"""
|
||||
|
||||
pin_names = ["A", "B", "C", "D", "Z", "vdd", "gnd"]
|
||||
type_list = ["INPUT", "INPUT", "INPUT", "INPUT", "OUTPUT", "POWER", "GROUND"]
|
||||
|
||||
(width, height) = utils.get_libcell_size("nand4_dec",
|
||||
GDS["unit"],
|
||||
layer["boundary"])
|
||||
pin_map = utils.get_libcell_pins(pin_names, "nand4_dec", GDS["unit"])
|
||||
|
||||
def __init__(self, name="nand4_dec", height=None):
|
||||
design.design.__init__(self, name)
|
||||
|
||||
self.width = nand4_dec.width
|
||||
self.height = nand4_dec.height
|
||||
self.pin_map = nand4_dec.pin_map
|
||||
self.add_pin_types(self.type_list)
|
||||
|
||||
# FIXME: For now...
|
||||
size = 1
|
||||
self.size = size
|
||||
self.nmos_size = 2 * size
|
||||
self.pmos_size = parameter["beta"] * size
|
||||
self.nmos_width = self.nmos_size * drc("minwidth_tx")
|
||||
self.pmos_width = self.pmos_size * drc("minwidth_tx")
|
||||
|
||||
def analytical_power(self, corner, load):
|
||||
"""Returns dynamic and leakage power. Results in nW"""
|
||||
c_eff = self.calculate_effective_capacitance(load)
|
||||
freq = spice["default_event_frequency"]
|
||||
power_dyn = self.calc_dynamic_power(corner, c_eff, freq)
|
||||
power_leak = spice["nand4_leakage"]
|
||||
|
||||
total_power = self.return_power(power_dyn, power_leak)
|
||||
return total_power
|
||||
|
||||
def calculate_effective_capacitance(self, load):
|
||||
"""Computes effective capacitance. Results in fF"""
|
||||
c_load = load
|
||||
# In fF
|
||||
c_para = spice["min_tx_drain_c"] * (self.nmos_size / parameter["min_tx_size"])
|
||||
transition_prob = 0.1875
|
||||
return transition_prob * (c_load + c_para)
|
||||
|
||||
def input_load(self):
|
||||
"""Return the relative input capacitance of a single input"""
|
||||
return self.nmos_size + self.pmos_size
|
||||
|
||||
def get_stage_effort(self, cout, inp_is_rise=True):
|
||||
"""
|
||||
Returns an object representing the parameters for delay in tau units.
|
||||
Optional is_rise refers to the input direction rise/fall.
|
||||
Input inverted by this stage.
|
||||
"""
|
||||
parasitic_delay = 2
|
||||
return logical_effort.logical_effort(self.name,
|
||||
self.size,
|
||||
self.input_load(),
|
||||
cout,
|
||||
parasitic_delay,
|
||||
not inp_is_rise)
|
||||
|
||||
def build_graph(self, graph, inst_name, port_nets):
|
||||
"""
|
||||
Adds edges based on inputs/outputs.
|
||||
Overrides base class function.
|
||||
"""
|
||||
self.add_graph_edges(graph, port_nets)
|
||||
|
||||
|
|
@ -83,10 +83,10 @@ class bank(design.design):
|
|||
self.add_pin(self.bitcell_array.get_rbl_bl_name(self.port_rbl_map[port]), "OUTPUT")
|
||||
for port in self.write_ports:
|
||||
for bit in range(self.word_size):
|
||||
self.add_pin("din{0}_{1}".format(port,bit), "INPUT")
|
||||
self.add_pin("din{0}_{1}".format(port, bit), "INPUT")
|
||||
for port in self.all_ports:
|
||||
for bit in range(self.addr_size):
|
||||
self.add_pin("addr{0}_{1}".format(port,bit), "INPUT")
|
||||
self.add_pin("addr{0}_{1}".format(port, bit), "INPUT")
|
||||
|
||||
# For more than one bank, we have a bank select and name
|
||||
# the signals gated_*.
|
||||
|
|
@ -123,25 +123,22 @@ class bank(design.design):
|
|||
|
||||
def route_rbl(self, port):
|
||||
""" Route the rbl_bl and rbl_wl """
|
||||
|
||||
bl_pin_name = self.bitcell_array.get_rbl_bl_name(self.port_rbl_map[port])
|
||||
bl_pin = self.bitcell_array_inst.get_pin(bl_pin_name)
|
||||
# This will ensure the pin is only on the top or bottom edge
|
||||
|
||||
# Connect the rbl to the port data pin
|
||||
bl_pin = self.port_data_inst[port].get_pin("rbl_bl")
|
||||
if port % 2:
|
||||
via_offset = bl_pin.uc() + vector(0, self.m2_pitch)
|
||||
left_right_offset = vector(self.max_x_offset, via_offset.y)
|
||||
pin_offset = bl_pin.uc()
|
||||
left_right_offset = vector(self.max_x_offset, pin_offset.y)
|
||||
else:
|
||||
via_offset = bl_pin.bc() - vector(0, self.m2_pitch)
|
||||
left_right_offset = vector(self.min_x_offset, via_offset.y)
|
||||
if bl_pin == "m1":
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=via_offset)
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=via_offset)
|
||||
pin_offset = bl_pin.bc()
|
||||
left_right_offset = vector(self.min_x_offset, pin_offset.y)
|
||||
self.add_via_stack_center(from_layer=bl_pin.layer,
|
||||
to_layer="m3",
|
||||
offset=pin_offset)
|
||||
self.add_layout_pin_segment_center(text="rbl_bl{0}".format(port),
|
||||
layer="m3",
|
||||
start=left_right_offset,
|
||||
end=via_offset)
|
||||
end=pin_offset)
|
||||
|
||||
def route_bitlines(self, port):
|
||||
""" Route the bitlines depending on the port type rw, w, or r. """
|
||||
|
|
@ -635,11 +632,10 @@ class bank(design.design):
|
|||
# Port 0
|
||||
# The bank is at (0,0), so this is to the left of the y-axis.
|
||||
# 2 pitches on the right for vias/jogs to access the inputs
|
||||
control_bus_offset = vector(-self.m2_pitch * self.num_control_lines[0] - self.m2_pitch, self.min_y_offset)
|
||||
control_bus_offset = vector(-self.m3_pitch * self.num_control_lines[0] - self.m3_pitch, self.min_y_offset)
|
||||
# The control bus is routed up to two pitches below the bitcell array
|
||||
control_bus_length = self.main_bitcell_array_bottom - self.min_y_offset - 2 * self.m1_pitch
|
||||
self.bus_xoffset[0] = self.create_bus(layer="m2",
|
||||
pitch=self.m2_pitch,
|
||||
offset=control_bus_offset,
|
||||
names=self.control_signals[0],
|
||||
length=control_bus_length,
|
||||
|
|
@ -650,11 +646,10 @@ class bank(design.design):
|
|||
if len(self.all_ports)==2:
|
||||
# The other control bus is routed up to two pitches above the bitcell array
|
||||
control_bus_length = self.max_y_offset - self.main_bitcell_array_top - 2 * self.m1_pitch
|
||||
control_bus_offset = vector(self.bitcell_array_right + self.m2_pitch,
|
||||
control_bus_offset = vector(self.bitcell_array_right + self.m3_pitch,
|
||||
self.max_y_offset - control_bus_length)
|
||||
# The bus for the right port is reversed so that the rbl_wl is closest to the array
|
||||
self.bus_xoffset[1] = self.create_bus(layer="m2",
|
||||
pitch=self.m2_pitch,
|
||||
offset=control_bus_offset,
|
||||
names=list(reversed(self.control_signals[1])),
|
||||
length=control_bus_length,
|
||||
|
|
@ -844,9 +839,9 @@ class bank(design.design):
|
|||
self.copy_layout_pin(self.column_decoder_inst[port], decoder_name, addr_name)
|
||||
|
||||
if port % 2:
|
||||
offset = self.column_decoder_inst[port].ll() - vector(self.num_col_addr_lines * self.m2_pitch, 0)
|
||||
offset = self.column_decoder_inst[port].ll() - vector(self.num_col_addr_lines * self.m2_nonpref_pitch, 0)
|
||||
else:
|
||||
offset = self.column_decoder_inst[port].lr() + vector(self.m2_pitch, 0)
|
||||
offset = self.column_decoder_inst[port].lr() + vector(self.m2_nonpref_pitch, 0)
|
||||
|
||||
decode_pins = [self.column_decoder_inst[port].get_pin(x) for x in decode_names]
|
||||
|
||||
|
|
@ -854,7 +849,9 @@ class bank(design.design):
|
|||
column_mux_pins = [self.port_data_inst[port].get_pin(x) for x in sel_names]
|
||||
|
||||
route_map = list(zip(decode_pins, column_mux_pins))
|
||||
self.create_vertical_channel_route(route_map, offset, self.m1_stack)
|
||||
self.create_vertical_channel_route(route_map,
|
||||
offset,
|
||||
self.m1_stack)
|
||||
|
||||
def add_lvs_correspondence_points(self):
|
||||
"""
|
||||
|
|
@ -910,30 +907,39 @@ class bank(design.design):
|
|||
# pre-decoder and this connection is in metal3
|
||||
connection = []
|
||||
connection.append((self.prefix + "p_en_bar{}".format(port),
|
||||
self.port_data_inst[port].get_pin("p_en_bar").lc()))
|
||||
self.port_data_inst[port].get_pin("p_en_bar").lc(),
|
||||
self.port_data_inst[port].get_pin("p_en_bar").layer))
|
||||
|
||||
rbl_wl_name = self.bitcell_array.get_rbl_wl_name(self.port_rbl_map[port])
|
||||
connection.append((self.prefix + "wl_en{}".format(port),
|
||||
self.bitcell_array_inst.get_pin(rbl_wl_name).lc()))
|
||||
self.bitcell_array_inst.get_pin(rbl_wl_name).lc(),
|
||||
self.bitcell_array_inst.get_pin(rbl_wl_name).layer))
|
||||
|
||||
if port in self.write_ports:
|
||||
if port % 2:
|
||||
connection.append((self.prefix + "w_en{}".format(port),
|
||||
self.port_data_inst[port].get_pin("w_en").rc()))
|
||||
self.port_data_inst[port].get_pin("w_en").rc(),
|
||||
self.port_data_inst[port].get_pin("w_en").layer))
|
||||
else:
|
||||
connection.append((self.prefix + "w_en{}".format(port),
|
||||
self.port_data_inst[port].get_pin("w_en").lc()))
|
||||
self.port_data_inst[port].get_pin("w_en").lc(),
|
||||
self.port_data_inst[port].get_pin("w_en").layer))
|
||||
|
||||
if port in self.read_ports:
|
||||
connection.append((self.prefix + "s_en{}".format(port),
|
||||
self.port_data_inst[port].get_pin("s_en").lc()))
|
||||
self.port_data_inst[port].get_pin("s_en").lc(),
|
||||
self.port_data_inst[port].get_pin("s_en").layer))
|
||||
|
||||
for (control_signal, pin_pos) in connection:
|
||||
control_mid_pos = self.bus_xoffset[port][control_signal]
|
||||
control_pos = vector(self.bus_xoffset[port][control_signal].x, pin_pos.y)
|
||||
self.add_wire(self.m1_stack, [control_mid_pos, control_pos, pin_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=control_pos)
|
||||
for (control_signal, pin_pos, pin_layer) in connection:
|
||||
if port==0:
|
||||
y_offset = self.min_y_offset
|
||||
else:
|
||||
y_offset = self.max_y_offset
|
||||
control_pos = vector(self.bus_xoffset[port][control_signal].x, y_offset)
|
||||
if pin_layer == "m1":
|
||||
self.add_wire(self.m1_stack, [control_pos, pin_pos])
|
||||
elif pin_layer == "m3":
|
||||
self.add_wire(self.m2_stack[::-1], [control_pos, pin_pos])
|
||||
|
||||
# clk to wordline_driver
|
||||
control_signal = self.prefix + "wl_en{}".format(port)
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class bank_select(design.design):
|
|||
bank_sel_line_end = vector(xoffset_bank_sel, self.yoffset_maxpoint)
|
||||
self.add_path("m2", [bank_sel_line_pos, bank_sel_line_end])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=bank_sel_inv_pin.lc())
|
||||
offset=bank_sel_inv_pin.center())
|
||||
|
||||
# Route the pin to the left edge as well
|
||||
bank_sel_pin_pos=vector(0, 0)
|
||||
|
|
@ -242,30 +242,31 @@ class bank_select(design.design):
|
|||
|
||||
# Connect the logic output to inverter input
|
||||
out_pin = logic_inst.get_pin("Z")
|
||||
out_pos = out_pin.rc()
|
||||
out_pos = out_pin.center()
|
||||
in_pin = inv_inst.get_pin("A")
|
||||
in_pos = in_pin.lc()
|
||||
in_pos = in_pin.center()
|
||||
mid1_pos = vector(0.5 * (out_pos.x + in_pos.x), out_pos.y)
|
||||
mid2_pos = vector(0.5 * (out_pos.x + in_pos.x), in_pos.y)
|
||||
self.add_path("m1", [out_pos, mid1_pos, mid2_pos, in_pos])
|
||||
|
||||
# Connect the logic B input to bank_sel / bank_sel_bar
|
||||
logic_pos = logic_inst.get_pin("B").lc() - vector(0.5 * contact.m1_via.height, 0)
|
||||
logic_pin = logic_inst.get_pin("B")
|
||||
logic_pos = logic_pin.center()
|
||||
input_pos = vector(xoffset_bank_signal, logic_pos.y)
|
||||
self.add_path("m2", [logic_pos, input_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=logic_pos,
|
||||
directions=("H", "H"))
|
||||
self.add_path("m3", [logic_pos, input_pos])
|
||||
self.add_via_center(self.m2_stack,
|
||||
input_pos)
|
||||
self.add_via_stack_center(from_layer=logic_pin.layer,
|
||||
to_layer="m3",
|
||||
offset=logic_pos)
|
||||
|
||||
# Connect the logic A input to the input pin
|
||||
logic_pos = logic_inst.get_pin("A").lc()
|
||||
logic_pin = logic_inst.get_pin("A")
|
||||
logic_pos = logic_pin.center()
|
||||
input_pos = vector(0, logic_pos.y)
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=logic_pos,
|
||||
directions=("H", "H"))
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=logic_pos,
|
||||
directions=("H", "H"))
|
||||
self.add_via_stack_center(from_layer=logic_pin.layer,
|
||||
to_layer="m3",
|
||||
offset=logic_pos)
|
||||
self.add_layout_pin_segment_center(text=input_name,
|
||||
layer="m3",
|
||||
start=input_pos,
|
||||
|
|
|
|||
|
|
@ -104,9 +104,15 @@ class bitcell_base_array(design.design):
|
|||
# For non-square via stacks, vertical/horizontal direction refers to the stack orientation in 2d space
|
||||
# Default uses prefered directions for each layer; this cell property is only currently used by s8 tech (03/20)
|
||||
try:
|
||||
force_power_pins_vertical = cell_properties.bitcell_force_power_pins_vertical
|
||||
bitcell_power_pin_directions = cell_properties.bitcell_power_pin_directions
|
||||
except AttributeError:
|
||||
force_power_pins_vertical = None
|
||||
bitcell_power_pin_directions = None
|
||||
|
||||
# For specific technologies, there is no vdd via within the bitcell. Instead vdd is connect via end caps.
|
||||
try:
|
||||
bitcell_no_vdd_pin = cell_properties.bitcell.no_vdd_via
|
||||
except AttributeError:
|
||||
bitcell_no_vdd_pin = False
|
||||
|
||||
# Add vdd/gnd via stacks
|
||||
for row in range(self.row_size):
|
||||
|
|
@ -114,7 +120,11 @@ class bitcell_base_array(design.design):
|
|||
inst = self.cell_inst[row,col]
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
for pin in inst.get_pins(pin_name):
|
||||
self.add_power_pin(name=pin_name, loc=pin.center(), vertical=force_power_pins_vertical, start_layer=pin.layer)
|
||||
if not (pin_name == "vdd" and bitcell_no_vdd_pin):
|
||||
self.add_power_pin(name=pin_name,
|
||||
loc=pin.center(),
|
||||
directions=bitcell_power_pin_directions,
|
||||
start_layer=pin.layer)
|
||||
|
||||
def _adjust_x_offset(self, xoffset, col, col_offset):
|
||||
tempx = xoffset
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
from bitcell_base_array import bitcell_base_array
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
from tech import cell_properties
|
||||
|
||||
class col_cap_array(bitcell_base_array):
|
||||
"""
|
||||
Generate a dummy row/column for the replica array.
|
||||
"""
|
||||
def __init__(self, cols, rows, column_offset=0, mirror=0, name=""):
|
||||
super().__init__(cols, rows, name, column_offset)
|
||||
self.mirror = mirror
|
||||
|
||||
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 create_layout(self):
|
||||
|
||||
self.place_array("dummy_r{0}_c{1}", self.mirror)
|
||||
self.add_layout_pins()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_modules(self):
|
||||
""" Add the modules used in this design """
|
||||
# self.dummy_cell = factory.create(module_type="col_cap_bitcell_1rw_1r") # TODO: make module_type generic
|
||||
self.dummy_cell = factory.create(module_type="col_cap_bitcell")
|
||||
self.add_mod(self.dummy_cell)
|
||||
|
||||
self.cell = factory.create(module_type="bitcell")
|
||||
|
||||
def create_instances(self):
|
||||
""" Create the module instances used in this design """
|
||||
self.cell_inst = {}
|
||||
for col in range(self.column_size):
|
||||
for row in range(self.row_size):
|
||||
name = "bit_r{0}_c{1}".format(row, col)
|
||||
self.cell_inst[row,col]=self.add_inst(name=name,
|
||||
mod=self.dummy_cell)
|
||||
self.connect_inst(self.get_bitcell_pins(col, row))
|
||||
|
||||
def get_bitcell_pins(self, col, row):
|
||||
"""
|
||||
Creates a list of connections in the bitcell,
|
||||
indexed by column and row, for instance use in bitcell_array
|
||||
"""
|
||||
|
||||
pin_name = cell_properties.bitcell.cell_1rw1r.pin
|
||||
bitcell_pins = ["{0}_{1}".format(pin_name.bl0, col),
|
||||
"{0}_{1}".format(pin_name.br0, col),
|
||||
"{0}_{1}".format(pin_name.bl1, col),
|
||||
"{0}_{1}".format(pin_name.br1, col),
|
||||
"vdd"]
|
||||
|
||||
return bitcell_pins
|
||||
|
||||
def add_layout_pins(self):
|
||||
""" Add the layout pins """
|
||||
|
||||
column_list = self.cell.get_all_bitline_names()
|
||||
|
||||
for col in range(self.column_size):
|
||||
for cell_column in column_list:
|
||||
bl_pin = self.cell_inst[0,col].get_pin(cell_column)
|
||||
self.add_layout_pin(text=cell_column+"_{0}".format(col),
|
||||
layer=bl_pin.layer,
|
||||
offset=bl_pin.ll().scale(1,0),
|
||||
width=bl_pin.width(),
|
||||
height=self.height)
|
||||
|
||||
# Add vdd/gnd via stacks
|
||||
for row in range(self.row_size):
|
||||
for col in range(self.column_size):
|
||||
inst = self.cell_inst[row,col]
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
for pin in inst.get_pins(pin_name):
|
||||
self.add_power_pin(name=pin.name,
|
||||
loc=pin.center(),
|
||||
start_layer=pin.layer)
|
||||
|
||||
|
||||
# def input_load(self):
|
||||
# wl_wire = self.gen_wl_wire()
|
||||
# return wl_wire.return_input_cap()
|
||||
#
|
||||
# def get_wordline_cin(self):
|
||||
# """Get the relative input capacitance from the wordline connections in all the bitcell"""
|
||||
# #A single wordline is connected to all the bitcells in a single row meaning the capacitance depends on the # of columns
|
||||
# bitcell_wl_cin = self.cell.get_wl_cin()
|
||||
# total_cin = bitcell_wl_cin * self.column_size
|
||||
# return total_cin
|
||||
|
|
@ -384,7 +384,10 @@ class control_logic(design.design):
|
|||
height = self.control_logic_center.y - self.m2_pitch
|
||||
offset = vector(self.ctrl_dff_array.width, 0)
|
||||
|
||||
self.rail_offsets = self.create_vertical_bus("m2", self.m2_pitch, offset, self.internal_bus_list, height)
|
||||
self.rail_offsets = self.create_vertical_bus("m2",
|
||||
offset,
|
||||
self.internal_bus_list,
|
||||
height)
|
||||
|
||||
def create_instances(self):
|
||||
""" Create all the instances """
|
||||
|
|
@ -432,7 +435,7 @@ class control_logic(design.design):
|
|||
row += 1
|
||||
if (self.port_type == "rw") or (self.port_type == "w"):
|
||||
self.place_rbl_delay_row(row)
|
||||
row += 1
|
||||
row += 1
|
||||
if (self.port_type == "rw") or (self.port_type == "r"):
|
||||
self.place_sen_row(row)
|
||||
row += 1
|
||||
|
|
@ -522,16 +525,8 @@ class control_logic(design.design):
|
|||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=clk_pos)
|
||||
|
||||
# Connect this at the bottom of the buffer
|
||||
out_pos = self.clk_buf_inst.get_pin("Z").center()
|
||||
mid1 = vector(out_pos.x, 2 * self.m2_pitch)
|
||||
mid2 = vector(self.rail_offsets["clk_buf"].x, mid1.y)
|
||||
bus_pos = self.rail_offsets["clk_buf"]
|
||||
self.add_wire(self.m2_stack[::-1], [out_pos, mid1, mid2, bus_pos])
|
||||
# The pin is on M1, so we need another via as well
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=self.clk_buf_inst.get_pin("Z").center())
|
||||
|
||||
self.route_output_to_bus_jogged(self.clk_buf_inst,
|
||||
"clk_buf")
|
||||
self.connect_output(self.clk_buf_inst, "Z", "clk_buf")
|
||||
|
||||
def create_gated_clk_bar_row(self):
|
||||
|
|
@ -541,7 +536,7 @@ class control_logic(design.design):
|
|||
|
||||
self.gated_clk_bar_inst = self.add_inst(name="and2_gated_clk_bar",
|
||||
mod=self.and2)
|
||||
self.connect_inst(["cs", "clk_bar", "gated_clk_bar", "vdd", "gnd"])
|
||||
self.connect_inst(["clk_bar", "cs", "gated_clk_bar", "vdd", "gnd"])
|
||||
|
||||
def place_gated_clk_bar_row(self, row):
|
||||
x_offset = self.control_x_offset
|
||||
|
|
@ -554,31 +549,26 @@ class control_logic(design.design):
|
|||
def route_gated_clk_bar(self):
|
||||
clkbuf_map = zip(["A"], ["clk_buf"])
|
||||
self.connect_vertical_bus(clkbuf_map, self.clk_bar_inst, self.rail_offsets)
|
||||
|
||||
|
||||
out_pos = self.clk_bar_inst.get_pin("Z").center()
|
||||
in_pos = self.gated_clk_bar_inst.get_pin("B").center()
|
||||
mid1 = vector(in_pos.x, out_pos.y)
|
||||
self.add_path("m1", [out_pos, mid1, in_pos])
|
||||
in_pos = self.gated_clk_bar_inst.get_pin("A").center()
|
||||
self.add_zjog("m1", out_pos, in_pos)
|
||||
|
||||
# This is the second gate over, so it needs to be on M3
|
||||
clkbuf_map = zip(["A"], ["cs"])
|
||||
clkbuf_map = zip(["B"], ["cs"])
|
||||
self.connect_vertical_bus(clkbuf_map,
|
||||
self.gated_clk_bar_inst,
|
||||
self.rail_offsets,
|
||||
self.m2_stack[::-1])
|
||||
# The pin is on M1, so we need another via as well
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=self.gated_clk_bar_inst.get_pin("A").center())
|
||||
b_pin = self.gated_clk_bar_inst.get_pin("B")
|
||||
self.add_via_stack_center(from_layer=b_pin.layer,
|
||||
to_layer="m3",
|
||||
offset=b_pin.center())
|
||||
|
||||
# This is the second gate over, so it needs to be on M3
|
||||
clkbuf_map = zip(["Z"], ["gated_clk_bar"])
|
||||
self.connect_vertical_bus(clkbuf_map,
|
||||
self.gated_clk_bar_inst,
|
||||
self.rail_offsets,
|
||||
self.m2_stack[::-1])
|
||||
# The pin is on M1, so we need another via as well
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=self.gated_clk_bar_inst.get_pin("Z").center())
|
||||
self.route_output_to_bus_jogged(self.gated_clk_bar_inst,
|
||||
"gated_clk_bar")
|
||||
|
||||
def create_gated_clk_buf_row(self):
|
||||
self.gated_clk_buf_inst = self.add_inst(name="and2_gated_clk_buf",
|
||||
|
|
@ -594,7 +584,9 @@ class control_logic(design.design):
|
|||
|
||||
def route_gated_clk_buf(self):
|
||||
clkbuf_map = zip(["A", "B"], ["clk_buf", "cs"])
|
||||
self.connect_vertical_bus(clkbuf_map, self.gated_clk_buf_inst, self.rail_offsets)
|
||||
self.connect_vertical_bus(clkbuf_map,
|
||||
self.gated_clk_buf_inst,
|
||||
self.rail_offsets)
|
||||
|
||||
clkbuf_map = zip(["Z"], ["gated_clk_buf"])
|
||||
self.connect_vertical_bus(clkbuf_map,
|
||||
|
|
@ -602,8 +594,10 @@ class control_logic(design.design):
|
|||
self.rail_offsets,
|
||||
self.m2_stack[::-1])
|
||||
# The pin is on M1, so we need another via as well
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=self.gated_clk_buf_inst.get_pin("Z").center())
|
||||
z_pin = self.gated_clk_buf_inst.get_pin("Z")
|
||||
self.add_via_stack_center(from_layer=z_pin.layer,
|
||||
to_layer="m2",
|
||||
offset=z_pin.center())
|
||||
|
||||
def create_wlen_row(self):
|
||||
# input pre_p_en, output: wl_en
|
||||
|
|
@ -647,11 +641,16 @@ class control_logic(design.design):
|
|||
in_map = zip(["A", "B"], ["gated_clk_buf", "rbl_bl_delay"])
|
||||
self.connect_vertical_bus(in_map, self.p_en_bar_nand_inst, self.rail_offsets)
|
||||
|
||||
out_pos = self.p_en_bar_nand_inst.get_pin("Z").rc()
|
||||
in_pos = self.p_en_bar_driver_inst.get_pin("A").lc()
|
||||
mid1 = vector(out_pos.x, in_pos.y)
|
||||
self.add_wire(self.m1_stack, [out_pos, mid1, in_pos])
|
||||
|
||||
out_pin = self.p_en_bar_nand_inst.get_pin("Z")
|
||||
out_pos = out_pin.center()
|
||||
in_pin = self.p_en_bar_driver_inst.get_pin("A")
|
||||
in_pos = in_pin.center()
|
||||
mid1 = vector(in_pos.x, out_pos.y)
|
||||
self.add_path(out_pin.layer, [out_pos, mid1, in_pos])
|
||||
self.add_via_stack_center(from_layer=out_pin.layer,
|
||||
to_layer=in_pin.layer,
|
||||
offset=in_pin.center())
|
||||
|
||||
self.connect_output(self.p_en_bar_driver_inst, "Z", "p_en_bar")
|
||||
|
||||
def create_sen_row(self):
|
||||
|
|
@ -704,11 +703,7 @@ class control_logic(design.design):
|
|||
# Connect from delay line
|
||||
# Connect to rail
|
||||
|
||||
rbl_map = zip(["Z"], ["rbl_bl_delay_bar"])
|
||||
self.connect_vertical_bus(rbl_map, self.rbl_bl_delay_inv_inst, self.rail_offsets, ("m3", "via2", "m2"))
|
||||
# The pin is on M1, so we need another via as well
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=self.rbl_bl_delay_inv_inst.get_pin("Z").center())
|
||||
self.route_output_to_bus_jogged(self.rbl_bl_delay_inv_inst, "rbl_bl_delay_bar")
|
||||
|
||||
rbl_map = zip(["A"], ["rbl_bl_delay"])
|
||||
self.connect_vertical_bus(rbl_map, self.rbl_bl_delay_inv_inst, self.rail_offsets)
|
||||
|
|
@ -766,11 +761,12 @@ class control_logic(design.design):
|
|||
dff_out_map = zip(["dout_bar_0", "dout_0"], ["cs", "cs_bar"])
|
||||
else:
|
||||
dff_out_map = zip(["dout_bar_0"], ["cs"])
|
||||
self.connect_vertical_bus(dff_out_map, self.ctrl_dff_inst, self.rail_offsets, ("m3", "via2", "m2"))
|
||||
self.connect_vertical_bus(dff_out_map, self.ctrl_dff_inst, self.rail_offsets, self.m2_stack[::-1])
|
||||
|
||||
# Connect the clock rail to the other clock rail
|
||||
# by routing in the supply rail track to avoid channel conflicts
|
||||
in_pos = self.ctrl_dff_inst.get_pin("clk").uc()
|
||||
mid_pos = in_pos + vector(0, 2 * self.m2_pitch)
|
||||
mid_pos = in_pos + vector(0, self.and2.height)
|
||||
rail_pos = vector(self.rail_offsets["clk_buf"].x, mid_pos.y)
|
||||
self.add_wire(self.m1_stack, [in_pos, mid_pos, rail_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
|
|
@ -823,10 +819,10 @@ class control_logic(design.design):
|
|||
self.add_path("m1", [row_loc, pin_loc])
|
||||
|
||||
self.copy_layout_pin(self.delay_inst, "gnd")
|
||||
self.copy_layout_pin(self.delay_inst, "vdd")
|
||||
self.copy_layout_pin(self.delay_inst, "vdd")
|
||||
|
||||
self.copy_layout_pin(self.ctrl_dff_inst, "gnd")
|
||||
self.copy_layout_pin(self.ctrl_dff_inst, "vdd")
|
||||
self.copy_layout_pin(self.ctrl_dff_inst, "vdd")
|
||||
|
||||
def add_lvs_correspondence_points(self):
|
||||
""" This adds some points for easier debugging if LVS goes wrong.
|
||||
|
|
@ -1000,3 +996,15 @@ class control_logic(design.design):
|
|||
offset = vector(x_offset, y_offset)
|
||||
inst.place(offset, mirror)
|
||||
return x_offset + inst.width
|
||||
|
||||
def route_output_to_bus_jogged(self, inst, name):
|
||||
# Connect this at the bottom of the buffer
|
||||
out_pos = inst.get_pin("Z").center()
|
||||
mid1 = vector(out_pos.x, out_pos.y - 0.25 * inst.mod.height)
|
||||
mid2 = vector(self.rail_offsets[name].x, mid1.y)
|
||||
bus_pos = self.rail_offsets[name]
|
||||
self.add_wire(self.m2_stack[::-1], [out_pos, mid1, mid2, bus_pos])
|
||||
# The pin is on M1, so we need another via as well
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=out_pos)
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class delay_chain(design.design):
|
|||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def add_modules(self):
|
||||
self.inv = factory.create(module_type="pinv", route_output=False)
|
||||
self.inv = factory.create(module_type="pinv")
|
||||
self.add_mod(self.inv)
|
||||
|
||||
def create_inverters(self):
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ class dff_buf(design.design):
|
|||
height=din_pin.height())
|
||||
|
||||
dout_pin = self.inv2_inst.get_pin("Z")
|
||||
mid_pos = dout_pin.center() + vector(self.m1_pitch, 0)
|
||||
mid_pos = dout_pin.center() + vector(self.m1_nonpref_pitch, 0)
|
||||
q_pos = mid_pos - vector(0, self.m2_pitch)
|
||||
self.add_layout_pin_rect_center(text="Q",
|
||||
layer="m2",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ from sram_factory import factory
|
|||
from vector import vector
|
||||
from globals import OPTS
|
||||
from errors import drc_error
|
||||
from tech import cell_properties
|
||||
|
||||
|
||||
class hierarchical_decoder(design.design):
|
||||
|
|
@ -28,12 +27,8 @@ class hierarchical_decoder(design.design):
|
|||
self.pre3x8_inst = []
|
||||
|
||||
b = factory.create(module_type="bitcell")
|
||||
try:
|
||||
self.cell_multiple = cell_properties.bitcell.decoder_bitcell_multiple
|
||||
except AttributeError:
|
||||
self.cell_multiple = 1
|
||||
self.cell_height = self.cell_multiple * b.height
|
||||
|
||||
self.cell_height = b.height
|
||||
|
||||
self.num_outputs = num_outputs
|
||||
self.num_inputs = math.ceil(math.log(self.num_outputs, 2))
|
||||
(self.no_of_pre2x4, self.no_of_pre3x8)=self.determine_predecodes(self.num_inputs)
|
||||
|
|
@ -41,41 +36,6 @@ class hierarchical_decoder(design.design):
|
|||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def find_decoder_height(self):
|
||||
"""
|
||||
Dead code. This would dynamically determine the bitcell multiple,
|
||||
but I just decided to hard code it in the tech file if it is not 1
|
||||
because a DRC tool would be required even to run in front-end mode.
|
||||
"""
|
||||
b = factory.create(module_type="bitcell")
|
||||
|
||||
# Old behavior
|
||||
if OPTS.netlist_only:
|
||||
return (b.height, 1)
|
||||
|
||||
# Search for the smallest multiple that works
|
||||
cell_multiple = 1
|
||||
while cell_multiple < 5:
|
||||
cell_height = cell_multiple * b.height
|
||||
# debug.info(2,"Trying mult = {0} height={1}".format(cell_multiple, cell_height))
|
||||
try:
|
||||
and3 = factory.create(module_type="pand3",
|
||||
height=cell_height)
|
||||
except drc_error:
|
||||
# debug.info(1, "Incrementing decoder height by 1 bitcell height {}".format(b.height))
|
||||
pass
|
||||
else:
|
||||
(drc_errors, lvs_errors) = and3.DRC_LVS(force_check=True)
|
||||
total_errors = drc_errors + lvs_errors
|
||||
if total_errors == 0:
|
||||
debug.info(1, "Decoder height is multiple of {} bitcells.".format(cell_multiple))
|
||||
return (cell_height, cell_multiple)
|
||||
|
||||
cell_multiple += 1
|
||||
|
||||
else:
|
||||
debug.error("Couldn't find a valid decoder height multiple.", -1)
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_modules()
|
||||
|
|
@ -89,6 +49,7 @@ class hierarchical_decoder(design.design):
|
|||
self.place_pre_decoder()
|
||||
self.place_row_decoder()
|
||||
self.route_inputs()
|
||||
self.route_outputs()
|
||||
self.route_decoder_bus()
|
||||
self.route_vdd_gnd()
|
||||
self.offset_all_coordinates()
|
||||
|
|
@ -96,15 +57,16 @@ class hierarchical_decoder(design.design):
|
|||
self.DRC_LVS()
|
||||
|
||||
def add_modules(self):
|
||||
self.inv = factory.create(module_type="pinv",
|
||||
height=self.cell_height)
|
||||
self.add_mod(self.inv)
|
||||
self.and2 = factory.create(module_type="pand2",
|
||||
self.and2 = factory.create(module_type="and2_dec",
|
||||
height=self.cell_height)
|
||||
self.add_mod(self.and2)
|
||||
self.and3 = factory.create(module_type="pand3",
|
||||
height=self.cell_height)
|
||||
|
||||
self.and3 = factory.create(module_type="and3_dec",
|
||||
height=self.cell_height)
|
||||
self.add_mod(self.and3)
|
||||
# TBD
|
||||
# self.and4 = factory.create(module_type="and4_dec")
|
||||
# self.add_mod(self.and4)
|
||||
|
||||
self.add_decoders()
|
||||
|
||||
|
|
@ -175,39 +137,64 @@ class hierarchical_decoder(design.design):
|
|||
-1)
|
||||
|
||||
# Calculates height and width of pre-decoder,
|
||||
if self.no_of_pre3x8 > 0:
|
||||
# FIXME: Update with 4x16
|
||||
if self.no_of_pre3x8 > 0 and self.no_of_pre2x4 > 0:
|
||||
self.predecoder_width = max(self.pre3_8.width, self.pre2_4.width)
|
||||
elif self.no_of_pre3x8 > 0:
|
||||
self.predecoder_width = self.pre3_8.width
|
||||
else:
|
||||
self.predecoder_width = self.pre2_4.width
|
||||
|
||||
self.predecoder_height = self.pre2_4.height * self.no_of_pre2x4 + self.pre3_8.height * self.no_of_pre3x8
|
||||
|
||||
# We may have more than one bitcell per decoder row
|
||||
self.num_rows = math.ceil(self.num_outputs / self.cell_multiple)
|
||||
# We will place this many final decoders per row
|
||||
self.decoders_per_row = math.ceil(self.num_outputs / self.num_rows)
|
||||
|
||||
# Calculates height and width of row-decoder
|
||||
if (self.num_inputs == 4 or self.num_inputs == 5):
|
||||
nand_width = self.and2.width
|
||||
# How much space between each predecoder
|
||||
self.predecoder_spacing = self.and2.height
|
||||
self.predecoder_height = self.pre2_4.height * self.no_of_pre2x4 + self.pre3_8.height * self.no_of_pre3x8 \
|
||||
+ (self.no_of_pre2x4 + self.no_of_pre3x8 - 1) * self.predecoder_spacing
|
||||
|
||||
# Inputs to cells are on input layer
|
||||
# Outputs from cells are on output layer
|
||||
if OPTS.tech_name == "s8":
|
||||
self.bus_layer = "m1"
|
||||
self.bus_directions = "nonpref"
|
||||
self.bus_pitch = self.m1_pitch
|
||||
self.bus_space = self.m2_space
|
||||
self.input_layer = "m2"
|
||||
self.output_layer = "li"
|
||||
self.output_layer_pitch = self.li_pitch
|
||||
else:
|
||||
nand_width = self.and3.width
|
||||
self.internal_routing_width = self.m2_pitch * (self.total_number_of_predecoder_outputs + 1)
|
||||
self.row_decoder_height = self.inv.height * self.num_rows
|
||||
self.bus_layer = "m2"
|
||||
self.bus_directions = "pref"
|
||||
self.bus_pitch = self.m2_pitch
|
||||
self.bus_space = self.m2_space
|
||||
# These two layers being the same requires a special jog
|
||||
# to ensure to conflicts with the output layers
|
||||
self.input_layer = "m1"
|
||||
self.output_layer = "m3"
|
||||
self.output_layer_pitch = self.m3_pitch
|
||||
|
||||
self.input_routing_width = (self.num_inputs + 1) * self.m2_pitch
|
||||
# Two extra pitches between modules on left and right
|
||||
self.internal_routing_width = self.total_number_of_predecoder_outputs * self.bus_pitch + self.bus_pitch
|
||||
self.row_decoder_height = self.and2.height * self.num_outputs
|
||||
|
||||
# Extra bus space for supply contacts
|
||||
self.input_routing_width = self.num_inputs * self.bus_pitch + self.bus_space
|
||||
|
||||
# Calculates height and width of row-decoder
|
||||
# Calculates height and width of hierarchical decoder
|
||||
# Add extra pitch for good measure
|
||||
self.height = max(self.predecoder_height, self.row_decoder_height) + self.m3_pitch
|
||||
self.width = self.input_routing_width + self.predecoder_width \
|
||||
self.height = max(self.predecoder_height, self.row_decoder_height) + self.bus_space
|
||||
if (self.num_inputs == 4 or self.num_inputs == 5):
|
||||
self.nand_width = self.and2.width
|
||||
else:
|
||||
self.nand_width = self.and3.width
|
||||
|
||||
self.width = self.input_routing_width \
|
||||
+ self.predecoder_width \
|
||||
+ self.internal_routing_width \
|
||||
+ self.decoders_per_row * nand_width + self.inv.width
|
||||
|
||||
+ self.nand_width \
|
||||
+ self.m1_space
|
||||
|
||||
def route_inputs(self):
|
||||
""" Create input bus for the predecoders """
|
||||
# inputs should be as high as the decoders
|
||||
input_height = self.no_of_pre2x4 * self.pre2_4.height + self.no_of_pre3x8 * self.pre3_8.height
|
||||
|
||||
# Find the left-most predecoder
|
||||
min_x = 0
|
||||
if self.no_of_pre2x4 > 0:
|
||||
|
|
@ -217,11 +204,10 @@ class hierarchical_decoder(design.design):
|
|||
input_offset=vector(min_x - self.input_routing_width, 0)
|
||||
|
||||
input_bus_names = ["addr_{0}".format(i) for i in range(self.num_inputs)]
|
||||
self.input_bus = self.create_vertical_pin_bus(layer="m2",
|
||||
pitch=self.m2_pitch,
|
||||
self.input_bus = self.create_vertical_pin_bus(layer=self.bus_layer,
|
||||
offset=input_offset,
|
||||
names=input_bus_names,
|
||||
length=input_height)
|
||||
length=self.predecoder_height)
|
||||
|
||||
self.route_input_to_predecodes()
|
||||
|
||||
|
|
@ -236,9 +222,7 @@ class hierarchical_decoder(design.design):
|
|||
in_name = "in_{}".format(i)
|
||||
decoder_pin = self.pre2x4_inst[pre_num].get_pin(in_name)
|
||||
|
||||
# To prevent conflicts, we will offset each input connect so
|
||||
# that it aligns with the vdd/gnd rails
|
||||
decoder_offset = decoder_pin.bc() + vector(0, (i + 1) * self.inv.height)
|
||||
decoder_offset = decoder_pin.center()
|
||||
input_offset = input_pos.scale(1, 0) + decoder_offset.scale(0, 1)
|
||||
|
||||
self.route_input_bus(decoder_offset, input_offset)
|
||||
|
|
@ -252,9 +236,7 @@ class hierarchical_decoder(design.design):
|
|||
in_name = "in_{}".format(i)
|
||||
decoder_pin = self.pre3x8_inst[pre_num].get_pin(in_name)
|
||||
|
||||
# To prevent conflicts, we will offset each input connect so
|
||||
# that it aligns with the vdd/gnd rails
|
||||
decoder_offset = decoder_pin.bc() + vector(0, (i + 1) * self.inv.height)
|
||||
decoder_offset = decoder_pin.center()
|
||||
input_offset = input_pos.scale(1, 0) + decoder_offset.scale(0, 1)
|
||||
|
||||
self.route_input_bus(decoder_offset, input_offset)
|
||||
|
|
@ -265,11 +247,14 @@ class hierarchical_decoder(design.design):
|
|||
vertical M2 coordinate to the predecode inputs
|
||||
"""
|
||||
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=input_offset)
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=output_offset)
|
||||
self.add_path(("m3"), [input_offset, output_offset])
|
||||
self.add_via_stack_center(from_layer=self.bus_layer,
|
||||
to_layer=self.input_layer,
|
||||
offset=input_offset)
|
||||
self.add_via_stack_center(from_layer=self.bus_layer,
|
||||
to_layer=self.input_layer,
|
||||
offset=output_offset,
|
||||
directions=self.bus_directions)
|
||||
self.add_path(self.input_layer, [input_offset, output_offset])
|
||||
|
||||
def add_pins(self):
|
||||
""" Add the module pins """
|
||||
|
|
@ -344,19 +329,19 @@ class hierarchical_decoder(design.design):
|
|||
if (self.num_inputs == 2):
|
||||
base = vector(-self.pre2_4.width, 0)
|
||||
else:
|
||||
base= vector(-self.pre2_4.width, num * self.pre2_4.height)
|
||||
base= vector(-self.pre2_4.width, num * (self.pre2_4.height + self.predecoder_spacing))
|
||||
|
||||
self.pre2x4_inst[num].place(base - vector(2 * self.m2_pitch, 0))
|
||||
self.pre2x4_inst[num].place(base)
|
||||
|
||||
def place_pre3x8(self, num):
|
||||
""" Place 3x8 predecoder to the left of the origin and above any 2x4 decoders """
|
||||
if (self.num_inputs == 3):
|
||||
offset = vector(-self.pre_3_8.width, 0)
|
||||
else:
|
||||
height = self.no_of_pre2x4 * self.pre2_4.height + num * self.pre3_8.height
|
||||
height = self.no_of_pre2x4 * (self.pre2_4.height + self.predecoder_spacing) + num * (self.pre3_8.height + self.predecoder_spacing)
|
||||
offset = vector(-self.pre3_8.width, height)
|
||||
|
||||
self.pre3x8_inst[num].place(offset - vector(2 * self.m2_pitch, 0))
|
||||
self.pre3x8_inst[num].place(offset)
|
||||
|
||||
def create_row_decoder(self):
|
||||
""" Create the row-decoder by placing AND2/AND3 and Inverters
|
||||
|
|
@ -411,7 +396,6 @@ class hierarchical_decoder(design.design):
|
|||
"""
|
||||
if (self.num_inputs >= 4):
|
||||
self.place_decoder_and_array()
|
||||
self.route_decoder()
|
||||
|
||||
def place_decoder_and_array(self):
|
||||
"""
|
||||
|
|
@ -433,9 +417,7 @@ class hierarchical_decoder(design.design):
|
|||
Add a column of AND gates for the decoder above the predecoders.
|
||||
"""
|
||||
|
||||
for inst_index in range(self.num_outputs):
|
||||
row = math.floor(inst_index / self.decoders_per_row)
|
||||
dec = inst_index % self.decoders_per_row
|
||||
for row in range(self.num_outputs):
|
||||
if ((row % 2) == 0):
|
||||
y_off = and_mod.height * row
|
||||
mirror = "R0"
|
||||
|
|
@ -443,20 +425,16 @@ class hierarchical_decoder(design.design):
|
|||
y_off = and_mod.height * (row + 1)
|
||||
mirror = "MX"
|
||||
|
||||
x_off = self.internal_routing_width + dec * and_mod.width
|
||||
self.and_inst[inst_index].place(offset=vector(x_off, y_off),
|
||||
mirror=mirror)
|
||||
x_off = self.internal_routing_width
|
||||
self.and_inst[row].place(offset=vector(x_off, y_off),
|
||||
mirror=mirror)
|
||||
|
||||
def route_decoder(self):
|
||||
def route_outputs(self):
|
||||
""" Add the pins. """
|
||||
|
||||
for output in range(self.num_outputs):
|
||||
z_pin = self.and_inst[output].get_pin("Z")
|
||||
self.add_layout_pin(text="decode_{0}".format(output),
|
||||
layer="m1",
|
||||
offset=z_pin.ll(),
|
||||
width=z_pin.width(),
|
||||
height=z_pin.height())
|
||||
for row in range(self.num_outputs):
|
||||
and_inst = self.and_inst[row]
|
||||
self.copy_layout_pin(and_inst, "Z", "decode_{0}".format(row))
|
||||
|
||||
def route_decoder_bus(self):
|
||||
"""
|
||||
|
|
@ -467,9 +445,9 @@ class hierarchical_decoder(design.design):
|
|||
if (self.num_inputs >= 4):
|
||||
# This leaves an offset for the predecoder output jogs
|
||||
input_bus_names = ["predecode_{0}".format(i) for i in range(self.total_number_of_predecoder_outputs)]
|
||||
self.predecode_bus = self.create_vertical_pin_bus(layer="m2",
|
||||
pitch=self.m2_pitch,
|
||||
offset=vector(0, 0),
|
||||
self.predecode_bus = self.create_vertical_pin_bus(layer=self.bus_layer,
|
||||
pitch=self.bus_pitch,
|
||||
offset=vector(self.bus_pitch, 0),
|
||||
names=input_bus_names,
|
||||
length=self.height)
|
||||
|
||||
|
|
@ -487,8 +465,9 @@ class hierarchical_decoder(design.design):
|
|||
predecode_name = "predecode_{}".format(pre_num * 4 + i)
|
||||
out_name = "out_{}".format(i)
|
||||
pin = self.pre2x4_inst[pre_num].get_pin(out_name)
|
||||
x_offset = self.pre2x4_inst[pre_num].rx() + self.m2_pitch
|
||||
self.route_predecode_bus_inputs(predecode_name, pin, x_offset)
|
||||
x_offset = self.pre2x4_inst[pre_num].rx() + self.output_layer_pitch
|
||||
y_offset = self.pre2x4_inst[pre_num].by() + i * self.cell_height
|
||||
self.route_predecode_bus_inputs(predecode_name, pin, x_offset, y_offset)
|
||||
|
||||
# FIXME: convert to connect_bus
|
||||
for pre_num in range(self.no_of_pre3x8):
|
||||
|
|
@ -496,8 +475,9 @@ class hierarchical_decoder(design.design):
|
|||
predecode_name = "predecode_{}".format(pre_num * 8 + i + self.no_of_pre2x4 * 4)
|
||||
out_name = "out_{}".format(i)
|
||||
pin = self.pre3x8_inst[pre_num].get_pin(out_name)
|
||||
x_offset = self.pre3x8_inst[pre_num].rx() + self.m2_pitch
|
||||
self.route_predecode_bus_inputs(predecode_name, pin, x_offset)
|
||||
x_offset = self.pre3x8_inst[pre_num].rx() + self.output_layer_pitch
|
||||
y_offset = self.pre3x8_inst[pre_num].by() + i * self.cell_height
|
||||
self.route_predecode_bus_inputs(predecode_name, pin, x_offset, y_offset)
|
||||
|
||||
def route_bus_to_decoder(self):
|
||||
"""
|
||||
|
|
@ -511,23 +491,20 @@ class hierarchical_decoder(design.design):
|
|||
and the 128th AND3 is connected to [3,7,15]
|
||||
"""
|
||||
output_index = 0
|
||||
|
||||
|
||||
if (self.num_inputs == 4 or self.num_inputs == 5):
|
||||
for index_B in self.predec_groups[1]:
|
||||
for index_A in self.predec_groups[0]:
|
||||
# FIXME: convert to connect_bus?
|
||||
if (output_index < self.num_outputs):
|
||||
row_index = math.floor(output_index / self.decoders_per_row)
|
||||
row_remainder = (output_index % self.decoders_per_row)
|
||||
row_offset = row_index * self.and_inst[0].height + (2 * row_remainder + 1) * self.m3_pitch
|
||||
predecode_name = "predecode_{}".format(index_A)
|
||||
self.route_predecode_bus_outputs(predecode_name,
|
||||
self.and_inst[output_index].get_pin("A"),
|
||||
row_offset)
|
||||
output_index)
|
||||
predecode_name = "predecode_{}".format(index_B)
|
||||
self.route_predecode_bus_outputs(predecode_name,
|
||||
self.and_inst[output_index].get_pin("B"),
|
||||
row_offset + self.m3_pitch)
|
||||
output_index)
|
||||
output_index = output_index + 1
|
||||
|
||||
elif (self.num_inputs > 5):
|
||||
|
|
@ -536,21 +513,18 @@ class hierarchical_decoder(design.design):
|
|||
for index_A in self.predec_groups[0]:
|
||||
# FIXME: convert to connect_bus?
|
||||
if (output_index < self.num_outputs):
|
||||
row_index = math.floor(output_index / self.decoders_per_row)
|
||||
row_remainder = (output_index % self.decoders_per_row)
|
||||
row_offset = row_index * self.and_inst[0].height + (3 * row_remainder + 1) * self.m3_pitch
|
||||
predecode_name = "predecode_{}".format(index_A)
|
||||
self.route_predecode_bus_outputs(predecode_name,
|
||||
self.and_inst[output_index].get_pin("A"),
|
||||
row_offset)
|
||||
output_index)
|
||||
predecode_name = "predecode_{}".format(index_B)
|
||||
self.route_predecode_bus_outputs(predecode_name,
|
||||
self.and_inst[output_index].get_pin("B"),
|
||||
row_offset + self.m3_pitch)
|
||||
output_index)
|
||||
predecode_name = "predecode_{}".format(index_C)
|
||||
self.route_predecode_bus_outputs(predecode_name,
|
||||
self.and_inst[output_index].get_pin("C"),
|
||||
row_offset + 2 * self.m3_pitch)
|
||||
output_index)
|
||||
output_index = output_index + 1
|
||||
|
||||
def route_vdd_gnd(self):
|
||||
|
|
@ -558,65 +532,90 @@ class hierarchical_decoder(design.design):
|
|||
Add a pin for each row of vdd/gnd which are
|
||||
must-connects next level up.
|
||||
"""
|
||||
|
||||
if OPTS.tech_name == "s8":
|
||||
for n in ["vdd", "gnd"]:
|
||||
pins = self.and_inst[0].get_pins(n)
|
||||
for pin in pins:
|
||||
self.add_rect(layer=pin.layer,
|
||||
offset=pin.ll() + vector(0, self.bus_space),
|
||||
width=pin.width(),
|
||||
height=self.height - 2 * self.bus_space)
|
||||
|
||||
# The vias will be placed at the right of the cells.
|
||||
xoffset = max(x.rx() for x in self.and_inst)
|
||||
for num in range(0, self.num_outputs):
|
||||
# Only add the power pin for the 1st in each row
|
||||
if num % self.decoders_per_row:
|
||||
continue
|
||||
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
# The nand and inv are the same height rows...
|
||||
supply_pin = self.and_inst[num].get_pin(pin_name)
|
||||
pin_pos = vector(xoffset, supply_pin.cy())
|
||||
self.add_path("m1",
|
||||
[supply_pin.lc(), vector(xoffset, supply_pin.cy())])
|
||||
self.add_power_pin(name=pin_name,
|
||||
loc=pin_pos)
|
||||
|
||||
# Copy the pins from the predecoders
|
||||
for pre in self.pre2x4_inst + self.pre3x8_inst:
|
||||
self.copy_layout_pin(pre, "vdd")
|
||||
self.copy_layout_pin(pre, "gnd")
|
||||
# This adds power vias at the top of each cell
|
||||
# (except the last to keep them inside the boundary)
|
||||
for i in self.and_inst[:-1]:
|
||||
pins = i.get_pins(n)
|
||||
for pin in pins:
|
||||
self.add_power_pin(name=n,
|
||||
loc=pin.uc(),
|
||||
start_layer=pin.layer)
|
||||
self.add_power_pin(name=n,
|
||||
loc=pin.uc(),
|
||||
start_layer=pin.layer)
|
||||
|
||||
for i in self.pre2x4_inst + self.pre3x8_inst:
|
||||
self.copy_layout_pin(i, n)
|
||||
else:
|
||||
# The vias will be placed at the right of the cells.
|
||||
xoffset = max(x.rx() for x in self.and_inst) + 0.5 * self.m1_space
|
||||
for row in range(0, self.num_outputs):
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
# The nand and inv are the same height rows...
|
||||
supply_pin = self.and_inst[row].get_pin(pin_name)
|
||||
pin_pos = vector(xoffset, supply_pin.cy())
|
||||
self.add_power_pin(name=pin_name,
|
||||
loc=pin_pos,
|
||||
start_layer=supply_pin.layer)
|
||||
|
||||
# Copy the pins from the predecoders
|
||||
for pre in self.pre2x4_inst + self.pre3x8_inst:
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
self.copy_layout_pin(pre, pin_name)
|
||||
|
||||
def route_predecode_bus_outputs(self, rail_name, pin, y_offset):
|
||||
def route_predecode_bus_outputs(self, rail_name, pin, row):
|
||||
"""
|
||||
Connect the routing rail to the given metal1 pin
|
||||
using a routing track at the given y_offset
|
||||
|
||||
"""
|
||||
pin_pos = pin.center()
|
||||
# If we have a single decoder per row, we can route on M1
|
||||
if self.decoders_per_row == 1:
|
||||
rail_pos = vector(self.predecode_bus[rail_name].x, pin_pos.y)
|
||||
self.add_path("m1", [rail_pos, pin_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=rail_pos)
|
||||
# If not, we must route over the decoder cells on M3
|
||||
else:
|
||||
rail_pos = vector(self.predecode_bus[rail_name].x, y_offset)
|
||||
mid_pos = vector(pin_pos.x, rail_pos.y)
|
||||
self.add_wire(self.m2_stack[::-1], [rail_pos, mid_pos, pin_pos])
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=rail_pos)
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=pin_pos)
|
||||
|
||||
def route_predecode_bus_inputs(self, rail_name, pin, x_offset):
|
||||
pin_pos = pin.center()
|
||||
rail_pos = vector(self.predecode_bus[rail_name].x, pin_pos.y)
|
||||
self.add_path(self.input_layer, [rail_pos, pin_pos])
|
||||
|
||||
self.add_via_stack_center(from_layer=self.bus_layer,
|
||||
to_layer=self.input_layer,
|
||||
offset=rail_pos,
|
||||
directions=self.bus_directions)
|
||||
|
||||
self.add_via_stack_center(from_layer=pin.layer,
|
||||
to_layer=self.input_layer,
|
||||
offset=pin_pos,
|
||||
directions=("H", "H"))
|
||||
|
||||
def route_predecode_bus_inputs(self, rail_name, pin, x_offset, y_offset):
|
||||
"""
|
||||
Connect the routing rail to the given metal1 pin using a jog
|
||||
to the right of the cell at the given x_offset.
|
||||
"""
|
||||
# This routes the pin up to the rail, basically, to avoid conflicts.
|
||||
# It would be fixed with a channel router.
|
||||
pin_pos = pin.center()
|
||||
pin_pos = pin.rc()
|
||||
mid_point1 = vector(x_offset, pin_pos.y)
|
||||
mid_point2 = vector(x_offset, pin_pos.y + self.inv.height / 2)
|
||||
mid_point2 = vector(x_offset, y_offset)
|
||||
rail_pos = vector(self.predecode_bus[rail_name].x, mid_point2.y)
|
||||
self.add_wire(self.m1_stack, [pin_pos, mid_point1, mid_point2, rail_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=rail_pos)
|
||||
self.add_path(self.output_layer, [pin_pos, mid_point1, mid_point2, rail_pos])
|
||||
|
||||
# pin_pos = pin.center()
|
||||
# rail_pos = vector(self.predecode_bus[rail_name].x, pin_pos.y)
|
||||
# self.add_path(self.output_layer, [pin_pos, rail_pos])
|
||||
self.add_via_stack_center(from_layer=pin.layer,
|
||||
to_layer=self.output_layer,
|
||||
offset=pin_pos)
|
||||
self.add_via_stack_center(from_layer=self.bus_layer,
|
||||
to_layer=self.output_layer,
|
||||
offset=rail_pos,
|
||||
directions=self.bus_directions)
|
||||
|
||||
def input_load(self):
|
||||
if self.determine_predecodes(self.num_inputs)[1]==0:
|
||||
|
|
|
|||
|
|
@ -8,18 +8,24 @@
|
|||
import debug
|
||||
import design
|
||||
import math
|
||||
import contact
|
||||
from vector import vector
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
|
||||
|
||||
class hierarchical_predecode(design.design):
|
||||
"""
|
||||
Pre 2x4 and 3x8 decoder shared code.
|
||||
Pre 2x4 and 3x8 and TBD 4x16 decoder shared code.
|
||||
"""
|
||||
def __init__(self, name, input_number, height=None):
|
||||
self.number_of_inputs = input_number
|
||||
self.cell_height = height
|
||||
|
||||
if not height:
|
||||
b = factory.create(module_type="bitcell")
|
||||
self.cell_height = b.height
|
||||
else:
|
||||
self.cell_height = height
|
||||
|
||||
self.number_of_outputs = int(math.pow(2, self.number_of_inputs))
|
||||
design.design.__init__(self, name)
|
||||
|
||||
|
|
@ -33,34 +39,71 @@ class hierarchical_predecode(design.design):
|
|||
|
||||
def add_modules(self):
|
||||
""" Add the INV and AND gate modules """
|
||||
|
||||
self.inv = factory.create(module_type="pinv",
|
||||
height=self.cell_height)
|
||||
self.add_mod(self.inv)
|
||||
|
||||
self.add_and(self.number_of_inputs)
|
||||
self.add_mod(self.and_mod)
|
||||
|
||||
def add_and(self, inputs):
|
||||
""" Create the NAND for the predecode input stage """
|
||||
if inputs==2:
|
||||
self.and_mod = factory.create(module_type="pand2",
|
||||
if self.number_of_inputs == 2:
|
||||
self.and_mod = factory.create(module_type="and2_dec",
|
||||
height=self.cell_height)
|
||||
elif inputs==3:
|
||||
self.and_mod = factory.create(module_type="pand3",
|
||||
elif self.number_of_inputs == 3:
|
||||
self.and_mod = factory.create(module_type="and3_dec",
|
||||
height=self.cell_height)
|
||||
elif self.number_of_inputs == 4:
|
||||
self.and_mod = factory.create(module_type="and4_dec",
|
||||
height=self.cell_height)
|
||||
else:
|
||||
debug.error("Invalid number of predecode inputs: {}".format(inputs), -1)
|
||||
|
||||
debug.error("Invalid number of predecode inputs: {}".format(self.number_of_inputs), -1)
|
||||
self.add_mod(self.and_mod)
|
||||
|
||||
# This uses the pinv_dec parameterized cell
|
||||
self.inv = factory.create(module_type="inv_dec",
|
||||
height=self.cell_height,
|
||||
size=1)
|
||||
self.add_mod(self.inv)
|
||||
|
||||
def create_layout(self):
|
||||
""" The general organization is from left to right:
|
||||
1) a set of M2 rails for input signals
|
||||
2) a set of inverters to invert input signals
|
||||
3) a set of M2 rails for the vdd, gnd, inverted inputs, inputs
|
||||
4) a set of AND gates for inversion
|
||||
"""
|
||||
self.setup_layout_constraints()
|
||||
self.route_rails()
|
||||
self.place_input_inverters()
|
||||
self.place_and_array()
|
||||
self.route()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def setup_layout_constraints(self):
|
||||
|
||||
# Inputs to cells are on input layer
|
||||
# Outputs from cells are on output layer
|
||||
if OPTS.tech_name == "s8":
|
||||
self.bus_layer = "m1"
|
||||
self.bus_directions = None
|
||||
self.bus_pitch = self.m1_pitch
|
||||
self.bus_space = 1.5 * self.m1_space
|
||||
self.input_layer = "li"
|
||||
self.output_layer = "m2"
|
||||
self.output_layer_pitch = self.m2_pitch
|
||||
else:
|
||||
self.bus_layer = "m2"
|
||||
self.bus_directions = None
|
||||
self.bus_pitch = self.m2_pitch
|
||||
self.bus_space = self.m2_space
|
||||
# This requires a special jog to ensure to conflicts with the output layers
|
||||
self.input_layer = "m1"
|
||||
self.output_layer = "m1"
|
||||
self.output_layer_pitch = self.m1_pitch
|
||||
|
||||
self.height = self.number_of_outputs * self.and_mod.height
|
||||
|
||||
# x offset for input inverters
|
||||
self.x_off_inv_1 = self.number_of_inputs*self.m2_pitch
|
||||
# +1 input for spacing for supply rail contacts
|
||||
self.x_off_inv_1 = (self.number_of_inputs + 1) * self.bus_pitch + self.bus_pitch
|
||||
|
||||
# x offset to AND decoder includes the left rails, mid rails and inverters, plus two extra m2 pitches
|
||||
self.x_off_and = self.x_off_inv_1 + self.inv.width + (2*self.number_of_inputs + 2) * self.m2_pitch
|
||||
# x offset to AND decoder includes the left rails, mid rails and inverters, plus two extra bus pitches
|
||||
self.x_off_and = self.x_off_inv_1 + self.inv.width + (2 * self.number_of_inputs + 2) * self.bus_pitch
|
||||
|
||||
# x offset to output inverters
|
||||
self.width = self.x_off_and + self.and_mod.width
|
||||
|
|
@ -68,30 +111,30 @@ class hierarchical_predecode(design.design):
|
|||
def route_rails(self):
|
||||
""" Create all of the rails for the inputs and vdd/gnd/inputs_bar/inputs """
|
||||
input_names = ["in_{}".format(x) for x in range(self.number_of_inputs)]
|
||||
offset = vector(0.5 * self.m2_width, self.m1_pitch)
|
||||
self.input_rails = self.create_vertical_pin_bus(layer="m2",
|
||||
pitch=self.m2_pitch,
|
||||
offset=offset,
|
||||
names=input_names,
|
||||
length=self.height - 2 * self.m1_pitch)
|
||||
# Offsets for the perimeter spacing to other modules
|
||||
# This uses m3 pitch to leave space for power routes
|
||||
offset = vector(self.bus_pitch, self.bus_pitch)
|
||||
self.input_rails = self.create_vertical_bus(layer=self.bus_layer,
|
||||
offset=offset,
|
||||
names=input_names,
|
||||
length=self.height - 2 * self.bus_pitch)
|
||||
|
||||
invert_names = ["Abar_{}".format(x) for x in range(self.number_of_inputs)]
|
||||
non_invert_names = ["A_{}".format(x) for x in range(self.number_of_inputs)]
|
||||
decode_names = invert_names + non_invert_names
|
||||
offset = vector(self.x_off_inv_1 + self.inv.width + 2 * self.m2_pitch, self.m1_pitch)
|
||||
self.decode_rails = self.create_vertical_bus(layer="m2",
|
||||
pitch=self.m2_pitch,
|
||||
offset = vector(self.x_off_inv_1 + self.inv.width + self.bus_pitch, self.bus_pitch)
|
||||
self.decode_rails = self.create_vertical_bus(layer=self.bus_layer,
|
||||
offset=offset,
|
||||
names=decode_names,
|
||||
length=self.height - 2 * self.m1_pitch)
|
||||
length=self.height - 2 * self.bus_pitch)
|
||||
|
||||
def create_input_inverters(self):
|
||||
""" Create the input inverters to invert input signals for the decode stage. """
|
||||
self.in_inst = []
|
||||
self.inv_inst = []
|
||||
for inv_num in range(self.number_of_inputs):
|
||||
name = "pre_inv_{0}".format(inv_num)
|
||||
self.in_inst.append(self.add_inst(name=name,
|
||||
mod=self.inv))
|
||||
self.inv_inst.append(self.add_inst(name=name,
|
||||
mod=self.inv))
|
||||
self.connect_inst(["in_{0}".format(inv_num),
|
||||
"inbar_{0}".format(inv_num),
|
||||
"vdd", "gnd"])
|
||||
|
|
@ -99,6 +142,7 @@ class hierarchical_predecode(design.design):
|
|||
def place_input_inverters(self):
|
||||
""" Place the input inverters to invert input signals for the decode stage. """
|
||||
for inv_num in range(self.number_of_inputs):
|
||||
|
||||
if (inv_num % 2 == 0):
|
||||
y_off = inv_num * (self.inv.height)
|
||||
mirror = "R0"
|
||||
|
|
@ -106,8 +150,8 @@ class hierarchical_predecode(design.design):
|
|||
y_off = (inv_num + 1) * (self.inv.height)
|
||||
mirror="MX"
|
||||
offset = vector(self.x_off_inv_1, y_off)
|
||||
self.in_inst[inv_num].place(offset=offset,
|
||||
mirror=mirror)
|
||||
self.inv_inst[inv_num].place(offset=offset,
|
||||
mirror=mirror)
|
||||
|
||||
def create_and_array(self, connections):
|
||||
""" Create the AND stage for the decodes """
|
||||
|
|
@ -142,20 +186,31 @@ class hierarchical_predecode(design.design):
|
|||
|
||||
def route_inputs_to_rails(self):
|
||||
""" Route the uninverted inputs to the second set of rails """
|
||||
|
||||
top_and_gate = self.and_inst[-1]
|
||||
for num in range(self.number_of_inputs):
|
||||
# route one signal next to each vdd/gnd rail since this is
|
||||
# typically where the p/n devices are and there are no
|
||||
# pins in the and gates.
|
||||
y_offset = (num + self.number_of_inputs) * self.inv.height + contact.m1_via.width + self.m1_space
|
||||
if num == 0:
|
||||
pin = top_and_gate.get_pin("A")
|
||||
elif num == 1:
|
||||
pin = top_and_gate.get_pin("B")
|
||||
elif num == 2:
|
||||
pin = top_and_gate.get_pin("C")
|
||||
elif num == 3:
|
||||
pin = top_and_gate.get_pin("D")
|
||||
else:
|
||||
debug.error("Too many inputs for predecoder.", -1)
|
||||
y_offset = pin.cy()
|
||||
in_pin = "in_{}".format(num)
|
||||
a_pin = "A_{}".format(num)
|
||||
in_pos = vector(self.input_rails[in_pin].x, y_offset)
|
||||
a_pos = vector(self.decode_rails[a_pin].x, y_offset)
|
||||
self.add_path("m1", [in_pos, a_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=[self.input_rails[in_pin].x, y_offset])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=[self.decode_rails[a_pin].x, y_offset])
|
||||
self.add_path(self.input_layer, [in_pos, a_pos])
|
||||
self.add_via_stack_center(from_layer=self.input_layer,
|
||||
to_layer=self.bus_layer,
|
||||
offset=[self.input_rails[in_pin].x, y_offset])
|
||||
self.add_via_stack_center(from_layer=self.input_layer,
|
||||
to_layer=self.bus_layer,
|
||||
offset=[self.decode_rails[a_pin].x, y_offset])
|
||||
|
||||
def route_output_and(self):
|
||||
"""
|
||||
|
|
@ -165,37 +220,59 @@ class hierarchical_predecode(design.design):
|
|||
|
||||
z_pin = self.and_inst[num].get_pin("Z")
|
||||
self.add_layout_pin(text="out_{}".format(num),
|
||||
layer="m1",
|
||||
layer=z_pin.layer,
|
||||
offset=z_pin.ll(),
|
||||
height=z_pin.height(),
|
||||
width=z_pin.width())
|
||||
|
||||
def route_input_inverters(self):
|
||||
"""
|
||||
Route all conections of the inputs inverters [Inputs, outputs, vdd, gnd]
|
||||
Route all conections of the inputs inverters [Inputs, outputs, vdd, gnd]
|
||||
"""
|
||||
for inv_num in range(self.number_of_inputs):
|
||||
out_pin = "Abar_{}".format(inv_num)
|
||||
in_pin = "in_{}".format(inv_num)
|
||||
|
||||
inv_out_pin = self.inv_inst[inv_num].get_pin("Z")
|
||||
inv_out_pos = inv_out_pin.rc()
|
||||
|
||||
#add output so that it is just below the vdd or gnd rail
|
||||
# add output so that it is just below the vdd or gnd rail
|
||||
# since this is where the p/n devices are and there are no
|
||||
# pins in the and gates.
|
||||
y_offset = (inv_num+1) * self.inv.height - 3*self.m1_space
|
||||
inv_out_pos = self.in_inst[inv_num].get_pin("Z").rc()
|
||||
right_pos = inv_out_pos + vector(self.inv.width - self.inv.get_pin("Z").lx(),0)
|
||||
rail_pos = vector(self.decode_rails[out_pin].x,y_offset)
|
||||
self.add_path("m1", [inv_out_pos, right_pos, vector(right_pos.x, y_offset), rail_pos])
|
||||
self.add_via_center(layers = self.m1_stack,
|
||||
offset=rail_pos)
|
||||
|
||||
if OPTS.tech_name == "s8":
|
||||
rail_pos = vector(self.decode_rails[out_pin].x, inv_out_pos.y)
|
||||
self.add_path(self.output_layer, [inv_out_pos, rail_pos])
|
||||
else:
|
||||
y_offset = (inv_num + 1) * self.inv.height - self.output_layer_pitch
|
||||
right_pos = inv_out_pos + vector(self.inv.width - self.inv.get_pin("Z").rx(), 0)
|
||||
rail_pos = vector(self.decode_rails[out_pin].x, y_offset)
|
||||
self.add_path(self.output_layer, [inv_out_pos, right_pos, vector(right_pos.x, y_offset), rail_pos])
|
||||
|
||||
self.add_via_stack_center(from_layer=inv_out_pin.layer,
|
||||
to_layer=self.output_layer,
|
||||
offset=inv_out_pos)
|
||||
self.add_via_stack_center(from_layer=self.output_layer,
|
||||
to_layer=self.bus_layer,
|
||||
offset=rail_pos,
|
||||
directions=self.bus_directions)
|
||||
|
||||
#route input
|
||||
inv_in_pos = self.in_inst[inv_num].get_pin("A").lc()
|
||||
in_pos = vector(self.input_rails[in_pin].x,inv_in_pos.y)
|
||||
self.add_path("m1", [in_pos, inv_in_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=in_pos)
|
||||
# route input
|
||||
pin = self.inv_inst[inv_num].get_pin("A")
|
||||
inv_in_pos = pin.center()
|
||||
in_pos = vector(self.input_rails[in_pin].x, inv_in_pos.y)
|
||||
self.add_path(self.input_layer, [in_pos, inv_in_pos])
|
||||
self.add_via_stack_center(from_layer=pin.layer,
|
||||
to_layer=self.input_layer,
|
||||
offset=inv_in_pos)
|
||||
via=self.add_via_stack_center(from_layer=self.input_layer,
|
||||
to_layer=self.bus_layer,
|
||||
offset=in_pos)
|
||||
# Create the input pin at this location on the rail
|
||||
self.add_layout_pin_rect_center(text=in_pin,
|
||||
layer=self.bus_layer,
|
||||
offset=in_pos,
|
||||
height=via.mod.second_layer_height,
|
||||
width=via.mod.second_layer_width)
|
||||
|
||||
def route_and_to_rails(self):
|
||||
# This 2D array defines the connection mapping
|
||||
|
|
@ -205,39 +282,76 @@ class hierarchical_predecode(design.design):
|
|||
index_lst= and_input_line_combination[k]
|
||||
|
||||
if self.number_of_inputs == 2:
|
||||
gate_lst = ["A","B"]
|
||||
gate_lst = ["A", "B"]
|
||||
else:
|
||||
gate_lst = ["A","B","C"]
|
||||
gate_lst = ["A", "B", "C"]
|
||||
|
||||
# this will connect pins A,B or A,B,C
|
||||
for rail_pin,gate_pin in zip(index_lst,gate_lst):
|
||||
pin_pos = self.and_inst[k].get_pin(gate_pin).lc()
|
||||
for rail_pin, gate_pin in zip(index_lst, gate_lst):
|
||||
pin = self.and_inst[k].get_pin(gate_pin)
|
||||
pin_pos = pin.center()
|
||||
rail_pos = vector(self.decode_rails[rail_pin].x, pin_pos.y)
|
||||
self.add_path("m1", [rail_pos, pin_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=rail_pos)
|
||||
self.add_path(self.input_layer, [rail_pos, pin_pos])
|
||||
self.add_via_stack_center(from_layer=self.input_layer,
|
||||
to_layer=self.bus_layer,
|
||||
offset=rail_pos,
|
||||
directions=self.bus_directions)
|
||||
if gate_pin == "A":
|
||||
direction = None
|
||||
else:
|
||||
direction = ("H", "H")
|
||||
|
||||
self.add_via_stack_center(from_layer=pin.layer,
|
||||
to_layer=self.input_layer,
|
||||
offset=pin_pos,
|
||||
directions=direction)
|
||||
|
||||
def route_vdd_gnd(self):
|
||||
""" Add a pin for each row of vdd/gnd which are must-connects next level up. """
|
||||
|
||||
# Find the x offsets for where the vias/pins should be placed
|
||||
in_xoffset = self.in_inst[0].rx() + self.m1_space
|
||||
# out_xoffset = self.and_inst[0].cx() + self.m1_space
|
||||
for num in range(0, self.number_of_outputs):
|
||||
# this will result in duplicate polygons for rails, but who cares
|
||||
|
||||
# Route both supplies
|
||||
# In s8, we use hand-made decoder cells with vertical power
|
||||
if OPTS.tech_name == "s8":
|
||||
for n in ["vdd", "gnd"]:
|
||||
and_pin = self.and_inst[num].get_pin(n)
|
||||
supply_offset = and_pin.ll().scale(0, 1)
|
||||
self.add_rect(layer="m1",
|
||||
offset=supply_offset,
|
||||
width=self.and_inst[num].rx())
|
||||
# This makes a wire from top to bottom for both inv and and gates
|
||||
for i in [self.inv_inst, self.and_inst]:
|
||||
bot_pins = i[0].get_pins(n)
|
||||
top_pins = i[-1].get_pins(n)
|
||||
for (bot_pin, top_pin) in zip(bot_pins, top_pins):
|
||||
self.add_rect(layer=bot_pin.layer,
|
||||
offset=vector(bot_pin.lx(), self.bus_pitch),
|
||||
width=bot_pin.width(),
|
||||
height=top_pin.uy() - self.bus_pitch)
|
||||
# This adds power vias at the top of each cell
|
||||
# (except the last to keep them inside the boundary)
|
||||
for i in self.inv_inst[:-1:2] + self.and_inst[:-1:2]:
|
||||
pins = i.get_pins(n)
|
||||
for pin in pins:
|
||||
self.add_power_pin(name=n,
|
||||
loc=pin.uc(),
|
||||
start_layer=pin.layer)
|
||||
self.add_power_pin(name=n,
|
||||
loc=pin.uc(),
|
||||
start_layer=pin.layer)
|
||||
|
||||
# In other techs, we are using standard cell decoder cells with horizontal power
|
||||
else:
|
||||
for num in range(0, self.number_of_outputs):
|
||||
|
||||
# Add pins in two locations
|
||||
for xoffset in [in_xoffset]:
|
||||
pin_pos = vector(xoffset, and_pin.cy())
|
||||
self.add_power_pin(n, pin_pos)
|
||||
# Route both supplies
|
||||
for n in ["vdd", "gnd"]:
|
||||
and_pins = self.and_inst[num].get_pins(n)
|
||||
for and_pin in and_pins:
|
||||
self.add_segment_center(layer=and_pin.layer,
|
||||
start=vector(0, and_pin.cy()),
|
||||
end=vector(self.width, and_pin.cy()))
|
||||
|
||||
# Add pins in two locations
|
||||
for xoffset in [self.inv_inst[0].lx() - self.bus_space,
|
||||
self.and_inst[0].lx() - self.bus_space]:
|
||||
pin_pos = vector(xoffset, and_pin.cy())
|
||||
self.add_power_pin(name=n,
|
||||
loc=pin_pos,
|
||||
start_layer=and_pin.layer)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,10 @@
|
|||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
from tech import drc
|
||||
import debug
|
||||
import design
|
||||
from vector import vector
|
||||
from hierarchical_predecode import hierarchical_predecode
|
||||
from globals import OPTS
|
||||
|
||||
|
||||
class hierarchical_predecode2x4(hierarchical_predecode):
|
||||
"""
|
||||
Pre 2x4 decoder used in hierarchical_decoder.
|
||||
|
|
@ -33,21 +30,6 @@ class hierarchical_predecode2x4(hierarchical_predecode):
|
|||
["in_0", "in_1", "out_3", "vdd", "gnd"]]
|
||||
self.create_and_array(connections)
|
||||
|
||||
def create_layout(self):
|
||||
""" The general organization is from left to right:
|
||||
1) a set of M2 rails for input signals
|
||||
2) a set of inverters to invert input signals
|
||||
3) a set of M2 rails for the vdd, gnd, inverted inputs, inputs
|
||||
4) a set of AND gates for inversion
|
||||
"""
|
||||
self.setup_layout_constraints()
|
||||
self.route_rails()
|
||||
self.place_input_inverters()
|
||||
self.place_and_array()
|
||||
self.route()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def get_and_input_line_combination(self):
|
||||
""" These are the decoder connections of the AND gates to the A,B pins """
|
||||
combination = [["Abar_0", "Abar_1"],
|
||||
|
|
|
|||
|
|
@ -5,13 +5,10 @@
|
|||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
from tech import drc
|
||||
import debug
|
||||
import design
|
||||
from vector import vector
|
||||
from hierarchical_predecode import hierarchical_predecode
|
||||
from globals import OPTS
|
||||
|
||||
|
||||
class hierarchical_predecode3x8(hierarchical_predecode):
|
||||
"""
|
||||
Pre 3x8 decoder used in hierarchical_decoder.
|
||||
|
|
@ -37,22 +34,6 @@ class hierarchical_predecode3x8(hierarchical_predecode):
|
|||
["in_0", "in_1", "in_2", "out_7", "vdd", "gnd"]]
|
||||
self.create_and_array(connections)
|
||||
|
||||
def create_layout(self):
|
||||
"""
|
||||
The general organization is from left to right:
|
||||
1) a set of M2 rails for input signals
|
||||
2) a set of inverters to invert input signals
|
||||
3) a set of M2 rails for the vdd, gnd, inverted inputs, inputs
|
||||
4) a set of NAND gates for inversion
|
||||
"""
|
||||
self.setup_layout_constraints()
|
||||
self.route_rails()
|
||||
self.place_input_inverters()
|
||||
self.place_and_array()
|
||||
self.route()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def get_and_input_line_combination(self):
|
||||
""" These are the decoder connections of the NAND gates to the A,B,C pins """
|
||||
combination = [["Abar_0", "Abar_1", "Abar_2"],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
from hierarchical_predecode import hierarchical_predecode
|
||||
from globals import OPTS
|
||||
|
||||
|
||||
class hierarchical_predecode4x16(hierarchical_predecode):
|
||||
"""
|
||||
Pre 4x16 decoder used in hierarchical_decoder.
|
||||
"""
|
||||
def __init__(self, name, height=None):
|
||||
hierarchical_predecode.__init__(self, name, 4, height)
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
self.add_modules()
|
||||
self.create_input_inverters()
|
||||
connections=[["inbar_0", "inbar_1", "inbar_2", "inbar_3", "out_0", "vdd", "gnd"],
|
||||
["in_0", "inbar_1", "inbar_2", "inbar_3", "out_1", "vdd", "gnd"],
|
||||
["inbar_0", "in_1", "inbar_2", "inbar_3", "out_2", "vdd", "gnd"],
|
||||
["in_0", "in_1", "inbar_2", "inbar_3", "out_3", "vdd", "gnd"],
|
||||
["inbar_0", "inbar_1", "in_2", "inbar_3", "out_4", "vdd", "gnd"],
|
||||
["in_0", "inbar_1", "in_2", "inbar_3", "out_5", "vdd", "gnd"],
|
||||
["inbar_0", "in_1", "in_2", "inbar_3", "out_6", "vdd", "gnd"],
|
||||
["in_0", "in_1", "in_2", "inbar_3", "out_7", "vdd", "gnd"],
|
||||
["inbar_0", "inbar_1", "inbar_2", "in_3", "out_0", "vdd", "gnd"],
|
||||
["in_0", "inbar_1", "inbar_2", "in_3", "out_1", "vdd", "gnd"],
|
||||
["inbar_0", "in_1", "inbar_2", "in_3", "out_2", "vdd", "gnd"],
|
||||
["in_0", "in_1", "inbar_2", "in_3", "out_3", "vdd", "gnd"],
|
||||
["inbar_0", "inbar_1", "in_2", "in_3", "out_4", "vdd", "gnd"],
|
||||
["in_0", "inbar_1", "in_2", "in_3", "out_5", "vdd", "gnd"],
|
||||
["inbar_0", "in_1", "in_2", "in_3", "out_6", "vdd", "gnd"],
|
||||
["in_0", "in_1", "in_2", "in_3", "out_7", "vdd", "gnd"] ]
|
||||
|
||||
self.create_and_array(connections)
|
||||
|
||||
def get_and_input_line_combination(self):
|
||||
""" These are the decoder connections of the AND gates to the A,B pins """
|
||||
combination = [["Abar_0", "Abar_1", "Abar_2", "Abar_3"],
|
||||
["A_0", "Abar_1", "Abar_2", "Abar_3"],
|
||||
["Abar_0", "A_1", "Abar_2", "Abar_3"],
|
||||
["A_0", "A_1", "Abar_2", "Abar_3"],
|
||||
["Abar_0", "Abar_1", "A_2" , "Abar_3"],
|
||||
["A_0", "Abar_1", "A_2" , "Abar_3"],
|
||||
["Abar_0", "A_1", "A_2" , "Abar_3"],
|
||||
["A_0", "A_1", "A_2" , "Abar_3"],
|
||||
["Abar_0", "Abar_1", "Abar_2", "A_3"],
|
||||
["A_0", "Abar_1", "Abar_2", "A_3"],
|
||||
["Abar_0", "A_1", "Abar_2", "A_3"],
|
||||
["A_0", "A_1", "Abar_2", "A_3"],
|
||||
["Abar_0", "Abar_1", "A_2", "A_3"],
|
||||
["A_0", "Abar_1", "A_2", "A_3"],
|
||||
["Abar_0", "A_1", "A_2", "A_3"],
|
||||
["A_0", "A_1", "A_2", "A_3"]]
|
||||
return combination
|
||||
|
|
@ -3,16 +3,15 @@
|
|||
# Copyright (c) 2016-2019 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
import sys
|
||||
from tech import drc, parameter
|
||||
from math import log
|
||||
import debug
|
||||
import design
|
||||
from sram_factory import factory
|
||||
from vector import vector
|
||||
|
||||
from tech import layer
|
||||
from globals import OPTS
|
||||
|
||||
|
||||
class port_address(design.design):
|
||||
"""
|
||||
Create the address port (row decoder and wordline driver)..
|
||||
|
|
@ -25,17 +24,16 @@ class port_address(design.design):
|
|||
self.addr_size = int(log(self.num_rows, 2))
|
||||
|
||||
if name == "":
|
||||
name = "port_address_{0}_{1}".format(cols,rows)
|
||||
name = "port_address_{0}_{1}".format(cols, rows)
|
||||
design.design.__init__(self, name)
|
||||
debug.info(2, "create data port of cols {0} rows {1}".format(cols,rows))
|
||||
debug.info(2, "create data port of cols {0} rows {1}".format(cols, rows))
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
debug.check(len(self.all_ports)<=2,"Bank layout cannot handle more than two ports.")
|
||||
debug.check(len(self.all_ports) <= 2, "Bank layout cannot handle more than two ports.")
|
||||
self.create_layout()
|
||||
self.add_boundary()
|
||||
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
self.add_modules()
|
||||
|
|
@ -43,6 +41,10 @@ class port_address(design.design):
|
|||
self.create_wordline_driver()
|
||||
|
||||
def create_layout(self):
|
||||
if "li" in layer:
|
||||
self.route_layer = "li"
|
||||
else:
|
||||
self.route_layer = "m1"
|
||||
self.place_instances()
|
||||
self.route_layout()
|
||||
self.DRC_LVS()
|
||||
|
|
@ -51,16 +53,15 @@ class port_address(design.design):
|
|||
""" Adding pins for port address module"""
|
||||
|
||||
for bit in range(self.addr_size):
|
||||
self.add_pin("addr_{0}".format(bit),"INPUT")
|
||||
self.add_pin("addr_{0}".format(bit), "INPUT")
|
||||
|
||||
self.add_pin("wl_en", "INPUT")
|
||||
|
||||
for bit in range(self.num_rows):
|
||||
self.add_pin("wl_{0}".format(bit),"OUTPUT")
|
||||
self.add_pin("wl_{0}".format(bit), "OUTPUT")
|
||||
|
||||
self.add_pin("vdd","POWER")
|
||||
self.add_pin("gnd","GROUND")
|
||||
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def route_layout(self):
|
||||
""" Create routing amoung the modules """
|
||||
|
|
@ -71,8 +72,8 @@ class port_address(design.design):
|
|||
def route_supplies(self):
|
||||
""" Propagate all vdd/gnd pins up to this level for all modules """
|
||||
for inst in self.insts:
|
||||
self.copy_power_pins(inst,"vdd")
|
||||
self.copy_power_pins(inst,"gnd")
|
||||
self.copy_power_pins(inst, "vdd")
|
||||
self.copy_power_pins(inst, "gnd")
|
||||
|
||||
def route_pins(self):
|
||||
for row in range(self.addr_size):
|
||||
|
|
@ -88,11 +89,19 @@ class port_address(design.design):
|
|||
def route_internal(self):
|
||||
for row in range(self.num_rows):
|
||||
# The pre/post is to access the pin from "outside" the cell to avoid DRCs
|
||||
decoder_out_pos = self.row_decoder_inst.get_pin("decode_{}".format(row)).rc()
|
||||
driver_in_pos = self.wordline_driver_inst.get_pin("in_{}".format(row)).lc()
|
||||
mid1 = decoder_out_pos.scale(0.5, 1) + driver_in_pos.scale(0.5, 0)
|
||||
mid2 = decoder_out_pos.scale(0.5, 0) + driver_in_pos.scale(0.5, 1)
|
||||
self.add_path("m1", [decoder_out_pos, mid1, mid2, driver_in_pos])
|
||||
decoder_out_pin = self.row_decoder_inst.get_pin("decode_{}".format(row))
|
||||
decoder_out_pos = decoder_out_pin.rc()
|
||||
driver_in_pin = self.wordline_driver_inst.get_pin("in_{}".format(row))
|
||||
driver_in_pos = driver_in_pin.lc()
|
||||
self.add_zjog(self.route_layer, decoder_out_pos, driver_in_pos)
|
||||
|
||||
self.add_via_stack_center(from_layer=decoder_out_pin.layer,
|
||||
to_layer=self.route_layer,
|
||||
offset=decoder_out_pos)
|
||||
|
||||
self.add_via_stack_center(from_layer=driver_in_pin.layer,
|
||||
to_layer=self.route_layer,
|
||||
offset=driver_in_pos)
|
||||
|
||||
def add_modules(self):
|
||||
|
||||
|
|
@ -100,7 +109,7 @@ class port_address(design.design):
|
|||
num_outputs=self.num_rows)
|
||||
self.add_mod(self.row_decoder)
|
||||
|
||||
self.wordline_driver = factory.create(module_type="wordline_driver",
|
||||
self.wordline_driver = factory.create(module_type="wordline_driver_array",
|
||||
rows=self.num_rows,
|
||||
cols=self.num_cols)
|
||||
self.add_mod(self.wordline_driver)
|
||||
|
|
@ -119,12 +128,10 @@ class port_address(design.design):
|
|||
temp.extend(["vdd", "gnd"])
|
||||
self.connect_inst(temp)
|
||||
|
||||
|
||||
|
||||
def create_wordline_driver(self):
|
||||
""" Create the Wordline Driver """
|
||||
|
||||
self.wordline_driver_inst = self.add_inst(name="wordline_driver",
|
||||
self.wordline_driver_inst = self.add_inst(name="wordline_driver",
|
||||
mod=self.wordline_driver)
|
||||
|
||||
temp = []
|
||||
|
|
@ -137,20 +144,13 @@ class port_address(design.design):
|
|||
temp.append("gnd")
|
||||
self.connect_inst(temp)
|
||||
|
||||
|
||||
|
||||
def place_instances(self):
|
||||
"""
|
||||
Compute the offsets and place the instances.
|
||||
"""
|
||||
|
||||
# A space for wells or jogging m2
|
||||
self.m2_gap = max(2*drc("pwell_to_nwell") + drc("nwell_enclose_active"),
|
||||
3*self.m2_pitch)
|
||||
|
||||
row_decoder_offset = vector(0,0)
|
||||
wordline_driver_offset = vector(self.row_decoder.width + self.m2_gap,0)
|
||||
|
||||
row_decoder_offset = vector(0, 0)
|
||||
wordline_driver_offset = vector(self.row_decoder.width, 0)
|
||||
self.wordline_driver_inst.place(wordline_driver_offset)
|
||||
self.row_decoder_inst.place(row_decoder_offset)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class port_data(design.design):
|
|||
"""
|
||||
|
||||
def __init__(self, sram_config, port, name=""):
|
||||
|
||||
|
||||
sram_config.set_local_config(self)
|
||||
self.port = port
|
||||
if self.write_size is not None:
|
||||
|
|
@ -180,6 +180,7 @@ class port_data(design.design):
|
|||
# Precharge will be shifted left if needed
|
||||
self.precharge_array = factory.create(module_type="precharge_array",
|
||||
columns=self.num_cols + 1,
|
||||
port=self.port,
|
||||
bitcell_bl=self.bl_names[self.port],
|
||||
bitcell_br=self.br_names[self.port])
|
||||
self.add_mod(self.precharge_array)
|
||||
|
|
@ -195,6 +196,7 @@ class port_data(design.design):
|
|||
if self.col_addr_size > 0:
|
||||
self.column_mux_array = factory.create(module_type="column_mux_array",
|
||||
columns=self.num_cols,
|
||||
port=self.port,
|
||||
word_size=self.word_size,
|
||||
bitcell_bl=self.bl_names[self.port],
|
||||
bitcell_br=self.br_names[self.port])
|
||||
|
|
@ -250,6 +252,7 @@ class port_data(design.design):
|
|||
# module, which happens before we create the real precharge_array
|
||||
self.precharge_array = factory.create(module_type="precharge_array",
|
||||
columns=self.num_cols + 1,
|
||||
port=self.port,
|
||||
bitcell_bl=self.bl_names[self.port],
|
||||
bitcell_br=self.br_names[self.port])
|
||||
|
||||
|
|
@ -444,7 +447,7 @@ class port_data(design.design):
|
|||
|
||||
def route_sense_amp_out(self, port):
|
||||
""" Add pins for the sense amp output """
|
||||
|
||||
|
||||
for bit in range(self.word_size):
|
||||
data_pin = self.sense_amp_array_inst.get_pin("data_{}".format(bit))
|
||||
self.add_layout_pin_rect_center(text="dout_{0}".format(bit),
|
||||
|
|
@ -469,45 +472,37 @@ class port_data(design.design):
|
|||
bank_wmask_name = "bank_wmask_{}".format(bit)
|
||||
self.copy_layout_pin(self.write_mask_and_array_inst, wmask_in_name, bank_wmask_name)
|
||||
|
||||
def route_write_mask_and_array_to_write_driver(self,port):
|
||||
""" Routing of wdriver_sel_{} between write mask AND array and write driver array. Adds layout pin for write
|
||||
mask AND array output and via for write driver enable """
|
||||
def route_write_mask_and_array_to_write_driver(self, port):
|
||||
"""
|
||||
Routing of wdriver_sel_{} between write mask AND array and
|
||||
write driver array. Adds layout pin for write
|
||||
mask AND array output and via for write driver enable
|
||||
"""
|
||||
|
||||
inst1 = self.write_mask_and_array_inst
|
||||
inst2 = self.write_driver_array_inst
|
||||
wmask_inst = self.write_mask_and_array_inst
|
||||
wdriver_inst = self.write_driver_array_inst
|
||||
|
||||
loc = 0
|
||||
for bit in range(self.num_wmasks):
|
||||
# Bring write mask AND array output pin to port data level
|
||||
self.copy_layout_pin(inst1, "wmask_out_{0}".format(bit), "wdriver_sel_{0}".format(bit))
|
||||
self.copy_layout_pin(wmask_inst, "wmask_out_{0}".format(bit), "wdriver_sel_{0}".format(bit))
|
||||
|
||||
wmask_out_pin = inst1.get_pin("wmask_out_{0}".format(bit))
|
||||
wdriver_en_pin = inst2.get_pin("en_{0}".format(bit))
|
||||
wmask_out_pin = wmask_inst.get_pin("wmask_out_{0}".format(bit))
|
||||
wdriver_en_pin = wdriver_inst.get_pin("en_{0}".format(bit))
|
||||
|
||||
# The metal2 wdriver_sel_{} wire must hit the en_{} pin after the closest bitline pin that's right of the
|
||||
# the wdriver_sel_{} pin in the write driver AND array.
|
||||
if bit == 0:
|
||||
# When the write mask output pin is right of the bitline, the target is found
|
||||
while (wmask_out_pin.lx() + self.m2_pitch > inst2.get_pin("data_{0}".format(loc)).rx()):
|
||||
loc += 1
|
||||
length = inst2.get_pin("data_{0}".format(loc)).rx() + self.m2_pitch
|
||||
debug.check(loc<=self.num_wmasks,
|
||||
"Couldn't route the write mask select.")
|
||||
else:
|
||||
# Stride by the write size rather than finding the next pin to the right
|
||||
loc += self.write_size
|
||||
length = inst2.get_pin("data_{0}".format(loc)).rx() + self.m2_pitch
|
||||
wmask_pos = wmask_out_pin.center()
|
||||
wdriver_pos = wdriver_en_pin.rc() - vector(self.m2_pitch, 0)
|
||||
mid_pos = vector(wdriver_pos.x, wmask_pos.y)
|
||||
|
||||
beg_pos = wmask_out_pin.center()
|
||||
middle_pos = vector(length, wmask_out_pin.cy())
|
||||
end_pos = vector(length, wdriver_en_pin.cy())
|
||||
|
||||
# Add driver on mask output
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=wmask_pos)
|
||||
# Add via for the write driver array's enable input
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=end_pos)
|
||||
offset=wdriver_pos)
|
||||
|
||||
# Route between write mask AND array and write driver array
|
||||
self.add_wire(self.m1_stack, [beg_pos, middle_pos, end_pos])
|
||||
self.add_wire(self.m1_stack, [wmask_pos, mid_pos, wdriver_pos])
|
||||
|
||||
def route_column_mux_to_precharge_array(self, port):
|
||||
""" Routing of BL and BR between col mux and precharge array """
|
||||
|
|
@ -516,15 +511,12 @@ class port_data(design.design):
|
|||
if self.col_addr_size==0:
|
||||
return
|
||||
|
||||
inst1 = self.column_mux_array_inst
|
||||
inst2 = self.precharge_array_inst
|
||||
start_bit = 1 if self.port == 0 else 0
|
||||
|
||||
insn2_start_bit = 1 if self.port == 0 else 0
|
||||
|
||||
self.connect_bitlines(inst1=inst1,
|
||||
inst2=inst2,
|
||||
self.connect_bitlines(inst1=self.column_mux_array_inst,
|
||||
inst2=self.precharge_array_inst,
|
||||
num_bits=self.num_cols,
|
||||
inst2_start_bit=insn2_start_bit)
|
||||
inst2_start_bit=start_bit)
|
||||
|
||||
def route_sense_amp_to_column_mux_or_precharge_array(self, port):
|
||||
""" Routing of BL and BR between sense_amp and column mux or precharge array """
|
||||
|
|
@ -545,11 +537,20 @@ class port_data(design.design):
|
|||
else:
|
||||
start_bit=0
|
||||
|
||||
self.channel_route_bitlines(inst1=inst1,
|
||||
inst1_bls_template=inst1_bls_templ,
|
||||
inst2=inst2,
|
||||
num_bits=self.word_size,
|
||||
inst1_start_bit=start_bit)
|
||||
# This could be a channel route, but in some techs the bitlines
|
||||
# are too close together.
|
||||
if OPTS.tech_name == "s8":
|
||||
self.connect_bitlines(inst1=inst1,
|
||||
inst1_bls_template=inst1_bls_templ,
|
||||
inst2=inst2,
|
||||
num_bits=self.word_size,
|
||||
inst1_start_bit=start_bit)
|
||||
else:
|
||||
self.channel_route_bitlines(inst1=inst1,
|
||||
inst1_bls_template=inst1_bls_templ,
|
||||
inst2=inst2,
|
||||
num_bits=self.word_size,
|
||||
inst1_start_bit=start_bit)
|
||||
|
||||
def route_write_driver_to_column_mux_or_precharge_array(self, port):
|
||||
""" Routing of BL and BR between sense_amp and column mux or precharge array """
|
||||
|
|
@ -569,22 +570,30 @@ class port_data(design.design):
|
|||
else:
|
||||
start_bit=0
|
||||
|
||||
self.channel_route_bitlines(inst1=inst1, inst2=inst2,
|
||||
num_bits=self.word_size,
|
||||
inst1_bls_template=inst1_bls_templ,
|
||||
inst1_start_bit=start_bit)
|
||||
|
||||
# This could be a channel route, but in some techs the bitlines
|
||||
# are too close together.
|
||||
if OPTS.tech_name == "s8":
|
||||
self.connect_bitlines(inst1=inst1, inst2=inst2,
|
||||
num_bits=self.word_size,
|
||||
inst1_bls_template=inst1_bls_templ,
|
||||
inst1_start_bit=start_bit)
|
||||
else:
|
||||
self.channel_route_bitlines(inst1=inst1, inst2=inst2,
|
||||
num_bits=self.word_size,
|
||||
inst1_bls_template=inst1_bls_templ,
|
||||
inst1_start_bit=start_bit)
|
||||
|
||||
def route_write_driver_to_sense_amp(self, port):
|
||||
""" Routing of BL and BR between write driver and sense amp """
|
||||
|
||||
inst1 = self.write_driver_array_inst
|
||||
inst2 = self.sense_amp_array_inst
|
||||
|
||||
# These should be pitch matched in the cell library,
|
||||
# but just in case, do a channel route.
|
||||
self.channel_route_bitlines(inst1=inst1,
|
||||
inst2=inst2,
|
||||
num_bits=self.word_size)
|
||||
# This could be a channel route, but in some techs the bitlines
|
||||
# are too close together.
|
||||
self.connect_bitlines(inst1=inst1,
|
||||
inst2=inst2,
|
||||
num_bits=self.word_size)
|
||||
|
||||
def route_bitline_pins(self):
|
||||
""" Add the bitline pins for the given port """
|
||||
|
|
@ -687,25 +696,19 @@ class port_data(design.design):
|
|||
Route the bl and br of two modules using the channel router.
|
||||
"""
|
||||
|
||||
bot_inst_group, top_inst_group = self._group_bitline_instances(
|
||||
inst1, inst2, num_bits,
|
||||
inst1_bls_template, inst1_start_bit,
|
||||
inst2_bls_template, inst2_start_bit)
|
||||
bot_inst_group, top_inst_group = self._group_bitline_instances(inst1, inst2, num_bits,
|
||||
inst1_bls_template, inst1_start_bit,
|
||||
inst2_bls_template, inst2_start_bit)
|
||||
|
||||
# Channel route each mux separately since we don't minimize the number
|
||||
# of tracks in teh channel router yet. If we did, we could route all the bits at once!
|
||||
offset = bot_inst_group.inst.ul() + vector(0, self.m1_pitch)
|
||||
offset = bot_inst_group.inst.ul() + vector(0, self.m1_nonpref_pitch)
|
||||
for bit in range(num_bits):
|
||||
bottom_names = self._get_bitline_pins(bot_inst_group, bit)
|
||||
top_names = self._get_bitline_pins(top_inst_group, bit)
|
||||
|
||||
if bottom_names[0].layer == "m2":
|
||||
bitline_dirs = ("H", "V")
|
||||
elif bottom_names[0].layer == "m1":
|
||||
bitline_dirs = ("V", "H")
|
||||
|
||||
route_map = list(zip(bottom_names, top_names))
|
||||
self.create_horizontal_channel_route(route_map, offset, self.m1_stack, bitline_dirs)
|
||||
self.create_horizontal_channel_route(route_map, offset, self.m1_stack)
|
||||
|
||||
def connect_bitlines(self, inst1, inst2, num_bits,
|
||||
inst1_bls_template="{inst}_{bit}",
|
||||
|
|
@ -717,11 +720,10 @@ class port_data(design.design):
|
|||
This assumes that they have sufficient space to create a jog
|
||||
in the middle between the two modules (if needed).
|
||||
"""
|
||||
|
||||
bot_inst_group, top_inst_group = self._group_bitline_instances(
|
||||
inst1, inst2, num_bits,
|
||||
inst1_bls_template, inst1_start_bit,
|
||||
inst2_bls_template, inst2_start_bit)
|
||||
|
||||
bot_inst_group, top_inst_group = self._group_bitline_instances(inst1, inst2, num_bits,
|
||||
inst1_bls_template, inst1_start_bit,
|
||||
inst2_bls_template, inst2_start_bit)
|
||||
|
||||
for col in range(num_bits):
|
||||
bot_bl_pin, bot_br_pin = self._get_bitline_pins(bot_inst_group, col)
|
||||
|
|
@ -729,18 +731,11 @@ class port_data(design.design):
|
|||
bot_bl, bot_br = bot_bl_pin.uc(), bot_br_pin.uc()
|
||||
top_bl, top_br = top_bl_pin.bc(), top_br_pin.bc()
|
||||
|
||||
yoffset = 0.5 * (top_bl.y + bot_bl.y)
|
||||
self.add_path("m2", [bot_bl,
|
||||
vector(bot_bl.x, yoffset),
|
||||
vector(top_bl.x, yoffset),
|
||||
top_bl])
|
||||
self.add_path("m2", [bot_br,
|
||||
vector(bot_br.x, yoffset),
|
||||
vector(top_br.x, yoffset),
|
||||
top_br])
|
||||
|
||||
layer_pitch = getattr(self, "{}_pitch".format(top_bl_pin.layer))
|
||||
self.add_zjog(bot_bl_pin.layer, bot_bl, top_bl, "V", top_bl_pin.by() - layer_pitch)
|
||||
self.add_zjog(bot_br_pin.layer, bot_br, top_br, "V", top_bl_pin.by() - 2 * layer_pitch)
|
||||
|
||||
def graph_exclude_precharge(self):
|
||||
"""Precharge adds a loop between bitlines, can be excluded to reduce complexity"""
|
||||
if self.precharge_array_inst:
|
||||
self.graph_inst_exclude.add(self.precharge_array_inst)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#
|
||||
import design
|
||||
import debug
|
||||
from tech import drc
|
||||
from vector import vector
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
|
|
@ -19,13 +18,14 @@ class precharge_array(design.design):
|
|||
of bit line columns, height is the height of the bit-cell array.
|
||||
"""
|
||||
|
||||
def __init__(self, name, columns, size=1, bitcell_bl="bl", bitcell_br="br"):
|
||||
def __init__(self, name, columns, port, size=1, bitcell_bl="bl", bitcell_br="br"):
|
||||
design.design.__init__(self, name)
|
||||
debug.info(1, "Creating {0}".format(self.name))
|
||||
self.add_comment("cols: {0} size: {1} bl: {2} br: {3}".format(columns, size, bitcell_bl, bitcell_br))
|
||||
|
||||
self.columns = columns
|
||||
self.size = size
|
||||
self.port = port
|
||||
self.bitcell_bl = bitcell_bl
|
||||
self.bitcell_br = bitcell_br
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ class precharge_array(design.design):
|
|||
xoffset = 0
|
||||
for i in range(self.columns):
|
||||
tempx = xoffset
|
||||
if cell_properties.bitcell.mirror.y and (i + 1) % 2:
|
||||
if cell_properties.bitcell.mirror.y and (i + 1 + self.port) % 2:
|
||||
mirror = "MY"
|
||||
tempx = tempx + self.pc_cell.width
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California
|
||||
# Copyright (c) 2016-2019 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
|
||||
import debug
|
||||
import design
|
||||
from tech import drc, spice
|
||||
from tech import drc, spice, cell_properties
|
||||
from vector import vector
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
|
|
@ -34,11 +34,11 @@ class replica_bitcell_array(design.design):
|
|||
|
||||
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/cols plus replica for each port
|
||||
self.extra_rows = 2 + left_rbl + right_rbl
|
||||
self.extra_cols = 2 + left_rbl + right_rbl
|
||||
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
|
@ -46,8 +46,8 @@ class replica_bitcell_array(design.design):
|
|||
# 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()
|
||||
|
|
@ -55,15 +55,15 @@ class replica_bitcell_array(design.design):
|
|||
self.create_instances()
|
||||
|
||||
def add_modules(self):
|
||||
""" Array and dummy/replica columns
|
||||
""" 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
|
||||
b or B = bitcell
|
||||
replica columns 1
|
||||
v v
|
||||
bdDDDDDDDDDDDDDDdb <- Dummy row
|
||||
bdDDDDDDDDDDDDDDrb <- Dummy row
|
||||
bdDDDDDDDDDDDDDDdb <- Dummy row
|
||||
bdDDDDDDDDDDDDDDrb <- Dummy row
|
||||
br--------------rb
|
||||
br| Array |rb
|
||||
br| row x col |rb
|
||||
|
|
@ -91,14 +91,16 @@ class replica_bitcell_array(design.design):
|
|||
# Replica bitlines
|
||||
self.replica_columns = {}
|
||||
for bit in range(self.left_rbl+self.right_rbl):
|
||||
# Creating left_rbl
|
||||
if bit<self.left_rbl:
|
||||
replica_bit = bit+1
|
||||
# dummy column
|
||||
column_offset = 1
|
||||
column_offset = self.left_rbl - bit
|
||||
# Creating right_rbl
|
||||
else:
|
||||
replica_bit = bit+self.row_size+1
|
||||
# dummy column + replica column + bitcell colums
|
||||
column_offset = 3 + self.row_size
|
||||
column_offset = self.left_rbl - bit + self.row_size
|
||||
self.replica_columns[bit] = factory.create(module_type="replica_column",
|
||||
rows=self.row_size,
|
||||
left_rbl=self.left_rbl,
|
||||
|
|
@ -106,7 +108,7 @@ class replica_bitcell_array(design.design):
|
|||
column_offset=column_offset,
|
||||
replica_bit=replica_bit)
|
||||
self.add_mod(self.replica_columns[bit])
|
||||
|
||||
|
||||
# Dummy row
|
||||
self.dummy_row = factory.create(module_type="dummy_array",
|
||||
cols=self.column_size,
|
||||
|
|
@ -116,15 +118,35 @@ class replica_bitcell_array(design.design):
|
|||
mirror=0)
|
||||
self.add_mod(self.dummy_row)
|
||||
|
||||
# Dummy col (mirror starting at first if odd replica+dummy rows)
|
||||
self.dummy_col_left = factory.create(module_type="dummy_array",
|
||||
|
||||
# If there are bitcell end caps, replace the dummy cells on the edge of the bitcell array with end caps.
|
||||
try:
|
||||
end_caps_enabled = cell_properties.bitcell.end_caps
|
||||
except AttributeError:
|
||||
end_caps_enabled = False
|
||||
|
||||
# Dummy Row or Col Cap, depending on bitcell array properties
|
||||
edge_row_module_type = ("col_cap_array" if end_caps_enabled else "dummy_array")
|
||||
|
||||
self.edge_row = factory.create(module_type=edge_row_module_type,
|
||||
cols=self.column_size,
|
||||
rows=1,
|
||||
# dummy column + left replica column
|
||||
column_offset=1 + self.left_rbl,
|
||||
mirror=0)
|
||||
self.add_mod(self.edge_row)
|
||||
|
||||
# Dummy Col or Row Cap, depending on bitcell array properties
|
||||
edge_col_module_type = ("row_cap_array" if end_caps_enabled else "dummy_array")
|
||||
|
||||
self.edge_col_left = factory.create(module_type=edge_col_module_type,
|
||||
cols=1,
|
||||
column_offset=0,
|
||||
rows=self.row_size + self.extra_rows,
|
||||
mirror=(self.left_rbl+1)%2)
|
||||
self.add_mod(self.dummy_col_left)
|
||||
self.add_mod(self.edge_col_left)
|
||||
|
||||
self.dummy_col_right = factory.create(module_type="dummy_array",
|
||||
self.edge_col_right = factory.create(module_type=edge_col_module_type,
|
||||
cols=1,
|
||||
# dummy column
|
||||
# + left replica column
|
||||
|
|
@ -133,9 +155,7 @@ class replica_bitcell_array(design.design):
|
|||
column_offset=1 + self.left_rbl + self.column_size + self.right_rbl,
|
||||
rows=self.row_size + self.extra_rows,
|
||||
mirror=(self.left_rbl+1)%2)
|
||||
self.add_mod(self.dummy_col_right)
|
||||
|
||||
|
||||
self.add_mod(self.edge_col_right)
|
||||
|
||||
def add_pins(self):
|
||||
self.bitcell_array_wl_names = self.bitcell_array.get_all_wordline_names()
|
||||
|
|
@ -150,7 +170,7 @@ class replica_bitcell_array(design.design):
|
|||
self.rbl_bl_names = {}
|
||||
self.rbl_br_names = {}
|
||||
self.rbl_wl_names = {}
|
||||
|
||||
|
||||
# Create the full WL names include dummy, replica, and regular bit cells
|
||||
self.replica_col_wl_names = []
|
||||
self.replica_col_wl_names.extend(["{0}_bot".format(x) for x in self.dummy_cell_wl_names])
|
||||
|
|
@ -193,7 +213,7 @@ class replica_bitcell_array(design.design):
|
|||
wl_names = ["rbl_{0}_{1}".format(x,port) for x in self.cell.get_all_wl_names()]
|
||||
#wl_names[port] = "rbl_wl{}".format(port)
|
||||
self.replica_wl_names[port] = wl_names
|
||||
|
||||
|
||||
|
||||
# External pins
|
||||
self.add_pin_list(self.bitcell_array_bl_names, "INOUT")
|
||||
|
|
@ -204,22 +224,22 @@ class replica_bitcell_array(design.design):
|
|||
self.add_pin(bl_name,"OUTPUT")
|
||||
self.add_pin(br_name,"OUTPUT")
|
||||
self.add_pin_list(self.bitcell_array_wl_names, "INPUT")
|
||||
# Need to sort by port order since dictionary values may not be in order
|
||||
# Need to sort by port order since dictionary values may not be in order
|
||||
wl_names = [self.rbl_wl_names[x] for x in sorted(self.rbl_wl_names.keys())]
|
||||
for pin_name in wl_names:
|
||||
self.add_pin(pin_name,"INPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
|
||||
|
||||
def create_instances(self):
|
||||
""" Create the module instances used in this design """
|
||||
|
||||
supplies = ["vdd", "gnd"]
|
||||
|
||||
|
||||
# Used for names/dimensions only
|
||||
self.cell = factory.create(module_type="bitcell")
|
||||
|
||||
|
||||
# Main array
|
||||
self.bitcell_array_inst=self.add_inst(name="bitcell_array",
|
||||
mod=self.bitcell_array)
|
||||
|
|
@ -231,35 +251,33 @@ class replica_bitcell_array(design.design):
|
|||
self.replica_col_inst[port]=self.add_inst(name="replica_col_{}".format(port),
|
||||
mod=self.replica_columns[port])
|
||||
self.connect_inst(self.replica_bl_names[port] + self.replica_col_wl_names + supplies)
|
||||
|
||||
|
||||
|
||||
|
||||
# Dummy rows under the bitcell array (connected with with the replica cell wl)
|
||||
self.dummy_row_replica_inst = {}
|
||||
for port in range(self.left_rbl+self.right_rbl):
|
||||
self.dummy_row_replica_inst[port]=self.add_inst(name="dummy_row_{}".format(port),
|
||||
mod=self.dummy_row)
|
||||
self.connect_inst(self.dummy_row_bl_names + self.replica_wl_names[port] + supplies)
|
||||
|
||||
|
||||
# Top/bottom dummy rows
|
||||
|
||||
|
||||
# Top/bottom dummy rows or col caps
|
||||
self.dummy_row_bot_inst=self.add_inst(name="dummy_row_bot",
|
||||
mod=self.dummy_row)
|
||||
mod=self.edge_row)
|
||||
self.connect_inst(self.dummy_row_bl_names + [x+"_bot" for x in self.dummy_cell_wl_names] + supplies)
|
||||
self.dummy_row_top_inst=self.add_inst(name="dummy_row_top",
|
||||
mod=self.dummy_row)
|
||||
mod=self.edge_row)
|
||||
self.connect_inst(self.dummy_row_bl_names + [x+"_top" for x in self.dummy_cell_wl_names] + supplies)
|
||||
|
||||
|
||||
# Left/right Dummy columns
|
||||
self.dummy_col_left_inst=self.add_inst(name="dummy_col_left",
|
||||
mod=self.dummy_col_left)
|
||||
mod=self.edge_col_left)
|
||||
self.connect_inst([x+"_left" for x in self.dummy_cell_bl_names] + self.dummy_col_wl_names + supplies)
|
||||
self.dummy_col_right_inst=self.add_inst(name="dummy_col_right",
|
||||
mod=self.dummy_col_right)
|
||||
mod=self.edge_col_right)
|
||||
self.connect_inst([x+"_right" for x in self.dummy_cell_bl_names] + self.dummy_col_wl_names + supplies)
|
||||
|
||||
|
||||
|
||||
def create_layout(self):
|
||||
|
||||
self.height = (self.row_size+self.extra_rows)*self.dummy_row.height
|
||||
|
|
@ -267,7 +285,7 @@ class replica_bitcell_array(design.design):
|
|||
|
||||
# This is a bitcell x bitcell offset to scale
|
||||
offset = vector(self.cell.width, self.cell.height)
|
||||
|
||||
|
||||
self.bitcell_array_inst.place(offset=[0,0])
|
||||
|
||||
# To the left of the bitcell array
|
||||
|
|
@ -276,7 +294,6 @@ class replica_bitcell_array(design.design):
|
|||
# To the right of the bitcell array
|
||||
for bit in range(self.right_rbl):
|
||||
self.replica_col_inst[self.left_rbl+bit].place(offset=offset.scale(bit,-self.left_rbl-1)+self.bitcell_array_inst.lr())
|
||||
|
||||
|
||||
# Far top dummy row (first row above array is NOT flipped)
|
||||
flip_dummy = self.right_rbl%2
|
||||
|
|
@ -298,17 +315,17 @@ class replica_bitcell_array(design.design):
|
|||
for bit in range(self.right_rbl):
|
||||
self.dummy_row_replica_inst[self.left_rbl+bit].place(offset=offset.scale(0,bit+bit%2)+self.bitcell_array_inst.ul(),
|
||||
mirror="MX" if bit%2 else "R0")
|
||||
|
||||
|
||||
|
||||
self.translate_all(offset.scale(-1-self.left_rbl,-1-self.left_rbl))
|
||||
|
||||
|
||||
self.add_layout_pins()
|
||||
|
||||
|
||||
self.add_boundary()
|
||||
|
||||
|
||||
self.DRC_LVS()
|
||||
|
||||
|
||||
|
||||
def add_layout_pins(self):
|
||||
""" Add the layout pins """
|
||||
|
||||
|
|
@ -341,10 +358,10 @@ class replica_bitcell_array(design.design):
|
|||
for (pin_name,wl_name) in zip(self.cell.get_all_wl_names(),self.replica_wl_names[port]):
|
||||
# +1 for dummy row
|
||||
pin_bit = port+1
|
||||
# +row_size if above the array
|
||||
# +row_size if above the array
|
||||
if port>=self.left_rbl:
|
||||
pin_bit += self.row_size
|
||||
|
||||
|
||||
pin_name += "_{}".format(pin_bit)
|
||||
pin = inst.get_pin(pin_name)
|
||||
if wl_name in self.rbl_wl_names.values():
|
||||
|
|
@ -354,36 +371,41 @@ class replica_bitcell_array(design.design):
|
|||
width=self.width,
|
||||
height=pin.height())
|
||||
|
||||
|
||||
# Replica bitlines
|
||||
for port in range(self.left_rbl+self.right_rbl):
|
||||
for port in range(self.left_rbl + self.right_rbl):
|
||||
inst = self.replica_col_inst[port]
|
||||
for (pin_name, bl_name) in zip(self.cell.get_all_bitline_names(),self.replica_bl_names[port]):
|
||||
for (pin_name, bl_name) in zip(self.cell.get_all_bitline_names(), self.replica_bl_names[port]):
|
||||
pin = inst.get_pin(pin_name)
|
||||
if bl_name in self.rbl_bl_names or bl_name in self.rbl_br_names:
|
||||
name = bl_name
|
||||
else:
|
||||
name = "rbl_{0}_{1}".format(pin_name,port)
|
||||
name = "rbl_{0}_{1}".format(pin_name, port)
|
||||
self.add_layout_pin(text=name,
|
||||
layer=pin.layer,
|
||||
offset=pin.ll().scale(1,0),
|
||||
offset=pin.ll().scale(1, 0),
|
||||
width=pin.width(),
|
||||
height=self.height)
|
||||
|
||||
|
||||
for pin_name in ["vdd","gnd"]:
|
||||
# For specific technologies, there is no vdd via within the bitcell. Instead vdd is connect via end caps.
|
||||
try:
|
||||
bitcell_no_vdd_pin = cell_properties.bitcell.no_vdd_via
|
||||
except AttributeError:
|
||||
bitcell_no_vdd_pin = False
|
||||
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
for inst in self.insts:
|
||||
pin_list = inst.get_pins(pin_name)
|
||||
for pin in pin_list:
|
||||
self.add_power_pin(name=pin_name, loc=pin.center(), vertical=True, start_layer=pin.layer)
|
||||
if not (pin_name == "vdd" and bitcell_no_vdd_pin):
|
||||
self.add_power_pin(name=pin_name,
|
||||
loc=pin.center(),
|
||||
directions=("V", "V"),
|
||||
start_layer=pin.layer)
|
||||
|
||||
|
||||
|
||||
|
||||
def get_rbl_wl_name(self, port):
|
||||
""" Return the WL for the given RBL port """
|
||||
return self.rbl_wl_names[port]
|
||||
|
||||
|
||||
def get_rbl_bl_name(self, port):
|
||||
""" Return the BL for the given RBL port """
|
||||
return self.rbl_bl_names[port]
|
||||
|
|
@ -395,17 +417,17 @@ class replica_bitcell_array(design.design):
|
|||
def analytical_power(self, corner, load):
|
||||
"""Power of Bitcell array and bitline in nW."""
|
||||
from tech import drc, parameter
|
||||
|
||||
|
||||
# Dynamic Power from Bitline
|
||||
bl_wire = self.gen_bl_wire()
|
||||
cell_load = 2 * bl_wire.return_input_cap()
|
||||
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
|
||||
|
||||
#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)
|
||||
|
|
@ -431,13 +453,13 @@ class replica_bitcell_array(design.design):
|
|||
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)
|
||||
|
||||
|
||||
def graph_exclude_replica_col_bits(self):
|
||||
"""Exclude all replica/dummy cells in the replica columns except the replica bit."""
|
||||
|
||||
|
||||
for port in range(self.left_rbl+self.right_rbl):
|
||||
self.replica_columns[port].exclude_all_but_replica()
|
||||
|
||||
def get_cell_name(self, inst_name, row, col):
|
||||
"""Gets the spice name of the target bitcell."""
|
||||
return self.bitcell_array.get_cell_name(inst_name+'.x'+self.bitcell_array_inst.name, row, col)
|
||||
return self.bitcell_array.get_cell_name(inst_name+'.x'+self.bitcell_array_inst.name, row, col)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California
|
||||
# Copyright (c) 2016-2019 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
import design
|
||||
from tech import drc
|
||||
from tech import drc, cell_properties
|
||||
import contact
|
||||
from sram_factory import factory
|
||||
from vector import vector
|
||||
|
|
@ -16,7 +16,7 @@ class replica_column(design.design):
|
|||
Generate a replica bitline column for the replica array.
|
||||
Rows is the total number of rows i the main array.
|
||||
Left_rbl and right_rbl are the number of left and right replica bitlines.
|
||||
Replica bit specifies which replica column this is (to determine where to put the
|
||||
Replica bit specifies which replica column this is (to determine where to put the
|
||||
replica cell.
|
||||
"""
|
||||
|
||||
|
|
@ -31,15 +31,15 @@ class replica_column(design.design):
|
|||
# left, right, regular rows plus top/bottom dummy cells
|
||||
self.total_size = self.left_rbl+rows+self.right_rbl+2
|
||||
self.column_offset = column_offset
|
||||
|
||||
|
||||
debug.check(replica_bit!=0 and replica_bit!=rows,"Replica bit cannot be the dummy row.")
|
||||
debug.check(replica_bit<=left_rbl or replica_bit>=self.total_size-right_rbl-1,
|
||||
"Replica bit cannot be in the regular array.")
|
||||
"Replica bit cannot be in the regular array.")
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_modules()
|
||||
self.add_pins()
|
||||
|
|
@ -47,7 +47,7 @@ class replica_column(design.design):
|
|||
|
||||
def create_layout(self):
|
||||
self.height = self.total_size*self.cell.height
|
||||
self.width = self.cell.width
|
||||
self.width = self.cell.width
|
||||
|
||||
self.place_instances()
|
||||
self.add_layout_pins()
|
||||
|
|
@ -55,7 +55,7 @@ class replica_column(design.design):
|
|||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
|
||||
|
||||
for bl_name in self.cell.get_all_bitline_names():
|
||||
# In the replica column, these are only outputs!
|
||||
self.add_pin("{0}_{1}".format(bl_name,0), "OUTPUT")
|
||||
|
|
@ -63,7 +63,7 @@ class replica_column(design.design):
|
|||
for row in range(self.total_size):
|
||||
for wl_name in self.cell.get_all_wl_names():
|
||||
self.add_pin("{0}_{1}".format(wl_name,row), "INPUT")
|
||||
|
||||
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
|
|
@ -72,27 +72,48 @@ class replica_column(design.design):
|
|||
self.add_mod(self.replica_cell)
|
||||
self.dummy_cell = factory.create(module_type="dummy_bitcell")
|
||||
self.add_mod(self.dummy_cell)
|
||||
try:
|
||||
edge_module_type = ("col_cap_bitcell" if cell_properties.bitcell.end_caps else "dummy_bitcell")
|
||||
except AttributeError:
|
||||
edge_module_type = "dummy_bitcell"
|
||||
self.edge_cell = factory.create(module_type=edge_module_type)
|
||||
self.add_mod(self.edge_cell)
|
||||
# Used for pin names only
|
||||
self.cell = factory.create(module_type="bitcell")
|
||||
|
||||
|
||||
def create_instances(self):
|
||||
|
||||
try:
|
||||
end_caps_enabled = cell_properties.bitcell.end_caps
|
||||
except AttributeError:
|
||||
end_caps_enabled = False
|
||||
|
||||
self.cell_inst = {}
|
||||
for row in range(self.total_size):
|
||||
name="rbc_{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.
|
||||
# Replic bit specifies which other bit (in the full range (0,rows) to make a replica cell.
|
||||
if (row>self.left_rbl and row<self.total_size-self.right_rbl-1):
|
||||
self.cell_inst[row]=self.add_inst(name=name,
|
||||
mod=self.replica_cell)
|
||||
self.connect_inst(self.get_bitcell_pins(0, row))
|
||||
elif row==self.replica_bit:
|
||||
self.cell_inst[row]=self.add_inst(name=name,
|
||||
mod=self.replica_cell)
|
||||
self.connect_inst(self.get_bitcell_pins(0, row))
|
||||
elif (row == 0 or row == self.total_size - 1):
|
||||
self.cell_inst[row]=self.add_inst(name=name,
|
||||
mod=self.edge_cell)
|
||||
if end_caps_enabled:
|
||||
self.connect_inst(self.get_bitcell_pins_col_cap(0, row))
|
||||
else:
|
||||
self.connect_inst(self.get_bitcell_pins(0, row))
|
||||
else:
|
||||
self.cell_inst[row]=self.add_inst(name=name,
|
||||
mod=self.dummy_cell)
|
||||
self.connect_inst(self.get_bitcell_pins(0, row))
|
||||
|
||||
self.connect_inst(self.get_bitcell_pins(0, row))
|
||||
|
||||
def place_instances(self):
|
||||
from tech import cell_properties
|
||||
# Flip the mirrors if we have an odd number of replica+dummy rows at the bottom
|
||||
|
|
@ -127,40 +148,50 @@ class replica_column(design.design):
|
|||
self.cell_inst[row].place(offset=offset,
|
||||
mirror=dir_key)
|
||||
|
||||
|
||||
|
||||
def add_layout_pins(self):
|
||||
""" Add the layout pins """
|
||||
|
||||
|
||||
for bl_name in self.cell.get_all_bitline_names():
|
||||
bl_pin = self.cell_inst[0].get_pin(bl_name)
|
||||
self.add_layout_pin(text=bl_name,
|
||||
layer="m2",
|
||||
layer=bl_pin.layer,
|
||||
offset=bl_pin.ll(),
|
||||
width=bl_pin.width(),
|
||||
height=self.height)
|
||||
|
||||
for row in range(self.total_size):
|
||||
try:
|
||||
end_caps_enabled = cell_properties.bitcell.end_caps
|
||||
except AttributeError:
|
||||
end_caps_enabled = False
|
||||
|
||||
if end_caps_enabled:
|
||||
row_range_max = self.total_size - 1
|
||||
row_range_min = 1
|
||||
else:
|
||||
row_range_max = self.total_size
|
||||
row_range_min = 0
|
||||
|
||||
for row in range(row_range_min, row_range_max):
|
||||
for wl_name in self.cell.get_all_wl_names():
|
||||
wl_pin = self.cell_inst[row].get_pin(wl_name)
|
||||
self.add_layout_pin(text="{0}_{1}".format(wl_name,row),
|
||||
layer="m1",
|
||||
layer=wl_pin.layer,
|
||||
offset=wl_pin.ll().scale(0,1),
|
||||
width=self.width,
|
||||
height=wl_pin.height())
|
||||
|
||||
# For every second row and column, add a via for gnd and vdd
|
||||
for row in range(self.total_size):
|
||||
for row in range(row_range_min, row_range_max):
|
||||
inst = self.cell_inst[row]
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
self.copy_layout_pin(inst, pin_name)
|
||||
|
||||
def get_bitcell_pins(self, col, row):
|
||||
""" Creates a list of connections in the bitcell,
|
||||
""" Creates a list of connections in the bitcell,
|
||||
indexed by column and row, for instance use in bitcell_array """
|
||||
|
||||
bitcell_pins = []
|
||||
|
||||
|
||||
pin_names = self.cell.get_all_bitline_names()
|
||||
for pin in pin_names:
|
||||
bitcell_pins.append(pin+"_{0}".format(col))
|
||||
|
|
@ -169,12 +200,26 @@ class replica_column(design.design):
|
|||
bitcell_pins.append(pin+"_{0}".format(row))
|
||||
bitcell_pins.append("vdd")
|
||||
bitcell_pins.append("gnd")
|
||||
|
||||
|
||||
return bitcell_pins
|
||||
|
||||
|
||||
def get_bitcell_pins_col_cap(self, col, row):
|
||||
""" Creates a list of connections in the bitcell,
|
||||
indexed by column and row, for instance use in bitcell_array """
|
||||
|
||||
bitcell_pins = []
|
||||
|
||||
pin_names = self.cell.get_all_bitline_names()
|
||||
for pin in pin_names:
|
||||
bitcell_pins.append(pin+"_{0}".format(col))
|
||||
bitcell_pins.append("vdd")
|
||||
|
||||
return bitcell_pins
|
||||
|
||||
|
||||
def exclude_all_but_replica(self):
|
||||
"""Excludes all bits except the replica cell (self.replica_bit)."""
|
||||
|
||||
|
||||
for row, cell in self.cell_inst.items():
|
||||
if row != self.replica_bit:
|
||||
self.graph_inst_exclude.add(cell)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,128 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
from bitcell_base_array import bitcell_base_array
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
from tech import cell_properties
|
||||
|
||||
class row_cap_array(bitcell_base_array):
|
||||
"""
|
||||
Generate a dummy row/column for the replica array.
|
||||
"""
|
||||
def __init__(self, cols, rows, column_offset=0, mirror=0, name=""):
|
||||
super().__init__(cols, rows, name, column_offset)
|
||||
self.mirror = mirror
|
||||
|
||||
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 create_layout(self):
|
||||
|
||||
self.place_array("dummy_r{0}_c{1}", self.mirror)
|
||||
self.add_layout_pins()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_modules(self):
|
||||
""" Add the modules used in this design """
|
||||
self.dummy_cell = factory.create(module_type="row_cap_bitcell_1rw_1r") # TODO: make module_type generic
|
||||
self.add_mod(self.dummy_cell)
|
||||
|
||||
self.cell = factory.create(module_type="bitcell")
|
||||
|
||||
def create_instances(self):
|
||||
""" Create the module instances used in this design """
|
||||
self.cell_inst = {}
|
||||
for col in range(self.column_size):
|
||||
for row in range(1, self.row_size - 1):
|
||||
name = "bit_r{0}_c{1}".format(row, col)
|
||||
self.cell_inst[row,col]=self.add_inst(name=name,
|
||||
mod=self.dummy_cell)
|
||||
self.connect_inst(self.get_bitcell_pins(col, row))
|
||||
|
||||
def get_bitcell_pins(self, col, row):
|
||||
"""
|
||||
Creates a list of connections in the bitcell,
|
||||
indexed by column and row, for instance use in bitcell_array
|
||||
"""
|
||||
|
||||
pin_name = cell_properties.bitcell.cell_1rw1r.pin
|
||||
bitcell_pins = ["{0}_{1}".format(pin_name.wl0, row),
|
||||
"{0}_{1}".format(pin_name.wl1, row),
|
||||
"gnd"]
|
||||
|
||||
return bitcell_pins
|
||||
|
||||
def place_array(self, name_template, row_offset=0):
|
||||
# We increase it by a well enclosure so the precharges don't overlap our wells
|
||||
self.height = self.row_size*self.cell.height
|
||||
self.width = self.column_size*self.cell.width
|
||||
|
||||
xoffset = 0.0
|
||||
for col in range(self.column_size):
|
||||
yoffset = self.cell.height
|
||||
tempx, dir_y = self._adjust_x_offset(xoffset, col, self.column_offset)
|
||||
|
||||
for row in range(1, self.row_size - 1):
|
||||
name = name_template.format(row, col)
|
||||
tempy, dir_x = self._adjust_y_offset(yoffset, row, row_offset)
|
||||
|
||||
if dir_x and dir_y:
|
||||
dir_key = "XY"
|
||||
elif dir_x:
|
||||
dir_key = "MX"
|
||||
elif dir_y:
|
||||
dir_key = "MY"
|
||||
else:
|
||||
dir_key = ""
|
||||
|
||||
self.cell_inst[row,col].place(offset=[tempx, tempy],
|
||||
mirror=dir_key)
|
||||
yoffset += self.cell.height
|
||||
xoffset += self.cell.width
|
||||
|
||||
def add_layout_pins(self):
|
||||
""" Add the layout pins """
|
||||
|
||||
row_list = self.cell.get_all_wl_names()
|
||||
|
||||
for row in range(1, self.row_size - 1):
|
||||
for cell_row in row_list:
|
||||
wl_pin = self.cell_inst[row,0].get_pin(cell_row)
|
||||
self.add_layout_pin(text=cell_row+"_{0}".format(row),
|
||||
layer=wl_pin.layer,
|
||||
offset=wl_pin.ll().scale(0,1),
|
||||
width=self.width,
|
||||
height=wl_pin.height())
|
||||
|
||||
# Add vdd/gnd via stacks
|
||||
for row in range(1, self.row_size - 1):
|
||||
for col in range(self.column_size):
|
||||
inst = self.cell_inst[row,col]
|
||||
for pin_name in ["vdd", "gnd"]:
|
||||
for pin in inst.get_pins(pin_name):
|
||||
self.add_power_pin(name=pin.name,
|
||||
loc=pin.center(),
|
||||
start_layer=pin.layer)
|
||||
|
||||
|
||||
# def input_load(self):
|
||||
# wl_wire = self.gen_wl_wire()
|
||||
# return wl_wire.return_input_cap()
|
||||
#
|
||||
# def get_wordline_cin(self):
|
||||
# """Get the relative input capacitance from the wordline connections in all the bitcell"""
|
||||
# #A single wordline is connected to all the bitcells in a single row meaning the capacitance depends on the # of columns
|
||||
# bitcell_wl_cin = self.cell.get_wl_cin()
|
||||
# total_cin = bitcell_wl_cin * self.column_size
|
||||
# return total_cin
|
||||
|
|
@ -130,13 +130,13 @@ class sense_amp_array(design.design):
|
|||
self.add_power_pin(name="gnd",
|
||||
loc=gnd_pin.center(),
|
||||
start_layer=gnd_pin.layer,
|
||||
vertical=True)
|
||||
directions=("V", "V"))
|
||||
|
||||
vdd_pin = inst.get_pin("vdd")
|
||||
self.add_power_pin(name="vdd",
|
||||
loc=vdd_pin.center(),
|
||||
start_layer=vdd_pin.layer,
|
||||
vertical=True)
|
||||
directions=("V", "V"))
|
||||
|
||||
bl_pin = inst.get_pin(inst.mod.get_bl_names())
|
||||
br_pin = inst.get_pin(inst.mod.get_br_names())
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
#
|
||||
import design
|
||||
import debug
|
||||
from tech import layer
|
||||
from tech import layer, preferred_directions
|
||||
from vector import vector
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
|
|
@ -20,12 +20,13 @@ class single_level_column_mux_array(design.design):
|
|||
Array of column mux to read the bitlines through the 6T.
|
||||
"""
|
||||
|
||||
def __init__(self, name, columns, word_size, bitcell_bl="bl", bitcell_br="br"):
|
||||
def __init__(self, name, columns, port, word_size, bitcell_bl="bl", bitcell_br="br"):
|
||||
design.design.__init__(self, name)
|
||||
debug.info(1, "Creating {0}".format(self.name))
|
||||
self.add_comment("cols: {0} word_size: {1} bl: {2} br: {3}".format(columns, word_size, bitcell_bl, bitcell_br))
|
||||
|
||||
self.columns = columns
|
||||
self.port = port
|
||||
self.word_size = word_size
|
||||
self.words_per_row = int(self.columns / self.word_size)
|
||||
self.bitcell_bl = bitcell_bl
|
||||
|
|
@ -33,10 +34,15 @@ class single_level_column_mux_array(design.design):
|
|||
|
||||
if "li" in layer:
|
||||
self.col_mux_stack = self.li_stack
|
||||
self.col_mux_stack_pitch = self.li_pitch
|
||||
self.col_mux_stack_pitch = self.m1_pitch
|
||||
else:
|
||||
self.col_mux_stack = self.m1_stack
|
||||
self.col_mux_stack_pitch = self.m1_pitch
|
||||
|
||||
if preferred_directions[self.col_mux_stack[0]] == "V":
|
||||
self.via_directions = ("H", "H")
|
||||
else:
|
||||
self.via_directions = "pref"
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
|
|
@ -112,7 +118,7 @@ class single_level_column_mux_array(design.design):
|
|||
# For every column, add a pass gate
|
||||
for col_num in range(self.columns):
|
||||
xoffset = col_num * self.mux.width
|
||||
if cell_properties.bitcell.mirror.y and col_num % 2:
|
||||
if cell_properties.bitcell.mirror.y and (col_num + self.port) % 2:
|
||||
mirror = "MY"
|
||||
xoffset = xoffset + self.mux.width
|
||||
else:
|
||||
|
|
@ -173,73 +179,53 @@ class single_level_column_mux_array(design.design):
|
|||
self.get_pin("sel_{}".format(sel_index)).cy())
|
||||
# Add the poly contact with a shift to account for the rotation
|
||||
self.add_via_center(layers=self.poly_stack,
|
||||
offset=offset)
|
||||
offset=offset,
|
||||
directions=self.via_directions)
|
||||
self.add_path("poly", [offset, gate_offset])
|
||||
|
||||
def route_bitlines(self):
|
||||
""" Connect the output bit-lines to form the appropriate width mux """
|
||||
from tech import cell_properties
|
||||
for j in range(self.columns):
|
||||
bl_offset = self.mux_inst[j].get_pin("bl_out").bc()
|
||||
br_offset = self.mux_inst[j].get_pin("br_out").bc()
|
||||
|
||||
bl_out_offset = bl_offset - vector(0, (self.words_per_row + 1) * self.col_mux_stack_pitch)
|
||||
br_out_offset = br_offset - vector(0, (self.words_per_row + 2) * self.col_mux_stack_pitch)
|
||||
bl_offset_begin = self.mux_inst[j].get_pin("bl_out").bc()
|
||||
br_offset_begin = self.mux_inst[j].get_pin("br_out").bc()
|
||||
|
||||
bl_out_offset_end = bl_out_offset + vector(0, self.route_height)
|
||||
br_out_offset_end = br_out_offset + vector(0, self.route_height)
|
||||
bl_out_offset_begin = bl_offset_begin - vector(0, (self.words_per_row + 1) * self.col_mux_stack_pitch)
|
||||
br_out_offset_begin = br_offset_begin - vector(0, (self.words_per_row + 2) * self.col_mux_stack_pitch)
|
||||
|
||||
if cell_properties.bitcell.mirror.y and j % 2:
|
||||
tmp_bl_out_end = br_out_offset_end
|
||||
tmp_br_out_end = bl_out_offset_end
|
||||
else:
|
||||
tmp_bl_out_end = bl_out_offset_end
|
||||
tmp_br_out_end = br_out_offset_end
|
||||
|
||||
if (j % self.words_per_row) == 0:
|
||||
# Create the metal1 to connect the n-way mux output from the pass gate
|
||||
# These will be located below the select lines. Yes, these are M2 width
|
||||
# to ensure vias are enclosed and M1 min width rules.
|
||||
width = self.m2_width + self.mux.width * (self.words_per_row - 1)
|
||||
|
||||
if cell_properties.bitcell.mirror.y and (j % 2) == 0:
|
||||
bl = self.mux.get_pin("bl")
|
||||
br = self.mux.get_pin("br")
|
||||
dist = abs(bl.ll().x - br.ll().x)
|
||||
else:
|
||||
dist = 0
|
||||
|
||||
self.add_path(self.col_mux_stack[0], [bl_out_offset, bl_out_offset + vector(width + dist, 0)])
|
||||
self.add_path(self.col_mux_stack[0], [br_out_offset, br_out_offset + vector(width - dist, 0)])
|
||||
# Add the horizontal wires for the first bit
|
||||
if j % self.words_per_row == 0:
|
||||
bl_offset_end = self.mux_inst[j + self.words_per_row - 1].get_pin("bl_out").bc()
|
||||
br_offset_end = self.mux_inst[j + self.words_per_row - 1].get_pin("br_out").bc()
|
||||
bl_out_offset_end = bl_offset_end - vector(0, (self.words_per_row + 1) * self.col_mux_stack_pitch)
|
||||
br_out_offset_end = br_offset_end - vector(0, (self.words_per_row + 2) * self.col_mux_stack_pitch)
|
||||
|
||||
self.add_path(self.col_mux_stack[0], [bl_out_offset_begin, bl_out_offset_end])
|
||||
self.add_path(self.col_mux_stack[0], [br_out_offset_begin, br_out_offset_end])
|
||||
|
||||
# Extend the bitline output rails and gnd downward on the first bit of each n-way mux
|
||||
self.add_layout_pin_segment_center(text="bl_out_{}".format(int(j / self.words_per_row)),
|
||||
layer=self.col_mux_stack[2],
|
||||
start=bl_out_offset,
|
||||
end=tmp_bl_out_end)
|
||||
start=bl_offset_begin,
|
||||
end=bl_out_offset_begin)
|
||||
self.add_layout_pin_segment_center(text="br_out_{}".format(int(j / self.words_per_row)),
|
||||
layer=self.col_mux_stack[2],
|
||||
start=br_out_offset,
|
||||
end=tmp_br_out_end)
|
||||
|
||||
# This via is on the right of the wire
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=bl_out_offset)
|
||||
|
||||
# This via is on the left of the wire
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=br_out_offset)
|
||||
start=br_offset_begin,
|
||||
end=br_out_offset_begin)
|
||||
|
||||
else:
|
||||
self.add_path(self.col_mux_stack[2], [bl_out_offset, bl_offset])
|
||||
self.add_path(self.col_mux_stack[2], [br_out_offset, br_offset])
|
||||
self.add_path(self.col_mux_stack[2], [bl_out_offset_begin, bl_offset_begin])
|
||||
self.add_path(self.col_mux_stack[2], [br_out_offset_begin, br_offset_begin])
|
||||
|
||||
# This via is on the right of the wire
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=bl_out_offset)
|
||||
# This via is on the left of the wire
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=br_out_offset)
|
||||
# This via is on the right of the wire
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=bl_out_offset_begin,
|
||||
directions=self.via_directions)
|
||||
|
||||
# This via is on the left of the wire
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=br_out_offset_begin,
|
||||
directions=self.via_directions)
|
||||
|
||||
def get_drain_cin(self):
|
||||
"""Get the relative capacitance of the drain of the NMOS pass TX"""
|
||||
|
|
|
|||
|
|
@ -1,218 +0,0 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
import design
|
||||
import math
|
||||
import contact
|
||||
from vector import vector
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
from tech import cell_properties
|
||||
|
||||
|
||||
class wordline_driver(design.design):
|
||||
"""
|
||||
Creates a Wordline Driver
|
||||
Generates the wordline-driver to drive the bitcell
|
||||
"""
|
||||
|
||||
def __init__(self, name, rows, cols):
|
||||
design.design.__init__(self, name)
|
||||
debug.info(1, "Creating {0}".format(self.name))
|
||||
self.add_comment("rows: {0} cols: {1}".format(rows, cols))
|
||||
|
||||
self.rows = rows
|
||||
self.cols = cols
|
||||
|
||||
b = factory.create(module_type="bitcell")
|
||||
try:
|
||||
self.cell_multiple = cell_properties.bitcell.decoder_bitcell_multiple
|
||||
except AttributeError:
|
||||
self.cell_multiple = 1
|
||||
self.cell_height = self.cell_multiple * b.height
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_modules()
|
||||
self.add_pins()
|
||||
self.create_drivers()
|
||||
|
||||
def create_layout(self):
|
||||
self.setup_layout_constants()
|
||||
self.place_drivers()
|
||||
self.route_layout()
|
||||
self.route_vdd_gnd()
|
||||
self.offset_all_coordinates()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
# inputs to wordline_driver.
|
||||
for i in range(self.rows):
|
||||
self.add_pin("in_{0}".format(i), "INPUT")
|
||||
# Outputs from wordline_driver.
|
||||
for i in range(self.rows):
|
||||
self.add_pin("wl_{0}".format(i), "OUTPUT")
|
||||
self.add_pin("en", "INPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def add_modules(self):
|
||||
self.and2 = factory.create(module_type="pand2",
|
||||
height=self.cell_height,
|
||||
size=self.cols)
|
||||
self.add_mod(self.and2)
|
||||
|
||||
def route_vdd_gnd(self):
|
||||
"""
|
||||
Add a pin for each row of vdd/gnd which
|
||||
are must-connects next level up.
|
||||
"""
|
||||
|
||||
# Find the x offsets for where the vias/pins should be placed
|
||||
xoffset_list = [self.and_inst[0].lx()]
|
||||
for num in range(self.rows):
|
||||
# this will result in duplicate polygons for rails, but who cares
|
||||
|
||||
# use the inverter offset even though it will be the and's too
|
||||
(gate_offset, y_dir) = self.get_gate_offset(0,
|
||||
self.and2.height,
|
||||
num)
|
||||
# Route both supplies
|
||||
for name in ["vdd", "gnd"]:
|
||||
supply_pin = self.and_inst[num].get_pin(name)
|
||||
|
||||
# Add pins in two locations
|
||||
for xoffset in xoffset_list:
|
||||
pin_pos = vector(xoffset, supply_pin.cy())
|
||||
self.add_power_pin(name, pin_pos)
|
||||
|
||||
def create_drivers(self):
|
||||
self.and_inst = []
|
||||
for row in range(self.rows):
|
||||
name_and = "wl_driver_and{}".format(row)
|
||||
|
||||
# add and2
|
||||
self.and_inst.append(self.add_inst(name=name_and,
|
||||
mod=self.and2))
|
||||
self.connect_inst(["en",
|
||||
"in_{0}".format(row),
|
||||
"wl_{0}".format(row),
|
||||
"vdd", "gnd"])
|
||||
|
||||
def setup_layout_constants(self):
|
||||
# We may have more than one bitcell per decoder row
|
||||
self.num_rows = math.ceil(self.rows / self.cell_multiple)
|
||||
# We will place this many final decoders per row
|
||||
self.decoders_per_row = math.ceil(self.rows / self.num_rows)
|
||||
|
||||
def place_drivers(self):
|
||||
and2_xoffset = 2 * self.m1_width + 5 * self.m1_space
|
||||
|
||||
self.width = and2_xoffset + self.and2.width
|
||||
self.height = self.and2.height * self.num_rows
|
||||
|
||||
for row in range(self.rows):
|
||||
#row = math.floor(inst_index / self.decoders_per_row)
|
||||
#dec = inst_index % self.decoders_per_row
|
||||
|
||||
if (row % 2):
|
||||
y_offset = self.and2.height * (row + 1)
|
||||
inst_mirror = "MX"
|
||||
else:
|
||||
y_offset = self.and2.height * row
|
||||
inst_mirror = "R0"
|
||||
|
||||
# x_off = self.internal_routing_width + dec * and_mod.width
|
||||
and2_offset = [and2_xoffset, y_offset]
|
||||
|
||||
# add and2
|
||||
self.and_inst[row].place(offset=and2_offset,
|
||||
mirror=inst_mirror)
|
||||
|
||||
def route_layout(self):
|
||||
""" Route all of the signals """
|
||||
|
||||
# Wordline enable connection
|
||||
en_offset = [self.m1_width + 2 * self.m1_space, 0]
|
||||
en_pin = self.add_layout_pin(text="en",
|
||||
layer="m2",
|
||||
offset=en_offset,
|
||||
width=self.m2_width,
|
||||
height=self.height)
|
||||
|
||||
for row in range(self.rows):
|
||||
and_inst = self.and_inst[row]
|
||||
|
||||
# en connection
|
||||
a_pin = and_inst.get_pin("A")
|
||||
a_pos = a_pin.lc()
|
||||
clk_offset = vector(en_pin.bc().x, a_pos.y)
|
||||
self.add_segment_center(layer="m1",
|
||||
start=clk_offset,
|
||||
end=a_pos)
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=clk_offset)
|
||||
|
||||
# connect the decoder input pin to and2 B
|
||||
b_pin = and_inst.get_pin("B")
|
||||
b_pos = b_pin.lc()
|
||||
# needs to move down since B and input is
|
||||
# nearly aligned with A inv input
|
||||
up_or_down = self.m2_space if row % 2 else -self.m2_space
|
||||
input_offset = vector(0, b_pos.y + up_or_down)
|
||||
base_offset = vector(clk_offset.x, input_offset.y)
|
||||
contact_offset = vector(0.5 * self.m2_width + self.m2_space + 0.5 * contact.m1_via.width, 0)
|
||||
mid_via_offset = base_offset + contact_offset
|
||||
|
||||
# must under the clk line in M1
|
||||
self.add_layout_pin_segment_center(text="in_{0}".format(row),
|
||||
layer="m1",
|
||||
start=input_offset,
|
||||
end=mid_via_offset)
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=mid_via_offset,
|
||||
directions=("V", "V"))
|
||||
|
||||
# now connect to the and2 B
|
||||
self.add_path("m2", [mid_via_offset, b_pos])
|
||||
contact_offset = b_pos - vector(0.5 * contact.m1_via.height, 0)
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=contact_offset,
|
||||
directions=("H", "H"))
|
||||
|
||||
# output each WL on the right
|
||||
wl_offset = and_inst.get_pin("Z").rc()
|
||||
self.add_layout_pin_segment_center(text="wl_{0}".format(row),
|
||||
layer="m1",
|
||||
start=wl_offset,
|
||||
end=wl_offset - vector(self.m1_width, 0))
|
||||
|
||||
def determine_wordline_stage_efforts(self, external_cout, inp_is_rise=True):
|
||||
"""
|
||||
Follows the clk_buf to a wordline signal adding
|
||||
each stages stage effort to a list.
|
||||
"""
|
||||
stage_effort_list = []
|
||||
|
||||
stage1 = self.and2.get_stage_effort(external_cout, inp_is_rise)
|
||||
stage_effort_list.append(stage1)
|
||||
|
||||
return stage_effort_list
|
||||
|
||||
def get_wl_en_cin(self):
|
||||
"""
|
||||
Get the relative capacitance of all
|
||||
the enable connections in the bank
|
||||
"""
|
||||
# The enable is connected to a and2 for every row.
|
||||
total_cin = self.and2.get_cin() * self.rows
|
||||
return total_cin
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
import design
|
||||
from tech import drc, layer
|
||||
from vector import vector
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
|
||||
class wordline_driver_array(design.design):
|
||||
"""
|
||||
Creates a Wordline Driver
|
||||
Generates the wordline-driver to drive the bitcell
|
||||
"""
|
||||
|
||||
def __init__(self, name, rows, cols):
|
||||
design.design.__init__(self, name)
|
||||
debug.info(1, "Creating {0}".format(self.name))
|
||||
self.add_comment("rows: {0} cols: {1}".format(rows, cols))
|
||||
|
||||
self.rows = rows
|
||||
self.cols = cols
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_modules()
|
||||
self.add_pins()
|
||||
self.create_drivers()
|
||||
|
||||
def create_layout(self):
|
||||
if "li" in layer:
|
||||
self.route_layer = "li"
|
||||
else:
|
||||
self.route_layer = "m1"
|
||||
self.place_drivers()
|
||||
self.route_layout()
|
||||
self.route_vdd_gnd()
|
||||
self.offset_all_coordinates()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
# inputs to wordline_driver.
|
||||
for i in range(self.rows):
|
||||
self.add_pin("in_{0}".format(i), "INPUT")
|
||||
# Outputs from wordline_driver.
|
||||
for i in range(self.rows):
|
||||
self.add_pin("wl_{0}".format(i), "OUTPUT")
|
||||
self.add_pin("en", "INPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def add_modules(self):
|
||||
self.wl_driver = factory.create(module_type="wordline_driver",
|
||||
size=self.cols)
|
||||
self.add_mod(self.wl_driver)
|
||||
|
||||
def route_vdd_gnd(self):
|
||||
"""
|
||||
Add a pin for each row of vdd/gnd which
|
||||
are must-connects next level up.
|
||||
"""
|
||||
if OPTS.tech_name == "s8":
|
||||
for name in ["vdd", "gnd"]:
|
||||
supply_pins = self.wld_inst[0].get_pins(name)
|
||||
for pin in supply_pins:
|
||||
self.add_layout_pin_segment_center(text=name,
|
||||
layer=pin.layer,
|
||||
start=pin.bc(),
|
||||
end=vector(pin.cx(), self.height))
|
||||
else:
|
||||
# Find the x offsets for where the vias/pins should be placed
|
||||
xoffset_list = [self.wld_inst[0].rx()]
|
||||
for num in range(self.rows):
|
||||
# this will result in duplicate polygons for rails, but who cares
|
||||
|
||||
# use the inverter offset even though it will be the and's too
|
||||
(gate_offset, y_dir) = self.get_gate_offset(0,
|
||||
self.wl_driver.height,
|
||||
num)
|
||||
# Route both supplies
|
||||
for name in ["vdd", "gnd"]:
|
||||
supply_pin = self.wld_inst[num].get_pin(name)
|
||||
|
||||
# Add pins in two locations
|
||||
for xoffset in xoffset_list:
|
||||
pin_pos = vector(xoffset, supply_pin.cy())
|
||||
self.add_power_pin(name, pin_pos)
|
||||
|
||||
def create_drivers(self):
|
||||
self.wld_inst = []
|
||||
for row in range(self.rows):
|
||||
name_and = "wl_driver_and{}".format(row)
|
||||
|
||||
# add and2
|
||||
self.wld_inst.append(self.add_inst(name=name_and,
|
||||
mod=self.wl_driver))
|
||||
self.connect_inst(["in_{0}".format(row),
|
||||
"en",
|
||||
"wl_{0}".format(row),
|
||||
"vdd", "gnd"])
|
||||
|
||||
def place_drivers(self):
|
||||
|
||||
for row in range(self.rows):
|
||||
if (row % 2):
|
||||
y_offset = self.wl_driver.height * (row + 1)
|
||||
inst_mirror = "MX"
|
||||
else:
|
||||
y_offset = self.wl_driver.height * row
|
||||
inst_mirror = "R0"
|
||||
|
||||
and2_offset = [self.wl_driver.width, y_offset]
|
||||
|
||||
# add and2
|
||||
self.wld_inst[row].place(offset=and2_offset,
|
||||
mirror=inst_mirror)
|
||||
|
||||
# Leave a well gap to separate the bitcell array well from this well
|
||||
well_gap = 2 * drc("pwell_to_nwell") + drc("nwell_enclose_active")
|
||||
self.width = self.wl_driver.width + well_gap
|
||||
self.height = self.wl_driver.height * self.rows
|
||||
|
||||
def route_layout(self):
|
||||
""" Route all of the signals """
|
||||
|
||||
# Wordline enable connection
|
||||
en_pin = self.wld_inst[0].get_pin("B")
|
||||
en_bottom_pos = vector(en_pin.lx(), 0)
|
||||
en_pin = self.add_layout_pin(text="en",
|
||||
layer="m2",
|
||||
offset=en_bottom_pos,
|
||||
height=self.height)
|
||||
|
||||
for row in range(self.rows):
|
||||
and_inst = self.wld_inst[row]
|
||||
|
||||
# Drop a via
|
||||
b_pin = and_inst.get_pin("B")
|
||||
self.add_via_stack_center(from_layer=b_pin.layer,
|
||||
to_layer="m2",
|
||||
offset=b_pin.center())
|
||||
|
||||
# connect the decoder input pin to and2 A
|
||||
self.copy_layout_pin(and_inst, "A", "in_{0}".format(row))
|
||||
|
||||
# output each WL on the right
|
||||
wl_offset = and_inst.get_pin("Z").rc()
|
||||
self.add_layout_pin_segment_center(text="wl_{0}".format(row),
|
||||
layer=self.route_layer,
|
||||
start=wl_offset,
|
||||
end=wl_offset - vector(self.m1_width, 0))
|
||||
|
||||
def determine_wordline_stage_efforts(self, external_cout, inp_is_rise=True):
|
||||
"""
|
||||
Follows the clk_buf to a wordline signal adding
|
||||
each stages stage effort to a list.
|
||||
"""
|
||||
stage_effort_list = []
|
||||
|
||||
stage1 = self.wl_driver.get_stage_effort(external_cout, inp_is_rise)
|
||||
stage_effort_list.append(stage1)
|
||||
|
||||
return stage_effort_list
|
||||
|
||||
def get_wl_en_cin(self):
|
||||
"""
|
||||
Get the relative capacitance of all
|
||||
the enable connections in the bank
|
||||
"""
|
||||
# The enable is connected to a and2 for every row.
|
||||
total_cin = self.wl_driver.get_cin() * self.rows
|
||||
return total_cin
|
||||
|
|
@ -165,7 +165,7 @@ class write_driver_array(design.design):
|
|||
for pin in pin_list:
|
||||
self.add_power_pin(name=n,
|
||||
loc=pin.center(),
|
||||
vertical=True,
|
||||
directions=("V", "V"),
|
||||
start_layer=pin.layer)
|
||||
if self.write_size:
|
||||
for bit in range(self.num_wmasks):
|
||||
|
|
|
|||
|
|
@ -5,9 +5,7 @@
|
|||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
from math import log
|
||||
import design
|
||||
from tech import drc
|
||||
import debug
|
||||
from sram_factory import factory
|
||||
from vector import vector
|
||||
|
|
@ -43,33 +41,28 @@ class write_mask_and_array(design.design):
|
|||
self.add_pins()
|
||||
self.create_and2_array()
|
||||
|
||||
|
||||
def create_layout(self):
|
||||
self.place_and2_array()
|
||||
spacing = self.wmask_en_len - self.and2.width
|
||||
self.width = (self.num_wmasks*self.and2.width) + ((self.num_wmasks-1)*spacing)
|
||||
self.height = self.and2.height
|
||||
self.add_layout_pins()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
for bit in range(self.num_wmasks):
|
||||
self.add_pin("wmask_in_{}".format(bit),"INPUT")
|
||||
self.add_pin("wmask_in_{}".format(bit), "INPUT")
|
||||
self.add_pin("en", "INPUT")
|
||||
for bit in range(self.num_wmasks):
|
||||
self.add_pin("wmask_out_{}".format(bit),"OUTPUT")
|
||||
self.add_pin("vdd","POWER")
|
||||
self.add_pin("gnd","GROUND")
|
||||
self.add_pin("wmask_out_{}".format(bit), "OUTPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def add_modules(self):
|
||||
# Size the AND gate for the number of write drivers it drives, which is equal to the write size.
|
||||
# Assume stage effort of 3 to compute the size
|
||||
self.and2 = factory.create(module_type="pand2",
|
||||
size=self.write_size/4.0)
|
||||
size=max(self.write_size / 4.0, 1))
|
||||
self.add_mod(self.and2)
|
||||
|
||||
|
||||
def create_and2_array(self):
|
||||
self.and2_insts = {}
|
||||
for bit in range(self.num_wmasks):
|
||||
|
|
@ -81,7 +74,6 @@ class write_mask_and_array(design.design):
|
|||
"wmask_out_{}".format(bit),
|
||||
"vdd", "gnd"])
|
||||
|
||||
|
||||
def place_and2_array(self):
|
||||
# Place the write mask AND array at the start of each write driver enable length.
|
||||
# This ensures the write mask AND array will be directly under the corresponding write driver enable wire.
|
||||
|
|
@ -96,56 +88,45 @@ class write_mask_and_array(design.design):
|
|||
|
||||
self.wmask_en_len = self.words_per_row * (self.write_size * self.driver_spacing)
|
||||
debug.check(self.wmask_en_len >= self.and2.width,
|
||||
"Write mask AND is wider than the corresponding write drivers {0} vs {1}.".format(self.and2.width,self.wmask_en_len))
|
||||
"Write mask AND is wider than the corresponding write drivers {0} vs {1}.".format(self.and2.width,
|
||||
self.wmask_en_len))
|
||||
|
||||
self.width = self.bitcell.width * self.columns
|
||||
self.height = self.and2.height
|
||||
|
||||
for i in range(self.num_wmasks):
|
||||
base = vector(i * self.wmask_en_len, 0)
|
||||
self.and2_insts[i].place(base)
|
||||
|
||||
|
||||
def add_layout_pins(self):
|
||||
|
||||
# Create the enable pin that connects all write mask AND array's B pins
|
||||
beg_en_pin = self.and2_insts[0].get_pin("B")
|
||||
end_en_pin = self.and2_insts[self.num_wmasks-1].get_pin("B")
|
||||
if self.port % 2:
|
||||
# Extend metal3 to edge of AND array in multiport
|
||||
en_to_edge = self.and2.width - beg_en_pin.cx()
|
||||
self.add_layout_pin(text="en",
|
||||
layer="m3",
|
||||
offset=beg_en_pin.bc(),
|
||||
width=end_en_pin.cx() - beg_en_pin.cx() + en_to_edge)
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=vector(end_en_pin.cx() + en_to_edge, end_en_pin.cy()))
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=vector(end_en_pin.cx() + en_to_edge, end_en_pin.cy()))
|
||||
else:
|
||||
self.add_layout_pin(text="en",
|
||||
layer="m3",
|
||||
offset=beg_en_pin.bc(),
|
||||
width=end_en_pin.cx() - beg_en_pin.cx())
|
||||
en_pin = self.and2_insts[0].get_pin("B")
|
||||
self.add_layout_pin_segment_center(text="en",
|
||||
layer="m3",
|
||||
start=vector(0, en_pin.cy()),
|
||||
end=vector(self.width, en_pin.cy()))
|
||||
|
||||
for i in range(self.num_wmasks):
|
||||
# Copy remaining layout pins
|
||||
self.copy_layout_pin(self.and2_insts[i],"A","wmask_in_{0}".format(i))
|
||||
self.copy_layout_pin(self.and2_insts[i],"Z","wmask_out_{0}".format(i))
|
||||
self.copy_layout_pin(self.and2_insts[i], "A", "wmask_in_{0}".format(i))
|
||||
self.copy_layout_pin(self.and2_insts[i], "Z", "wmask_out_{0}".format(i))
|
||||
|
||||
# Add via connections to metal3 for AND array's B pin
|
||||
en_pin = self.and2_insts[i].get_pin("B")
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=en_pin.center())
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=en_pin.center())
|
||||
en_pos = en_pin.center()
|
||||
self.add_via_stack_center(from_layer=en_pin.layer,
|
||||
to_layer="m3",
|
||||
offset=en_pos)
|
||||
|
||||
for supply in ["gnd", "vdd"]:
|
||||
supply_pin=self.and2_insts[i].get_pin(supply)
|
||||
self.add_power_pin(supply, supply_pin.center())
|
||||
|
||||
|
||||
for supply in ["gnd", "vdd"]:
|
||||
supply_pin_left = self.and2_insts[0].get_pin(supply)
|
||||
supply_pin_right = self.and2_insts[self.num_wmasks-1].get_pin(supply)
|
||||
self.add_path("m1",[supply_pin_left.lc(), supply_pin_right.rc()])
|
||||
supply_pin_right = self.and2_insts[self.num_wmasks - 1].get_pin(supply)
|
||||
self.add_path("m1", [supply_pin_left.lc(), supply_pin_right.rc()])
|
||||
|
||||
def get_cin(self):
|
||||
"""Get the relative capacitance of all the input connections in the bank"""
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@ class options(optparse.Values):
|
|||
###################
|
||||
# This is the technology directory.
|
||||
openram_tech = ""
|
||||
|
||||
|
||||
# This is the name of the technology.
|
||||
tech_name = ""
|
||||
|
||||
|
||||
# Port configuration (1-2 ports allowed)
|
||||
num_rw_ports = 1
|
||||
num_r_ports = 0
|
||||
|
|
@ -32,7 +32,7 @@ class options(optparse.Values):
|
|||
|
||||
# Write mask size, default will be overwritten with word_size if not user specified
|
||||
write_size = None
|
||||
|
||||
|
||||
# These will get initialized by the user or the tech file
|
||||
nominal_corner_only = False
|
||||
supply_voltages = ""
|
||||
|
|
@ -50,17 +50,17 @@ class options(optparse.Values):
|
|||
###################
|
||||
# Approximate percentage of delay compared to bitlines
|
||||
rbl_delay_percentage = 0.5
|
||||
|
||||
|
||||
# Allow manual adjustment of the delay chain over automatic
|
||||
use_tech_delay_chain_size = False
|
||||
delay_chain_stages = 9
|
||||
delay_chain_fanout_per_stage = 4
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
###################
|
||||
# Debug options.
|
||||
###################
|
||||
###################
|
||||
# This is the temp directory where all intermediate results are stored.
|
||||
try:
|
||||
# If user defined the temporary location in their environment, use it
|
||||
|
|
@ -91,7 +91,7 @@ class options(optparse.Values):
|
|||
# Run with extracted parasitics
|
||||
use_pex = False
|
||||
|
||||
|
||||
|
||||
###################
|
||||
# Tool options
|
||||
###################
|
||||
|
|
@ -108,7 +108,7 @@ class options(optparse.Values):
|
|||
drc_exe = None
|
||||
lvs_exe = None
|
||||
pex_exe = None
|
||||
|
||||
|
||||
# Should we print out the banner at startup
|
||||
print_banner = True
|
||||
|
||||
|
|
@ -127,6 +127,7 @@ class options(optparse.Values):
|
|||
bank_select = "bank_select"
|
||||
bitcell_array = "bitcell_array"
|
||||
bitcell = "bitcell"
|
||||
col_cap_bitcell = "col_cap_bitcell"
|
||||
column_mux_array = "single_level_column_mux_array"
|
||||
control_logic = "control_logic"
|
||||
decoder = "hierarchical_decoder"
|
||||
|
|
@ -134,10 +135,15 @@ class options(optparse.Values):
|
|||
dff_array = "dff_array"
|
||||
dff = "dff"
|
||||
dummy_bitcell = "dummy_bitcell"
|
||||
inv_dec = "pinv"
|
||||
nand2_dec = "pnand2"
|
||||
nand3_dec = "pnand3"
|
||||
nand4_dec = "pnand4" # Not available right now
|
||||
precharge_array = "precharge_array"
|
||||
ptx = "ptx"
|
||||
replica_bitcell = "replica_bitcell"
|
||||
replica_bitline = "replica_bitline"
|
||||
row_cap_bitcell = "row_cap_bitcell"
|
||||
sense_amp_array = "sense_amp_array"
|
||||
sense_amp = "sense_amp"
|
||||
tri_gate_array = "tri_gate_array"
|
||||
|
|
@ -146,4 +152,3 @@ class options(optparse.Values):
|
|||
write_driver_array = "write_driver_array"
|
||||
write_driver = "write_driver"
|
||||
write_mask_and_array = "write_mask_and_array"
|
||||
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ from sram_factory import factory
|
|||
|
||||
class pand2(pgate.pgate):
|
||||
"""
|
||||
This is a simple buffer used for driving loads.
|
||||
This is an AND (or NAND) with configurable drive strength.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None):
|
||||
debug.info(1, "Creating pnand2 {}".format(name))
|
||||
def __init__(self, name, size=1, height=None, vertical=False, add_wells=True):
|
||||
debug.info(1, "Creating pand2 {}".format(name))
|
||||
self.add_comment("size: {}".format(size))
|
||||
|
||||
|
||||
self.vertical = vertical
|
||||
self.size = size
|
||||
|
||||
# Creates the netlist and layout
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
|
||||
pgate.pgate.__init__(self, name, height, add_wells)
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
|
|
@ -30,20 +30,29 @@ class pand2(pgate.pgate):
|
|||
self.create_insts()
|
||||
|
||||
def create_modules(self):
|
||||
self.nand = factory.create(module_type="pnand2", height=self.height)
|
||||
self.add_mod(self.nand)
|
||||
self.nand = factory.create(module_type="pnand2",
|
||||
height=self.height,
|
||||
add_wells=self.vertical)
|
||||
|
||||
self.inv = factory.create(module_type="pdriver",
|
||||
neg_polarity=True,
|
||||
fanout=self.size,
|
||||
height=self.height)
|
||||
size_list=[self.size],
|
||||
height=self.height,
|
||||
add_wells=self.add_wells)
|
||||
|
||||
self.add_mod(self.nand)
|
||||
self.add_mod(self.inv)
|
||||
|
||||
def create_layout(self):
|
||||
self.width = self.nand.width + self.inv.width
|
||||
if self.vertical:
|
||||
self.height = 2 * self.nand.height
|
||||
self.width = max(self.nand.width, self.inv.width)
|
||||
else:
|
||||
self.width = self.nand.width + self.inv.width
|
||||
|
||||
self.place_insts()
|
||||
self.add_wires()
|
||||
self.add_layout_pins()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
|
|
@ -67,35 +76,62 @@ class pand2(pgate.pgate):
|
|||
# Add NAND to the right
|
||||
self.nand_inst.place(offset=vector(0, 0))
|
||||
|
||||
# Add INV to the right
|
||||
self.inv_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
if self.vertical:
|
||||
# Add INV above
|
||||
self.inv_inst.place(offset=vector(self.inv.width,
|
||||
2 * self.nand.height),
|
||||
mirror="XY")
|
||||
else:
|
||||
# Add INV to the right
|
||||
self.inv_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top, (middle), and bottom. """
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
|
||||
# Second gnd of the inverter gate
|
||||
if self.vertical:
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
if self.vertical:
|
||||
# Shared between two gates
|
||||
y_offset = 0.5 * self.height
|
||||
else:
|
||||
y_offset = self.height
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, y_offset),
|
||||
width=self.width)
|
||||
|
||||
def add_wires(self):
|
||||
# nand Z to inv A
|
||||
z1_pin = self.nand_inst.get_pin("Z")
|
||||
a2_pin = self.inv_inst.get_pin("A")
|
||||
mid1_point = vector(0.5 * (z1_pin.cx() + a2_pin.cx()), z1_pin.cy())
|
||||
mid2_point = vector(mid1_point, a2_pin.cy())
|
||||
self.add_path("m1",
|
||||
[z1_pin.center(), mid1_point, mid2_point, a2_pin.center()])
|
||||
if self.vertical:
|
||||
route_layer = "m2"
|
||||
self.add_via_stack_center(offset=z1_pin.center(),
|
||||
from_layer=z1_pin.layer,
|
||||
to_layer=route_layer)
|
||||
self.add_zjog(route_layer,
|
||||
z1_pin.uc(),
|
||||
a2_pin.bc(),
|
||||
"V")
|
||||
self.add_via_stack_center(offset=a2_pin.center(),
|
||||
from_layer=a2_pin.layer,
|
||||
to_layer=route_layer)
|
||||
else:
|
||||
route_layer = self.route_layer
|
||||
mid1_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path(route_layer,
|
||||
[z1_pin.center(), mid1_point, a2_pin.center()])
|
||||
|
||||
def add_layout_pins(self):
|
||||
# Continous vdd rail along with label.
|
||||
vdd_pin = self.inv_inst.get_pin("vdd")
|
||||
self.add_layout_pin(text="vdd",
|
||||
layer="m1",
|
||||
offset=vdd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
# Continous gnd rail along with label.
|
||||
gnd_pin = self.inv_inst.get_pin("gnd")
|
||||
self.add_layout_pin(text="gnd",
|
||||
layer="m1",
|
||||
offset=gnd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
pin = self.inv_inst.get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=pin.layer,
|
||||
|
|
|
|||
|
|
@ -15,14 +15,15 @@ class pand3(pgate.pgate):
|
|||
"""
|
||||
This is a simple buffer used for driving loads.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None):
|
||||
def __init__(self, name, size=1, height=None, vertical=False, add_wells=True):
|
||||
debug.info(1, "Creating pand3 {}".format(name))
|
||||
self.add_comment("size: {}".format(size))
|
||||
|
||||
|
||||
self.vertical = vertical
|
||||
self.size = size
|
||||
|
||||
# Creates the netlist and layout
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
pgate.pgate.__init__(self, name, height, add_wells)
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
|
|
@ -31,19 +32,31 @@ class pand3(pgate.pgate):
|
|||
|
||||
def create_modules(self):
|
||||
# Shield the cap, but have at least a stage effort of 4
|
||||
self.nand = factory.create(module_type="pnand3", height=self.height)
|
||||
self.add_mod(self.nand)
|
||||
self.nand = factory.create(module_type="pnand3",
|
||||
height=self.height,
|
||||
add_wells=self.vertical)
|
||||
|
||||
self.inv = factory.create(module_type="pinv",
|
||||
size=self.size,
|
||||
height=self.height)
|
||||
# Add the well tap to the inverter because when stacked
|
||||
# vertically it is sometimes narrower
|
||||
self.inv = factory.create(module_type="pdriver",
|
||||
size_list=[self.size],
|
||||
height=self.height,
|
||||
add_wells=self.add_wells)
|
||||
|
||||
self.add_mod(self.nand)
|
||||
self.add_mod(self.inv)
|
||||
|
||||
def create_layout(self):
|
||||
self.width = self.nand.width + self.inv.width
|
||||
if self.vertical:
|
||||
self.height = 2 * self.nand.height
|
||||
self.width = max(self.nand.width, self.inv.width)
|
||||
else:
|
||||
self.width = self.nand.width + self.inv.width
|
||||
|
||||
self.place_insts()
|
||||
self.add_wires()
|
||||
self.add_layout_pins()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
|
|
@ -68,35 +81,62 @@ class pand3(pgate.pgate):
|
|||
# Add NAND to the right
|
||||
self.nand_inst.place(offset=vector(0, 0))
|
||||
|
||||
# Add INV to the right
|
||||
self.inv_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
if self.vertical:
|
||||
# Add INV above
|
||||
self.inv_inst.place(offset=vector(self.inv.width,
|
||||
2 * self.nand.height),
|
||||
mirror="XY")
|
||||
else:
|
||||
# Add INV to the right
|
||||
self.inv_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top, (middle), and bottom. """
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
|
||||
# Second gnd of the inverter gate
|
||||
if self.vertical:
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
if self.vertical:
|
||||
# Shared between two gates
|
||||
y_offset = 0.5 * self.height
|
||||
else:
|
||||
y_offset = self.height
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, y_offset),
|
||||
width=self.width)
|
||||
|
||||
def add_wires(self):
|
||||
# nand Z to inv A
|
||||
z1_pin = self.nand_inst.get_pin("Z")
|
||||
a2_pin = self.inv_inst.get_pin("A")
|
||||
mid1_point = vector(0.5 * (z1_pin.cx()+a2_pin.cx()), z1_pin.cy())
|
||||
mid2_point = vector(mid1_point, a2_pin.cy())
|
||||
self.add_path("m1",
|
||||
[z1_pin.center(), mid1_point, mid2_point, a2_pin.center()])
|
||||
|
||||
if self.vertical:
|
||||
route_layer = "m2"
|
||||
self.add_via_stack_center(offset=z1_pin.center(),
|
||||
from_layer=z1_pin.layer,
|
||||
to_layer=route_layer)
|
||||
self.add_zjog(route_layer,
|
||||
z1_pin.uc(),
|
||||
a2_pin.bc(),
|
||||
"V")
|
||||
self.add_via_stack_center(offset=a2_pin.center(),
|
||||
from_layer=a2_pin.layer,
|
||||
to_layer=route_layer)
|
||||
else:
|
||||
route_layer = self.route_layer
|
||||
mid1_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path(route_layer,
|
||||
[z1_pin.center(), mid1_point, a2_pin.center()])
|
||||
|
||||
def add_layout_pins(self):
|
||||
# Continous vdd rail along with label.
|
||||
vdd_pin = self.inv_inst.get_pin("vdd")
|
||||
self.add_layout_pin(text="vdd",
|
||||
layer="m1",
|
||||
offset=vdd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
# Continous gnd rail along with label.
|
||||
gnd_pin = self.inv_inst.get_pin("gnd")
|
||||
self.add_layout_pin(text="gnd",
|
||||
layer="m1",
|
||||
offset=gnd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
pin = self.inv_inst.get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=pin.layer,
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class pbuf(pgate.pgate):
|
|||
self.place_insts()
|
||||
self.add_wires()
|
||||
self.add_layout_pins()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
|
||||
def add_pins(self):
|
||||
|
|
@ -55,7 +56,8 @@ class pbuf(pgate.pgate):
|
|||
|
||||
self.inv2 = factory.create(module_type="pinv",
|
||||
size=self.size,
|
||||
height=self.height)
|
||||
height=self.height,
|
||||
add_wells=False)
|
||||
self.add_mod(self.inv2)
|
||||
|
||||
def create_insts(self):
|
||||
|
|
@ -78,26 +80,9 @@ class pbuf(pgate.pgate):
|
|||
# inv1 Z to inv2 A
|
||||
z1_pin = self.inv1_inst.get_pin("Z")
|
||||
a2_pin = self.inv2_inst.get_pin("A")
|
||||
mid_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path("m1", [z1_pin.center(), mid_point, a2_pin.center()])
|
||||
self.add_zjog(self.route_layer, z1_pin.center(), a2_pin.center())
|
||||
|
||||
def add_layout_pins(self):
|
||||
# Continous vdd rail along with label.
|
||||
vdd_pin = self.inv1_inst.get_pin("vdd")
|
||||
self.add_layout_pin(text="vdd",
|
||||
layer="m1",
|
||||
offset=vdd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
# Continous gnd rail along with label.
|
||||
gnd_pin = self.inv1_inst.get_pin("gnd")
|
||||
self.add_layout_pin(text="gnd",
|
||||
layer="m1",
|
||||
offset=gnd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
z_pin = self.inv2_inst.get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=z_pin.layer,
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ class pdriver(pgate.pgate):
|
|||
sized for driving a load.
|
||||
"""
|
||||
|
||||
def __init__(self, name, neg_polarity=False, fanout=0, size_list=None, height=None):
|
||||
def __init__(self, name, inverting=False, fanout=0, size_list=None, height=None, add_wells=True):
|
||||
|
||||
debug.info(1, "creating pdriver {}".format(name))
|
||||
|
||||
self.stage_effort = 3
|
||||
self.height = height
|
||||
self.neg_polarity = neg_polarity
|
||||
self.inverting = inverting
|
||||
self.size_list = size_list
|
||||
self.fanout = fanout
|
||||
|
||||
|
|
@ -31,11 +31,11 @@ class pdriver(pgate.pgate):
|
|||
debug.error("Either fanout or size list must be specified.", -1)
|
||||
if self.size_list and self.fanout != 0:
|
||||
debug.error("Cannot specify both size_list and fanout.", -1)
|
||||
if self.size_list and self.neg_polarity:
|
||||
debug.error("Cannot specify both size_list and neg_polarity.", -1)
|
||||
if self.size_list and self.inverting:
|
||||
debug.error("Cannot specify both size_list and inverting.", -1)
|
||||
|
||||
# Creates the netlist and layout
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
pgate.pgate.__init__(self, name, height, add_wells)
|
||||
|
||||
def compute_sizes(self):
|
||||
# size_list specified
|
||||
|
|
@ -47,9 +47,9 @@ class pdriver(pgate.pgate):
|
|||
int(round(self.fanout ** (1 / self.stage_effort))))
|
||||
|
||||
# Increase the number of stages if we need to fix polarity
|
||||
if self.neg_polarity and (self.num_stages % 2 == 0):
|
||||
if self.inverting and (self.num_stages % 2 == 0):
|
||||
self.num_stages += 1
|
||||
elif not self.neg_polarity and (self.num_stages % 2):
|
||||
elif not self.inverting and (self.num_stages % 2):
|
||||
self.num_stages += 1
|
||||
|
||||
self.size_list = []
|
||||
|
|
@ -73,9 +73,10 @@ class pdriver(pgate.pgate):
|
|||
self.place_modules()
|
||||
self.route_wires()
|
||||
self.add_layout_pins()
|
||||
|
||||
self.width = self.inv_inst_list[-1].rx()
|
||||
self.height = self.inv_inst_list[0].height
|
||||
self.extend_wells()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
|
||||
def add_pins(self):
|
||||
|
|
@ -86,10 +87,13 @@ class pdriver(pgate.pgate):
|
|||
|
||||
def add_modules(self):
|
||||
self.inv_list = []
|
||||
add_well = self.add_wells
|
||||
for size in self.size_list:
|
||||
temp_inv = factory.create(module_type="pinv",
|
||||
size=size,
|
||||
height=self.height)
|
||||
height=self.height,
|
||||
add_wells=add_well)
|
||||
add_well=False
|
||||
self.inv_list.append(temp_inv)
|
||||
self.add_mod(temp_inv)
|
||||
|
||||
|
|
@ -141,26 +145,11 @@ class pdriver(pgate.pgate):
|
|||
z_inst_list.append(self.inv_inst_list[x].get_pin("Z"))
|
||||
a_inst_list.append(self.inv_inst_list[x + 1].get_pin("A"))
|
||||
mid_point = vector(z_inst_list[x].cx(), a_inst_list[x].cy())
|
||||
self.add_path("m1",
|
||||
self.add_path(self.route_layer,
|
||||
[z_inst_list[x].center(), mid_point,
|
||||
a_inst_list[x].center()])
|
||||
|
||||
def add_layout_pins(self):
|
||||
# Continous vdd rail along with label.
|
||||
vdd_pin = self.inv_inst_list[0].get_pin("vdd")
|
||||
self.add_layout_pin(text="vdd",
|
||||
layer="m1",
|
||||
offset=vdd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
# Continous gnd rail along with label.
|
||||
gnd_pin = self.inv_inst_list[0].get_pin("gnd")
|
||||
self.add_layout_pin(text="gnd",
|
||||
layer="m1",
|
||||
offset=gnd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
z_pin = self.inv_inst_list[len(self.inv_inst_list) - 1].get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
|
|
|
|||
|
|
@ -22,17 +22,17 @@ from errors import drc_error
|
|||
if(OPTS.tech_name == "s8"):
|
||||
from tech import nmos_bins, pmos_bins, accuracy_requirement
|
||||
|
||||
|
||||
class pinv(pgate.pgate):
|
||||
"""
|
||||
Pinv generates gds of a parametrically sized inverter. The
|
||||
size is specified as the drive size (relative to minimum NMOS) and
|
||||
a beta value for choosing the pmos size. The inverter's cell
|
||||
height is usually the same as the 6t library cell and is measured
|
||||
from center of rail to rail.. The route_output will route the
|
||||
output to the right side of the cell for easier access.
|
||||
from center of rail to rail.
|
||||
"""
|
||||
|
||||
def __init__(self, name, size=1, beta=parameter["beta"], height=None, route_output=True):
|
||||
def __init__(self, name, size=1, beta=parameter["beta"], height=None, add_wells=True):
|
||||
|
||||
debug.info(2,
|
||||
"creating pinv structure {0} with size of {1}".format(name,
|
||||
|
|
@ -40,12 +40,12 @@ class pinv(pgate.pgate):
|
|||
self.add_comment("size: {}".format(size))
|
||||
|
||||
self.size = size
|
||||
debug.check(self.size >= 1, "Must have a size greater than or equal to 1.")
|
||||
self.nmos_size = size
|
||||
self.pmos_size = beta * size
|
||||
self.beta = beta
|
||||
self.route_output = False
|
||||
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
pgate.pgate.__init__(self, name, height, add_wells)
|
||||
|
||||
def create_netlist(self):
|
||||
""" Calls all functions related to the generation of the netlist """
|
||||
|
|
@ -57,17 +57,18 @@ class pinv(pgate.pgate):
|
|||
def create_layout(self):
|
||||
""" Calls all functions related to the generation of the layout """
|
||||
self.place_ptx()
|
||||
self.add_well_contacts()
|
||||
if self.add_wells:
|
||||
self.add_well_contacts()
|
||||
self.determine_width()
|
||||
self.extend_wells()
|
||||
self.route_supply_rails()
|
||||
self.connect_rails()
|
||||
self.route_input_gate(self.pmos_inst,
|
||||
self.nmos_inst,
|
||||
self.output_pos.y,
|
||||
"A",
|
||||
position="farleft")
|
||||
self.route_outputs()
|
||||
self.route_supply_rails()
|
||||
self.connect_rails()
|
||||
self.add_boundary()
|
||||
|
||||
def add_pins(self):
|
||||
|
|
@ -108,13 +109,6 @@ class pinv(pgate.pgate):
|
|||
min_channel = max(contact.poly_contact.width + self.m1_space,
|
||||
contact.poly_contact.width + 2 * self.poly_to_active)
|
||||
|
||||
# This is the extra space needed to ensure DRC rules
|
||||
# to the active contacts
|
||||
extra_contact_space = max(-nmos.get_pin("D").by(), 0)
|
||||
# This is a poly-to-poly of a flipped cell
|
||||
self.top_bottom_space = max(0.5*self.m1_width + self.m1_space + extra_contact_space,
|
||||
self.poly_extend_active + self.poly_space)
|
||||
|
||||
total_height = tx_height + min_channel + 2 * self.top_bottom_space
|
||||
# debug.check(self.height > total_height,
|
||||
# "Cell height {0} too small for simple min height {1}.".format(self.height,
|
||||
|
|
@ -202,30 +196,22 @@ class pinv(pgate.pgate):
|
|||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
connect_drain_active=True)
|
||||
self.add_mod(self.nmos)
|
||||
|
||||
self.pmos = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
connect_drain_active=True)
|
||||
self.add_mod(self.pmos)
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top and bottom. """
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer="m1",
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer="m1",
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
def create_ptx(self):
|
||||
"""
|
||||
Create the PMOS and NMOS netlist.
|
||||
|
|
@ -266,7 +252,7 @@ class pinv(pgate.pgate):
|
|||
Route the output (drains) together.
|
||||
Optionally, routes output to edge.
|
||||
"""
|
||||
|
||||
|
||||
# Get the drain pins
|
||||
nmos_drain_pin = self.nmos_inst.get_pin("D")
|
||||
pmos_drain_pin = self.pmos_inst.get_pin("D")
|
||||
|
|
@ -274,24 +260,16 @@ class pinv(pgate.pgate):
|
|||
# Pick point at right most of NMOS and connect down to PMOS
|
||||
nmos_drain_pos = nmos_drain_pin.bc()
|
||||
pmos_drain_pos = vector(nmos_drain_pos.x, pmos_drain_pin.uc().y)
|
||||
self.add_path("m1", [nmos_drain_pos, pmos_drain_pos])
|
||||
self.add_path(self.route_layer, [nmos_drain_pos, pmos_drain_pos])
|
||||
|
||||
# Remember the mid for the output
|
||||
mid_drain_offset = vector(nmos_drain_pos.x, self.output_pos.y)
|
||||
|
||||
if self.route_output:
|
||||
# This extends the output to the edge of the cell
|
||||
output_offset = mid_drain_offset.scale(0, 1) + vector(self.width, 0)
|
||||
self.add_layout_pin_segment_center(text="Z",
|
||||
layer="m1",
|
||||
start=mid_drain_offset,
|
||||
end=output_offset)
|
||||
else:
|
||||
# This leaves the output as an internal pin (min sized)
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer="m1",
|
||||
offset=mid_drain_offset \
|
||||
+ vector(0.5 * self.m1_width, 0))
|
||||
# This leaves the output as an internal pin (min sized)
|
||||
output_offset = mid_drain_offset + vector(0.5 * self.route_layer_width, 0)
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=self.route_layer,
|
||||
offset=output_offset)
|
||||
|
||||
def add_well_contacts(self):
|
||||
""" Add n/p well taps to the layout and connect to supplies """
|
||||
|
|
|
|||
|
|
@ -0,0 +1,217 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import contact
|
||||
import pinv
|
||||
import debug
|
||||
from tech import drc, parameter
|
||||
from vector import vector
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
|
||||
if(OPTS.tech_name == "s8"):
|
||||
from tech import nmos_bins, pmos_bins, accuracy_requirement
|
||||
|
||||
|
||||
class pinv_dec(pinv.pinv):
|
||||
"""
|
||||
This is another version of pinv but with layout for the decoder.
|
||||
Other stuff is the same (netlist, sizes, etc.)
|
||||
"""
|
||||
|
||||
def __init__(self, name, size=1, beta=parameter["beta"], height=None, add_wells=True):
|
||||
|
||||
debug.info(2,
|
||||
"creating pinv_dec structure {0} with size of {1}".format(name,
|
||||
size))
|
||||
if not height:
|
||||
b = factory.create(module_type="bitcell")
|
||||
self.cell_height = b.height
|
||||
else:
|
||||
self.cell_height = height
|
||||
|
||||
# Inputs to cells are on input layer
|
||||
# Outputs from cells are on output layer
|
||||
if OPTS.tech_name == "s8":
|
||||
self.supply_layer = "m1"
|
||||
else:
|
||||
self.supply_layer = "m2"
|
||||
|
||||
pinv.pinv.__init__(self, name, size, beta, self.cell_height, add_wells)
|
||||
|
||||
def determine_tx_mults(self):
|
||||
"""
|
||||
Determines the number of fingers needed to achieve the size within
|
||||
the height constraint. This may fail if the user has a tight height.
|
||||
"""
|
||||
|
||||
# This is always 1 tx, because we have horizontal transistors.
|
||||
self.tx_mults = 1
|
||||
self.nmos_width = self.nmos_size * drc("minwidth_tx")
|
||||
self.pmos_width = self.pmos_size * drc("minwidth_tx")
|
||||
if OPTS.tech_name == "s8":
|
||||
(self.nmos_width, self.tx_mults) = self.bin_width("nmos", self.nmos_width)
|
||||
(self.pmos_width, self.tx_mults) = self.bin_width("pmos", self.pmos_width)
|
||||
return
|
||||
|
||||
# Over-ride the route input gate to call the horizontal version.
|
||||
# Other top-level netlist and layout functions are not changed.
|
||||
def route_input_gate(self, pmos_inst, nmos_inst, ypos, name, position="left", directions=None):
|
||||
"""
|
||||
Route the input gate to the left side of the cell for access.
|
||||
Position is actually ignored and is left to be compatible with the pinv.
|
||||
"""
|
||||
|
||||
nmos_gate_pin = nmos_inst.get_pin("G")
|
||||
pmos_gate_pin = pmos_inst.get_pin("G")
|
||||
|
||||
# Check if the gates are aligned and give an error if they aren't!
|
||||
if nmos_gate_pin.ll().y != pmos_gate_pin.ll().y:
|
||||
self.gds_write("unaliged_gates.gds")
|
||||
debug.check(nmos_gate_pin.ll().y == pmos_gate_pin.ll().y,
|
||||
"Connecting unaligned gates not supported. See unaligned_gates.gds.")
|
||||
|
||||
# Pick point on the left of NMOS and up to PMOS
|
||||
nmos_gate_pos = nmos_gate_pin.rc()
|
||||
pmos_gate_pos = pmos_gate_pin.lc()
|
||||
self.add_path("poly", [nmos_gate_pos, pmos_gate_pos])
|
||||
|
||||
# Center is completely symmetric.
|
||||
contact_width = contact.poly_contact.width
|
||||
contact_offset = nmos_gate_pin.lc() \
|
||||
- vector(self.poly_extend_active + 0.5 * contact_width, 0)
|
||||
via = self.add_via_stack_center(from_layer="poly",
|
||||
to_layer=self.route_layer,
|
||||
offset=contact_offset,
|
||||
directions=directions)
|
||||
self.add_path("poly", [contact_offset, nmos_gate_pin.lc()])
|
||||
|
||||
self.add_layout_pin_rect_center(text=name,
|
||||
layer=self.route_layer,
|
||||
offset=contact_offset,
|
||||
width=via.mod.second_layer_width,
|
||||
height=via.mod.second_layer_height)
|
||||
|
||||
def determine_width(self):
|
||||
self.width = self.pmos_inst.rx() + self.well_extend_active
|
||||
|
||||
def extend_wells(self):
|
||||
""" Extend bottom to top for each well. """
|
||||
|
||||
from tech import layer
|
||||
if "pwell" in layer:
|
||||
ll = self.nmos_inst.ll() - self.nmos_inst.mod.active_offset
|
||||
ur = self.nmos_inst.ur() + self.nmos_inst.mod.active_offset
|
||||
self.add_rect(layer="pwell",
|
||||
offset=ll,
|
||||
width=ur.x - ll.x,
|
||||
height=self.height - ll.y)
|
||||
|
||||
if "nwell" in layer:
|
||||
ll = self.pmos_inst.ll() - self.pmos_inst.mod.active_offset
|
||||
ur = self.pmos_inst.ur() + self.pmos_inst.mod.active_offset
|
||||
self.add_rect(layer="nwell",
|
||||
offset=ll - vector(self.nwell_enclose_active, 0),
|
||||
width=ur.x - ll.x + self.nwell_enclose_active,
|
||||
height=self.height - ll.y + 2 * self.nwell_enclose_active)
|
||||
|
||||
def place_ptx(self):
|
||||
"""
|
||||
"""
|
||||
|
||||
# offset so that the input contact is over from the left edge by poly spacing
|
||||
x_offset = self.nmos.active_offset.y + contact.poly_contact.width + self.poly_space
|
||||
# center the transistor in the y-dimension
|
||||
y_offset = self.nmos.width + self.active_space
|
||||
self.nmos_pos = vector(x_offset, y_offset)
|
||||
self.nmos_inst.place(self.nmos_pos)
|
||||
self.nmos_inst.place(self.nmos_pos,
|
||||
rotate=270)
|
||||
# place PMOS so it is half a poly spacing down from the top
|
||||
xoffset = self.nmos_inst.height + 2 * self.poly_extend_active + 2 * self.well_extend_active + drc("pwell_to_nwell")
|
||||
self.pmos_pos = self.nmos_pos + vector(xoffset, 0)
|
||||
self.pmos_inst.place(self.pmos_pos,
|
||||
rotate=270)
|
||||
|
||||
# Output position will be in between the PMOS and NMOS drains
|
||||
pmos_drain_pos = self.pmos_inst.get_pin("D").center()
|
||||
nmos_drain_pos = self.nmos_inst.get_pin("D").center()
|
||||
self.output_pos = vector(0.5 * (pmos_drain_pos.x + nmos_drain_pos.x), nmos_drain_pos.y)
|
||||
|
||||
def route_outputs(self):
|
||||
"""
|
||||
Route the output (drains) together.
|
||||
Optionally, routes output to edge.
|
||||
"""
|
||||
|
||||
# Get the drain pin
|
||||
nmos_drain_pin = self.nmos_inst.get_pin("D")
|
||||
|
||||
# Pick point at right most of NMOS and connect over to PMOS
|
||||
nmos_drain_pos = nmos_drain_pin.lc()
|
||||
right_side = vector(self.width, nmos_drain_pos.y)
|
||||
|
||||
self.add_layout_pin_segment_center("Z",
|
||||
self.route_layer,
|
||||
nmos_drain_pos,
|
||||
right_side)
|
||||
|
||||
def add_well_contacts(self):
|
||||
""" Add n/p well taps to the layout and connect to supplies """
|
||||
|
||||
source_pos = self.pmos_inst.get_pin("S").center()
|
||||
contact_pos = vector(source_pos.x, self.height)
|
||||
self.nwell_contact = self.add_via_center(layers=self.active_stack,
|
||||
offset=contact_pos,
|
||||
implant_type="n",
|
||||
well_type="n")
|
||||
self.add_via_stack_center(offset=contact_pos,
|
||||
from_layer=self.active_stack[2],
|
||||
to_layer=self.supply_layer)
|
||||
|
||||
source_pos = self.nmos_inst.get_pin("S").center()
|
||||
contact_pos = vector(source_pos.x, self.height)
|
||||
self.pwell_contact= self.add_via_center(layers=self.active_stack,
|
||||
offset=contact_pos,
|
||||
implant_type="p",
|
||||
well_type="p")
|
||||
self.add_via_stack_center(offset=contact_pos,
|
||||
from_layer=self.active_stack[2],
|
||||
to_layer=self.supply_layer)
|
||||
|
||||
def route_supply_rails(self):
|
||||
pin = self.nmos_inst.get_pin("S")
|
||||
source_pos = pin.center()
|
||||
bottom_pos = source_pos.scale(1, 0)
|
||||
top_pos = bottom_pos + vector(0, self.height)
|
||||
self.add_layout_pin_segment_center("gnd",
|
||||
self.supply_layer,
|
||||
start=bottom_pos,
|
||||
end=top_pos)
|
||||
|
||||
pin = self.pmos_inst.get_pin("S")
|
||||
source_pos = pin.center()
|
||||
bottom_pos = source_pos.scale(1, 0)
|
||||
top_pos = bottom_pos + vector(0, self.height)
|
||||
self.add_layout_pin_segment_center("vdd",
|
||||
self.supply_layer,
|
||||
start=bottom_pos,
|
||||
end=top_pos)
|
||||
|
||||
def connect_rails(self):
|
||||
""" Connect the nmos and pmos to its respective power rails """
|
||||
|
||||
source_pos = self.nmos_inst.get_pin("S").center()
|
||||
self.add_via_stack_center(offset=source_pos,
|
||||
from_layer=self.route_layer,
|
||||
to_layer=self.supply_layer)
|
||||
|
||||
source_pos = self.pmos_inst.get_pin("S").center()
|
||||
self.add_via_stack_center(offset=source_pos,
|
||||
from_layer=self.route_layer,
|
||||
to_layer=self.supply_layer)
|
||||
|
||||
|
|
@ -5,7 +5,6 @@
|
|||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import contact
|
||||
import pgate
|
||||
import debug
|
||||
from tech import drc, parameter, spice
|
||||
|
|
@ -20,7 +19,7 @@ class pnand2(pgate.pgate):
|
|||
This module generates gds of a parametrically sized 2-input nand.
|
||||
This model use ptx to generate a 2-input nand within a cetrain height.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None):
|
||||
def __init__(self, name, size=1, height=None, add_wells=True):
|
||||
""" Creates a cell for a simple 2 input nand """
|
||||
|
||||
debug.info(2,
|
||||
|
|
@ -43,7 +42,7 @@ class pnand2(pgate.pgate):
|
|||
(self.pmos_width, self.tx_mults) = self.bin_width("pmos", self.pmos_width)
|
||||
|
||||
# Creates the netlist and layout
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
pgate.pgate.__init__(self, name, height, add_wells)
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
|
|
@ -55,13 +54,14 @@ class pnand2(pgate.pgate):
|
|||
|
||||
self.setup_layout_constants()
|
||||
self.place_ptx()
|
||||
self.add_well_contacts()
|
||||
if self.add_wells:
|
||||
self.add_well_contacts()
|
||||
self.route_output()
|
||||
self.determine_width()
|
||||
self.route_supply_rails()
|
||||
self.connect_rails()
|
||||
self.extend_wells()
|
||||
self.route_inputs()
|
||||
self.route_output()
|
||||
self.add_boundary()
|
||||
|
||||
def add_pins(self):
|
||||
|
|
@ -72,65 +72,45 @@ class pnand2(pgate.pgate):
|
|||
|
||||
def add_ptx(self):
|
||||
""" Create the PMOS and NMOS transistors. """
|
||||
self.nmos_nd = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_drain_contact=False,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.nmos_nd)
|
||||
self.nmos_left = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact="active")
|
||||
self.add_mod(self.nmos_left)
|
||||
|
||||
self.nmos_ns = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact=False,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.nmos_ns)
|
||||
self.nmos_right = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact="active",
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.nmos_right)
|
||||
|
||||
self.pmos = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.pmos)
|
||||
self.pmos_left = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.pmos_left)
|
||||
|
||||
self.pmos_right = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.pmos_right)
|
||||
|
||||
def setup_layout_constants(self):
|
||||
""" Pre-compute some handy layout parameters. """
|
||||
|
||||
# metal spacing to allow contacts on any layer
|
||||
self.input_spacing = max(self.poly_space + contact.poly_contact.first_layer_width,
|
||||
self.m1_space + contact.m1_via.first_layer_width,
|
||||
self.m2_space + contact.m2_via.first_layer_width,
|
||||
self.m3_space + contact.m2_via.second_layer_width)
|
||||
|
||||
|
||||
# Compute the other pmos2 location,
|
||||
# but determining offset to overlap the
|
||||
# source and drain pins
|
||||
self.overlap_offset = self.pmos.get_pin("D").ll() - self.pmos.get_pin("S").ll()
|
||||
|
||||
# This is the extra space needed to ensure DRC rules
|
||||
# to the active contacts
|
||||
extra_contact_space = max(-self.nmos_nd.get_pin("D").by(), 0)
|
||||
# This is a poly-to-poly of a flipped cell
|
||||
self.top_bottom_space = max(0.5 * self.m1_width + self.m1_space + extra_contact_space,
|
||||
self.poly_extend_active + self.poly_space)
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top and bottom. """
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer="m1",
|
||||
offset=vector(0.5*self.width, 0),
|
||||
width=self.width)
|
||||
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer="m1",
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
self.overlap_offset = self.pmos_left.get_pin("D").center() - self.pmos_left.get_pin("S").center()
|
||||
|
||||
def create_ptx(self):
|
||||
"""
|
||||
|
|
@ -138,19 +118,19 @@ class pnand2(pgate.pgate):
|
|||
"""
|
||||
|
||||
self.pmos1_inst = self.add_inst(name="pnand2_pmos1",
|
||||
mod=self.pmos)
|
||||
mod=self.pmos_left)
|
||||
self.connect_inst(["vdd", "A", "Z", "vdd"])
|
||||
|
||||
self.pmos2_inst = self.add_inst(name="pnand2_pmos2",
|
||||
mod=self.pmos)
|
||||
mod=self.pmos_right)
|
||||
self.connect_inst(["Z", "B", "vdd", "vdd"])
|
||||
|
||||
self.nmos1_inst = self.add_inst(name="pnand2_nmos1",
|
||||
mod=self.nmos_nd)
|
||||
mod=self.nmos_left)
|
||||
self.connect_inst(["Z", "B", "net1", "gnd"])
|
||||
|
||||
self.nmos2_inst = self.add_inst(name="pnand2_nmos2",
|
||||
mod=self.nmos_ns)
|
||||
mod=self.nmos_right)
|
||||
self.connect_inst(["net1", "A", "gnd", "gnd"])
|
||||
|
||||
def place_ptx(self):
|
||||
|
|
@ -159,35 +139,29 @@ class pnand2(pgate.pgate):
|
|||
to provide maximum routing in channel
|
||||
"""
|
||||
|
||||
pmos1_pos = vector(self.pmos.active_offset.x,
|
||||
self.height - self.pmos.active_height \
|
||||
pmos1_pos = vector(self.pmos_left.active_offset.x,
|
||||
self.height - self.pmos_left.active_height \
|
||||
- self.top_bottom_space)
|
||||
self.pmos1_inst.place(pmos1_pos)
|
||||
|
||||
self.pmos2_pos = pmos1_pos + self.overlap_offset
|
||||
self.pmos2_inst.place(self.pmos2_pos)
|
||||
|
||||
nmos1_pos = vector(self.pmos.active_offset.x,
|
||||
nmos1_pos = vector(self.pmos_left.active_offset.x,
|
||||
self.top_bottom_space)
|
||||
self.nmos1_inst.place(nmos1_pos)
|
||||
|
||||
self.nmos2_pos = nmos1_pos + self.overlap_offset
|
||||
self.nmos2_inst.place(self.nmos2_pos)
|
||||
|
||||
# Output position will be in between the PMOS and NMOS
|
||||
self.output_pos = vector(0,
|
||||
0.5 * (pmos1_pos.y + nmos1_pos.y + self.nmos_nd.active_height))
|
||||
|
||||
def add_well_contacts(self):
|
||||
"""
|
||||
Add n/p well taps to the layout and connect to supplies
|
||||
AFTER the wells are created
|
||||
"""
|
||||
|
||||
self.add_nwell_contact(self.pmos,
|
||||
self.pmos2_pos + vector(self.m1_pitch, 0))
|
||||
self.add_pwell_contact(self.nmos_nd,
|
||||
self.nmos2_pos + vector(self.m1_pitch, 0))
|
||||
self.add_nwell_contact(self.pmos_right, self.pmos2_pos)
|
||||
self.add_pwell_contact(self.nmos_left, self.nmos2_pos)
|
||||
|
||||
def connect_rails(self):
|
||||
""" Connect the nmos and pmos to its respective power rails """
|
||||
|
|
@ -200,35 +174,46 @@ class pnand2(pgate.pgate):
|
|||
|
||||
def route_inputs(self):
|
||||
""" Route the A and B inputs """
|
||||
inputB_yoffset = self.nmos2_inst.uy() + 0.5 * contact.poly_contact.height
|
||||
|
||||
|
||||
# Top of NMOS drain
|
||||
nmos_pin = self.nmos2_inst.get_pin("D")
|
||||
bottom_pin_offset = nmos_pin.uy()
|
||||
self.inputA_yoffset = bottom_pin_offset + self.m1_pitch
|
||||
|
||||
self.inputB_yoffset = self.inputA_yoffset + self.m3_pitch
|
||||
|
||||
# This will help with the wells and the input/output placement
|
||||
self.route_input_gate(self.pmos2_inst,
|
||||
self.nmos2_inst,
|
||||
inputB_yoffset,
|
||||
self.inputB_yoffset,
|
||||
"B",
|
||||
position="center")
|
||||
|
||||
# This will help with the wells and the input/output placement
|
||||
self.inputA_yoffset = self.pmos2_inst.by() - self.poly_extend_active \
|
||||
- contact.poly_contact.height
|
||||
self.route_input_gate(self.pmos1_inst,
|
||||
self.nmos1_inst,
|
||||
self.inputA_yoffset,
|
||||
"A")
|
||||
"A",
|
||||
position="center")
|
||||
|
||||
def route_output(self):
|
||||
""" Route the Z output """
|
||||
|
||||
# One routing track layer below the PMOS contacts
|
||||
route_layer_offset = 0.5 * self.route_layer_width + self.route_layer_space
|
||||
output_yoffset = self.pmos1_inst.get_pin("D").by() - route_layer_offset
|
||||
|
||||
|
||||
# PMOS1 drain
|
||||
pmos_pin = self.pmos1_inst.get_pin("D")
|
||||
top_pin_offset = pmos_pin.center()
|
||||
top_pin_offset = pmos_pin.bc()
|
||||
# NMOS2 drain
|
||||
nmos_pin = self.nmos2_inst.get_pin("D")
|
||||
bottom_pin_offset = nmos_pin.center()
|
||||
bottom_pin_offset = nmos_pin.uc()
|
||||
|
||||
# Output pin
|
||||
c_pin = self.get_pin("B")
|
||||
out_offset = vector(c_pin.cx() + self.m1_pitch,
|
||||
self.inputA_yoffset)
|
||||
out_offset = vector(nmos_pin.cx() + self.route_layer_pitch,
|
||||
output_yoffset)
|
||||
|
||||
# This routes on M2
|
||||
# # Midpoints of the L routes go horizontal first then vertical
|
||||
|
|
@ -251,27 +236,22 @@ class pnand2(pgate.pgate):
|
|||
# [top_pin_offset, mid1_offset, out_offset,
|
||||
# mid2_offset, bottom_pin_offset])
|
||||
|
||||
# This routes on M1
|
||||
# This routes on route_layer
|
||||
# Midpoints of the L routes goes vertical first then horizontal
|
||||
mid1_offset = vector(top_pin_offset.x, out_offset.y)
|
||||
# Midpoints of the L routes goes horizontal first then vertical
|
||||
mid2_offset = vector(out_offset.x, bottom_pin_offset.y)
|
||||
top_mid_offset = vector(top_pin_offset.x, out_offset.y)
|
||||
# Top transistors
|
||||
self.add_path(self.route_layer,
|
||||
[top_pin_offset, top_mid_offset, out_offset])
|
||||
|
||||
self.add_path("m1",
|
||||
[top_pin_offset, mid1_offset, out_offset])
|
||||
# Route in two segments to have the width rule
|
||||
self.add_path("m1",
|
||||
[bottom_pin_offset, mid2_offset + vector(0.5 * self.m1_width, 0)],
|
||||
width=nmos_pin.height())
|
||||
self.add_path("m1",
|
||||
[mid2_offset, out_offset])
|
||||
bottom_mid_offset = bottom_pin_offset + vector(0, self.route_layer_pitch)
|
||||
# Bottom transistors
|
||||
self.add_path(self.route_layer,
|
||||
[out_offset, bottom_mid_offset, bottom_pin_offset])
|
||||
|
||||
# This extends the output to the edge of the cell
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer="m1",
|
||||
offset=out_offset,
|
||||
width=contact.m1_via.first_layer_width,
|
||||
height=contact.m1_via.first_layer_height)
|
||||
layer=self.route_layer,
|
||||
offset=out_offset)
|
||||
|
||||
def analytical_power(self, corner, load):
|
||||
"""Returns dynamic and leakage power. Results in nW"""
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import contact
|
||||
import pgate
|
||||
import debug
|
||||
from tech import drc, parameter, spice
|
||||
|
|
@ -14,12 +13,13 @@ import logical_effort
|
|||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
|
||||
|
||||
class pnand3(pgate.pgate):
|
||||
"""
|
||||
This module generates gds of a parametrically sized 2-input nand.
|
||||
This model use ptx to generate a 2-input nand within a cetrain height.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None):
|
||||
def __init__(self, name, size=1, height=None, add_wells=True):
|
||||
""" Creates a cell for a simple 3 input nand """
|
||||
|
||||
debug.info(2,
|
||||
|
|
@ -45,7 +45,7 @@ class pnand3(pgate.pgate):
|
|||
(self.pmos_width, self.tx_mults) = self.bin_width("pmos", self.pmos_width)
|
||||
|
||||
# Creates the netlist and layout
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
pgate.pgate.__init__(self, name, height, add_wells)
|
||||
|
||||
def add_pins(self):
|
||||
""" Adds pins for spice netlist """
|
||||
|
|
@ -63,79 +63,76 @@ class pnand3(pgate.pgate):
|
|||
|
||||
self.setup_layout_constants()
|
||||
self.place_ptx()
|
||||
self.add_well_contacts()
|
||||
if self.add_wells:
|
||||
self.add_well_contacts()
|
||||
self.route_inputs()
|
||||
self.route_output()
|
||||
self.determine_width()
|
||||
self.route_supply_rails()
|
||||
self.connect_rails()
|
||||
self.extend_wells()
|
||||
self.route_inputs()
|
||||
self.route_output()
|
||||
self.add_boundary()
|
||||
|
||||
def add_ptx(self):
|
||||
""" Create the PMOS and NMOS transistors. """
|
||||
self.nmos_nsnd = factory.create(module_type="ptx",
|
||||
self.nmos_center = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact="active",
|
||||
add_drain_contact="active")
|
||||
self.add_mod(self.nmos_center)
|
||||
|
||||
self.nmos_right = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact="active",
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.nmos_right)
|
||||
|
||||
self.nmos_left = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact=False,
|
||||
add_drain_contact=False,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.nmos_nsnd)
|
||||
|
||||
self.nmos_ns = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact=False,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.nmos_ns)
|
||||
|
||||
self.nmos_nd = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_drain_contact=False,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.nmos_nd)
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact="active")
|
||||
self.add_mod(self.nmos_left)
|
||||
|
||||
self.pmos = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.pmos)
|
||||
self.pmos_left = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.pmos_left)
|
||||
|
||||
self.pmos_center = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.pmos_center)
|
||||
|
||||
self.pmos_right = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.pmos_right)
|
||||
|
||||
def setup_layout_constants(self):
|
||||
""" Pre-compute some handy layout parameters. """
|
||||
|
||||
# Compute the overlap of the source and drain pins
|
||||
overlap_xoffset = self.pmos.get_pin("D").ll().x - self.pmos.get_pin("S").ll().x
|
||||
self.ptx_offset = vector(overlap_xoffset, 0)
|
||||
self.ptx_offset = self.pmos_left.get_pin("D").center() - self.pmos_left.get_pin("S").center()
|
||||
|
||||
# This is the extra space needed to ensure DRC rules
|
||||
# to the active contacts
|
||||
nmos = factory.create(module_type="ptx", tx_type="nmos")
|
||||
extra_contact_space = max(-nmos.get_pin("D").by(), 0)
|
||||
# This is a poly-to-poly of a flipped cell
|
||||
self.top_bottom_space = max(0.5 * self.m1_width + self.m1_space + extra_contact_space,
|
||||
self.poly_extend_active + self.poly_space)
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top and bottom. """
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer="m1",
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer="m1",
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
def create_ptx(self):
|
||||
"""
|
||||
|
|
@ -143,27 +140,27 @@ class pnand3(pgate.pgate):
|
|||
"""
|
||||
|
||||
self.pmos1_inst = self.add_inst(name="pnand3_pmos1",
|
||||
mod=self.pmos)
|
||||
mod=self.pmos_left)
|
||||
self.connect_inst(["vdd", "A", "Z", "vdd"])
|
||||
|
||||
self.pmos2_inst = self.add_inst(name="pnand3_pmos2",
|
||||
mod=self.pmos)
|
||||
mod=self.pmos_center)
|
||||
self.connect_inst(["Z", "B", "vdd", "vdd"])
|
||||
|
||||
self.pmos3_inst = self.add_inst(name="pnand3_pmos3",
|
||||
mod=self.pmos)
|
||||
mod=self.pmos_right)
|
||||
self.connect_inst(["Z", "C", "vdd", "vdd"])
|
||||
|
||||
self.nmos1_inst = self.add_inst(name="pnand3_nmos1",
|
||||
mod=self.nmos_nd)
|
||||
mod=self.nmos_left)
|
||||
self.connect_inst(["Z", "C", "net1", "gnd"])
|
||||
|
||||
self.nmos2_inst = self.add_inst(name="pnand3_nmos2",
|
||||
mod=self.nmos_nsnd)
|
||||
mod=self.nmos_center)
|
||||
self.connect_inst(["net1", "B", "net2", "gnd"])
|
||||
|
||||
self.nmos3_inst = self.add_inst(name="pnand3_nmos3",
|
||||
mod=self.nmos_ns)
|
||||
mod=self.nmos_right)
|
||||
self.connect_inst(["net2", "A", "gnd", "gnd"])
|
||||
|
||||
def place_ptx(self):
|
||||
|
|
@ -172,8 +169,8 @@ class pnand3(pgate.pgate):
|
|||
and lowest position to provide maximum routing in channel
|
||||
"""
|
||||
|
||||
pmos1_pos = vector(self.pmos.active_offset.x,
|
||||
self.height - self.pmos.active_height - self.top_bottom_space)
|
||||
pmos1_pos = vector(self.pmos_left.active_offset.x,
|
||||
self.height - self.pmos_left.active_height - self.top_bottom_space)
|
||||
self.pmos1_inst.place(pmos1_pos)
|
||||
|
||||
pmos2_pos = pmos1_pos + self.ptx_offset
|
||||
|
|
@ -182,7 +179,7 @@ class pnand3(pgate.pgate):
|
|||
self.pmos3_pos = pmos2_pos + self.ptx_offset
|
||||
self.pmos3_inst.place(self.pmos3_pos)
|
||||
|
||||
nmos1_pos = vector(self.pmos.active_offset.x,
|
||||
nmos1_pos = vector(self.pmos_left.active_offset.x,
|
||||
self.top_bottom_space)
|
||||
self.nmos1_inst.place(nmos1_pos)
|
||||
|
||||
|
|
@ -195,9 +192,9 @@ class pnand3(pgate.pgate):
|
|||
def add_well_contacts(self):
|
||||
""" Add n/p well taps to the layout and connect to supplies """
|
||||
|
||||
self.add_nwell_contact(self.pmos,
|
||||
self.add_nwell_contact(self.pmos_right,
|
||||
self.pmos3_pos + vector(self.m1_pitch, 0))
|
||||
self.add_pwell_contact(self.nmos_ns,
|
||||
self.add_pwell_contact(self.nmos_right,
|
||||
self.nmos3_pos + vector(self.m1_pitch, 0))
|
||||
|
||||
def connect_rails(self):
|
||||
|
|
@ -212,37 +209,37 @@ class pnand3(pgate.pgate):
|
|||
def route_inputs(self):
|
||||
""" Route the A and B and C inputs """
|
||||
|
||||
m1_pitch = self.m1_space + contact.m1_via.first_layer_height
|
||||
# Put B right on the well line
|
||||
self.inputB_yoffset = self.nwell_y_offset
|
||||
self.route_input_gate(self.pmos2_inst,
|
||||
self.nmos2_inst,
|
||||
self.inputB_yoffset,
|
||||
"B",
|
||||
position="center")
|
||||
|
||||
# FIXME: constant hack
|
||||
self.inputC_yoffset = self.inputB_yoffset - 1.15 * m1_pitch
|
||||
self.route_input_gate(self.pmos3_inst,
|
||||
self.nmos3_inst,
|
||||
self.inputC_yoffset,
|
||||
"C",
|
||||
position="right")
|
||||
pmos_drain_bottom = self.pmos1_inst.get_pin("D").by()
|
||||
self.output_yoffset = pmos_drain_bottom - 0.5 * self.route_layer_width - self.route_layer_space
|
||||
|
||||
# FIXME: constant hack
|
||||
if OPTS.tech_name == "s8":
|
||||
self.inputA_yoffset = self.inputB_yoffset + 1.15 * m1_pitch
|
||||
else:
|
||||
self.inputA_yoffset = self.inputB_yoffset + 1.12 * m1_pitch
|
||||
# This is a more compact offset, but the bottom one works better in the decoders to "center" the pins
|
||||
# in the height of the gates
|
||||
self.inputA_yoffset = self.output_yoffset - 0.5 * self.route_layer_width - self.route_layer_space
|
||||
# self.inputA_yoffset = self.output_yoffset - self.m1_pitch
|
||||
self.route_input_gate(self.pmos1_inst,
|
||||
self.nmos1_inst,
|
||||
self.inputA_yoffset,
|
||||
"A",
|
||||
position="left")
|
||||
|
||||
# Put B right on the well line
|
||||
self.inputB_yoffset = self.inputA_yoffset - self.m1_pitch
|
||||
self.route_input_gate(self.pmos2_inst,
|
||||
self.nmos2_inst,
|
||||
self.inputB_yoffset,
|
||||
"B",
|
||||
position="center")
|
||||
|
||||
self.inputC_yoffset = self.inputB_yoffset - self.m1_pitch
|
||||
self.route_input_gate(self.pmos3_inst,
|
||||
self.nmos3_inst,
|
||||
self.inputC_yoffset,
|
||||
"C",
|
||||
position="right")
|
||||
|
||||
def route_output(self):
|
||||
""" Route the Z output """
|
||||
|
||||
|
||||
# PMOS1 drain
|
||||
pmos1_pin = self.pmos1_inst.get_pin("D")
|
||||
# PMOS3 drain
|
||||
|
|
@ -250,14 +247,9 @@ class pnand3(pgate.pgate):
|
|||
# NMOS3 drain
|
||||
nmos3_pin = self.nmos3_inst.get_pin("D")
|
||||
|
||||
# midpoint for routing
|
||||
mid_offset = vector(nmos3_pin.cx() + self.m1_pitch,
|
||||
self.inputA_yoffset)
|
||||
out_offset = vector(nmos3_pin.cx() + self.route_layer_pitch,
|
||||
self.output_yoffset)
|
||||
|
||||
# Aligned with the well taps
|
||||
out_offset = vector(self.nwell_contact.cx(),
|
||||
self.inputA_yoffset)
|
||||
|
||||
# Go up to metal2 for ease on all output pins
|
||||
# self.add_via_center(layers=self.m1_stack,
|
||||
# offset=pmos1_pin.center(),
|
||||
|
|
@ -282,26 +274,24 @@ class pnand3(pgate.pgate):
|
|||
bottom_pin_offset = nmos3_pin.center()
|
||||
|
||||
# PMOS1 to output
|
||||
self.add_path("m1", [top_left_pin_offset,
|
||||
vector(top_left_pin_offset.x, out_offset.y),
|
||||
out_offset])
|
||||
self.add_path(self.route_layer, [top_left_pin_offset,
|
||||
vector(top_left_pin_offset.x, out_offset.y),
|
||||
out_offset])
|
||||
# PMOS3 to output
|
||||
self.add_path("m1", [top_right_pin_offset,
|
||||
vector(top_right_pin_offset.x, mid_offset.y),
|
||||
mid_offset])
|
||||
self.add_path(self.route_layer, [top_right_pin_offset,
|
||||
vector(top_right_pin_offset.x, out_offset.y),
|
||||
out_offset])
|
||||
# NMOS3 to output
|
||||
mid2_offset = vector(mid_offset.x, bottom_pin_offset.y)
|
||||
self.add_path("m1",
|
||||
mid2_offset = vector(out_offset.x, bottom_pin_offset.y)
|
||||
self.add_path(self.route_layer,
|
||||
[bottom_pin_offset, mid2_offset],
|
||||
width=nmos3_pin.height())
|
||||
mid3_offset = vector(mid_offset.x, nmos3_pin.by())
|
||||
self.add_path("m1", [mid3_offset, mid_offset])
|
||||
mid3_offset = vector(out_offset.x, nmos3_pin.by())
|
||||
self.add_path(self.route_layer, [mid3_offset, out_offset])
|
||||
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer="m1",
|
||||
offset=out_offset,
|
||||
width=contact.m1_via.first_layer_width,
|
||||
height=contact.m1_via.first_layer_height)
|
||||
layer=self.route_layer,
|
||||
offset=out_offset)
|
||||
|
||||
def analytical_power(self, corner, load):
|
||||
"""Returns dynamic and leakage power. Results in nW"""
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class pnor2(pgate.pgate):
|
|||
This module generates gds of a parametrically sized 2-input nor.
|
||||
This model use ptx to generate a 2-input nor within a cetrain height.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None):
|
||||
def __init__(self, name, size=1, height=None, add_wells=True):
|
||||
""" Creates a cell for a simple 2 input nor """
|
||||
|
||||
debug.info(2,
|
||||
|
|
@ -42,7 +42,7 @@ class pnor2(pgate.pgate):
|
|||
(self.pmos_width, self.tx_mults) = self.bin_width("pmos", self.pmos_width)
|
||||
|
||||
# Creates the netlist and layout
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
pgate.pgate.__init__(self, name, height, add_wells)
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
|
|
@ -54,13 +54,14 @@ class pnor2(pgate.pgate):
|
|||
|
||||
self.setup_layout_constants()
|
||||
self.place_ptx()
|
||||
self.add_well_contacts()
|
||||
if self.add_wells:
|
||||
self.add_well_contacts()
|
||||
self.route_inputs()
|
||||
self.route_output()
|
||||
self.determine_width()
|
||||
self.route_supply_rails()
|
||||
self.connect_rails()
|
||||
self.extend_wells()
|
||||
self.route_inputs()
|
||||
self.route_output()
|
||||
self.add_boundary()
|
||||
|
||||
def add_pins(self):
|
||||
|
|
@ -71,74 +72,54 @@ class pnor2(pgate.pgate):
|
|||
|
||||
def add_ptx(self):
|
||||
""" Create the PMOS and NMOS transistors. """
|
||||
self.nmos = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.nmos)
|
||||
self.nmos_left = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.nmos_left)
|
||||
|
||||
self.pmos_nd = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_drain_contact=False,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.pmos_nd)
|
||||
self.nmos_right = factory.create(module_type="ptx",
|
||||
width=self.nmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="nmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.nmos_right)
|
||||
|
||||
self.pmos_left = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=self.route_layer,
|
||||
add_drain_contact="active")
|
||||
self.add_mod(self.pmos_left)
|
||||
|
||||
self.pmos_ns = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact=False,
|
||||
connect_poly=True,
|
||||
connect_active=True)
|
||||
self.add_mod(self.pmos_ns)
|
||||
self.pmos_right = factory.create(module_type="ptx",
|
||||
width=self.pmos_width,
|
||||
mults=self.tx_mults,
|
||||
tx_type="pmos",
|
||||
add_source_contact="active",
|
||||
add_drain_contact=self.route_layer)
|
||||
self.add_mod(self.pmos_right)
|
||||
|
||||
def setup_layout_constants(self):
|
||||
""" Pre-compute some handy layout parameters. """
|
||||
|
||||
# metal spacing to allow contacts on any layer
|
||||
self.input_spacing = max(self.poly_space + contact.poly_contact.first_layer_width,
|
||||
self.m1_space + contact.m1_via.first_layer_width,
|
||||
self.m2_space + contact.m2_via.first_layer_width,
|
||||
self.m3_space + contact.m2_via.second_layer_width)
|
||||
|
||||
# Compute the other pmos2 location, but determining
|
||||
# offset to overlap the source and drain pins
|
||||
self.overlap_offset = self.pmos_ns.get_pin("D").ll() - self.pmos_nd.get_pin("S").ll()
|
||||
self.overlap_offset = self.pmos_right.get_pin("D").center() - self.pmos_left.get_pin("S").center()
|
||||
|
||||
# Two PMOS devices and a well contact. Separation between each.
|
||||
# Enclosure space on the sides.
|
||||
self.width = 2 * self.pmos_ns.active_width \
|
||||
+ self.pmos_ns.active_contact.width \
|
||||
self.width = 2 * self.pmos_right.active_width \
|
||||
+ self.pmos_right.active_contact.width \
|
||||
+ 2 * self.active_space \
|
||||
+ 0.5 * self.nwell_enclose_active
|
||||
self.well_width = self.width + 2 * self.nwell_enclose_active
|
||||
# Height is an input parameter, so it is not recomputed.
|
||||
|
||||
# This is the extra space needed to ensure DRC rules
|
||||
# to the active contacts
|
||||
extra_contact_space = max(-self.nmos.get_pin("D").by(), 0)
|
||||
# This is a poly-to-poly of a flipped cell
|
||||
self.top_bottom_space = max(0.5 * self.m1_width + self.m1_space + extra_contact_space,
|
||||
self.poly_extend_active,
|
||||
self.poly_space)
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top and bottom. """
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer="m1",
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer="m1",
|
||||
offset=vector(0.5 * self.width, self.height),
|
||||
width=self.width)
|
||||
|
||||
def create_ptx(self):
|
||||
"""
|
||||
Add PMOS and NMOS to the layout at the upper-most and lowest position
|
||||
|
|
@ -146,19 +127,19 @@ class pnor2(pgate.pgate):
|
|||
"""
|
||||
|
||||
self.pmos1_inst = self.add_inst(name="pnor2_pmos1",
|
||||
mod=self.pmos_nd)
|
||||
mod=self.pmos_left)
|
||||
self.connect_inst(["vdd", "A", "net1", "vdd"])
|
||||
|
||||
self.pmos2_inst = self.add_inst(name="pnor2_pmos2",
|
||||
mod=self.pmos_ns)
|
||||
mod=self.pmos_right)
|
||||
self.connect_inst(["net1", "B", "Z", "vdd"])
|
||||
|
||||
self.nmos1_inst = self.add_inst(name="pnor2_nmos1",
|
||||
mod=self.nmos)
|
||||
mod=self.nmos_left)
|
||||
self.connect_inst(["Z", "A", "gnd", "gnd"])
|
||||
|
||||
self.nmos2_inst = self.add_inst(name="pnor2_nmos2",
|
||||
mod=self.nmos)
|
||||
mod=self.nmos_right)
|
||||
self.connect_inst(["Z", "B", "gnd", "gnd"])
|
||||
|
||||
def place_ptx(self):
|
||||
|
|
@ -166,30 +147,35 @@ class pnor2(pgate.pgate):
|
|||
Add PMOS and NMOS to the layout at the upper-most and lowest position
|
||||
to provide maximum routing in channel
|
||||
"""
|
||||
# Some of the S/D contacts may extend beyond the active,
|
||||
# but this needs to be done in the gate itself
|
||||
contact_extend_active_space = max(-self.nmos_right.get_pin("D").by(), 0)
|
||||
# Assume the contact starts at the active edge
|
||||
contact_to_vdd_rail_space = 0.5 * self.m1_width + self.m1_space + contact_extend_active_space
|
||||
# This is a poly-to-poly of a flipped cell
|
||||
poly_to_poly_gate_space = self.poly_extend_active + self.poly_space
|
||||
# Recompute this since it has a small txwith the added contact extend active spacing
|
||||
self.top_bottom_space = max(contact_to_vdd_rail_space,
|
||||
poly_to_poly_gate_space)
|
||||
|
||||
pmos1_pos = vector(self.pmos_ns.active_offset.x,
|
||||
self.height - self.pmos_ns.active_height \
|
||||
- self.top_bottom_space)
|
||||
pmos1_pos = vector(self.pmos_right.active_offset.x,
|
||||
self.height - self.pmos_right.active_height - self.top_bottom_space)
|
||||
self.pmos1_inst.place(pmos1_pos)
|
||||
|
||||
self.pmos2_pos = pmos1_pos + self.overlap_offset
|
||||
self.pmos2_inst.place(self.pmos2_pos)
|
||||
|
||||
nmos1_pos = vector(self.pmos_ns.active_offset.x, self.top_bottom_space)
|
||||
nmos1_pos = vector(self.pmos_right.active_offset.x, self.top_bottom_space)
|
||||
self.nmos1_inst.place(nmos1_pos)
|
||||
|
||||
self.nmos2_pos = nmos1_pos + self.overlap_offset
|
||||
self.nmos2_inst.place(self.nmos2_pos)
|
||||
|
||||
# Output position will be in between the PMOS and NMOS
|
||||
self.output_pos = vector(0,
|
||||
0.5 * (pmos1_pos.y + nmos1_pos.y + self.nmos.active_height))
|
||||
|
||||
def add_well_contacts(self):
|
||||
""" Add n/p well taps to the layout and connect to supplies """
|
||||
|
||||
self.add_nwell_contact(self.pmos_ns, self.pmos2_pos)
|
||||
self.add_pwell_contact(self.nmos, self.nmos2_pos)
|
||||
self.add_nwell_contact(self.pmos_right, self.pmos2_pos)
|
||||
self.add_pwell_contact(self.nmos_right, self.nmos2_pos)
|
||||
|
||||
def connect_rails(self):
|
||||
""" Connect the nmos and pmos to its respective power rails """
|
||||
|
|
@ -202,53 +188,53 @@ class pnor2(pgate.pgate):
|
|||
|
||||
def route_inputs(self):
|
||||
""" Route the A and B inputs """
|
||||
# Use M2 spaces so we can drop vias on the pins later!
|
||||
inputB_yoffset = self.nmos2_inst.uy() + contact.poly_contact.height
|
||||
|
||||
# Top of NMOS drain
|
||||
nmos_pin = self.nmos2_inst.get_pin("D")
|
||||
bottom_pin_offset = nmos_pin.uy()
|
||||
self.inputB_yoffset = bottom_pin_offset + self.m1_nonpref_pitch
|
||||
self.inputA_yoffset = self.inputB_yoffset + self.m1_nonpref_pitch
|
||||
|
||||
self.route_input_gate(self.pmos2_inst,
|
||||
self.nmos2_inst,
|
||||
inputB_yoffset,
|
||||
self.inputB_yoffset,
|
||||
"B",
|
||||
position="center")
|
||||
position="right",
|
||||
directions=("V", "V"))
|
||||
|
||||
# This will help with the wells and the input/output placement
|
||||
self.inputA_yoffset = inputB_yoffset + self.input_spacing
|
||||
self.route_input_gate(self.pmos1_inst,
|
||||
self.nmos1_inst,
|
||||
self.inputA_yoffset,
|
||||
"A")
|
||||
"A",
|
||||
directions=("V", "V"))
|
||||
|
||||
self.output_yoffset = self.inputA_yoffset + self.m1_nonpref_pitch
|
||||
|
||||
def route_output(self):
|
||||
""" Route the Z output """
|
||||
# PMOS2 drain
|
||||
# PMOS2 (right) drain
|
||||
pmos_pin = self.pmos2_inst.get_pin("D")
|
||||
# NMOS1 drain
|
||||
# NMOS1 (left) drain
|
||||
nmos_pin = self.nmos1_inst.get_pin("D")
|
||||
# NMOS2 drain (for output via placement)
|
||||
# NMOS2 (right) drain (for output via placement)
|
||||
nmos2_pin = self.nmos2_inst.get_pin("D")
|
||||
|
||||
# Go up to metal2 for ease on all output pins
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=pmos_pin.center())
|
||||
m1m2_contact = self.add_via_center(layers=self.m1_stack,
|
||||
offset=nmos_pin.center())
|
||||
|
||||
mid1_offset = vector(pmos_pin.center().x, nmos2_pin.center().y)
|
||||
mid2_offset = vector(pmos_pin.center().x, self.inputA_yoffset)
|
||||
mid3_offset = mid2_offset + vector(self.m2_width, 0)
|
||||
# self.add_via_center(layers=self.m1_stack,
|
||||
# offset=pmos_pin.center())
|
||||
# m1m2_contact = self.add_via_center(layers=self.m1_stack,
|
||||
# offset=nmos_pin.center())
|
||||
|
||||
mid1_offset = vector(nmos_pin.center().x, self.output_yoffset)
|
||||
mid2_offset = vector(pmos_pin.center().x, self.output_yoffset)
|
||||
|
||||
# PMOS1 to mid-drain to NMOS2 drain
|
||||
self.add_path("m2",
|
||||
[pmos_pin.center(), mid2_offset, mid3_offset])
|
||||
self.add_path("m2",
|
||||
[nmos_pin.rc(), mid1_offset, mid2_offset])
|
||||
# This extends the output to the edge of the cell
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=mid3_offset)
|
||||
self.add_path(self.route_layer,
|
||||
[nmos_pin.center(), mid1_offset, mid2_offset, pmos_pin.center()])
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer="m1",
|
||||
offset=mid3_offset,
|
||||
width=contact.m1_via.first_layer_height,
|
||||
height=contact.m1_via.first_layer_width)
|
||||
layer=self.route_layer,
|
||||
offset=mid2_offset)
|
||||
|
||||
def analytical_power(self, corner, load):
|
||||
"""Returns dynamic and leakage power. Results in nW"""
|
||||
|
|
|
|||
|
|
@ -105,21 +105,16 @@ class precharge(design.design):
|
|||
|
||||
# center of vdd rail
|
||||
pmos_vdd_pos = vector(pmos_pin.cx(), vdd_position.y)
|
||||
self.add_path("m1", [pmos_pin.uc(), pmos_vdd_pos])
|
||||
self.add_path(self.en_layer, [pmos_pin.center(), pmos_vdd_pos])
|
||||
|
||||
# if enable is not on M1, the supply can be
|
||||
if self.en_layer != "m1":
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=pmos_vdd_pos)
|
||||
|
||||
self.add_power_pin("vdd",
|
||||
self.well_contact_pos,
|
||||
vertical=True)
|
||||
|
||||
# Hack for li layers
|
||||
if hasattr(self, "li_stack"):
|
||||
self.add_via_center(layers=self.li_stack,
|
||||
offset=self.well_contact_pos)
|
||||
directions=("V", "V"))
|
||||
|
||||
self.add_via_stack_center(from_layer=pmos_pin.layer,
|
||||
to_layer=self.en_layer,
|
||||
offset=pmos_pin.center(),
|
||||
directions=("V", "V"))
|
||||
|
||||
def create_ptx(self):
|
||||
"""
|
||||
|
|
@ -159,7 +154,7 @@ class precharge(design.design):
|
|||
self.lower_pmos_inst.place(self.lower_pmos_position)
|
||||
|
||||
# adds the upper pmos(s) to layout with 2 M2 tracks
|
||||
ydiff = self.pmos.height + self.m2_pitch
|
||||
ydiff = self.pmos.height + 2 * self.m2_pitch
|
||||
self.upper_pmos1_pos = self.lower_pmos_position + vector(0, ydiff)
|
||||
self.upper_pmos1_inst.place(self.upper_pmos1_pos)
|
||||
|
||||
|
|
@ -196,19 +191,15 @@ class precharge(design.design):
|
|||
"""
|
||||
|
||||
# adds the en contact to connect the gates to the en rail
|
||||
# midway in the 4 M2 tracks
|
||||
offset = self.lower_pmos_inst.get_pin("G").ul() \
|
||||
+ vector(0, 0.5 * self.m2_pitch)
|
||||
self.add_via_center(layers=self.poly_stack,
|
||||
offset=offset)
|
||||
if self.en_layer == "m2":
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=offset)
|
||||
if hasattr(self, "li_stack"):
|
||||
self.add_via_center(layers=self.li_stack,
|
||||
offset=offset)
|
||||
|
||||
# adds the en rail on metal1
|
||||
pin_offset = self.lower_pmos_inst.get_pin("G").lr()
|
||||
# This is an extra space down for some techs with contact to active spacing
|
||||
offset = pin_offset - vector(0, self.poly_space)
|
||||
self.add_via_stack_center(from_layer="poly",
|
||||
to_layer=self.en_layer,
|
||||
offset=offset)
|
||||
self.add_path("poly",
|
||||
[self.lower_pmos_inst.get_pin("G").bc(), offset])
|
||||
# adds the en rail
|
||||
self.add_layout_pin_segment_center(text="en_bar",
|
||||
layer=self.en_layer,
|
||||
start=offset.scale(0, 1),
|
||||
|
|
@ -225,13 +216,13 @@ class precharge(design.design):
|
|||
self.nwell_extend_active
|
||||
self.well_contact_pos = self.upper_pmos1_inst.get_pin("D").center().scale(1, 0) + \
|
||||
vector(0, offset_height)
|
||||
self.add_via_center(layers=self.active_stack,
|
||||
offset=self.well_contact_pos,
|
||||
implant_type="n",
|
||||
well_type="n")
|
||||
if hasattr(self, "li_stack"):
|
||||
self.add_via_center(layers=self.li_stack,
|
||||
offset=self.well_contact_pos)
|
||||
self.well_contact = self.add_via_center(layers=self.active_stack,
|
||||
offset=self.well_contact_pos,
|
||||
implant_type="n",
|
||||
well_type="n")
|
||||
self.add_via_stack_center(from_layer=self.active_stack[2],
|
||||
to_layer=self.bitline_layer,
|
||||
offset=self.well_contact_pos)
|
||||
|
||||
self.height = self.well_contact_pos.y + contact.active_contact.height + self.m1_space
|
||||
|
||||
|
|
@ -245,11 +236,10 @@ class precharge(design.design):
|
|||
"""
|
||||
Adds both bit-line and bit-line-bar to the module
|
||||
"""
|
||||
layer_width = drc("minwidth_" + self.bitline_layer)
|
||||
layer_space = drc("{0}_to_{0}".format(self.bitline_layer))
|
||||
layer_pitch = getattr(self, "{}_pitch".format(self.bitline_layer))
|
||||
|
||||
# adds the BL
|
||||
self.bl_xoffset = layer_space + 0.5 * layer_width
|
||||
self.bl_xoffset = layer_pitch
|
||||
top_pos = vector(self.bl_xoffset, self.height)
|
||||
pin_pos = vector(self.bl_xoffset, 0)
|
||||
self.add_path(self.bitline_layer, [top_pos, pin_pos])
|
||||
|
|
@ -259,7 +249,7 @@ class precharge(design.design):
|
|||
end=top_pos)
|
||||
|
||||
# adds the BR
|
||||
self.br_xoffset = self.width - layer_space - 0.5 * layer_width
|
||||
self.br_xoffset = self.width - layer_pitch
|
||||
top_pos = vector(self.br_xoffset, self.height)
|
||||
pin_pos = vector(self.br_xoffset, 0)
|
||||
self.add_path(self.bitline_layer, [top_pos, pin_pos])
|
||||
|
|
@ -288,31 +278,19 @@ class precharge(design.design):
|
|||
Adds contacts/via from metal1 to metal2 for bit-lines
|
||||
"""
|
||||
|
||||
# No contacts needed if M1
|
||||
if self.bitline_layer == "m1":
|
||||
return
|
||||
|
||||
# BL
|
||||
lower_pin = self.lower_pmos_inst.get_pin("S")
|
||||
self.lower_via = self.add_via_center(layers=self.m1_stack,
|
||||
offset=lower_pin.center(),
|
||||
directions=("V", "V"))
|
||||
for lower_pin in [self.lower_pmos_inst.get_pin("S"), self.lower_pmos_inst.get_pin("D")]:
|
||||
self.add_via_stack_center(from_layer=lower_pin.layer,
|
||||
to_layer=self.bitline_layer,
|
||||
offset=lower_pin.center(),
|
||||
directions=("V", "V"))
|
||||
|
||||
lower_pin = self.lower_pmos_inst.get_pin("D")
|
||||
self.lower_via = self.add_via_center(layers=self.m1_stack,
|
||||
offset=lower_pin.center(),
|
||||
directions=("V", "V"))
|
||||
|
||||
# BR
|
||||
upper_pin = self.upper_pmos1_inst.get_pin("S")
|
||||
self.upper_via2 = self.add_via_center(layers=self.m1_stack,
|
||||
offset=upper_pin.center(),
|
||||
directions=("V", "V"))
|
||||
|
||||
upper_pin = self.upper_pmos2_inst.get_pin("D")
|
||||
self.upper_via2 = self.add_via_center(layers=self.m1_stack,
|
||||
offset=upper_pin.center(),
|
||||
directions=("V", "V"))
|
||||
for upper_pin in [self.upper_pmos1_inst.get_pin("S"), self.upper_pmos2_inst.get_pin("D")]:
|
||||
self.add_via_stack_center(from_layer=upper_pin.layer,
|
||||
to_layer=self.bitline_layer,
|
||||
offset=upper_pin.center(),
|
||||
directions=("V", "V"))
|
||||
|
||||
def connect_pmos(self, pmos_pin, bit_xoffset):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -79,9 +79,6 @@ class ptristate_inv(pgate.pgate):
|
|||
self.width = self.well_width + 0.5 * self.m1_space
|
||||
# Height is an input parameter, so it is not recomputed.
|
||||
|
||||
# Make sure we can put a well above and below
|
||||
self.top_bottom_space = max(contact.active_contact.width, contact.active_contact.height)
|
||||
|
||||
def add_ptx(self):
|
||||
""" Create the PMOS and NMOS transistors. """
|
||||
self.nmos = factory.create(module_type="ptx",
|
||||
|
|
|
|||
|
|
@ -23,32 +23,47 @@ class ptx(design.design):
|
|||
the transistor width. Mults is the number of transistors of the
|
||||
given width. Total width is therefore mults*width. Options allow
|
||||
you to connect the fingered gates and active for parallel devices.
|
||||
|
||||
The add_*_contact option tells which layer to bring source/drain up to.
|
||||
"""
|
||||
def __init__(self,
|
||||
name="",
|
||||
width=drc("minwidth_tx"),
|
||||
mults=1,
|
||||
tx_type="nmos",
|
||||
add_source_contact=True,
|
||||
add_drain_contact=True,
|
||||
add_source_contact=None,
|
||||
add_drain_contact=None,
|
||||
series_devices=False,
|
||||
connect_active=False,
|
||||
connect_drain_active=False,
|
||||
connect_source_active=False,
|
||||
connect_poly=False,
|
||||
num_contacts=None):
|
||||
|
||||
if "li" in layer:
|
||||
self.route_layer = "li"
|
||||
else:
|
||||
self.route_layer = "m1"
|
||||
|
||||
# Default contacts are the lowest layer
|
||||
if not add_source_contact:
|
||||
add_source_contact = self.route_layer
|
||||
|
||||
# Default contacts are the lowest layer
|
||||
if not add_drain_contact:
|
||||
add_drain_contact = self.route_layer
|
||||
|
||||
# We need to keep unique names because outputting to GDSII
|
||||
# will use the last record with a given name. I.e., you will
|
||||
# over-write a design in GDS if one has and the other doesn't
|
||||
# have poly connected, for example.
|
||||
name = "{0}_m{1}_w{2:.3f}".format(tx_type, mults, width)
|
||||
if not add_source_contact:
|
||||
name += "_ns"
|
||||
if not add_drain_contact:
|
||||
name += "_nd"
|
||||
name += "_s{}".format(add_source_contact)
|
||||
name += "_d{}".format(add_drain_contact)
|
||||
if series_devices:
|
||||
name += "_sd"
|
||||
if connect_active:
|
||||
name += "_a"
|
||||
if connect_drain_active:
|
||||
name += "_da"
|
||||
if connect_source_active:
|
||||
name += "_sa"
|
||||
if connect_poly:
|
||||
name += "_p"
|
||||
if num_contacts:
|
||||
|
|
@ -61,13 +76,17 @@ class ptx(design.design):
|
|||
self.tx_type = tx_type
|
||||
self.mults = mults
|
||||
self.tx_width = width
|
||||
self.connect_active = connect_active
|
||||
self.connect_drain_active = connect_drain_active
|
||||
self.connect_source_active = connect_source_active
|
||||
self.connect_poly = connect_poly
|
||||
self.add_source_contact = add_source_contact
|
||||
self.add_drain_contact = add_drain_contact
|
||||
self.series_devices = series_devices
|
||||
self.num_contacts = num_contacts
|
||||
|
||||
self.route_layer_width = drc("minwidth_{}".format(self.route_layer))
|
||||
self.route_layer_space = drc("{0}_to_{0}".format(self.route_layer))
|
||||
|
||||
# Since it has variable height, it is not a pgate.
|
||||
self.create_netlist()
|
||||
# We must always create ptx layout for pbitcell
|
||||
|
|
@ -266,55 +285,42 @@ class ptx(design.design):
|
|||
width=poly_width,
|
||||
height=self.poly_width)
|
||||
|
||||
def connect_fingered_active(self, drain_positions, source_positions):
|
||||
def connect_fingered_active(self, positions, pin_name, top):
|
||||
"""
|
||||
Connect each contact up/down to a source or drain pin
|
||||
"""
|
||||
|
||||
|
||||
if len(positions) <= 1:
|
||||
return
|
||||
|
||||
layer_space = getattr(self, "{}_space".format(self.route_layer))
|
||||
layer_width = getattr(self, "{}_width".format(self.route_layer))
|
||||
|
||||
# This is the distance that we must route up or down from the center
|
||||
# of the contacts to avoid DRC violations to the other contacts
|
||||
pin_offset = vector(0,
|
||||
0.5 * self.active_contact.second_layer_height + self.m1_space + 0.5 * self.m1_width)
|
||||
0.5 * self.active_contact.second_layer_height + layer_space + 0.5 * layer_width)
|
||||
# This is the width of a m1 extend the ends of the pin
|
||||
end_offset = vector(self.m1_width / 2.0, 0)
|
||||
end_offset = vector(layer_width / 2.0, 0)
|
||||
|
||||
# drains always go to the MIDDLE of the cell,
|
||||
# so top of NMOS, bottom of PMOS
|
||||
# so reverse the directions for NMOS compared to PMOS.
|
||||
if self.tx_type == "pmos":
|
||||
drain_dir = -1
|
||||
source_dir = 1
|
||||
# We move the opposite direction from the bottom
|
||||
if not top:
|
||||
offset = pin_offset.scale(-1, -1)
|
||||
else:
|
||||
drain_dir = 1
|
||||
source_dir = -1
|
||||
|
||||
if len(source_positions) > 1:
|
||||
source_offset = pin_offset.scale(source_dir, source_dir)
|
||||
# remove the individual connections
|
||||
self.remove_layout_pin("S")
|
||||
# Add each vertical segment
|
||||
for a in source_positions:
|
||||
self.add_path(("m1"),
|
||||
[a, a + pin_offset.scale(source_dir,
|
||||
source_dir)])
|
||||
# Add a single horizontal pin
|
||||
self.add_layout_pin_segment_center(text="S",
|
||||
layer="m1",
|
||||
start=source_positions[0] + source_offset - end_offset,
|
||||
end=source_positions[-1] + source_offset + end_offset)
|
||||
offset = pin_offset
|
||||
|
||||
# remove the individual connections
|
||||
self.remove_layout_pin(pin_name)
|
||||
# Add each vertical segment
|
||||
for a in positions:
|
||||
self.add_path(self.route_layer,
|
||||
[a, a + offset])
|
||||
# Add a single horizontal pin
|
||||
self.add_layout_pin_segment_center(text=pin_name,
|
||||
layer=self.route_layer,
|
||||
start=positions[0] + offset - end_offset,
|
||||
end=positions[-1] + offset + end_offset)
|
||||
|
||||
if len(drain_positions)>1:
|
||||
drain_offset = pin_offset.scale(drain_dir,drain_dir)
|
||||
self.remove_layout_pin("D") # remove the individual connections
|
||||
# Add each vertical segment
|
||||
for a in drain_positions:
|
||||
self.add_path(("m1"), [a,a+drain_offset])
|
||||
# Add a single horizontal pin
|
||||
self.add_layout_pin_segment_center(text="D",
|
||||
layer="m1",
|
||||
start=drain_positions[0] + drain_offset - end_offset,
|
||||
end=drain_positions[-1] + drain_offset + end_offset)
|
||||
|
||||
def add_poly(self):
|
||||
"""
|
||||
Add the poly gates(s) and (optionally) connect them.
|
||||
|
|
@ -380,10 +386,12 @@ class ptx(design.design):
|
|||
well_ll = center_pos - vector(0.5 * self.well_width,
|
||||
0.5 * self.well_height)
|
||||
if well_name in layer:
|
||||
self.add_rect(layer=well_name,
|
||||
offset=well_ll,
|
||||
width=self.well_width,
|
||||
height=self.well_height)
|
||||
well = self.add_rect(layer=well_name,
|
||||
offset=well_ll,
|
||||
width=self.well_width,
|
||||
height=self.well_height)
|
||||
setattr(self, well_name, well)
|
||||
|
||||
if "vtg" in layer:
|
||||
self.add_rect(layer="vtg",
|
||||
offset=well_ll,
|
||||
|
|
@ -433,12 +441,12 @@ class ptx(design.design):
|
|||
label = "S"
|
||||
source_positions.append(pos)
|
||||
|
||||
if (label=="S" and self.add_source_contact) or (label=="D" and self.add_drain_contact):
|
||||
if (label=="S" and self.add_source_contact):
|
||||
contact = self.add_diff_contact(label, pos)
|
||||
if label == "S":
|
||||
self.source_contacts.append(contact)
|
||||
else:
|
||||
self.drain_contacts.append(contact)
|
||||
self.source_contacts.append(contact)
|
||||
elif (label=="D" and self.add_drain_contact):
|
||||
contact = self.add_diff_contact(label, pos)
|
||||
self.drain_contacts.append(contact)
|
||||
else:
|
||||
self.add_layout_pin_rect_center(text=label,
|
||||
layer="active",
|
||||
|
|
@ -454,19 +462,22 @@ class ptx(design.design):
|
|||
label = "S"
|
||||
source_positions.append(pos)
|
||||
|
||||
if (label=="S" and self.add_source_contact) or (label=="D" and self.add_drain_contact):
|
||||
if (label=="S" and self.add_source_contact):
|
||||
contact = self.add_diff_contact(label, pos)
|
||||
if label == "S":
|
||||
self.source_contacts.append(contact)
|
||||
else:
|
||||
self.drain_contacts.append(contact)
|
||||
self.source_contacts.append(contact)
|
||||
elif (label=="D" and self.add_drain_contact):
|
||||
contact = self.add_diff_contact(label, pos)
|
||||
self.drain_contacts.append(contact)
|
||||
else:
|
||||
self.add_layout_pin_rect_center(text=label,
|
||||
layer="active",
|
||||
offset=pos)
|
||||
|
||||
if self.connect_active:
|
||||
self.connect_fingered_active(drain_positions, source_positions)
|
||||
if self.connect_source_active:
|
||||
self.connect_fingered_active(source_positions, "S", top=(self.tx_type=="pmos"))
|
||||
|
||||
if self.connect_drain_active:
|
||||
self.connect_fingered_active(drain_positions, "D", top=(self.tx_type=="nmos"))
|
||||
|
||||
def get_stage_effort(self, cout):
|
||||
"""Returns an object representing the parameters for delay in tau units."""
|
||||
|
|
@ -489,34 +500,39 @@ class ptx(design.design):
|
|||
return self.mults * self.tx_width / drc("minwidth_tx")
|
||||
|
||||
def add_diff_contact(self, label, pos):
|
||||
contact=self.add_via_center(layers=self.active_stack,
|
||||
offset=pos,
|
||||
size=(1, self.num_contacts),
|
||||
directions=("V", "V"),
|
||||
implant_type=self.implant_type,
|
||||
well_type=self.well_type)
|
||||
|
||||
if hasattr(self, "li_stack"):
|
||||
contact=self.add_via_center(layers=self.li_stack,
|
||||
offset=pos,
|
||||
directions=("V", "V"))
|
||||
|
||||
# contact_area = contact.mod.second_layer_width * contact.mod.second_layer_height
|
||||
# min_area = drc("minarea_m1")
|
||||
# width = contact.mod.second_layer_width
|
||||
# if contact_area < min_area:
|
||||
# height = min_area / width
|
||||
# else:
|
||||
# height = contact.mod.second_layer_height
|
||||
width = contact.mod.second_layer_width
|
||||
height = contact.mod.second_layer_height
|
||||
if label == "S":
|
||||
layer = self.add_source_contact
|
||||
elif label == "D":
|
||||
layer = self.add_drain_contact
|
||||
else:
|
||||
debug.error("Invalid source drain name.")
|
||||
|
||||
if layer != "active":
|
||||
via=self.add_via_stack_center(offset=pos,
|
||||
from_layer="active",
|
||||
to_layer=layer,
|
||||
size=(1, self.num_contacts),
|
||||
directions=("V", "V"),
|
||||
implant_type=self.implant_type,
|
||||
well_type=self.well_type)
|
||||
|
||||
pin_height = via.mod.second_layer_height
|
||||
pin_width = via.mod.second_layer_width
|
||||
else:
|
||||
via = None
|
||||
|
||||
pin_height = None
|
||||
pin_width = None
|
||||
|
||||
# Source drain vias are all vertical
|
||||
self.add_layout_pin_rect_center(text=label,
|
||||
layer="m1",
|
||||
layer=layer,
|
||||
offset=pos,
|
||||
width=width,
|
||||
height=height)
|
||||
width=pin_width,
|
||||
height=pin_height)
|
||||
|
||||
return(contact)
|
||||
return(via)
|
||||
|
||||
def get_cin(self):
|
||||
"""Returns the relative gate cin of the tx"""
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ from tech import drc, layer
|
|||
from vector import vector
|
||||
from sram_factory import factory
|
||||
import logical_effort
|
||||
from utils import round_to_grid
|
||||
|
||||
|
||||
class single_level_column_mux(pgate.pgate):
|
||||
|
|
@ -44,13 +45,22 @@ class single_level_column_mux(pgate.pgate):
|
|||
|
||||
def create_layout(self):
|
||||
|
||||
self.pin_height = 2 * self.m2_width
|
||||
# If li exists, use li and m1 for the mux, otherwise use m1 and m2
|
||||
if "li" in layer:
|
||||
self.col_mux_stack = self.li_stack
|
||||
else:
|
||||
self.col_mux_stack = self.m1_stack
|
||||
self.pin_layer = self.bitcell.get_pin(self.bitcell_bl).layer
|
||||
self.pin_pitch = getattr(self, "{}_pitch".format(self.pin_layer))
|
||||
self.pin_width = getattr(self, "{}_width".format(self.pin_layer))
|
||||
self.pin_height = 2 * self.pin_width
|
||||
self.width = self.bitcell.width
|
||||
self.height = self.nmos_upper.uy() + self.pin_height
|
||||
|
||||
self.connect_poly()
|
||||
self.add_bitline_pins()
|
||||
self.connect_bitlines()
|
||||
self.add_wells()
|
||||
self.add_pn_wells()
|
||||
|
||||
def add_modules(self):
|
||||
self.bitcell = factory.create(module_type="bitcell")
|
||||
|
|
@ -58,9 +68,7 @@ class single_level_column_mux(pgate.pgate):
|
|||
# Adds nmos_lower,nmos_upper to the module
|
||||
self.ptx_width = self.tx_size * drc("minwidth_tx")
|
||||
self.nmos = factory.create(module_type="ptx",
|
||||
width=self.ptx_width,
|
||||
add_source_contact=False,
|
||||
add_drain_contact=False)
|
||||
width=self.ptx_width)
|
||||
self.add_mod(self.nmos)
|
||||
|
||||
def add_pins(self):
|
||||
|
|
@ -69,29 +77,26 @@ class single_level_column_mux(pgate.pgate):
|
|||
def add_bitline_pins(self):
|
||||
""" Add the top and bottom pins to this cell """
|
||||
|
||||
bl_pin=self.bitcell.get_pin(self.bitcell_bl)
|
||||
br_pin=self.bitcell.get_pin(self.bitcell_br)
|
||||
|
||||
bl_pos = vector(bl_pin.lx(), 0)
|
||||
br_pos = vector(br_pin.lx(), 0)
|
||||
bl_pos = vector(self.pin_pitch, 0)
|
||||
br_pos = vector(self.width - self.pin_pitch, 0)
|
||||
|
||||
# bl and br
|
||||
self.add_layout_pin(text="bl",
|
||||
layer=bl_pin.layer,
|
||||
layer=self.pin_layer,
|
||||
offset=bl_pos + vector(0, self.height - self.pin_height),
|
||||
height=self.pin_height)
|
||||
self.add_layout_pin(text="br",
|
||||
layer=br_pin.layer,
|
||||
layer=self.pin_layer,
|
||||
offset=br_pos + vector(0, self.height - self.pin_height),
|
||||
height=self.pin_height)
|
||||
|
||||
# bl_out and br_out
|
||||
self.add_layout_pin(text="bl_out",
|
||||
layer=bl_pin.layer,
|
||||
layer=self.pin_layer,
|
||||
offset=bl_pos,
|
||||
height=self.pin_height)
|
||||
self.add_layout_pin(text="br_out",
|
||||
layer=br_pin.layer,
|
||||
layer=self.pin_layer,
|
||||
offset=br_pos,
|
||||
height=self.pin_height)
|
||||
|
||||
|
|
@ -99,7 +104,7 @@ class single_level_column_mux(pgate.pgate):
|
|||
""" Create the two pass gate NMOS transistors to switch the bitlines"""
|
||||
|
||||
# Space it in the center
|
||||
nmos_lower_position = self.nmos.active_offset.scale(0,1) \
|
||||
nmos_lower_position = self.nmos.active_offset.scale(0, 1) \
|
||||
+ vector(0.5 * self.bitcell.width- 0.5 * self.nmos.active_width, 0)
|
||||
self.nmos_lower = self.add_inst(name="mux_tx1",
|
||||
mod=self.nmos,
|
||||
|
|
@ -133,63 +138,30 @@ class single_level_column_mux(pgate.pgate):
|
|||
|
||||
def connect_bitlines(self):
|
||||
""" Connect the bitlines to the mux transistors """
|
||||
|
||||
# If li exists, use li and m1 for the mux, otherwise use m1 and m2
|
||||
if "li" in layer:
|
||||
self.col_mux_stack = self.li_stack
|
||||
else:
|
||||
self.col_mux_stack = self.m1_stack
|
||||
|
||||
# These are on metal2
|
||||
bl_pin = self.get_pin("bl")
|
||||
br_pin = self.get_pin("br")
|
||||
bl_out_pin = self.get_pin("bl_out")
|
||||
br_out_pin = self.get_pin("br_out")
|
||||
|
||||
# These are on metal1
|
||||
nmos_lower_s_pin = self.nmos_lower.get_pin("S")
|
||||
nmos_lower_d_pin = self.nmos_lower.get_pin("D")
|
||||
nmos_upper_s_pin = self.nmos_upper.get_pin("S")
|
||||
nmos_upper_d_pin = self.nmos_upper.get_pin("D")
|
||||
|
||||
# Add vias to bl, br_out, nmos_upper/S, nmos_lower/D
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=bl_pin.bc(),
|
||||
directions=("V", "V"))
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=br_out_pin.uc(),
|
||||
directions=("V", "V"))
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=nmos_upper_s_pin.center(),
|
||||
directions=("V", "V"))
|
||||
self.add_via_center(layers=self.col_mux_stack,
|
||||
offset=nmos_lower_d_pin.center(),
|
||||
directions=("V", "V"))
|
||||
|
||||
# Add diffusion contacts
|
||||
# These were previously omitted with the options: add_source_contact=False, add_drain_contact=False
|
||||
# They are added now and not previously so that they do not include m1 (which is usually included by default)
|
||||
# This is only a concern when the local interconnect (li) layer is being used
|
||||
self.add_via_center(layers=self.active_stack,
|
||||
offset=nmos_upper_d_pin.center(),
|
||||
directions=("V", "V"),
|
||||
implant_type="n",
|
||||
well_type="nwell")
|
||||
self.add_via_center(layers=self.active_stack,
|
||||
offset=nmos_lower_s_pin.center(),
|
||||
directions=("V", "V"),
|
||||
implant_type="n",
|
||||
well_type="nwell")
|
||||
self.add_via_center(layers=self.active_stack,
|
||||
offset=nmos_upper_s_pin.center(),
|
||||
directions=("V", "V"),
|
||||
implant_type="n",
|
||||
well_type="nwell")
|
||||
self.add_via_center(layers=self.active_stack,
|
||||
offset=nmos_lower_d_pin.center(),
|
||||
directions=("V", "V"),
|
||||
implant_type="n",
|
||||
well_type="nwell")
|
||||
self.add_via_stack_center(from_layer=bl_pin.layer,
|
||||
to_layer=self.col_mux_stack[0],
|
||||
offset=bl_pin.bc())
|
||||
self.add_via_stack_center(from_layer=br_out_pin.layer,
|
||||
to_layer=self.col_mux_stack[0],
|
||||
offset=br_out_pin.uc())
|
||||
self.add_via_stack_center(from_layer=nmos_upper_s_pin.layer,
|
||||
to_layer=self.col_mux_stack[2],
|
||||
offset=nmos_upper_s_pin.center())
|
||||
self.add_via_stack_center(from_layer=nmos_lower_d_pin.layer,
|
||||
to_layer=self.col_mux_stack[2],
|
||||
offset=nmos_lower_d_pin.center())
|
||||
|
||||
# bl -> nmos_upper/D on metal1
|
||||
# bl_out -> nmos_upper/S on metal2
|
||||
|
|
@ -218,7 +190,7 @@ class single_level_column_mux(pgate.pgate):
|
|||
self.add_path(self.col_mux_stack[2],
|
||||
[br_pin.bc(), mid1, mid2, nmos_lower_d_pin.center()])
|
||||
|
||||
def add_wells(self):
|
||||
def add_pn_wells(self):
|
||||
"""
|
||||
Add a well and implant over the whole cell. Also, add the
|
||||
pwell contact (if it exists)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,151 @@
|
|||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
from vector import vector
|
||||
import design
|
||||
from sram_factory import factory
|
||||
from globals import OPTS
|
||||
from tech import layer
|
||||
|
||||
|
||||
class wordline_driver(design.design):
|
||||
"""
|
||||
This is an AND (or NAND) with configurable drive strength to drive the wordlines.
|
||||
It is matched to the bitcell height.
|
||||
"""
|
||||
def __init__(self, name, size=1, height=None):
|
||||
debug.info(1, "Creating wordline_driver {}".format(name))
|
||||
self.add_comment("size: {}".format(size))
|
||||
design.design.__init__(self, name)
|
||||
|
||||
if height is None:
|
||||
b = factory.create(module_type="bitcell")
|
||||
self.height = b.height
|
||||
else:
|
||||
self.height = height
|
||||
self.size = size
|
||||
|
||||
self.create_netlist()
|
||||
if not OPTS.netlist_only:
|
||||
self.create_layout()
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
self.create_modules()
|
||||
self.create_insts()
|
||||
|
||||
def create_modules(self):
|
||||
self.nand = factory.create(module_type="nand2_dec",
|
||||
height=self.height)
|
||||
|
||||
self.driver = factory.create(module_type="inv_dec",
|
||||
size=self.size,
|
||||
height=self.nand.height)
|
||||
|
||||
self.add_mod(self.nand)
|
||||
self.add_mod(self.driver)
|
||||
|
||||
def create_layout(self):
|
||||
self.width = self.nand.width + self.driver.width
|
||||
if "li" in layer:
|
||||
self.route_layer = "li"
|
||||
else:
|
||||
self.route_layer = "m1"
|
||||
|
||||
self.place_insts()
|
||||
self.route_wires()
|
||||
self.add_layout_pins()
|
||||
self.route_supply_rails()
|
||||
self.add_boundary()
|
||||
self.DRC_LVS()
|
||||
|
||||
def add_pins(self):
|
||||
self.add_pin("A", "INPUT")
|
||||
self.add_pin("B", "INPUT")
|
||||
self.add_pin("Z", "OUTPUT")
|
||||
self.add_pin("vdd", "POWER")
|
||||
self.add_pin("gnd", "GROUND")
|
||||
|
||||
def create_insts(self):
|
||||
self.nand_inst = self.add_inst(name="wld_nand",
|
||||
mod=self.nand)
|
||||
self.connect_inst(["A", "B", "zb_int", "vdd", "gnd"])
|
||||
|
||||
self.driver_inst = self.add_inst(name="wl_driver",
|
||||
mod=self.driver)
|
||||
self.connect_inst(["zb_int", "Z", "vdd", "gnd"])
|
||||
|
||||
def place_insts(self):
|
||||
# Add NAND to the right
|
||||
self.nand_inst.place(offset=vector(0, 0))
|
||||
|
||||
# Add INV to the right
|
||||
self.driver_inst.place(offset=vector(self.nand_inst.rx(), 0))
|
||||
|
||||
def route_supply_rails(self):
|
||||
""" Add vdd/gnd rails to the top, (middle), and bottom. """
|
||||
if OPTS.tech_name == "s8":
|
||||
for name in ["vdd", "gnd"]:
|
||||
for inst in [self.nand_inst, self.driver_inst]:
|
||||
self.copy_layout_pin(inst, name)
|
||||
else:
|
||||
self.add_layout_pin_rect_center(text="gnd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, 0),
|
||||
width=self.width)
|
||||
|
||||
y_offset = self.height
|
||||
self.add_layout_pin_rect_center(text="vdd",
|
||||
layer=self.route_layer,
|
||||
offset=vector(0.5 * self.width, y_offset),
|
||||
width=self.width)
|
||||
|
||||
def route_wires(self):
|
||||
|
||||
# nand Z to inv A
|
||||
z1_pin = self.nand_inst.get_pin("Z")
|
||||
a2_pin = self.driver_inst.get_pin("A")
|
||||
if OPTS.tech_name == "s8":
|
||||
mid1_point = vector(a2_pin.cx(), z1_pin.cy())
|
||||
else:
|
||||
mid1_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path(self.route_layer,
|
||||
[z1_pin.center(), mid1_point, a2_pin.center()])
|
||||
|
||||
def add_layout_pins(self):
|
||||
pin = self.driver_inst.get_pin("Z")
|
||||
self.add_layout_pin_rect_center(text="Z",
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
for pin_name in ["A", "B"]:
|
||||
pin = self.nand_inst.get_pin(pin_name)
|
||||
self.add_layout_pin_rect_center(text=pin_name,
|
||||
layer=pin.layer,
|
||||
offset=pin.center(),
|
||||
width=pin.width(),
|
||||
height=pin.height())
|
||||
|
||||
def get_stage_efforts(self, external_cout, inp_is_rise=False):
|
||||
"""Get the stage efforts of the A or B -> Z path"""
|
||||
stage_effort_list = []
|
||||
stage1_cout = self.driver.get_cin()
|
||||
stage1 = self.nand.get_stage_effort(stage1_cout, inp_is_rise)
|
||||
stage_effort_list.append(stage1)
|
||||
|
||||
stage2 = self.driver.get_stage_effort(external_cout, stage1.is_rise)
|
||||
stage_effort_list.append(stage2)
|
||||
|
||||
return stage_effort_list
|
||||
|
||||
def get_cin(self):
|
||||
"""Return the relative input capacitance of a single input"""
|
||||
return self.nand.get_cin()
|
||||
|
||||
|
|
@ -18,17 +18,13 @@ class router_tech:
|
|||
"""
|
||||
def __init__(self, layers, rail_track_width):
|
||||
"""
|
||||
Allows us to change the layers that we are routing on. First layer
|
||||
is always horizontal, middle is via, and last is always
|
||||
vertical.
|
||||
Allows us to change the layers that we are routing on.
|
||||
This uses the preferreed directions.
|
||||
"""
|
||||
self.layers = layers
|
||||
self.rail_track_width = rail_track_width
|
||||
|
||||
if len(self.layers) == 1:
|
||||
if preferred_directions[self.layers[0]] != "H":
|
||||
debug.warning("Using '{}' for horizontal routing, but it " \
|
||||
"prefers vertical routing".format(self.layers[0]))
|
||||
self.horiz_layer_name = self.vert_layer_name = self.layers[0]
|
||||
self.horiz_lpp = self.vert_lpp = layer[self.layers[0]]
|
||||
|
||||
|
|
@ -42,13 +38,21 @@ class router_tech:
|
|||
|
||||
# figure out wich of the two layers prefers horizontal/vertical
|
||||
# routing
|
||||
if preferred_directions[try_horiz_layer] == "H" and preferred_directions[try_vert_layer] == "V":
|
||||
self.horiz_layer_name = None
|
||||
self.vert_layer_name = None
|
||||
|
||||
if preferred_directions[try_horiz_layer] == "H":
|
||||
self.horiz_layer_name = try_horiz_layer
|
||||
else:
|
||||
self.horiz_layer_name = try_vert_layer
|
||||
if preferred_directions[try_vert_layer] == "V":
|
||||
self.vert_layer_name = try_vert_layer
|
||||
else:
|
||||
raise ValueError("Layer '{}' and '{}' are using the wrong " \
|
||||
"preferred_directions '{}' and '{}'. Only "\
|
||||
"('H', 'V') are supported")
|
||||
self.vert_layer_name = try_horiz_layer
|
||||
|
||||
if not self.horiz_layer_name or not self.vert_layer_name:
|
||||
raise ValueError("Layer '{}' and '{}' are using the wrong "
|
||||
"preferred_directions '{}' and '{}'.")
|
||||
|
||||
via_connect = contact(self.layers, (1, 1))
|
||||
max_via_size = max(via_connect.width,via_connect.height)
|
||||
|
|
|
|||
|
|
@ -5,21 +5,15 @@
|
|||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import gdsMill
|
||||
import tech
|
||||
import math
|
||||
import debug
|
||||
from globals import OPTS,print_time
|
||||
from contact import contact
|
||||
from pin_group import pin_group
|
||||
from pin_layout import pin_layout
|
||||
from vector3d import vector3d
|
||||
from globals import print_time
|
||||
from vector3d import vector3d
|
||||
from router import router
|
||||
from direction import direction
|
||||
from datetime import datetime
|
||||
import grid
|
||||
import grid_utils
|
||||
|
||||
|
||||
class supply_grid_router(router):
|
||||
"""
|
||||
A router class to read an obstruction map from a gds and
|
||||
|
|
@ -44,14 +38,13 @@ class supply_grid_router(router):
|
|||
self.supply_rail_tracks = {}
|
||||
|
||||
print_time("Init supply router", datetime.now(), start_time, 3)
|
||||
|
||||
|
||||
def create_routing_grid(self):
|
||||
"""
|
||||
Create a sprase routing grid with A* expansion functions.
|
||||
"""
|
||||
size = self.ur - self.ll
|
||||
debug.info(1,"Size: {0} x {1}".format(size.x,size.y))
|
||||
debug.info(1, "Size: {0} x {1}".format(size.x, size.y))
|
||||
|
||||
import supply_grid
|
||||
self.rg = supply_grid.supply_grid(self.ll, self.ur, self.track_width)
|
||||
|
|
@ -60,12 +53,12 @@ class supply_grid_router(router):
|
|||
"""
|
||||
Add power supply rails and connect all pins to these rails.
|
||||
"""
|
||||
debug.info(1,"Running supply router on {0} and {1}...".format(vdd_name, gnd_name))
|
||||
debug.info(1, "Running supply router on {0} and {1}...".format(vdd_name, gnd_name))
|
||||
self.vdd_name = vdd_name
|
||||
self.gnd_name = gnd_name
|
||||
|
||||
# Clear the pins if we have previously routed
|
||||
if (hasattr(self,'rg')):
|
||||
if (hasattr(self, 'rg')):
|
||||
self.clear_pins()
|
||||
else:
|
||||
# Creat a routing grid over the entire area
|
||||
|
|
@ -76,32 +69,32 @@ class supply_grid_router(router):
|
|||
# Get the pin shapes
|
||||
start_time = datetime.now()
|
||||
self.find_pins_and_blockages([self.vdd_name, self.gnd_name])
|
||||
print_time("Finding pins and blockages",datetime.now(), start_time, 3)
|
||||
print_time("Finding pins and blockages", datetime.now(), start_time, 3)
|
||||
# Add the supply rails in a mesh network and connect H/V with vias
|
||||
start_time = datetime.now()
|
||||
# Block everything
|
||||
self.prepare_blockages(self.gnd_name)
|
||||
# Determine the rail locations
|
||||
self.route_supply_rails(self.gnd_name,0)
|
||||
self.route_supply_rails(self.gnd_name, 0)
|
||||
|
||||
# Block everything
|
||||
self.prepare_blockages(self.vdd_name)
|
||||
# Determine the rail locations
|
||||
self.route_supply_rails(self.vdd_name,1)
|
||||
print_time("Routing supply rails",datetime.now(), start_time, 3)
|
||||
self.route_supply_rails(self.vdd_name, 1)
|
||||
print_time("Routing supply rails", datetime.now(), start_time, 3)
|
||||
|
||||
start_time = datetime.now()
|
||||
self.route_simple_overlaps(vdd_name)
|
||||
self.route_simple_overlaps(gnd_name)
|
||||
print_time("Simple overlap routing",datetime.now(), start_time, 3)
|
||||
print_time("Simple overlap routing", datetime.now(), start_time, 3)
|
||||
|
||||
# Route the supply pins to the supply rails
|
||||
# Route vdd first since we want it to be shorter
|
||||
start_time = datetime.now()
|
||||
self.route_pins_to_rails(vdd_name)
|
||||
self.route_pins_to_rails(gnd_name)
|
||||
print_time("Maze routing supplies",datetime.now(), start_time, 3)
|
||||
#self.write_debug_gds("final.gds",False)
|
||||
print_time("Maze routing supplies", datetime.now(), start_time, 3)
|
||||
# self.write_debug_gds("final.gds", False)
|
||||
|
||||
# Did we route everything??
|
||||
if not self.check_all_routed(vdd_name):
|
||||
|
|
@ -111,9 +104,8 @@ class supply_grid_router(router):
|
|||
|
||||
return True
|
||||
|
||||
|
||||
def check_all_routed(self, pin_name):
|
||||
"""
|
||||
"""
|
||||
Check that all pin groups are routed.
|
||||
"""
|
||||
for pg in self.pin_groups[pin_name]:
|
||||
|
|
@ -125,7 +117,7 @@ class supply_grid_router(router):
|
|||
This checks for simple cases where a pin component already overlaps a supply rail.
|
||||
It will add an enclosure to ensure the overlap in wide DRC rule cases.
|
||||
"""
|
||||
debug.info(1,"Routing simple overlap pins for {0}".format(pin_name))
|
||||
debug.info(1, "Routing simple overlap pins for {0}".format(pin_name))
|
||||
|
||||
# These are the wire tracks
|
||||
wire_tracks = self.supply_rail_tracks[pin_name]
|
||||
|
|
@ -142,10 +134,10 @@ class supply_grid_router(router):
|
|||
continue
|
||||
|
||||
# Else, if we overlap some of the space track, we can patch it with an enclosure
|
||||
#pg.create_simple_overlap_enclosure(pg.grids)
|
||||
#pg.add_enclosure(self.cell)
|
||||
# pg.create_simple_overlap_enclosure(pg.grids)
|
||||
# pg.add_enclosure(self.cell)
|
||||
|
||||
debug.info(1,"Routed {} simple overlap pins".format(routed_count))
|
||||
debug.info(1, "Routed {} simple overlap pins".format(routed_count))
|
||||
|
||||
def finalize_supply_rails(self, name):
|
||||
"""
|
||||
|
|
@ -158,7 +150,7 @@ class supply_grid_router(router):
|
|||
|
||||
connections = set()
|
||||
via_areas = []
|
||||
for i1,r1 in enumerate(all_rails):
|
||||
for i1, r1 in enumerate(all_rails):
|
||||
# Only consider r1 horizontal rails
|
||||
e = next(iter(r1))
|
||||
if e.z==1:
|
||||
|
|
@ -166,9 +158,9 @@ class supply_grid_router(router):
|
|||
|
||||
# We need to move this rail to the other layer for the z indices to match
|
||||
# during the intersection. This also makes a copy.
|
||||
new_r1 = {vector3d(i.x,i.y,1) for i in r1}
|
||||
new_r1 = {vector3d(i.x, i.y, 1) for i in r1}
|
||||
|
||||
for i2,r2 in enumerate(all_rails):
|
||||
for i2, r2 in enumerate(all_rails):
|
||||
# Never compare to yourself
|
||||
if i1==i2:
|
||||
continue
|
||||
|
|
@ -184,16 +176,16 @@ class supply_grid_router(router):
|
|||
# the overlap area for placement of a via
|
||||
overlap = new_r1 & r2
|
||||
if len(overlap) >= 1:
|
||||
debug.info(3,"Via overlap {0} {1}".format(len(overlap),overlap))
|
||||
connections.update([i1,i2])
|
||||
debug.info(3, "Via overlap {0} {1}".format(len(overlap),overlap))
|
||||
connections.update([i1, i2])
|
||||
via_areas.append(overlap)
|
||||
|
||||
# Go through and add the vias at the center of the intersection
|
||||
for area in via_areas:
|
||||
ll = grid_utils.get_lower_left(area)
|
||||
ur = grid_utils.get_upper_right(area)
|
||||
center = (ll + ur).scale(0.5,0.5,0)
|
||||
self.add_via(center,1)
|
||||
center = (ll + ur).scale(0.5, 0.5, 0)
|
||||
self.add_via(center, 1)
|
||||
|
||||
# Determien which indices were not connected to anything above
|
||||
missing_indices = set([x for x in range(len(self.supply_rails[name]))])
|
||||
|
|
@ -204,13 +196,12 @@ class supply_grid_router(router):
|
|||
for rail_index in sorted(missing_indices, reverse=True):
|
||||
ll = grid_utils.get_lower_left(all_rails[rail_index])
|
||||
ur = grid_utils.get_upper_right(all_rails[rail_index])
|
||||
debug.info(1,"Removing disconnected supply rail {0} .. {1}".format(ll,ur))
|
||||
debug.info(1, "Removing disconnected supply rail {0} .. {1}".format(ll, ur))
|
||||
self.supply_rails[name].pop(rail_index)
|
||||
|
||||
# Make the supply rails into a big giant set of grids for easy blockages.
|
||||
# Must be done after we determine which ones are connected.
|
||||
self.create_supply_track_set(name)
|
||||
|
||||
|
||||
def add_supply_rails(self, name):
|
||||
"""
|
||||
|
|
@ -223,7 +214,7 @@ class supply_grid_router(router):
|
|||
ur = grid_utils.get_upper_right(rail)
|
||||
z = ll.z
|
||||
pin = self.compute_pin_enclosure(ll, ur, z, name)
|
||||
debug.info(3,"Adding supply rail {0} {1}->{2} {3}".format(name,ll,ur,pin))
|
||||
debug.info(3, "Adding supply rail {0} {1}->{2} {3}".format(name, ll, ur, pin))
|
||||
self.cell.add_layout_pin(text=name,
|
||||
layer=pin.layer,
|
||||
offset=pin.ll(),
|
||||
|
|
@ -243,19 +234,18 @@ class supply_grid_router(router):
|
|||
max_xoffset = self.rg.ur.x
|
||||
min_yoffset = self.rg.ll.y
|
||||
min_xoffset = self.rg.ll.x
|
||||
|
||||
|
||||
# Horizontal supply rails
|
||||
start_offset = min_yoffset + supply_number
|
||||
for offset in range(start_offset, max_yoffset, 2):
|
||||
# Seed the function at the location with the given width
|
||||
wave = [vector3d(min_xoffset,offset,0)]
|
||||
wave = [vector3d(min_xoffset, offset, 0)]
|
||||
# While we can keep expanding east in this horizontal track
|
||||
while wave and wave[0].x < max_xoffset:
|
||||
added_rail = self.find_supply_rail(name, wave, direction.EAST)
|
||||
if not added_rail:
|
||||
# Just seed with the next one
|
||||
wave = [x+vector3d(1,0,0) for x in wave]
|
||||
wave = [x+vector3d(1, 0, 0) for x in wave]
|
||||
else:
|
||||
# Seed with the neighbor of the end of the last rail
|
||||
wave = added_rail.neighbor(direction.EAST)
|
||||
|
|
@ -264,15 +254,15 @@ class supply_grid_router(router):
|
|||
start_offset = min_xoffset + supply_number
|
||||
for offset in range(start_offset, max_xoffset, 2):
|
||||
# Seed the function at the location with the given width
|
||||
wave = [vector3d(offset,min_yoffset,1)]
|
||||
wave = [vector3d(offset, min_yoffset, 1)]
|
||||
# While we can keep expanding north in this vertical track
|
||||
while wave and wave[0].y < max_yoffset:
|
||||
added_rail = self.find_supply_rail(name, wave, direction.NORTH)
|
||||
if not added_rail:
|
||||
# Just seed with the next one
|
||||
wave = [x+vector3d(0,1,0) for x in wave]
|
||||
wave = [x + vector3d(0, 1, 0) for x in wave]
|
||||
else:
|
||||
# Seed with the neighbor of the end of the last rail
|
||||
# Seed with the neighbor of the end of the last rail
|
||||
wave = added_rail.neighbor(direction.NORTH)
|
||||
|
||||
def find_supply_rail(self, name, seed_wave, direct):
|
||||
|
|
@ -294,7 +284,6 @@ class supply_grid_router(router):
|
|||
# Return the rail whether we approved it or not,
|
||||
# as it will be used to find the next start location
|
||||
return wave_path
|
||||
|
||||
|
||||
def probe_supply_rail(self, name, start_wave, direct):
|
||||
"""
|
||||
|
|
@ -328,23 +317,19 @@ class supply_grid_router(router):
|
|||
data structure. Return whether it was added or not.
|
||||
"""
|
||||
# We must have at least 2 tracks to drop plus 2 tracks for a via
|
||||
if len(wave_path)>=4*self.rail_track_width:
|
||||
if len(wave_path) >= 4 * self.rail_track_width:
|
||||
grid_set = wave_path.get_grids()
|
||||
self.supply_rails[name].append(grid_set)
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def route_supply_rails(self, name, supply_number):
|
||||
"""
|
||||
Route the horizontal and vertical supply rails across the entire design.
|
||||
Must be done with lower left at 0,0
|
||||
"""
|
||||
debug.info(1,"Routing supply rail {0}.".format(name))
|
||||
debug.info(1, "Routing supply rail {0}.".format(name))
|
||||
|
||||
# Compute the grid locations of the supply rails
|
||||
self.compute_supply_rails(name, supply_number)
|
||||
|
|
@ -355,7 +340,6 @@ class supply_grid_router(router):
|
|||
# Add the rails themselves
|
||||
self.add_supply_rails(name)
|
||||
|
||||
|
||||
def create_supply_track_set(self, pin_name):
|
||||
"""
|
||||
Make a single set of all the tracks for the rail and wire itself.
|
||||
|
|
@ -364,24 +348,22 @@ class supply_grid_router(router):
|
|||
for rail in self.supply_rails[pin_name]:
|
||||
rail_set.update(rail)
|
||||
self.supply_rail_tracks[pin_name] = rail_set
|
||||
|
||||
|
||||
|
||||
def route_pins_to_rails(self, pin_name):
|
||||
"""
|
||||
This will route each of the remaining pin components to the supply rails.
|
||||
This will route each of the remaining pin components to the supply rails.
|
||||
After it is done, the cells are added to the pin blockage list.
|
||||
"""
|
||||
|
||||
remaining_components = sum(not x.is_routed() for x in self.pin_groups[pin_name])
|
||||
debug.info(1,"Maze routing {0} with {1} pin components to connect.".format(pin_name,
|
||||
remaining_components))
|
||||
debug.info(1, "Maze routing {0} with {1} pin components to connect.".format(pin_name,
|
||||
remaining_components))
|
||||
|
||||
for index,pg in enumerate(self.pin_groups[pin_name]):
|
||||
for index, pg in enumerate(self.pin_groups[pin_name]):
|
||||
if pg.is_routed():
|
||||
continue
|
||||
|
||||
debug.info(3,"Routing component {0} {1}".format(pin_name, index))
|
||||
debug.info(3, "Routing component {0} {1}".format(pin_name, index))
|
||||
|
||||
# Clear everything in the routing grid.
|
||||
self.rg.reinit()
|
||||
|
|
@ -400,28 +382,26 @@ class supply_grid_router(router):
|
|||
|
||||
# Actually run the A* router
|
||||
if not self.run_router(detour_scale=5):
|
||||
self.write_debug_gds("debug_route.gds",False)
|
||||
self.write_debug_gds("debug_route.gds", False)
|
||||
|
||||
#if index==3 and pin_name=="vdd":
|
||||
# self.write_debug_gds("route.gds",False)
|
||||
# if index==3 and pin_name=="vdd":
|
||||
# self.write_debug_gds("route.gds",False)
|
||||
|
||||
|
||||
def add_supply_rail_target(self, pin_name):
|
||||
"""
|
||||
Add the supply rails of given name as a routing target.
|
||||
"""
|
||||
debug.info(4,"Add supply rail target {}".format(pin_name))
|
||||
debug.info(4, "Add supply rail target {}".format(pin_name))
|
||||
# Add the wire itself as the target
|
||||
self.rg.set_target(self.supply_rail_tracks[pin_name])
|
||||
# But unblock all the rail tracks including the space
|
||||
self.rg.set_blocked(self.supply_rail_tracks[pin_name],False)
|
||||
|
||||
self.rg.set_blocked(self.supply_rail_tracks[pin_name], False)
|
||||
|
||||
def set_supply_rail_blocked(self, value=True):
|
||||
"""
|
||||
Add the supply rails of given name as a routing target.
|
||||
"""
|
||||
debug.info(4,"Blocking supply rail")
|
||||
debug.info(4, "Blocking supply rail")
|
||||
for rail_name in self.supply_rail_tracks:
|
||||
self.rg.set_blocked(self.supply_rail_tracks[rail_name])
|
||||
|
||||
|
|
|
|||
|
|
@ -59,14 +59,23 @@ class sram_1bank(sram_base):
|
|||
wmask_pos = [None] * len(self.all_ports)
|
||||
data_pos = [None] * len(self.all_ports)
|
||||
|
||||
# These positions utilize the channel route sizes.
|
||||
# FIXME: Auto-compute these rather than manual computation.
|
||||
# If a horizontal channel, they rely on the vertical channel non-preferred (contacted) pitch.
|
||||
# If a vertical channel, they rely on the horizontal channel non-preferred (contacted) pitch.
|
||||
# So, m3 non-pref pitch means that this is routed on the m2 layer.
|
||||
if self.write_size:
|
||||
max_gap_size = self.m3_pitch * self.word_size + 2 * self.m1_pitch
|
||||
max_gap_size_wmask = self.m2_pitch * max(self.num_wmasks + 1, self.col_addr_size + 1) + 2 * self.m1_pitch
|
||||
self.data_bus_gap = self.m4_nonpref_pitch * 2
|
||||
self.data_bus_size = self.m4_nonpref_pitch * (self.word_size) + self.data_bus_gap
|
||||
self.wmask_bus_gap = self.m2_nonpref_pitch * 2
|
||||
self.wmask_bus_size = self.m2_nonpref_pitch * (max(self.num_wmasks + 1, self.col_addr_size + 1)) + self.wmask_bus_gap
|
||||
else:
|
||||
# This is M2 pitch even though it is on M1 to help stem via spacings on the trunk
|
||||
# The M1 pitch is for supply rail spacings
|
||||
max_gap_size = self.m2_pitch * max(self.word_size + 1,self.col_addr_size + 1) + 2 * self.m1_pitch
|
||||
self.data_bus_gap = self.m3_nonpref_pitch * 2
|
||||
self.data_bus_size = self.m3_nonpref_pitch * (max(self.word_size + 1, self.col_addr_size + 1)) + self.data_bus_gap
|
||||
|
||||
self.col_addr_bus_gap = self.m2_nonpref_pitch * 2
|
||||
self.col_addr_bus_size = self.m2_nonpref_pitch * (self.col_addr_size) + self.col_addr_bus_gap
|
||||
|
||||
# Port 0
|
||||
port = 0
|
||||
|
||||
|
|
@ -74,12 +83,12 @@ class sram_1bank(sram_base):
|
|||
if self.write_size:
|
||||
# Add the write mask flops below the write mask AND array.
|
||||
wmask_pos[port] = vector(self.bank.bank_array_ll.x,
|
||||
-max_gap_size_wmask - self.dff.height)
|
||||
- self.wmask_bus_size - self.dff.height)
|
||||
self.wmask_dff_insts[port].place(wmask_pos[port])
|
||||
|
||||
# Add the data flops below the write mask flops.
|
||||
data_pos[port] = vector(self.bank.bank_array_ll.x,
|
||||
-max_gap_size - max_gap_size_wmask - 2 * self.dff.height)
|
||||
- self.data_bus_size - self.wmask_bus_size - 2 * self.dff.height)
|
||||
self.data_dff_insts[port].place(data_pos[port])
|
||||
else:
|
||||
# Add the data flops below the bank to the right of the lower-left of bank array
|
||||
|
|
@ -89,7 +98,7 @@ class sram_1bank(sram_base):
|
|||
# sense amps.
|
||||
if port in self.write_ports:
|
||||
data_pos[port] = vector(self.bank.bank_array_ll.x,
|
||||
-max_gap_size - self.dff.height)
|
||||
-self.data_bus_size - self.dff.height)
|
||||
self.data_dff_insts[port].place(data_pos[port])
|
||||
else:
|
||||
wmask_pos[port] = vector(self.bank.bank_array_ll.x, 0)
|
||||
|
|
@ -99,10 +108,10 @@ class sram_1bank(sram_base):
|
|||
if self.col_addr_dff:
|
||||
if self.write_size:
|
||||
col_addr_pos[port] = vector(self.bank.bank_array_ll.x - self.col_addr_dff_insts[port].width - self.bank.m2_gap,
|
||||
-max_gap_size_wmask - self.col_addr_dff_insts[port].height)
|
||||
-self.wmask_bus_size - self.col_addr_dff_insts[port].height)
|
||||
else:
|
||||
col_addr_pos[port] = vector(self.bank.bank_array_ll.x - self.col_addr_dff_insts[port].width - self.bank.m2_gap,
|
||||
-max_gap_size - self.col_addr_dff_insts[port].height)
|
||||
-self.data_bus_size - self.col_addr_dff_insts[port].height)
|
||||
self.col_addr_dff_insts[port].place(col_addr_pos[port])
|
||||
else:
|
||||
col_addr_pos[port] = vector(self.bank.bank_array_ll.x, 0)
|
||||
|
|
@ -127,12 +136,12 @@ class sram_1bank(sram_base):
|
|||
if self.write_size:
|
||||
# Add the write mask flops below the write mask AND array.
|
||||
wmask_pos[port] = vector(self.bank.bank_array_ur.x - self.wmask_dff_insts[port].width,
|
||||
self.bank.height + max_gap_size_wmask + self.dff.height)
|
||||
self.bank.height + self.wmask_bus_size + self.dff.height)
|
||||
self.wmask_dff_insts[port].place(wmask_pos[port], mirror="MX")
|
||||
|
||||
# Add the data flops below the write mask flops
|
||||
data_pos[port] = vector(self.bank.bank_array_ur.x - self.data_dff_insts[port].width,
|
||||
self.bank.height + max_gap_size_wmask + max_gap_size + 2 * self.dff.height)
|
||||
self.bank.height + self.wmask_bus_size + self.data_bus_size + 2 * self.dff.height)
|
||||
self.data_dff_insts[port].place(data_pos[port], mirror="MX")
|
||||
else:
|
||||
# Add the data flops above the bank to the left of the upper-right of bank array
|
||||
|
|
@ -141,17 +150,17 @@ class sram_1bank(sram_base):
|
|||
# These flops go below the sensing and leave a gap to channel route to the
|
||||
# sense amps.
|
||||
data_pos[port] = vector(self.bank.bank_array_ur.x - self.data_dff_insts[port].width,
|
||||
self.bank.height + max_gap_size + self.dff.height)
|
||||
self.bank.height + self.data_bus_size + self.dff.height)
|
||||
self.data_dff_insts[port].place(data_pos[port], mirror="MX")
|
||||
|
||||
# Add the col address flops above the bank to the right of the upper-right of bank array
|
||||
if self.col_addr_dff:
|
||||
if self.write_size:
|
||||
col_addr_pos[port] = vector(self.bank.bank_array_ur.x + self.bank.m2_gap,
|
||||
self.bank.height + max_gap_size_wmask + self.dff.height)
|
||||
self.bank.height + self.wmask_bus_size + self.dff.height)
|
||||
else:
|
||||
col_addr_pos[port] = vector(self.bank.bank_array_ur.x + self.bank.m2_gap,
|
||||
self.bank.height + max_gap_size + self.dff.height)
|
||||
self.bank.height + self.data_bus_size + self.dff.height)
|
||||
self.col_addr_dff_insts[port].place(col_addr_pos[port], mirror="MX")
|
||||
else:
|
||||
col_addr_pos[port] = self.bank_inst.ur()
|
||||
|
|
@ -245,7 +254,7 @@ class sram_1bank(sram_base):
|
|||
# This uses a metal2 track to the right (for port0) of the control/row addr DFF
|
||||
# to route vertically. For port1, it is to the left.
|
||||
row_addr_clk_pin = self.row_addr_dff_insts[port].get_pin("clk")
|
||||
if port%2:
|
||||
if port % 2:
|
||||
control_clk_buf_pos = control_clk_buf_pin.lc()
|
||||
row_addr_clk_pos = row_addr_clk_pin.lc()
|
||||
mid1_pos = vector(self.row_addr_dff_insts[port].lx() - self.m2_pitch,
|
||||
|
|
@ -258,19 +267,20 @@ class sram_1bank(sram_base):
|
|||
|
||||
# This is the steiner point where the net branches out
|
||||
clk_steiner_pos = vector(mid1_pos.x, control_clk_buf_pos.y)
|
||||
self.add_path("m1", [control_clk_buf_pos, clk_steiner_pos])
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=clk_steiner_pos)
|
||||
self.add_path(control_clk_buf_pin.layer, [control_clk_buf_pos, clk_steiner_pos])
|
||||
self.add_via_stack_center(from_layer=control_clk_buf_pin.layer,
|
||||
to_layer="m2",
|
||||
offset=clk_steiner_pos)
|
||||
|
||||
# Note, the via to the control logic is taken care of above
|
||||
self.add_wire(("m3", "via2", "m2"),
|
||||
self.add_wire(self.m2_stack[::-1],
|
||||
[row_addr_clk_pos, mid1_pos, clk_steiner_pos])
|
||||
|
||||
if self.col_addr_dff:
|
||||
dff_clk_pin = self.col_addr_dff_insts[port].get_pin("clk")
|
||||
dff_clk_pos = dff_clk_pin.center()
|
||||
mid_pos = vector(clk_steiner_pos.x, dff_clk_pos.y)
|
||||
self.add_wire(("m3", "via2", "m2"),
|
||||
self.add_wire(self.m2_stack[::-1],
|
||||
[dff_clk_pos, mid_pos, clk_steiner_pos])
|
||||
|
||||
if port in self.write_ports:
|
||||
|
|
@ -282,7 +292,7 @@ class sram_1bank(sram_base):
|
|||
self.add_path("m2",
|
||||
[mid_pos, clk_steiner_pos],
|
||||
width=max(m2_via.width, m2_via.height))
|
||||
self.add_wire(("m3", "via2", "m2"),
|
||||
self.add_wire(self.m2_stack[::-1],
|
||||
[data_dff_clk_pos, mid_pos, clk_steiner_pos])
|
||||
|
||||
if self.write_size:
|
||||
|
|
@ -292,7 +302,7 @@ class sram_1bank(sram_base):
|
|||
# In some designs, the steiner via will be too close to the mid_pos via
|
||||
# so make the wire as wide as the contacts
|
||||
self.add_path("m2", [mid_pos, clk_steiner_pos], width=max(m2_via.width, m2_via.height))
|
||||
self.add_wire(("m3", "via2", "m2"), [wmask_dff_clk_pos, mid_pos, clk_steiner_pos])
|
||||
self.add_wire(self.m2_stack[::-1], [wmask_dff_clk_pos, mid_pos, clk_steiner_pos])
|
||||
|
||||
def route_control_logic(self):
|
||||
""" Route the control logic pins that are not inputs """
|
||||
|
|
@ -304,14 +314,15 @@ class sram_1bank(sram_base):
|
|||
continue
|
||||
src_pin = self.control_logic_insts[port].get_pin(signal)
|
||||
dest_pin = self.bank_inst.get_pin(signal + "{}".format(port))
|
||||
self.connect_vbus_m2m3(src_pin, dest_pin)
|
||||
self.connect_vbus(src_pin, dest_pin)
|
||||
|
||||
for port in self.all_ports:
|
||||
# Only input (besides pins) is the replica bitline
|
||||
src_pin = self.control_logic_insts[port].get_pin("rbl_bl")
|
||||
dest_pin = self.bank_inst.get_pin("rbl_bl{}".format(port))
|
||||
|
||||
self.connect_hbus_m2m3(src_pin, dest_pin)
|
||||
self.add_wire(self.m2_stack[::-1],
|
||||
[src_pin.center(), vector(src_pin.cx(), dest_pin.cy()), dest_pin.rc()])
|
||||
# self.connect_hbus(src_pin, dest_pin)
|
||||
|
||||
def route_row_addr_dff(self):
|
||||
""" Connect the output of the row flops to the bank pins """
|
||||
|
|
@ -324,33 +335,37 @@ class sram_1bank(sram_base):
|
|||
flop_pos = flop_pin.center()
|
||||
bank_pos = bank_pin.center()
|
||||
mid_pos = vector(bank_pos.x, flop_pos.y)
|
||||
self.add_wire(("m3", "via2", "m2"),
|
||||
self.add_wire(self.m2_stack[::-1],
|
||||
[flop_pos, mid_pos, bank_pos])
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=flop_pos)
|
||||
self.add_via_stack_center(from_layer=flop_pin.layer,
|
||||
to_layer="m3",
|
||||
offset=flop_pos)
|
||||
|
||||
def route_col_addr_dff(self):
|
||||
""" Connect the output of the col flops to the bank pins """
|
||||
for port in self.all_ports:
|
||||
if port%2:
|
||||
offset = self.col_addr_dff_insts[port].ll() - vector(0, (self.col_addr_size + 2) * self.m1_pitch)
|
||||
if port % 2:
|
||||
offset = self.col_addr_dff_insts[port].ll() - vector(0, self.col_addr_bus_size)
|
||||
else:
|
||||
offset = self.col_addr_dff_insts[port].ul() + vector(0, 2 * self.m1_pitch)
|
||||
offset = self.col_addr_dff_insts[port].ul() + vector(0, self.col_addr_bus_gap)
|
||||
|
||||
bus_names = ["addr_{}".format(x) for x in range(self.col_addr_size)]
|
||||
col_addr_bus_offsets = self.create_horizontal_bus(layer="m1",
|
||||
pitch=self.m1_pitch,
|
||||
offset=offset,
|
||||
names=bus_names,
|
||||
length=self.col_addr_dff_insts[port].width)
|
||||
|
||||
dff_names = ["dout_{}".format(x) for x in range(self.col_addr_size)]
|
||||
data_dff_map = zip(dff_names, bus_names)
|
||||
self.connect_horizontal_bus(data_dff_map, self.col_addr_dff_insts[port], col_addr_bus_offsets)
|
||||
self.connect_horizontal_bus(data_dff_map,
|
||||
self.col_addr_dff_insts[port],
|
||||
col_addr_bus_offsets)
|
||||
|
||||
bank_names = ["addr{0}_{1}".format(port, x) for x in range(self.col_addr_size)]
|
||||
data_bank_map = zip(bank_names, bus_names)
|
||||
self.connect_horizontal_bus(data_bank_map, self.bank_inst, col_addr_bus_offsets)
|
||||
self.connect_horizontal_bus(data_bank_map,
|
||||
self.bank_inst,
|
||||
col_addr_bus_offsets)
|
||||
|
||||
def route_data_dff(self):
|
||||
""" Connect the output of the data flops to the write driver """
|
||||
|
|
@ -358,48 +373,47 @@ class sram_1bank(sram_base):
|
|||
for port in self.write_ports:
|
||||
if self.write_size:
|
||||
if port % 2:
|
||||
offset = self.data_dff_insts[port].ll() - vector(0, (self.word_size + 2) * self.m3_pitch)
|
||||
offset = self.data_dff_insts[port].ll() - vector(0, self.data_bus_size)
|
||||
else:
|
||||
offset = self.data_dff_insts[port].ul() + vector(0, 2 * self.m3_pitch)
|
||||
offset = self.data_dff_insts[port].ul() + vector(0, self.data_bus_gap)
|
||||
else:
|
||||
if port % 2:
|
||||
offset = self.data_dff_insts[port].ll() - vector(0, (self.word_size + 2) * self.m1_pitch)
|
||||
offset = self.data_dff_insts[port].ll() - vector(0, self.data_bus_size)
|
||||
else:
|
||||
offset = self.data_dff_insts[port].ul() + vector(0, 2 * self.m1_pitch)
|
||||
offset = self.data_dff_insts[port].ul() + vector(0, self.data_bus_gap)
|
||||
|
||||
dff_names = ["dout_{}".format(x) for x in range(self.word_size)]
|
||||
dff_pins = [self.data_dff_insts[port].get_pin(x) for x in dff_names]
|
||||
if self.write_size:
|
||||
for x in dff_names:
|
||||
pin_offset = self.data_dff_insts[port].get_pin(x).center()
|
||||
pin = self.data_dff_insts[port].get_pin(x)
|
||||
pin_offset = pin.center()
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=pin_offset,
|
||||
directions=("V", "V"))
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=pin_offset)
|
||||
self.add_via_center(layers=self.m3_stack,
|
||||
offset=pin_offset)
|
||||
self.add_via_stack_center(from_layer="m2",
|
||||
to_layer="m4",
|
||||
offset=pin_offset)
|
||||
|
||||
bank_names = ["din{0}_{1}".format(port, x) for x in range(self.word_size)]
|
||||
bank_pins = [self.bank_inst.get_pin(x) for x in bank_names]
|
||||
if self.write_size:
|
||||
for x in bank_names:
|
||||
pin = self.bank_inst.get_pin(x)
|
||||
if port % 2:
|
||||
pin_offset = self.bank_inst.get_pin(x).uc()
|
||||
pin_offset = pin.uc()
|
||||
else:
|
||||
pin_offset = self.bank_inst.get_pin(x).bc()
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=pin_offset)
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=pin_offset)
|
||||
self.add_via_center(layers=self.m3_stack,
|
||||
offset=pin_offset)
|
||||
pin_offset = pin.bc()
|
||||
self.add_via_stack_center(from_layer=pin.layer,
|
||||
to_layer="m4",
|
||||
offset=pin_offset)
|
||||
|
||||
route_map = list(zip(bank_pins, dff_pins))
|
||||
if self.write_size:
|
||||
layer_stack = self.m3_stack
|
||||
else:
|
||||
layer_stack = self.m1_stack
|
||||
|
||||
self.create_horizontal_channel_route(netlist=route_map,
|
||||
offset=offset,
|
||||
layer_stack=layer_stack)
|
||||
|
|
@ -409,9 +423,9 @@ class sram_1bank(sram_base):
|
|||
# This is where the channel will start (y-dimension at least)
|
||||
for port in self.write_ports:
|
||||
if port % 2:
|
||||
offset = self.wmask_dff_insts[port].ll() - vector(0, (self.num_wmasks + 2) * self.m1_pitch)
|
||||
offset = self.wmask_dff_insts[port].ll() - vector(0, self.wmask_bus_size)
|
||||
else:
|
||||
offset = self.wmask_dff_insts[port].ul() + vector(0, 2 * self.m1_pitch)
|
||||
offset = self.wmask_dff_insts[port].ul() + vector(0, self.wmask_bus_gap)
|
||||
|
||||
dff_names = ["dout_{}".format(x) for x in range(self.num_wmasks)]
|
||||
dff_pins = [self.wmask_dff_insts[port].get_pin(x) for x in dff_names]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
import datetime
|
||||
import debug
|
||||
from math import log
|
||||
from importlib import reload
|
||||
from vector import vector
|
||||
from globals import OPTS, print_time
|
||||
|
|
@ -137,7 +138,6 @@ class sram_base(design, verilog, lef):
|
|||
self.copy_power_pins(inst, "vdd")
|
||||
self.copy_power_pins(inst, "gnd")
|
||||
|
||||
import tech
|
||||
if not OPTS.route_supplies:
|
||||
# Do not route the power supply (leave as must-connect pins)
|
||||
return
|
||||
|
|
@ -148,6 +148,7 @@ class sram_base(design, verilog, lef):
|
|||
grid_stack = power_grid
|
||||
except ImportError:
|
||||
# if no power_grid is specified by tech we use sensible defaults
|
||||
import tech
|
||||
if "m4" in tech.layer:
|
||||
# Route a M3/M4 grid
|
||||
grid_stack = self.m3_stack
|
||||
|
|
@ -496,70 +497,6 @@ class sram_base(design, verilog, lef):
|
|||
self.connect_inst(temp)
|
||||
|
||||
return insts
|
||||
|
||||
def connect_vbus_m2m3(self, src_pin, dest_pin):
|
||||
"""
|
||||
Helper routine to connect an instance to a vertical bus.
|
||||
Routes horizontal then vertical L shape.
|
||||
Dest pin is assumed to be on M2.
|
||||
Src pin can be on M1/M2/M3.
|
||||
"""
|
||||
|
||||
if src_pin.cx()<dest_pin.cx():
|
||||
in_pos = src_pin.rc()
|
||||
else:
|
||||
in_pos = src_pin.lc()
|
||||
if src_pin.cy() < dest_pin.cy():
|
||||
out_pos = dest_pin.bc()
|
||||
else:
|
||||
out_pos = dest_pin.uc()
|
||||
|
||||
# move horizontal first
|
||||
self.add_wire(("m3", "via2", "m2"),
|
||||
[in_pos,
|
||||
vector(out_pos.x, in_pos.y),
|
||||
out_pos])
|
||||
if src_pin.layer=="m1":
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=in_pos)
|
||||
if src_pin.layer in ["m1", "m2"]:
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=in_pos)
|
||||
|
||||
def connect_hbus_m2m3(self, src_pin, dest_pin):
|
||||
"""
|
||||
Helper routine to connect an instance to a horizontal bus.
|
||||
Routes horizontal then vertical L shape.
|
||||
Dest pin is on M1/M2/M3.
|
||||
Src pin can be on M1/M2/M3.
|
||||
"""
|
||||
|
||||
if src_pin.cx()<dest_pin.cx():
|
||||
in_pos = src_pin.rc()
|
||||
else:
|
||||
in_pos = src_pin.lc()
|
||||
if src_pin.cy() < dest_pin.cy():
|
||||
out_pos = dest_pin.lc()
|
||||
else:
|
||||
out_pos = dest_pin.rc()
|
||||
|
||||
# move horizontal first
|
||||
self.add_wire(("m3", "via2", "m2"),
|
||||
[in_pos,
|
||||
vector(out_pos.x, in_pos.y),
|
||||
out_pos])
|
||||
if src_pin.layer=="m1":
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=in_pos)
|
||||
if src_pin.layer in ["m1", "m2"]:
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=in_pos)
|
||||
if dest_pin.layer=="m1":
|
||||
self.add_via_center(layers=self.m1_stack,
|
||||
offset=out_pos)
|
||||
if dest_pin.layer=="m3":
|
||||
self.add_via_center(layers=self.m2_stack,
|
||||
offset=out_pos)
|
||||
|
||||
def sp_write(self, sp_name, lvs_netlist=False):
|
||||
# Write the entire spice of the object to the file
|
||||
|
|
|
|||
|
|
@ -77,7 +77,9 @@ class sram_factory:
|
|||
"""
|
||||
tech_module_type, tm_overridden = self.get_techmodule_type(module_type)
|
||||
user_module_type, um_overridden = self.get_usermodule_type(module_type)
|
||||
|
||||
#print(module_type, tech_module_type, tm_overridden)
|
||||
#print(module_type, user_module_type, um_overridden)
|
||||
|
||||
# overridden user modules have priority
|
||||
if um_overridden:
|
||||
real_module_type = user_module_type
|
||||
|
|
@ -109,11 +111,12 @@ class sram_factory:
|
|||
return obj_item
|
||||
|
||||
# If no prefered module name is provided, we generate one.
|
||||
if module_name is None:
|
||||
# Use the default name if there are default arguments
|
||||
if not module_name:
|
||||
# Use the default name for the first cell.
|
||||
# This is especially for library cells so that the
|
||||
# spice and gds files can be found.
|
||||
if len(kwargs) > 0:
|
||||
# Subsequent objects will get unique names to help with GDS limitation.
|
||||
if len(self.objects[real_module_type]) > 0:
|
||||
# Create a unique name and increment the index
|
||||
module_name = "{0}_{1}".format(real_module_type,
|
||||
self.module_indices[real_module_type])
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class library_lvs_test(openram_test):
|
|||
debug.error("Missing GDS file {}".format(gds_name))
|
||||
if not os.path.isfile(sp_name):
|
||||
lvs_errors += 1
|
||||
debug.error("Missing SPICE file {}".format(gds_name))
|
||||
debug.error("Missing SPICE file {}".format(sp_name))
|
||||
drc_errors += verify.run_drc(name, gds_name)
|
||||
lvs_errors += verify.run_lvs(f, gds_name, sp_name)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ class ptx_3finger_nmos_test(openram_test):
|
|||
width=tech.drc["minwidth_tx"],
|
||||
mults=3,
|
||||
tx_type="nmos",
|
||||
connect_active=True,
|
||||
connect_source_active=True,
|
||||
connect_drain_active=True,
|
||||
connect_poly=True)
|
||||
self.local_drc_check(fet)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ class ptx_3finger_pmos_test(openram_test):
|
|||
width=tech.drc["minwidth_tx"],
|
||||
mults=3,
|
||||
tx_type="pmos",
|
||||
connect_active=True,
|
||||
connect_source_active=True,
|
||||
connect_drain_active=True,
|
||||
connect_poly=True)
|
||||
self.local_drc_check(fet)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,12 @@ class ptx_4finger_nmos_test(openram_test):
|
|||
import tech
|
||||
|
||||
debug.info(2, "Checking three fingers NMOS")
|
||||
fet = factory.create(module_type="ptx",
|
||||
fet = factory.create(module_type="ptx",
|
||||
width= tech.drc["minwidth_tx"],
|
||||
mults=4,
|
||||
tx_type="nmos",
|
||||
connect_active=True,
|
||||
connect_source_active=True,
|
||||
connect_drain_active=True,
|
||||
connect_poly=True)
|
||||
self.local_drc_check(fet)
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,12 @@ class ptx_test(openram_test):
|
|||
import tech
|
||||
|
||||
debug.info(2, "Checking three fingers PMOS")
|
||||
fet = factory.create(module_type="ptx",
|
||||
fet = factory.create(module_type="ptx",
|
||||
width=tech.drc["minwidth_tx"],
|
||||
mults=4,
|
||||
tx_type="pmos",
|
||||
connect_active=True,
|
||||
connect_source_active=True,
|
||||
connect_drain_active=True,
|
||||
connect_poly=True)
|
||||
self.local_drc_check(fet)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
|
||||
class ptx_no_contacts_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
import tech
|
||||
|
||||
debug.info(2, "Checking single finger no source/drain")
|
||||
fet = factory.create(module_type="ptx",
|
||||
width=tech.drc["minwidth_tx"],
|
||||
mults=1,
|
||||
add_source_contact=False,
|
||||
add_drain_contact=False,
|
||||
tx_type="nmos")
|
||||
self.local_drc_check(fet)
|
||||
|
||||
debug.info(2, "Checking multifinger no source/drain")
|
||||
fet = factory.create(module_type="ptx",
|
||||
width=tech.drc["minwidth_tx"],
|
||||
mults=4,
|
||||
add_source_contact=False,
|
||||
add_drain_contact=False,
|
||||
tx_type="nmos")
|
||||
self.local_drc_check(fet)
|
||||
|
||||
debug.info(2, "Checking series ptx")
|
||||
fet = factory.create(module_type="ptx",
|
||||
width=tech.drc["minwidth_tx"],
|
||||
mults=4,
|
||||
series_devices=True,
|
||||
tx_type="nmos")
|
||||
self.local_drc_check(fet)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
class and2_dec_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
global verify
|
||||
import verify
|
||||
|
||||
import and2_dec
|
||||
|
||||
debug.info(2, "Testing and2 gate 4x")
|
||||
a = and2_dec.and2_dec(name="and2x4", size=4)
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
class and3_dec_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
global verify
|
||||
import verify
|
||||
|
||||
import and3_dec
|
||||
|
||||
debug.info(2, "Testing and3 gate 4x")
|
||||
a = and3_dec.and3_dec(name="and3x4", size=4)
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
class and3_dec_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
global verify
|
||||
import verify
|
||||
|
||||
import and3_dec
|
||||
|
||||
debug.info(2, "Testing and3 gate 4x")
|
||||
a = and3_dec.and3_dec(name="and3x4", size=4)
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -29,6 +29,10 @@ class pand2_test(openram_test):
|
|||
a = pand2.pand2(name="pand2x4", size=4)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(2, "Testing vertical pand2 gate 4x")
|
||||
a = pand2.pand2(name="pand2x4", size=4, vertical=True)
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ class pand3_test(openram_test):
|
|||
a = pand3.pand3(name="pand3x4", size=4)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(2, "Testing vertical pand3 gate 4x")
|
||||
a = pand3.pand3(name="pand3x4", size=4, vertical=True)
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# instantiate a copdsay of the class to actually run the test
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ class pdriver_test(openram_test):
|
|||
c = factory.create(module_type="pdriver", fanout = 50)
|
||||
self.local_check(c)
|
||||
|
||||
d = factory.create(module_type="pdriver", fanout = 50, neg_polarity = True)
|
||||
d = factory.create(module_type="pdriver", fanout = 50, inverting = True)
|
||||
self.local_check(d)
|
||||
|
||||
e = factory.create(module_type="pdriver", fanout = 64)
|
||||
self.local_check(e)
|
||||
|
||||
f = factory.create(module_type="pdriver", fanout = 64, neg_polarity = True)
|
||||
f = factory.create(module_type="pdriver", fanout = 64, inverting = True)
|
||||
self.local_check(f)
|
||||
|
||||
globals.end_openram()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
class pinv_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
debug.info(2, "Checking 100x inverter")
|
||||
tx = factory.create(module_type="pinv", size=100)
|
||||
self.local_check(tx)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -25,7 +25,7 @@ class pinv_test(openram_test):
|
|||
tx = factory.create(module_type="pinv", size=1)
|
||||
self.local_check(tx)
|
||||
|
||||
globals.end_openram()
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
class pinv_dec_1x_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
debug.info(2, "Checking 1x size decoder inverter")
|
||||
tx = factory.create(module_type="pinv_dec", size=1)
|
||||
self.local_check(tx)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -25,6 +25,11 @@ class pnand2_test(openram_test):
|
|||
tx = factory.create(module_type="pnand2", size=1)
|
||||
self.local_check(tx)
|
||||
|
||||
debug.info(2, "Checking 2-input nand gate")
|
||||
tx = factory.create(module_type="pnand2", size=1, add_wells=False)
|
||||
# Only DRC because well contacts will fail LVS
|
||||
self.local_drc_check(tx)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@ class pnand3_test(openram_test):
|
|||
tx = factory.create(module_type="pnand3", size=1)
|
||||
self.local_check(tx)
|
||||
|
||||
debug.info(2, "Checking 3-input nand gate")
|
||||
tx = factory.create(module_type="pnand3", size=1, add_wells=False)
|
||||
# Only DRC because well contacts will fail LVS
|
||||
self.local_drc_check(tx)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
|
||||
class single_level_column_mux_1rw_1r_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
OPTS.bitcell = "bitcell_1rw_1r"
|
||||
OPTS.num_rw_ports = 1
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 0
|
||||
|
||||
debug.info(2, "Checking column mux port 0")
|
||||
tx = factory.create(module_type="single_level_column_mux", tx_size=8, bitcell_bl="bl0", bitcell_br="br0")
|
||||
self.local_check(tx)
|
||||
|
||||
debug.info(2, "Checking column mux port 1")
|
||||
tx = factory.create(module_type="single_level_column_mux", tx_size=8, bitcell_bl="bl1", bitcell_br="br1")
|
||||
self.local_check(tx)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -15,7 +15,6 @@ from globals import OPTS
|
|||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
#@unittest.skip("SKIPPING 04_driver_test")
|
||||
|
||||
class single_level_column_mux_test(openram_test):
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class wordline_driver_test(openram_test):
|
|||
|
||||
# check wordline driver for single port
|
||||
debug.info(2, "Checking driver")
|
||||
tx = factory.create(module_type="wordline_driver", rows=8, cols=32)
|
||||
tx = factory.create(module_type="wordline_driver")
|
||||
self.local_check(tx)
|
||||
|
||||
globals.end_openram()
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
|
||||
class hierarchical_decoder_1rw_1r_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
# Use the 2 port cell since it is usually bigger/easier
|
||||
OPTS.bitcell = "bitcell_1rw_1r"
|
||||
OPTS.num_rw_ports = 1
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 0
|
||||
|
||||
# Checks 2x4 and 2-input NAND decoder
|
||||
debug.info(1, "Testing 16 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=16)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 2x4 and 2-input NAND decoder with non-power-of-two
|
||||
debug.info(1, "Testing 17 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=17)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 2x4 with 3x8 and 2-input NAND decoder
|
||||
debug.info(1, "Testing 32 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=32)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 3 x 2x4 and 3-input NAND decoder
|
||||
debug.info(1, "Testing 64 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=64)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 2x4 and 2 x 3x8 and 3-input NAND with non-power-of-two
|
||||
debug.info(1, "Testing 132 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=132)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 3 x 3x8 and 3-input NAND decoder
|
||||
debug.info(1, "Testing 512 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=512)
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -21,35 +21,32 @@ class hierarchical_decoder_test(openram_test):
|
|||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
# check hierarchical decoder for single port
|
||||
# Checks 2x4 and 2-input NAND decoder
|
||||
debug.info(1, "Testing 16 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=16)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 2x4 and 2-input NAND decoder with non-power-of-two
|
||||
debug.info(1, "Testing 17 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=17)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing 23 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=23)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 2x4 with 3x8 and 2-input NAND decoder
|
||||
debug.info(1, "Testing 32 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=32)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing 65 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=65)
|
||||
# Checks 3 x 2x4 and 3-input NAND decoder
|
||||
debug.info(1, "Testing 64 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=64)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing 128 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=128)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing 341 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=341)
|
||||
# Checks 2x4 and 2 x 3x8 and 3-input NAND with non-power-of-two
|
||||
debug.info(1, "Testing 132 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=132)
|
||||
self.local_check(a)
|
||||
|
||||
# Checks 3 x 3x8 and 3-input NAND decoder
|
||||
debug.info(1, "Testing 512 row sample for hierarchical_decoder")
|
||||
a = factory.create(module_type="hierarchical_decoder", num_outputs=512)
|
||||
self.local_check(a)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
|
||||
class hierarchical_predecode2x4_1rw_1r_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
# Use the 2 port cell since it is usually bigger/easier
|
||||
OPTS.bitcell = "bitcell_1rw_1r"
|
||||
OPTS.num_rw_ports = 1
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 0
|
||||
|
||||
debug.info(1, "Testing sample for hierarchy_predecode2x4")
|
||||
a = factory.create(module_type="hierarchical_predecode2x4")
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -21,7 +21,6 @@ class hierarchical_predecode2x4_test(openram_test):
|
|||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
# checking hierarchical precode 2x4 for single port
|
||||
debug.info(1, "Testing sample for hierarchy_predecode2x4")
|
||||
a = factory.create(module_type="hierarchical_predecode2x4")
|
||||
self.local_check(a)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
|
||||
class hierarchical_predecode3x8_1rw_1r_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
# Use the 2 port cell since it is usually bigger/easier
|
||||
OPTS.bitcell = "bitcell_1rw_1r"
|
||||
OPTS.num_rw_ports = 1
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 0
|
||||
|
||||
debug.info(1, "Testing sample for hierarchy_predecode3x8")
|
||||
a = factory.create(module_type="hierarchical_predecode3x8")
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -21,7 +21,6 @@ class hierarchical_predecode3x8_test(openram_test):
|
|||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
# checking hierarchical precode 3x8 for single port
|
||||
debug.info(1, "Testing sample for hierarchy_predecode3x8")
|
||||
a = factory.create(module_type="hierarchical_predecode3x8")
|
||||
self.local_check(a)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
import unittest
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
@unittest.skip("SKIPPING hierarchical_predecode4x16_test")
|
||||
class hierarchical_predecode4x16_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
# Use the 2 port cell since it is usually bigger/easier
|
||||
OPTS.bitcell = "bitcell_1rw_1r"
|
||||
OPTS.num_rw_ports = 1
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 0
|
||||
|
||||
debug.info(1, "Testing sample for hierarchy_predecode4x16")
|
||||
a = factory.create(module_type="hierarchical_predecode4x16")
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env python3
|
||||
# See LICENSE for licensing information.
|
||||
#
|
||||
# Copyright (c) 2016-2019 Regents of the University of California and The Board
|
||||
# of Regents for the Oklahoma Agricultural and Mechanical College
|
||||
# (acting for and on behalf of Oklahoma State University)
|
||||
# All rights reserved.
|
||||
#
|
||||
from testutils import *
|
||||
import sys,os
|
||||
sys.path.append(os.getenv("OPENRAM_HOME"))
|
||||
import globals
|
||||
from globals import OPTS
|
||||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
class single_level_column_mux_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
|
||||
OPTS.bitcell = "bitcell_1rw_1r"
|
||||
OPTS.num_rw_ports = 1
|
||||
OPTS.num_r_ports = 1
|
||||
OPTS.num_w_ports = 0
|
||||
|
||||
debug.info(1, "Testing sample for 4-way column_mux_array port 0")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=8, port=0, word_size=2, bitcell_bl="bl0", bitcell_br="br0")
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing sample for 4-way column_mux_array port 1")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=8, port=0, word_size=2, bitcell_bl="bl1", bitcell_br="br1")
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
||||
|
||||
# run the test from the command line
|
||||
if __name__ == "__main__":
|
||||
(OPTS, args) = globals.parse_args()
|
||||
del sys.argv[1:]
|
||||
header(__file__, OPTS.tech_name)
|
||||
unittest.main(testRunner=debugTestRunner())
|
||||
|
|
@ -29,19 +29,19 @@ class single_level_column_mux_pbitcell_test(openram_test):
|
|||
|
||||
factory.reset()
|
||||
debug.info(1, "Testing sample for 2-way column_mux_array in multi-port")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, word_size=8, bitcell_bl="bl0", bitcell_br="br0")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, port=0, word_size=8, bitcell_bl="bl0", bitcell_br="br0")
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing sample for 4-way column_mux_array in multi-port")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, word_size=4, bitcell_bl="bl0", bitcell_br="br0")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, port=0, word_size=4, bitcell_bl="bl0", bitcell_br="br0")
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing sample for 8-way column_mux_array in multi-port (innermost connections)")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=32, word_size=4, bitcell_bl="bl0", bitcell_br="br0")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=32, port=0, word_size=4, bitcell_bl="bl0", bitcell_br="br0")
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing sample for 8-way column_mux_array in multi-port (outermost connections)")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=32, word_size=4, bitcell_bl="bl2", bitcell_br="br2")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=32, port=3, word_size=4, bitcell_bl="bl2", bitcell_br="br2")
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
|
|
|||
|
|
@ -19,19 +19,17 @@ class single_level_column_mux_test(openram_test):
|
|||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
globals.init_openram(config_file)
|
||||
import single_level_column_mux_array
|
||||
|
||||
# check single level column mux array in single port
|
||||
debug.info(1, "Testing sample for 2-way column_mux_array")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, word_size=8)
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, port=0, word_size=8)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing sample for 4-way column_mux_array")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, word_size=4)
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=16, port=0, word_size=4)
|
||||
self.local_check(a)
|
||||
|
||||
debug.info(1, "Testing sample for 8-way column_mux_array")
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=32, word_size=4)
|
||||
a = factory.create(module_type="single_level_column_mux_array", columns=32, port=0, word_size=4)
|
||||
self.local_check(a)
|
||||
|
||||
globals.end_openram()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from globals import OPTS
|
|||
from sram_factory import factory
|
||||
import debug
|
||||
|
||||
class precharge_test(openram_test):
|
||||
class precharge_1rw_1r_test(openram_test):
|
||||
|
||||
def runTest(self):
|
||||
config_file = "{}/tests/configs/config".format(os.getenv("OPENRAM_HOME"))
|
||||
|
|
@ -29,7 +29,7 @@ class precharge_test(openram_test):
|
|||
|
||||
factory.reset()
|
||||
debug.info(2, "Checking 3 column precharge array for 1RW/1R bitcell")
|
||||
pc = factory.create(module_type="precharge_array", columns=3, bitcell_bl="bl0", bitcell_br="br0")
|
||||
pc = factory.create(module_type="precharge_array", columns=3, port=0, bitcell_bl="bl0", bitcell_br="br0")
|
||||
self.local_check(pc)
|
||||
|
||||
# debug.info(2, "Checking 3 column precharge array for pbitcell (innermost connections)")
|
||||
|
|
@ -23,7 +23,7 @@ class precharge_test(openram_test):
|
|||
|
||||
# check precharge array in single port
|
||||
debug.info(2, "Checking 3 column precharge")
|
||||
pc = factory.create(module_type="precharge_array", columns=3)
|
||||
pc = factory.create(module_type="precharge_array", columns=3, port=0)
|
||||
self.local_check(pc)
|
||||
|
||||
globals.end_openram()
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue