47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
|
|
# This file is part of the Coriolis Software.
|
|
# Copyright (c) Sorbonne Université 2019-2021, All Rights Reserved
|
|
#
|
|
# +-----------------------------------------------------------------+
|
|
# | C O R I O L I S |
|
|
# | Alliance / Hurricane Interface |
|
|
# | |
|
|
# | Author : Jean-Paul CHAPUT |
|
|
# | E-mail : Jean-Paul.Chaput@lip6.fr |
|
|
# | =============================================================== |
|
|
# | Python : "./common/devices.py" |
|
|
# +-----------------------------------------------------------------+
|
|
|
|
|
|
from Hurricane import DataBase
|
|
import helpers.io
|
|
from helpers.io import ErrorMessage
|
|
from helpers.io import WarningMessage
|
|
|
|
|
|
tech = DataBase.getDB().getTechnology()
|
|
|
|
|
|
def addDevice ( **kw ):
|
|
global tech
|
|
|
|
try:
|
|
if 'name' in kw:
|
|
devDesc = tech.addDeviceDescriptor( kw['name'] )
|
|
if 'spice' in kw: devDesc.setSpiceFilePath( kw['spice'] )
|
|
if 'connectors' in kw:
|
|
for connector in kw['connectors']:
|
|
devDesc.addConnector( connector )
|
|
else:
|
|
print( WarningMessage( 'common.addDevice(): Missing connectors on device "{}".' \
|
|
.format(kw['name'])))
|
|
if 'layouts' in kw:
|
|
for layout in kw['layouts']:
|
|
devDesc.addLayout( layout[0], layout[1] )
|
|
else:
|
|
print( WarningMessage( 'common.addDevice(): Missing layouts on device "{}".' \
|
|
.format( kw['name'] )))
|
|
except Exception as e:
|
|
helpers.io.catch( e )
|
|
return
|