coriolis/karakaze/python/oceane.py

167 lines
5.2 KiB
Python
Raw Normal View History

Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
import re
class Parameters ( object ):
class Transistor ( object ):
def __init__ ( self, aName ):
self.name = aName
self.L = 0.0
self.W = 0.0
self.M = 0
return
class Capacitor ( object ):
def __init__ ( self, aName ):
self.name = aName
self.C = 0.0
return
class Resistor ( object ):
def __init__ ( self, aName ):
self.name = aName
self.R = 0.0
Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
return
def __init__ ( self ):
self.transistors = { }
self.capacitors = { }
self.resistors = { }
Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
self.indexToName = { }
return
def addTransistor ( self, name, index ):
lname = name.lower()
if self.transistors.has_key(lname):
print 'Duplicated transistor "%s" (ignored).' % lname
else:
if self.indexToName.has_key(index):
print 'Transistors "%s" and "%s" have the same index %d (ignored).' % \
(self.indexToName[index],lname,index)
self.transistors[ lname ] = Parameters.Transistor( lname )
self.indexToName[ index ] = lname
return self.transistors[ lname ]
def getTransistor ( self, ref ):
transistor = None
if isinstance(ref,str):
lname = ref.lower()
if self.transistors.has_key(lname):
transistor = self.transistors[lname]
else:
print 'No transistor named "%s".' % ref
if isinstance(ref,int):
if self.indexToName.has_key(ref):
transistor = self.transistors[self.indexToName[ref]]
else:
print 'No transistor with index %d.' % ref
return transistor
#def getTransistorL ( self, ref ): return self.getTransistor(ref)[0]
#def getTransistorW ( self, ref ): return self.getTransistor(ref)[1]
#def getTransistorM ( self, ref ): return self.getTransistor(ref)[2]
def addCapacitor ( self, name, value ):
lname = name.lower()
if self.capacitors.has_key(lname):
print 'Duplicated capacitor "%s" (ignored).' % lname
else:
#print 'Add capacitor "%s"' % lname
self.capacitors[ lname ] = Parameters.Capacitor( lname )
self.capacitors[ lname ].C = value
return self.capacitors[ lname ]
def getCapacitor ( self, ref ):
capacitor = None
lname = ref.lower()
if self.capacitors.has_key(lname):
capacitor = self.capacitors[lname]
else:
print 'No capacitor named "%s".' % ref
return capacitor
def addResistor ( self, name, value ):
lname = name.lower()
if self.resistors.has_key(lname):
print 'Duplicated resistor "%s" (ignored).' % lname
else:
self.resistors[ lname ] = Parameters.Resistor( lname )
self.resistors[ lname ].R = value
return self.resistors[ lname ]
def getResistor ( self, ref ):
resistor = None
lname = ref.lower()
if self.capactors.has_key(lname):
resistor = self.capactors[lname]
else:
print 'No resistor named "%s".' % ref
return resistor
Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
def read ( self, file ):
reSpecCapa = re.compile( r'^(?P<name>C\w+)\s+(?P<value>.*)$' )
reSpecResis = re.compile( r'^(?P<name>R\w+)\s+(?P<value>.*)$' )
reSpecTran = re.compile( r'^\* SPECIFICATIONS DE M(?P<index>\d+)\s+:\s+(?P<name>\w+) \*$' )
reSpecL = re.compile( r'L_(?P<index>\d+)\s+(?P<float>[0-9.e-]+)' )
reSpecW = re.compile( r'W_(?P<index>\d+)\s+(?P<float>[0-9.e-]+)' )
reSpecM = re.compile( r'M_(?P<index>\d+)\s+(?P<int>\d+)' )
Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
fd = open( file, 'r' )
for line in fd.readlines():
if line.startswith('REGIME_'): continue
Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
m = reSpecTran.match( line[:-1] )
if m:
i = int(m.group('index'))
#print 'Found transistor %d:<%s>' % (i, m.group('name'))
self.addTransistor( m.group('name'), i )
continue
m = reSpecL.match( line[:-1] )
if m:
i = int (m.group('index'))
L = float(m.group('float'))
#print ' %d:L: %g' % (int(m.group('index')), L)
self.getTransistor(i).L = L
continue
m = reSpecW.match( line[:-1] )
if m:
i = int (m.group('index'))
W = float(m.group('float'))
#print ' %d:W: %g' % (int(m.group('index')), W)
self.getTransistor(i).W = W
continue
m = reSpecM.match( line[:-1] )
if m:
i = int(m.group('index'))
M = int(m.group('int' ))
#print ' %d:M: %d' % (int(m.group('index')), M)
self.getTransistor(i).M = M
self.getTransistor(i).W = M * self.getTransistor(i).W
m = reSpecCapa.match( line[:-1] )
if m:
self.addCapacitor( m.group('name'), float(m.group('value')) )
m = reSpecResis.match( line[:-1] )
if m:
self.addResistor( m.group('name'), float(m.group('value')) )
Analog integration part II. Analog place & route (slicing tree). * Change: In Hurricane::CellWidget, set the minimal size to 350 pixels to fit my normal DPI secondary screen... * Change: In Hurricane::Error(), reactivate the backtrace generation by default. Seriously slow down the program each time an Error is to be constructed. * Bug: In Analog::Device::preCreate(), check for NULL Technology before attempting to use it. * Change: In Hurricane/Analog, remove all '*Arguments*' classes and their Python interface. It was an obsoleted way of passing devices parameters to the Python layout generators (located in Oroshi). Now we just get them straight from the Device with the getParamter() method. * Change: In CRL::System CTOR, add Python pathes for Oroshi & Karakaze. * Change: In Oroshi/Python/WIP_*.py layout generator scripts, remove all uses of the "Arguments". Directly access the parameters through the device itself. Make the checkCoherency() with identical arguments as of layout(). * New: Bora tool that performs analog place & route. Based on a slicing tree representation. It is the thesis work of Eric Lao. Code beautyfication and some programming cleanup. * New: Karakaze tool, provide the Python base class AnalogDesign used to build an analog design. Create/configure devices and assemble them in a slicing tree. * Change: In Unicorn/cgt.py, display the stack trace in case of an ImportError exception as well as for other exceptions. Add Bora to the set for included tool engines.
2018-10-18 11:10:01 -05:00
fd.close()