2019-04-26 21:21:50 +02:00
|
|
|
# See LICENSE for licensing information.
|
|
|
|
|
#
|
2021-01-22 20:23:28 +01:00
|
|
|
# Copyright (c) 2016-2021 Regents of the University of California and The Board
|
2019-06-14 17:43:41 +02:00
|
|
|
# of Regents for the Oklahoma Agricultural and Mechanical College
|
|
|
|
|
# (acting for and on behalf of Oklahoma State University)
|
|
|
|
|
# All rights reserved.
|
2019-04-26 21:21:50 +02:00
|
|
|
#
|
2016-11-08 18:57:35 +01:00
|
|
|
import debug
|
|
|
|
|
from tech import drc
|
2022-07-13 19:57:56 +02:00
|
|
|
from base import design
|
|
|
|
|
from base import vector
|
2019-01-17 01:15:38 +01:00
|
|
|
from sram_factory import factory
|
2016-11-08 18:57:35 +01:00
|
|
|
from globals import OPTS
|
|
|
|
|
|
2022-07-13 19:57:56 +02:00
|
|
|
class tri_gate_array(design):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""
|
|
|
|
|
Dynamically generated tri gate array of all bitlines. words_per_row
|
|
|
|
|
"""
|
|
|
|
|
|
2019-03-06 23:12:24 +01:00
|
|
|
def __init__(self, columns, word_size, name):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""Intial function of tri gate array """
|
2020-08-06 20:33:26 +02:00
|
|
|
super().__init__(name)
|
2016-11-08 18:57:35 +01:00
|
|
|
debug.info(1, "Creating {0}".format(self.name))
|
|
|
|
|
|
|
|
|
|
self.columns = columns
|
|
|
|
|
self.word_size = word_size
|
2018-05-12 01:32:00 +02:00
|
|
|
self.words_per_row = int(self.columns / self.word_size)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
self.create_netlist()
|
2018-08-28 19:24:09 +02:00
|
|
|
if not OPTS.netlist_only:
|
|
|
|
|
self.create_layout()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
def create_netlist(self):
|
2018-08-28 19:24:09 +02:00
|
|
|
self.add_modules()
|
2016-11-08 18:57:35 +01:00
|
|
|
self.add_pins()
|
2017-08-24 00:02:15 +02:00
|
|
|
self.create_array()
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
def create_layout(self):
|
2018-08-28 19:24:09 +02:00
|
|
|
self.width = (self.columns / self.words_per_row) * self.tri.width
|
|
|
|
|
self.height = self.tri.height
|
|
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
self.place_array()
|
2017-08-24 00:02:15 +02:00
|
|
|
self.add_layout_pins()
|
2019-05-28 01:32:38 +02:00
|
|
|
self.add_boundary()
|
2018-08-27 20:13:34 +02:00
|
|
|
self.DRC_LVS()
|
2016-11-08 18:57:35 +01:00
|
|
|
|
2018-08-28 19:24:09 +02:00
|
|
|
def add_modules(self):
|
2019-01-17 01:15:38 +01:00
|
|
|
self.tri = factory.create(module_type="tri_gate")
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2016-11-08 18:57:35 +01:00
|
|
|
def add_pins(self):
|
|
|
|
|
"""create the name of pins depend on the word size"""
|
|
|
|
|
for i in range(self.word_size):
|
2018-10-11 18:53:08 +02:00
|
|
|
self.add_pin("in_{0}".format(i))
|
2016-11-08 18:57:35 +01:00
|
|
|
for i in range(self.word_size):
|
2018-10-11 18:53:08 +02:00
|
|
|
self.add_pin("out_{0}".format(i))
|
2016-11-08 18:57:35 +01:00
|
|
|
for pin in ["en", "en_bar", "vdd", "gnd"]:
|
|
|
|
|
self.add_pin(pin)
|
|
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
def create_array(self):
|
2016-11-08 18:57:35 +01:00
|
|
|
"""add tri gate to the array """
|
2017-08-24 00:02:15 +02:00
|
|
|
self.tri_inst = {}
|
|
|
|
|
for i in range(0,self.columns,self.words_per_row):
|
|
|
|
|
name = "Xtri_gate{0}".format(i)
|
|
|
|
|
self.tri_inst[i]=self.add_inst(name=name,
|
2018-08-27 20:13:34 +02:00
|
|
|
mod=self.tri)
|
2018-05-12 01:32:00 +02:00
|
|
|
index = int(i/self.words_per_row)
|
2018-10-11 18:53:08 +02:00
|
|
|
self.connect_inst(["in_{0}".format(index),
|
|
|
|
|
"out_{0}".format(index),
|
2016-11-08 18:57:35 +01:00
|
|
|
"en", "en_bar", "vdd", "gnd"])
|
|
|
|
|
|
2018-08-27 20:13:34 +02:00
|
|
|
def place_array(self):
|
|
|
|
|
""" Place the tri gate to the array """
|
|
|
|
|
for i in range(0,self.columns,self.words_per_row):
|
|
|
|
|
base = vector(i*self.tri.width, 0)
|
2018-08-28 02:25:39 +02:00
|
|
|
self.tri_inst[i].place(base)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
|
|
|
|
|
def add_layout_pins(self):
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
for i in range(0,self.columns,self.words_per_row):
|
2018-05-12 01:32:00 +02:00
|
|
|
index = int(i/self.words_per_row)
|
2017-08-24 00:02:15 +02:00
|
|
|
|
|
|
|
|
in_pin = self.tri_inst[i].get_pin("in")
|
2018-10-11 18:53:08 +02:00
|
|
|
self.add_layout_pin(text="in_{0}".format(index),
|
2019-12-17 20:03:36 +01:00
|
|
|
layer="m2",
|
2017-08-24 00:02:15 +02:00
|
|
|
offset=in_pin.ll(),
|
|
|
|
|
width=in_pin.width(),
|
|
|
|
|
height=in_pin.height())
|
|
|
|
|
|
|
|
|
|
out_pin = self.tri_inst[i].get_pin("out")
|
2018-10-11 18:53:08 +02:00
|
|
|
self.add_layout_pin(text="out_{0}".format(index),
|
2019-12-17 20:03:36 +01:00
|
|
|
layer="m2",
|
2017-08-24 00:02:15 +02:00
|
|
|
offset=out_pin.ll(),
|
|
|
|
|
width=out_pin.width(),
|
|
|
|
|
height=out_pin.height())
|
|
|
|
|
|
|
|
|
|
|
2018-04-12 00:11:47 +02:00
|
|
|
# Route both supplies
|
|
|
|
|
for n in ["vdd", "gnd"]:
|
|
|
|
|
for supply_pin in self.tri_inst[i].get_pins(n):
|
|
|
|
|
pin_pos = supply_pin.center()
|
2019-12-13 23:13:41 +01:00
|
|
|
self.add_via_center(layers=self.m2_stack,
|
2018-04-12 00:11:47 +02:00
|
|
|
offset=pin_pos)
|
|
|
|
|
self.add_layout_pin_rect_center(text=n,
|
2019-12-17 20:03:36 +01:00
|
|
|
layer="m3",
|
2018-04-12 00:11:47 +02:00
|
|
|
offset=pin_pos)
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
|
|
|
|
|
width = self.tri.width * self.columns - (self.words_per_row - 1) * self.tri.width
|
|
|
|
|
en_pin = self.tri_inst[0].get_pin("en")
|
|
|
|
|
self.add_layout_pin(text="en",
|
2019-12-17 20:03:36 +01:00
|
|
|
layer="m1",
|
2017-08-24 00:02:15 +02:00
|
|
|
offset=en_pin.ll().scale(0, 1),
|
|
|
|
|
width=width,
|
2019-12-17 20:03:36 +01:00
|
|
|
height=drc("minwidth_m1"))
|
2020-11-03 15:29:17 +01:00
|
|
|
|
2017-08-24 00:02:15 +02:00
|
|
|
enbar_pin = self.tri_inst[0].get_pin("en_bar")
|
|
|
|
|
self.add_layout_pin(text="en_bar",
|
2019-12-17 20:03:36 +01:00
|
|
|
layer="m1",
|
2017-08-24 00:02:15 +02:00
|
|
|
offset=enbar_pin.ll().scale(0, 1),
|
|
|
|
|
width=width,
|
2021-11-22 19:51:40 +01:00
|
|
|
height=drc("minwidth_m1"))
|