2018-10-01 09:52:17 -05:00
|
|
|
|
|
|
|
from Hurricane import DbU
|
|
|
|
from Hurricane import DataBase
|
2020-04-08 04:24:42 -05:00
|
|
|
import oroshi.dtr
|
2018-10-01 09:52:17 -05:00
|
|
|
|
|
|
|
|
|
|
|
rules = None
|
|
|
|
|
|
|
|
|
|
|
|
class Flag ( object ):
|
|
|
|
|
|
|
|
StandardRules = 0x0001
|
|
|
|
MIMRules = 0x0002
|
|
|
|
AllRules = StandardRules|MIMRules
|
|
|
|
|
|
|
|
|
|
|
|
def getRules ():
|
|
|
|
global rules
|
|
|
|
if not rules:
|
2020-04-08 04:24:42 -05:00
|
|
|
rules = oroshi.dtr.Rules( DataBase.getDB().getTechnology() )
|
2018-10-01 09:52:17 -05:00
|
|
|
return rules
|
|
|
|
|
|
|
|
|
|
|
|
def toNano ( value ): return DbU.toPhysical( value, DbU.UnitPowerNano )
|
|
|
|
def toMicro ( value ): return DbU.toPhysical( value, DbU.UnitPowerMicro )
|
|
|
|
def toUnity ( value ): return DbU.toPhysical( value, DbU.UnitPowerUnity )
|
|
|
|
|
|
|
|
|
|
|
|
def adjustOnGrid ( unit, mode='upper' ):
|
|
|
|
if mode == 'upper': return DbU.getOnPhysicalGrid(unit, DbU.SnapModeSuperior)
|
|
|
|
elif mode == 'lower': return DbU.getOnPhysicalGrid(unit, DbU.SnapModeInferior)
|
|
|
|
elif mode == 'near' : return DbU.getOnPhysicalGrid(unit, DbU.SnapModeNearest )
|
|
|
|
else:
|
|
|
|
print '[ERROR] oroshi.adjustOnGrid(): "%s" is not a valid mode.' % mode
|
|
|
|
print ' ("upper", "lower" or "near")'
|
|
|
|
return 0
|