mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-09-03 06:43:36 +02:00
Fix some pep8 errors/warnings in pgate and examples.
This commit is contained in:
+24
-26
@@ -6,20 +6,18 @@
|
||||
# All rights reserved.
|
||||
#
|
||||
import debug
|
||||
from tech import drc
|
||||
from math import log
|
||||
from vector import vector
|
||||
from globals import OPTS
|
||||
import pgate
|
||||
from sram_factory import factory
|
||||
|
||||
|
||||
class pbuf(pgate.pgate):
|
||||
"""
|
||||
This is a simple buffer used for driving loads.
|
||||
This is a simple buffer used for driving loads.
|
||||
"""
|
||||
def __init__(self, name, size=4, height=None):
|
||||
|
||||
debug.info(1, "creating {0} with size of {1}".format(name,size))
|
||||
debug.info(1, "creating {0} with size of {1}".format(name, size))
|
||||
self.add_comment("size: {}".format(size))
|
||||
|
||||
self.stage_effort = 4
|
||||
@@ -29,7 +27,6 @@ class pbuf(pgate.pgate):
|
||||
# Creates the netlist and layout
|
||||
pgate.pgate.__init__(self, name, height)
|
||||
|
||||
|
||||
def create_netlist(self):
|
||||
self.add_pins()
|
||||
self.create_modules()
|
||||
@@ -49,53 +46,54 @@ class pbuf(pgate.pgate):
|
||||
|
||||
def create_modules(self):
|
||||
# Shield the cap, but have at least a stage effort of 4
|
||||
input_size = max(1,int(self.size/self.stage_effort))
|
||||
self.inv1 = factory.create(module_type="pinv", size=input_size, height=self.height)
|
||||
input_size = max(1, int(self.size / self.stage_effort))
|
||||
self.inv1 = factory.create(module_type="pinv",
|
||||
size=input_size,
|
||||
height=self.height)
|
||||
self.add_mod(self.inv1)
|
||||
|
||||
self.inv2 = factory.create(module_type="pinv", size=self.size, height=self.height)
|
||||
self.inv2 = factory.create(module_type="pinv",
|
||||
size=self.size,
|
||||
height=self.height)
|
||||
self.add_mod(self.inv2)
|
||||
|
||||
def create_insts(self):
|
||||
self.inv1_inst=self.add_inst(name="buf_inv1",
|
||||
mod=self.inv1)
|
||||
self.connect_inst(["A", "zb_int", "vdd", "gnd"])
|
||||
self.inv1_inst = self.add_inst(name="buf_inv1",
|
||||
mod=self.inv1)
|
||||
self.connect_inst(["A", "zb_int", "vdd", "gnd"])
|
||||
|
||||
|
||||
self.inv2_inst=self.add_inst(name="buf_inv2",
|
||||
mod=self.inv2)
|
||||
self.connect_inst(["zb_int", "Z", "vdd", "gnd"])
|
||||
self.inv2_inst = self.add_inst(name="buf_inv2",
|
||||
mod=self.inv2)
|
||||
self.connect_inst(["zb_int", "Z", "vdd", "gnd"])
|
||||
|
||||
def place_insts(self):
|
||||
# Add INV1 to the right
|
||||
self.inv1_inst.place(vector(0,0))
|
||||
# Add INV1 to the right
|
||||
self.inv1_inst.place(vector(0, 0))
|
||||
|
||||
# Add INV2 to the right
|
||||
self.inv2_inst.place(vector(self.inv1_inst.rx(),0))
|
||||
|
||||
self.inv2_inst.place(vector(self.inv1_inst.rx(), 0))
|
||||
|
||||
def add_wires(self):
|
||||
# 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())
|
||||
mid_point = vector(z1_pin.cx(), a2_pin.cy())
|
||||
self.add_path("metal1", [z1_pin.center(), mid_point, a2_pin.center()])
|
||||
|
||||
|
||||
def add_layout_pins(self):
|
||||
# Continous vdd rail along with label.
|
||||
vdd_pin=self.inv1_inst.get_pin("vdd")
|
||||
vdd_pin = self.inv1_inst.get_pin("vdd")
|
||||
self.add_layout_pin(text="vdd",
|
||||
layer="metal1",
|
||||
offset=vdd_pin.ll().scale(0,1),
|
||||
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")
|
||||
gnd_pin = self.inv1_inst.get_pin("gnd")
|
||||
self.add_layout_pin(text="gnd",
|
||||
layer="metal1",
|
||||
offset=gnd_pin.ll().scale(0,1),
|
||||
offset=gnd_pin.ll().scale(0, 1),
|
||||
width=self.width,
|
||||
height=vdd_pin.height())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user