2020-04-08 04:24:42 -05:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from Hurricane import DataBase
|
|
|
|
from Hurricane import UpdateSession
|
|
|
|
from Hurricane import DbU
|
|
|
|
from Hurricane import Box
|
|
|
|
from Hurricane import Net
|
|
|
|
import helpers
|
|
|
|
import helpers.io
|
2022-07-13 04:20:55 -05:00
|
|
|
from helpers import trace, l, u, n
|
2020-04-08 04:24:42 -05:00
|
|
|
|
2020-04-10 05:15:23 -05:00
|
|
|
#helpers.setTraceLevel( 100 )
|
2020-04-08 04:24:42 -05:00
|
|
|
|
|
|
|
import Analog
|
|
|
|
from Analog import Device
|
|
|
|
import oroshi
|
|
|
|
import oroshi.paramsmatrix
|
|
|
|
from oroshi.resistorsnake import Resistor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def checkCoherency ( device, bbMode ):
|
|
|
|
message = 'Resistor.checkCoherency(): device "%s".\n' % device.getName()
|
|
|
|
|
|
|
|
techno = DataBase.getDB().getTechnology()
|
|
|
|
rules = oroshi.getRules()
|
|
|
|
|
|
|
|
resistance = device.getParameter( 'R' )
|
|
|
|
if resistance is None:
|
|
|
|
message += ' Missing "resistance" parameter on %s' % str(device)
|
|
|
|
return (False, message)
|
|
|
|
|
|
|
|
return (True, "")
|
|
|
|
|
|
|
|
|
|
|
|
def layout ( device, bbMode ):
|
|
|
|
|
|
|
|
trace( 100, ',+', '\tResistor.layout() called for "%s".\n' % device.getName())
|
|
|
|
|
|
|
|
paramsMatrix = oroshi.paramsmatrix.ParamsMatrix()
|
|
|
|
|
|
|
|
try:
|
|
|
|
resistance = device.getParameter( 'R' ).getValue()
|
|
|
|
width = device.getParameter( 'W' ).getValue()
|
|
|
|
length = device.getParameter( 'L' ).getValue()
|
|
|
|
bends = device.getParameter( 'bends' ).getValue()
|
|
|
|
|
2022-07-13 04:20:55 -05:00
|
|
|
width = u( 8.0)
|
|
|
|
length = u(100.0)
|
|
|
|
bends = 1
|
|
|
|
trace( 100, '\tpR:{0}\n'.format(device.getParameter('R')) )
|
2020-04-08 04:24:42 -05:00
|
|
|
trace( 100, '\tpW:{0}\n'.format(device.getParameter('W')) )
|
2022-07-13 04:20:55 -05:00
|
|
|
trace( 100, '\tpL:{0}\n'.format(device.getParameter('L')) )
|
2020-04-08 04:24:42 -05:00
|
|
|
trace( 100, '\tresistance:{0}, width:{1}, length:{2}\n'.format(resistance,width,length) )
|
|
|
|
|
|
|
|
typeArg = 'UnknownType'
|
|
|
|
if device.isRPOLYH(): typeArg = 'RPOLYH'
|
|
|
|
if device.isRPOLY2PH(): typeArg = 'RPOLY2PH'
|
|
|
|
|
|
|
|
netsArg = [ device.getNet('t1'), device.getNet('t2') ]
|
|
|
|
|
|
|
|
resistor = Resistor( device
|
|
|
|
, netsArg
|
|
|
|
, typeArg
|
|
|
|
, resistance
|
|
|
|
, resDim={ 'width':width, 'length':length }
|
|
|
|
, direction='vertical'
|
|
|
|
, bends=bends
|
|
|
|
, shape=135
|
|
|
|
)
|
|
|
|
resistor.create()
|
|
|
|
|
|
|
|
for net in netsArg:
|
|
|
|
device.setRestrictions( net, Device.SouthBlocked|Device.NorthBlocked )
|
|
|
|
|
|
|
|
paramsMatrix.setGlobalCapacitorParams( device.getAbutmentBox() )
|
|
|
|
trace( 100, '++' )
|
|
|
|
#paramsMatrix.trace()
|
|
|
|
|
2022-07-13 04:20:55 -05:00
|
|
|
except Exception as e:
|
2020-04-08 04:24:42 -05:00
|
|
|
helpers.io.catch( e )
|
|
|
|
|
|
|
|
trace( 100, '---' )
|
|
|
|
|
|
|
|
return paramsMatrix.getMatrix()
|