Skip to content

Commit

Permalink
Fix whitespace in orashi nonunitcapacitor
Browse files Browse the repository at this point in the history
  • Loading branch information
robtaylor committed Oct 9, 2023
1 parent 1765cb0 commit 935bf9f
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 63 deletions.
123 changes: 61 additions & 62 deletions oroshi/python/nonunitcapacitor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

import sys
import sys
from math import sqrt, ceil
from ..Hurricane import *
from ..CRL import *
Expand Down Expand Up @@ -34,17 +34,17 @@ def __init__( self, device, capacitorType, direction, capacitance, capacitorUnit
self.device = device
self.capacitorType = capacitorType
self.direction = direction
self.capacitance = capacitance
self.capacitorUnit = capacitorUnit
self.abutmentBoxPosition = abutmentBoxPosition
self.capUnitTopPlates_spacing = capUnitTopPlates_spacing
self.capacitance = capacitance
self.capacitorUnit = capacitorUnit
self.abutmentBoxPosition = abutmentBoxPosition
self.capUnitTopPlates_spacing = capUnitTopPlates_spacing

self.unitCapDim = CapacitorUnit.__computeCapDim__( self, capacitorUnit, capacitorType )
self.unitCapDim = CapacitorUnit.__computeCapDim__( self, capacitorUnit, capacitorType )

if self.__isDirectionOk__(direction):
self.nonUnitCapDim = {"width" : self.unitCapDim["width"] , "height" : 0 } if direction == "vertical" else {"width" : 0 , "height" : self.unitCapDim["width"] }
self.nonUnitCapDim = {"width" : self.unitCapDim["width"] , "height" : 0 } if direction == "vertical" else {"width" : 0 , "height" : self.unitCapDim["width"] }

self.nonUnitCapDim_sideLimit = 0
self.nonUnitCapDim_sideLimit = 0
self.dummyCapDim = {}

return
Expand All @@ -62,53 +62,52 @@ def __isDirectionOk__( self, direction ):

def setRules( self ):

CapacitorUnit.setRules(self)
CapacitorUnit.setRules(self)

if self.capacitorType == 'MIMCap':
self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_metcapdum )

elif self.capacitorType == 'PIPCap':
self.__setattr__( "minWidth_dummyTopPlate" , CapacitorUnit.rules.minWidth_cpoly )

return
return



def create( self, b, t ) :

UpdateSession.open()
UpdateSession.open()

self.setRules()
self.computeDimensions()
self.setRules()
self.computeDimensions()

if self.__isCapacitorOk__() :
if self.__isCapacitorOk__() :

print('drawing capacitor')
activeCapacitor = CapacitorUnit ( self.device, self.capacitorType, self.abutmentBoxPosition, capDim = self.nonUnitCapDim )
activeCapacitor.create( b, t )
print('drawing capacitor')
activeCapacitor = CapacitorUnit ( self.device, self.capacitorType, self.abutmentBoxPosition, capDim = self.nonUnitCapDim )
activeCapacitor.create( b, t )

side = "height" if self.direction == "vertical" else "width"
if self.__isNonUnitCapSideOk__( side ) :

print("drawing dummy too")
# activeCapacitor = CapacitorUnit ( self.device, activeCapacitance, self.capacitorType, self.abutmentBoxPosition )
if self.__isNonUnitCapSideOk__( side ):
print("drawing dummy too")
# activeCapacitor = CapacitorUnit ( self.device, activeCapacitance, self.capacitorType, self.abutmentBoxPosition )

dummyAbutmentBoxPosition = [ self.abutmentBoxPosition[0], self.abutmentBoxPosition[1] - CapacitorUnit.computeAbutmentBoxDimensions( self, self.dummyCapDim )["height"] ] if self.direction == "vertical" else [ self.abutmentBoxPosition[0] + CapacitorUnit.computeAbutmentBoxDimensions( self, self.nonUnitCapDim )["width"] , self.abutmentBoxPosition[1] ]
dummyAbutmentBoxPosition = [ self.abutmentBoxPosition[0], self.abutmentBoxPosition[1] - CapacitorUnit.computeAbutmentBoxDimensions( self, self.dummyCapDim )["height"] ] if self.direction == "vertical" else [ self.abutmentBoxPosition[0] + CapacitorUnit.computeAbutmentBoxDimensions( self, self.nonUnitCapDim )["width"] , self.abutmentBoxPosition[1] ]

dummyCapacitor = CapacitorUnit( self.device, self.capacitorType, dummyAbutmentBoxPosition, capDim = self.dummyCapDim )
# activeCapacitor.create( b, t )
dummyCapacitor.create ( b, t )
dummyCapacitor = CapacitorUnit( self.device, self.capacitorType, dummyAbutmentBoxPosition, capDim = self.dummyCapDim )
# activeCapacitor.create( b, t )
dummyCapacitor.create ( b, t )

else : print("not drawing dummy")

# abutmentBoxDimensions = self.computeAbutmentBoxDimensions(capDim)
# CapacitorUnit.drawAbutmentBox( self )

else : raise Error(1,'create() : Impossible to draw capacitor in the defined geometric limits.')
# abutmentBoxDimensions = self.computeAbutmentBoxDimensions(capDim)
# CapacitorUnit.drawAbutmentBox( self )

else : raise Error(1,'create() : Impossible to draw capacitor in the defined geometric limits.')

UpdateSession.close()

return
return



Expand All @@ -121,30 +120,30 @@ def create( self, b, t ) :

def __isCapacitorOk__( self ):

capacitorMax = self.computeCapacitorMax()
capacitorMax = self.computeCapacitorMax()

print("CMax",capacitorMax)
print("self.capacitance",self.capacitance)
print("self.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing))
print("CMax",capacitorMax)
print("self.capacitance",self.capacitance)
print("self.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing))

return True if self.capacitance < capacitorMax else False
return True if self.capacitance < capacitorMax else False




def computeDimensions( self ):

if self.capUnitTopPlates_spacing == -1 :
CapacitorUnit.computeAbutmentBoxDimensions(self, self.unitCapDim )
self.capUnitTopPlates_spacing = 2*(self.minSpacing_botPlate + self.enclosure_botPlate_topPlate)
if self.capUnitTopPlates_spacing == -1 :
CapacitorUnit.computeAbutmentBoxDimensions(self, self.unitCapDim )
self.capUnitTopPlates_spacing = 2*(self.minSpacing_botPlate + self.enclosure_botPlate_topPlate)

self.nonUnitCapDim_sideLimit = 2*self.unitCapDim["width"] - self.minWidth_dummyTopPlate
self.nonUnitCapDim_sideLimit = 2*self.unitCapDim["width"] - self.minWidth_dummyTopPlate

if self.direction == "vertical":
self.nonUnitCapDim["height"] = self.computeNonUnitCapheight()
self.nonUnitCapDim["height"] = self.computeNonUnitCapheight()
else : self.nonUnitCapDim["width"] = self.computeNonUnitCapheight()

print("sideLimit",toPhy(self.nonUnitCapDim_sideLimit))
print("sideLimit",toPhy(self.nonUnitCapDim_sideLimit))
print("self.capUnitTopPlates_spacing",toPhy(self.capUnitTopPlates_spacing))
print('self.nonUnitCapDim["width"]',toPhy(self.nonUnitCapDim["width"]))
print('self.nonUnitCapDim["height"]',toPhy(self.nonUnitCapDim["height"]))
Expand All @@ -156,36 +155,36 @@ def computeDimensions( self ):

print("self.dummyCapDim",toPhy(self.dummyCapDim["width" ]))
print("self.dummyCapDim",toPhy(self.dummyCapDim["height" ]))
return
return



def computeCapacitorMax( self ):

[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
capUnit_width = toPhy( self.unitCapDim["width"] )
topPlates_spacing = toPhy( self.capUnitTopPlates_spacing )
print("[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ]",[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ])
print("width",capUnit_width)
CMax = ( 2*capUnit_width + topPlates_spacing )*capUnit_width*areaCapacitorPerUnit + ( 3*capUnit_width + topPlates_spacing )*perimeterCapacitorPerUnit
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
capUnit_width = toPhy( self.unitCapDim["width"] )
topPlates_spacing = toPhy( self.capUnitTopPlates_spacing )
print("[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ]",[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ])
print("width",capUnit_width)
CMax = ( 2*capUnit_width + topPlates_spacing )*capUnit_width*areaCapacitorPerUnit + ( 3*capUnit_width + topPlates_spacing )*perimeterCapacitorPerUnit

return CMax
return CMax



def computeNonUnitCapheight( self ):


[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
width = toPhy( self.unitCapDim["width"] )
height = self.capacitance/( (width*areaCapacitorPerUnit + perimeterCapacitorPerUnit) + width*perimeterCapacitorPerUnit )
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = CapacitorUnit.__setCapacitorPerUnit__(self, self.capacitorType)
width = toPhy( self.unitCapDim["width"] )
height = self.capacitance/( (width*areaCapacitorPerUnit + perimeterCapacitorPerUnit) + width*perimeterCapacitorPerUnit )

print("height",height)
return toDbU(height)
print("height",height)
return toDbU(height)



def __isNonUnitCapSideOk__( self, side ):
def __isNonUnitCapSideOk__( self, side ):

if side in ["width","height"]:
state = True if self.nonUnitCapDim[side] < self.nonUnitCapDim_sideLimit else False
Expand Down Expand Up @@ -230,24 +229,24 @@ def scriptMain( **kw ):
device.setTerminal( True )

bottomPlate_net = Net.create( device, 'b' )
bottomPlate_net.setExternal( True )
bottomPlate_net.setExternal( True )
b = device.getNet("b")
doBreak( 1, 'Done building bottomPlate')

topPlate_net = Net.create( device, 't' )
topPlate_net.setExternal( True )
topPlate_net.setExternal( True )
t = device.getNet("t")
doBreak( 1, 'Done building tNet')

if editor:
UpdateSession.close( )
editor.setCell ( device )
editor.fit ( )
UpdateSession.open ( )
editor.setCell ( device )
editor.fit ( )
UpdateSession.open ( )

nonUnitCapacitor = NonUnitCapacitor ( device, 'PIPCap', 'horizontal', 65, 50, [0,0] )
nonUnitCapacitor.create(b,t)
nonUnitCapacitor.create(b,t)

AllianceFramework.get().saveCell( device, Catalog.State.Views )

return True
Expand Down

0 comments on commit 935bf9f

Please sign in to comment.