Merge branch 'devel' of gitlab.lip6.fr:vlsi-eda/coriolis into devel

This commit is contained in:
HoangAnhP 2022-07-13 12:30:33 +02:00
commit 78401f5129
16 changed files with 344 additions and 304 deletions

View File

@ -852,8 +852,8 @@ namespace Hurricane {
QPrinter printer ( QPrinter::ScreenResolution );
printer.setOutputFileName ( "unicorn-snapshot.pdf" );
printer.setPaperSize ( (QPrinter::PaperSize )Cfg::getParamEnumerate("viewer.printer.paper" ,0)->asInt() );
printer.setOrientation( (QPrinter::Orientation)Cfg::getParamEnumerate("viewer.printer.orientation",0)->asInt() );
printer.setPageSize ( (QPrinter::PaperSize )Cfg::getParamEnumerate("viewer.printer.paper" ,0)->asInt() );
printer.setPageOrientation( (QPageLayout::Orientation)Cfg::getParamEnumerate("viewer.printer.orientation",0)->asInt() );
QPrintDialog dialog ( &printer );
if ( dialog.exec() == QDialog::Accepted )

View File

@ -921,16 +921,19 @@ namespace Hurricane {
{ clear (); }
SelectorCriterion* CellWidget::SelectorCriterions::add ( const Net* net )
SelectorCriterion* CellWidget::SelectorCriterions::add ( Occurrence hyperNetOcc )
{
if ( _cellWidget == NULL ) return NULL;
if ( not _cellWidget->isSelected(Occurrence(net)) ) {
_criterions.push_back ( new NetSelectorCriterion(net) );
if (_cellWidget == NULL) return NULL;
if (not _cellWidget->isSelected(hyperNetOcc)) {
_criterions.push_back ( new NetSelectorCriterion(hyperNetOcc) );
//_criterions.back()->doSelection ( _cellWidget );
return _criterions.back();
}
for ( size_t i=0 ; i<_criterions.size() ; ++i ) {
if ( _criterions[i]->getNet() == net ) return _criterions[i];
if (not _criterions[i]->getNetOccurrence().getEntity())
continue;
if (_criterions[i]->getNetOccurrence() == hyperNetOcc)
return _criterions[i];
}
return NULL;
}
@ -949,19 +952,19 @@ namespace Hurricane {
}
bool CellWidget::SelectorCriterions::remove ( const Net* net )
bool CellWidget::SelectorCriterions::remove ( Occurrence netOccurrence )
{
if ( _cellWidget == NULL ) return false;
if ( not _cellWidget->isSelected(Occurrence(net)) ) return false;
if (not _cellWidget) return false;
if (not _cellWidget->isSelected(netOccurrence)) return false;
size_t i=0;
for ( ; i<_criterions.size() ; i++ )
if ( _criterions[i]->getNet() == net ) break;
if (_criterions[i]->getNetOccurrence() == netOccurrence) break;
if ( i < _criterions.size() ) {
swap ( _criterions[i], *(_criterions.end()-1) );
if (i < _criterions.size()) {
swap( _criterions[i], *(_criterions.end()-1) );
//_criterions.back()->undoSelection ( _cellWidget );
_criterions.pop_back ();
_criterions.pop_back();
} else
return false;
@ -1700,7 +1703,7 @@ namespace Hurricane {
if ( flags & BigFont ) font.setPointSize ( Graphics::isHighDpi() ? 7 : 18 );
QFontMetrics metrics = QFontMetrics(font);
int width = metrics.width ( text );
int width = metrics.horizontalAdvance( text );
//int height = metrics.height ();
int angle = 0;
@ -1857,7 +1860,7 @@ namespace Hurricane {
, std::max( 1.0
, std::floor( std::log10( longerSide / _snapGridStep() ))));
DbU::Unit gridStep = ((symbolicMode()) ? 1 : 10) * _snapGridStep();
//DbU::Unit gridStep = ((symbolicMode()) ? 1 : 10) * _snapGridStep();
DbU::Unit superGridStep = _snapGridStep() * scale;
DbU::Unit xGrid;
DbU::Unit yGrid;
@ -1940,7 +1943,7 @@ namespace Hurricane {
{
QFont font = Graphics::getNormalFont();
QFontMetrics metrics = QFontMetrics(font);
int tickLength = metrics.width ( "+00000u" );
int tickLength = metrics.horizontalAdvance( "+00000u" );
Point origin = ruler->getOrigin ();
Point extremity = ruler->getExtremity ();
Point angle = ruler->getAngle ();
@ -2622,23 +2625,23 @@ namespace Hurricane {
bool CellWidget::isSelected ( Occurrence occurrence )
{
if ( !occurrence.isValid() )
throw Error ( "Can't select occurrence : invalid occurrence" );
if (not occurrence.isValid())
throw Error( "Can't select occurrence : invalid occurrence" );
if ( occurrence.getOwnerCell() != getCell() ) {
string s1 = Graphics::toHtml ( getString(getCell()) );
string s2 = Graphics::toHtml ( getString(occurrence.getOwnerCell()) );
throw Error ( "Can't select occurrence : incompatible occurrence %s vs. %s"
, s1.c_str(), s2.c_str() );
if (occurrence.getOwnerCell() != getCell()) {
string s1 = Graphics::toHtml( getString(getCell()) );
string s2 = Graphics::toHtml( getString(occurrence.getOwnerCell()) );
throw Error( "Can't select occurrence : incompatible occurrence %s vs. %s"
, s1.c_str(), s2.c_str() );
}
Property* property = occurrence.getProperty ( Selector::getPropertyName() );
if ( !property )
Property* property = occurrence.getProperty( Selector::getPropertyName() );
if (not property)
return false;
Selector* selector = dynamic_cast<Selector*>(property);
if ( !selector )
throw Error ( "Abnormal property named " + getString(Selector::getPropertyName()) );
throw Error( "Abnormal property named " + getString(Selector::getPropertyName()) );
return selector->isAttachedTo(this);
}
@ -2687,34 +2690,38 @@ namespace Hurricane {
void CellWidget::select ( Occurrence occurrence )
{
if ( (++_delaySelectionChanged == 1) and not _state->cumulativeSelection() ) {
openRefreshSession ();
unselectAll ();
closeRefreshSession ();
openRefreshSession();
unselectAll();
closeRefreshSession();
}
if (not occurrence.isValid())
throw Error ( "Can't select occurrence : invalid occurrence" );
throw Error( "Can't select occurrence : invalid occurrence" );
if (occurrence.getOwnerCell() != getCell()) {
string s1 = Graphics::toHtml( getString(getCell()) );
string s2 = Graphics::toHtml( getString(occurrence.getOwnerCell()) );
throw Error ( "Can't select occurrence : incompatible occurrence %s vs. %s"
, s1.c_str(), s2.c_str() );
throw Error( "Can't select occurrence : incompatible occurrence %s vs. %s"
, s1.c_str(), s2.c_str() );
}
bool selected = true;
const Net* net = dynamic_cast<const Net*>( occurrence.getEntity() );
if ( net ) {
SelectorCriterion* criterion = _state->getSelection().add( net );
if (net) {
SelectorCriterion* criterion = _state->getSelection().add( occurrence );
if ( criterion and (not criterion->isEnabled()) ) {
criterion->enable();
for ( Component* component : net->getComponents() ) {
Occurrence occurrence ( component );
select( occurrence );
}
for ( Rubber* rubber : net->getRubbers() ) {
Occurrence occurrence ( rubber );
select( occurrence );
HyperNet hyperNet ( occurrence );
for ( Occurrence netOcc : hyperNet.getNetOccurrences() ) {
Net* subNet = static_cast<Net*>( netOcc.getEntity() );
for ( Component* component : subNet->getComponents() ) {
Occurrence occurrence ( component, netOcc.getPath() );
select( occurrence );
}
for ( Rubber* rubber : subNet->getRubbers() ) {
Occurrence occurrence ( rubber, netOcc.getPath() );
select( occurrence );
}
}
} else
selected = false;
@ -2753,29 +2760,29 @@ namespace Hurricane {
void CellWidget::unselect ( Occurrence occurrence )
{
if ( not occurrence.isValid() )
if (not occurrence.isValid())
throw Error ( "Can't unselect occurrence : invalid occurrence" );
if ( occurrence.getOwnerCell() != getCell() )
if (occurrence.getOwnerCell() != getCell())
throw Error ( "Can't unselect occurrence : incompatible occurrence" );
bool unselected = true;
const Net* net = dynamic_cast<const Net*>(occurrence.getEntity());
if ( net ) {
unselected = _state->getSelection().remove ( net );
if (net) {
unselected = _state->getSelection().remove( occurrence );
}
Property* property = occurrence.getProperty ( Selector::getPropertyName() );
if ( property ) {
Selector* selector = dynamic_cast<Selector*>(property);
if ( not selector )
throw Error ( "Abnormal property named " + getString(Selector::getPropertyName()) );
Property* property = occurrence.getProperty( Selector::getPropertyName() );
if (property) {
Selector* selector = dynamic_cast<Selector*>( property );
if (not selector)
throw Error( "Abnormal property named " + getString(Selector::getPropertyName()) );
selector->detachFrom(this);
selector->detachFrom( this );
}
_selectionHasChanged = true;
if ( (_delaySelectionChanged == 0) and unselected ) emit selectionChanged(_selectors);
if ( (_delaySelectionChanged == 0) and unselected ) emit selectionChanged( _selectors );
}

View File

@ -132,20 +132,18 @@ namespace Hurricane {
for ( ; _primaryLoc->isValid() ; _primaryLoc->progress() ) {
Occurrence element = _primaryLoc->getElement();
Component* component = dynamic_cast<Component*>(element.getEntity());
if ( not component ) continue;
Component* component = dynamic_cast<Component*>( element.getEntity() );
if (not component) continue;
Net* net = component->getNet();
Occurrence netOccurrence ( net, element.getPath() );
if ( _hideAnonymous
and QString(getString(net->getName()).c_str()).contains("onymous") )
if (_hideAnonymous and QString(getString(net->getName()).c_str()).contains("onymous") )
continue;
_element = getHyperNetRootNetOccurrence ( netOccurrence );
if ( _netOccurrences.find(_element) != _netOccurrences.end() ) continue;
_netOccurrences.insert ( _element );
_element = getHyperNetRootNetOccurrence( netOccurrence );
if (_netOccurrences.find(_element) != _netOccurrences.end()) continue;
_netOccurrences.insert( _element );
break;
}

View File

@ -29,8 +29,8 @@ namespace Hurricane {
{ }
const Net* SelectorCriterion::getNet () const
{ return NULL; }
Occurrence SelectorCriterion::getNetOccurrence () const
{ return Occurrence(); }
const Box& SelectorCriterion::getArea () const
@ -45,9 +45,8 @@ namespace Hurricane {
// Class : "Hurricane::NetSelectorCriterion".
NetSelectorCriterion::NetSelectorCriterion ( const Net* net )
: _net (net)
, _name(_net->getName())
NetSelectorCriterion::NetSelectorCriterion ( Occurrence netOccurrence )
: _netOccurrence(netOccurrence)
{ }
@ -56,27 +55,26 @@ namespace Hurricane {
NetSelectorCriterion* NetSelectorCriterion::clone () const
{ return new NetSelectorCriterion(_net); }
{ return new NetSelectorCriterion(_netOccurrence); }
const Net* NetSelectorCriterion::getNet () const
{ return _net; }
Occurrence NetSelectorCriterion::getNetOccurrence () const
{ return _netOccurrence; }
bool NetSelectorCriterion::isValid ( CellWidget* cw ) const
{
if ( cw->getCell() == NULL ) return false;
if ( not cw->getCell()->getNet(_name) ) return false;
return true;
if (cw->getCell() == NULL) return false;
return _netOccurrence.isValid();
}
void NetSelectorCriterion::doSelection ( CellWidget* cw )
{ cw->select ( Occurrence(_net) ); }
{ cw->select( _netOccurrence ); }
void NetSelectorCriterion::undoSelection ( CellWidget* cw )
{ cw->unselect ( Occurrence(_net) ); }
{ cw->unselect( _netOccurrence ); }
string NetSelectorCriterion::_getTypeName () const
@ -85,7 +83,7 @@ namespace Hurricane {
string NetSelectorCriterion::_getString () const
{
string s = "<" + _getTypeName() + " " + getString(_net) + ">";
string s = "<" + _getTypeName() + " " + getString(_netOccurrence) + ">";
return s;
}
@ -93,7 +91,7 @@ namespace Hurricane {
Record* NetSelectorCriterion::_getRecord () const
{
Record* record = new Record ( _getString() );
record->add ( getSlot("_net",_net) );
record->add ( getSlot("_netOccurrence",&_netOccurrence) );
return record;
}

View File

@ -52,8 +52,8 @@ namespace Hurricane {
void ZoomCommand::wheelEvent ( QWheelEvent* event )
{
if ( event->delta() > 0 ) _cellWidget->setScale ( _cellWidget->getScale()/1.2 );
else if ( event->delta() < 0 ) _cellWidget->setScale ( _cellWidget->getScale()*1.2 );
if (event->delta() > 0) _cellWidget->setScale ( _cellWidget->getScale()/1.2 );
else if (event->delta() < 0) _cellWidget->setScale ( _cellWidget->getScale()*1.2 );
event->accept ();
}

View File

@ -536,10 +536,10 @@ namespace Hurricane {
~SelectorCriterions ();
inline void setCellWidget ( CellWidget* );
inline const vector<SelectorCriterion*>& getCriterions () const;
SelectorCriterion* add ( const Net* net );
SelectorCriterion* add ( Occurrence netOccurrence );
SelectorCriterion* add ( Box area );
inline SelectorCriterion* add ( SelectorCriterion* );
bool remove ( const Net* net );
bool remove ( Occurrence netOccurrence );
void clear ();
void invalidate ();
void revalidate ();

View File

@ -14,9 +14,7 @@
// +-----------------------------------------------------------------+
#ifndef HURRICANE_SELECTOR_CRITERION_H
#define HURRICANE_SELECTOR_CRITERION_H
#pragma once
#include <string>
#include "hurricane/Commons.h"
#include "hurricane/Name.h"
@ -35,7 +33,7 @@ namespace Hurricane {
virtual SelectorCriterion* clone () const = 0;
virtual bool isValid ( CellWidget* ) const = 0;
inline bool isEnabled () const;
virtual const Net* getNet () const;
virtual Occurrence getNetOccurrence () const;
virtual const Box& getArea () const;
inline void enable ();
inline void disable ();
@ -57,19 +55,18 @@ namespace Hurricane {
class NetSelectorCriterion : public SelectorCriterion {
public:
NetSelectorCriterion ( const Net* );
virtual ~NetSelectorCriterion ();
virtual NetSelectorCriterion* clone () const;
virtual const Net* getNet () const;
virtual bool isValid ( CellWidget* ) const;
virtual void doSelection ( CellWidget* );
virtual void undoSelection ( CellWidget* );
virtual Record* _getRecord () const;
virtual string _getString () const;
virtual string _getTypeName () const;
NetSelectorCriterion ( Occurrence netOccurrence );
virtual ~NetSelectorCriterion ();
virtual NetSelectorCriterion* clone () const;
virtual Occurrence getNetOccurrence () const;
virtual bool isValid ( CellWidget* ) const;
virtual void doSelection ( CellWidget* );
virtual void undoSelection ( CellWidget* );
virtual Record* _getRecord () const;
virtual string _getString () const;
virtual string _getTypeName () const;
protected:
const Net* _net;
const Name _name;
const Occurrence _netOccurrence;
};
@ -93,5 +90,3 @@ namespace Hurricane {
INSPECTOR_P_SUPPORT(Hurricane::SelectorCriterion);
#endif // HURRICANE_SELECTOR_CRITERION_H

View File

@ -74,7 +74,7 @@ class CapacitorStack( CapacitorUnit ):
if unitCap == 0:
self.__initGivenZeroUnitCap__( capacitance[0] )
elif unitCap <> 0 and CapacitorUnit.__isCapacitorUnitOK__( self, self.unitCapDim ):
elif unitCap != 0 and CapacitorUnit.__isCapacitorUnitOK__( self, self.unitCapDim ):
self.__initGivenNonZeroUnitCap__( capacitance[0], unitCap )
else:
raise Error( 1, [ 'CapacitorStack.__init__(): Impossible to draw the unit capacitor, dimensions are either too large or too small.'
@ -85,7 +85,7 @@ class CapacitorStack( CapacitorUnit ):
if unitCap == 0:
self.__initGivenZeroUnitCapInMatchingMode__( capacitance )
elif unitCap <> 0 and CapacitorUnit.__isCapacitorUnitOK__( self, self.unitCapDim ):
elif unitCap != 0 and CapacitorUnit.__isCapacitorUnitOK__( self, self.unitCapDim ):
self.__initGivenNonZeroUnitCapInMatchingMode__( capacitance, unitCap )
else:
raise Error( 1, [ 'CapacitorStack.__init__(): Impossible to draw the unit capacitor, dimensions are either too large or too small.'
@ -166,13 +166,13 @@ class CapacitorStack( CapacitorUnit ):
if self.matrixDim.values()[0]*self.matrixDim.values()[1] == capacitance/unitCap :
self.__initMatrixMode__( capacitance, unitCap )
else : raise Error( 1, '__init__() : Matrix dimensions and unit capacitance are not compatible : "capacitance %d divides by unit capacitance %s <> columns %d * rows %d ".' %( capacitance, unitCap, self.matrixDim["columns"], self.matrixDim["rows"] ) )
else : raise Error( 1, '__init__() : Matrix dimensions and unit capacitance are not compatible : "capacitance %d divides by unit capacitance %s != columns %d * rows %d ".' %( capacitance, unitCap, self.matrixDim["columns"], self.matrixDim["rows"] ) )
else : # self.matrixDim.values() == [1,1] : # jai donne ou jai ps donne
if capacitance == unitCap : #compact
[ self.capacitance , self.unitCapDim ] = [ capacitance , self.compactCapDim ]
elif capacitance <> unitCap : #matrice
elif capacitance != unitCap : #matrice
self.__initMatrixMode__( capacitance, unitCap )
self.matrixDim = {"columns" : int(sqrt(capacitance/unitCap)), "rows" : int(sqrt(capacitance/unitCap)) } # ici mettre toutes les combi si matching mode = [] sinon utiliser la meme combi que matching scheme
@ -230,8 +230,7 @@ class CapacitorStack( CapacitorUnit ):
def __areMatrixDimOK__( self ): return True if self.matrixDim.values() > 0 else False
def __areMatrixDimOK__( self ): return True if len(self.matrixDim.values()) else False
def computeUnitCap( self, capacitance ):
@ -307,13 +306,13 @@ class CapacitorStack( CapacitorUnit ):
if self.matchingMode in [False, True] and self.dummyRing in [False,True] and self.dummyElement in [False,True]:
[ matchingSchemeCapIds , capacitanceIds ] = [ list( numpy.unique(self.matchingScheme) ) , range(0,self.capacitorsNumber) ]
if (self.matchingScheme != [] and set(matchingSchemeCapIds) == set(capacitanceIds) ) or (self.matchingScheme == [] and len(capacitance) == 1) :
if (len(self.matchingScheme) and set(matchingSchemeCapIds) == set(capacitanceIds) ) or (len(self.matchingScheme) == 0 and len(capacitance) == 1) :
if (len(self.nets) == self.capacitorsNumber + 1 and self.dummyElement == False and self.dummyRing == True ) \
or (len(self.nets) == self.capacitorsNumber and self.dummyElement == False and self.dummyRing == False) \
or (len(self.nets) == self.capacitorsNumber and self.dummyElement == True and self.dummyRing == True ) \
or (len(self.nets) == self.capacitorsNumber and self.dummyElement == True and self.dummyRing == False):
if ( self.matchingMode == True and self.__isMatchingSchemeOK__() ) or ( self.matchingMode == False and self.matchingScheme == [] ):
if ( self.matchingMode == True and self.__isMatchingSchemeOK__() ) or ( self.matchingMode == False and len(self.matchingScheme) == 0 ):
state = True
else: raise Error(1, '__areInputDataOK__(): Please check compatibility of the entered parameters (Matching mode, matching scheme, capacitance). It must be either equal to (False, [], one capacitance value) or ( True, matching scheme, capacitance values as much as there are capacitor ids in matching scheme ). The entered parameters are (%s, %s, %s).' %(self.matchingMode, self.matchingScheme, capacitance) ) #com2 : tester
@ -559,7 +558,7 @@ class CapacitorStack( CapacitorUnit ):
def scriptMain( **kw ):
editor = None
if kw.has_key('editor') and kw['editor']:
if 'editor' in kw and kw['editor']:
editor = kw['editor']
UpdateSession.open()

View File

@ -29,7 +29,7 @@ helpers.staticInitialization( True )
# An elementary capacitor unit can be a part of C1 or C2 according to the matching scheme. However, to respect common-centroid layout specifications, for C1 and C2 to be equal, the matrix number of colums and number of rows must be both even. Addionnally, the number of elementary capacitors dedicated to C1 must be equal to those dedicated to C2. These two conditions are tested in one of the class methods. An exception is raised if at least one of the two is not respected.
class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks ):
class RoutMatchedCapacitor( VerticalRoutingTracks ):
rules = oroshi.getRules()
@ -152,34 +152,37 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
trace( 101, '\tminimum before adjust: {0}\n'.format( DbU.getValueString(self.minimumPosition) ))
trace( 101, '\tdY: {0}\n'.format( DbU.getValueString(dY) ))
firstVRTId = "t0"
lastVRTId = self.vRoutingTrackXCenter[-1].keys()[-1]
firstVRTId = 't0'
lastVRTId = list(self.vRoutingTrackXCenter[-1].keys())[-1]
firstIndex = int(firstVRTId[1])
lastIndex = int( lastVRTId[1])
print( lastVRTId )
if self.dummyRing:
xMin = self.abutmentBox.getXMin()
xMax = self.abutmentBox.getXMax()
else:
trackSpacing = (self.vRoutingTrack_width + self.vpitch + self.metal3Width)/2
if firstVRTId > len(self.vRoutingTrackXCenter[ 0]):
if firstIndex > len(self.vRoutingTrackXCenter[0]):
xMin = self.abutmentBox.getXMin() - trackSpacing
else:
xMin = self.vRoutingTrackXCenter[ 0][firstVRTId] - trackSpacing
xMin = self.vRoutingTrackXCenter[0][firstVRTId] - trackSpacing
if lastVRTId > len(self.vRoutingTrackXCenter[-1]):
if lastIndex > len(self.vRoutingTrackXCenter[-1]):
xMax = self.abutmentBox.getXMax() + trackSpacing
else:
xMax = self.vRoutingTrackXCenter[-1][ lastVRTId] + trackSpacing
xMax = self.vRoutingTrackXCenter[-1][lastVRTId] + trackSpacing
width = xMax - xMin
widthAdjust = width % (2*self.vpitch)
if widthAdjust:
widthAdjust = 2*self.vpitch - widthAdjust
xMax += widthAdjust/2
xMin -= widthAdjust/2
xMax += widthAdjust//2
xMin -= widthAdjust//2
self.device.setAbutmentBox( Box( xMin
, self.minimumPosition - dY
, xMax
, self.maximumPosition + dY ) )
self.device.setAbutmentBox( Box( int(xMin)
, int(self.minimumPosition - dY)
, int(xMax)
, int(self.maximumPosition + dY )) )
trace( 101, '\tHeight after tracks enclosure: {0}\n'.format( DbU.getValueString(self.device.getAbutmentBox().getHeight()) ))
if not bbMode :
@ -503,7 +506,7 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
def drawHRoutingTracks( self , routingTracksLayer ):
lastVRTId = self.vRoutingTrackXCenter[-1].keys()[-1]
lastVRTId = list(self.vRoutingTrackXCenter[-1].keys())[-1]
firstVRTId = "t0"
#doDummyRing = 1 if self.dummyRing == True else 0
#dxSource = self.vRoutingTrackXCenter[0][firstVRTId] - self.vRoutingTrack_width/2 if not self.dummyRing else self.abutmentBox.getXMin()
@ -519,10 +522,10 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
horizontal = Horizontal.create( net
, routingTracksLayer
, self.hRoutingtrackYCenter[i][j]
, self.hRoutingTrack_width
, dxSource
, dxTarget )
, int(self.hRoutingtrackYCenter[i][j])
, int(self.hRoutingTrack_width)
, int(dxSource)
, int(dxTarget) )
NetExternalComponents.setExternal( horizontal )
return
@ -537,8 +540,18 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
[ t , b ] = [ self.nets[self.matchingScheme[i][j]][0], self.nets[self.matchingScheme[i][j]][1] ]
dxDict = self.__computeConnections__( i,j, self.matchingScheme[i][j] )
Horizontal.create ( t, xPlateRLayer , self.hRoutingLayerYCenter["topPlate" ][i][j] , self.hRoutingLayer_width , dxDict["topPlate" ][ "source" ] , dxDict["topPlate" ][ "target" ] )
Horizontal.create ( b, xPlateRLayer , self.hRoutingLayerYCenter["bottomPlate"][i][j] , self.hRoutingLayer_width , dxDict["bottomPlate" ][ "source" ] , dxDict["bottomPlate" ][ "target" ] )
Horizontal.create ( t
, xPlateRLayer
, int(self.hRoutingLayerYCenter["topPlate" ][i][j])
, int(self.hRoutingLayer_width)
, int(dxDict["topPlate" ][ "source" ])
, int(dxDict["topPlate" ][ "target" ]) )
Horizontal.create ( b
, xPlateRLayer
, int(self.hRoutingLayerYCenter["bottomPlate"][i][j])
, int(self.hRoutingLayer_width)
, int(dxDict["bottomPlate" ][ "source" ])
, int(dxDict["bottomPlate" ][ "target" ]) )
return
@ -570,12 +583,12 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
for j in range( 0, self.matrixDim["columns"] ):
if ( j % 2 == 0 ):
leftVRTIds = self.capacitorIds[0:self.capacitorsNumber/2] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0: int(self.capacitorsNumber/2+1)]
rightVRTIds = self.capacitorIds[self.capacitorsNumber/2 : self.capacitorsNumber] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber/2+1) : self.capacitorsNumber]
leftVRTIds = self.capacitorIds[0:self.capacitorsNumber//2] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0: int(self.capacitorsNumber//2+1)]
rightVRTIds = self.capacitorIds[self.capacitorsNumber//2 : self.capacitorsNumber] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber//2+1) : self.capacitorsNumber]
else:
leftVRTIds = self.capacitorIds[self.capacitorsNumber/2 : self.capacitorsNumber] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber/2+1) : self.capacitorsNumber]
rightVRTIds = self.capacitorIds[0:self.capacitorsNumber/2] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0: int(self.capacitorsNumber/2+1)]
leftVRTIds = self.capacitorIds[self.capacitorsNumber//2 : self.capacitorsNumber] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber//2+1) : self.capacitorsNumber]
rightVRTIds = self.capacitorIds[0:self.capacitorsNumber//2] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0: int(self.capacitorsNumber//2+1)]
index1 = j if self.matchingScheme[i][j] in leftVRTIds else j+1
@ -605,7 +618,7 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
## Draws cuts to connect vertical routing tracks in metal 2 and horizontal routing tracks in metal 3.
def drawCuts_vRoutingTrack_hRoutingTrack( self,cutLayer, cutNumber, enclosure_cut ):
keysList = self.hRoutingtrackYCenter.keys()
keysList = list(self.hRoutingtrackYCenter.keys())
for i in range(0, len(self.vRoutingTrackXCenter) ):
for k in self.vRoutingTrackXCenter[i]:
@ -698,10 +711,10 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
Vertical.create( net
, routingLayer
, topPlateRLayerXCenter
, topPlateRLayer_width
, dySource
, dyTarget )
, int(topPlateRLayerXCenter)
, int(topPlateRLayer_width)
, int(dySource)
, int(dyTarget) )
return
@ -731,12 +744,12 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
dxDict = { "bottomPlate": {}, "topPlate": {} }
if ( j % 2 == 0 ):
leftVRTIds = self.capacitorIds[0 :self.capacitorsNumber/2 ] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0 : int(self.capacitorsNumber/2+1)]
rightVRTIds = self.capacitorIds[self.capacitorsNumber/2 : self.capacitorsNumber ] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber/2+1) : self.capacitorsNumber ]
leftVRTIds = self.capacitorIds[0 :self.capacitorsNumber//2] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0 : int(self.capacitorsNumber/2+1)]
rightVRTIds = self.capacitorIds[self.capacitorsNumber//2 : self.capacitorsNumber ] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber//2+1) : self.capacitorsNumber ]
else:
leftVRTIds = self.capacitorIds[self.capacitorsNumber/2 : self.capacitorsNumber ] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber/2+1) : self.capacitorsNumber ]
rightVRTIds = self.capacitorIds[0 : self.capacitorsNumber/2 ] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0 : int(self.capacitorsNumber/2+1)]
leftVRTIds = self.capacitorIds[self.capacitorsNumber//2 : self.capacitorsNumber ] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber//2+1) : self.capacitorsNumber ]
rightVRTIds = self.capacitorIds[0 : self.capacitorsNumber//2 ] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0 : int(self.capacitorsNumber//2+1)]
[topPlateLabel, bottomPlateLabel ] = [self.__setPlatesLabels__(i,j)["t"] , self.__setPlatesLabels__(i,j)["b"]]
@ -830,7 +843,7 @@ class RoutMatchedCapacitor( CapacitorUnit, CapacitorStack, VerticalRoutingTracks
def scriptMain( **kw ):
editor = None
if kw.has_key('editor') and kw['editor']:
if 'editor' in kw and kw['editor']:
editor = kw['editor']
UpdateSession.open()

View File

@ -680,7 +680,7 @@ class RouteCapacitorSingle ( CapacitorUnit ):
def scriptMain( **kw ):
editor = None
if kw.has_key('editor') and kw['editor']:
if 'editor' in kw and kw['editor']:
editor = kw['editor']
UpdateSession.open()

View File

@ -95,16 +95,16 @@ class CapacitorUnit():
def __initCapDim__( self, capacitance, capDim ):
if capacitance != 0 and capDim.values() != []:
if capacitance != 0 and len(capDim.values()):
if self.__computeCapacitance__( capDim, self.capacitorType ) == capacitance :
self.capDim = capDim
else:
raise Error( 1, [ 'CapacitorUnit.__initCapDim__(): Please check compatibility between capacitance value {0},'.format(capacitance)
, 'and the given capacitor dimensions {0}.'.format(capDim) ] )
elif capacitance == 0 and capDim.values() != []:
elif capacitance == 0 and len(capDim.values()):
self.capDim = capDim
capacitance = self.__computeCapacitance__( capDim, self.capacitorType )
elif capacitance != 0 and capDim.values() == [] :
elif capacitance != 0 and len(capDim.values()) == 0 :
self.capDim = self.__computeCapDim__( capacitance, self.capacitorType )
else:
raise Error( 1, [ 'CapacitorUnit.__initCapDim__(): Invalid capacitance and/or capacitance dimensions {0}, {1}.'.format(capacitance, capDim)
@ -161,12 +161,10 @@ class CapacitorUnit():
def __computeCapacitance__( self, capDim, capacitorType ):
[ areaCapacitorPerUnit, perimeterCapacitorPerUnit ] = self.__setCapacitorPerUnit__( capacitorType )
areaCapacitance = toPhY(capDim["width"]) * toPhY(capDim["height"]) *areaCapacitorPerUnit
perimeterCapacitance = ( toPhY(capDim["width"]) + toPhY(capDim["height"]) )*perimeterCapacitorPerUnit
capacitance = areaCapacitance + perimeterCapacitance
return capacitance
@ -678,19 +676,19 @@ class CapacitorUnit():
def drawRoutingLayers( self, bottomPlateLayer, topPlateLayer, t, b ):
Vertical.create ( t, topPlateLayer
, self.topPlateRLayerDict["XCenter"]
, self.topPlateRLayerDict["width" ]
, self.topPlateRLayerDict["YMin" ]
, self.topPlateRLayerDict["YMax" ]
, int(self.topPlateRLayerDict["XCenter"])
, int(self.topPlateRLayerDict["width" ])
, int(self.topPlateRLayerDict["YMin" ])
, int(self.topPlateRLayerDict["YMax" ])
)
cutLinesXMins = [ self.cutLeftLineDict["XMin"], self.cutRightLineDict["XMin"] ]
for i in range(2):
Vertical.create ( b, bottomPlateLayer
, cutLinesXMins[i]
, self.bottomPlateRLayerDict["width"]
, self.bottomPlateRLayerDict["YMin" ]
, self.bottomPlateRLayerDict["YMax" ]
, int(cutLinesXMins[i])
, int(self.bottomPlateRLayerDict["width"])
, int(self.bottomPlateRLayerDict["YMin" ])
, int(self.bottomPlateRLayerDict["YMax" ])
)
return
@ -711,8 +709,18 @@ class CapacitorUnit():
def cutLine( self, net, layer, firstCutXCenter, firstCutYCenter, width_cut, height_cut, spacing_cut, cutNumber, direction ):
for i in range( cutNumber) :
segment = Contact.create( net, layer, firstCutXCenter + i*(width_cut + spacing_cut), firstCutYCenter, width_cut, height_cut ) if direction == 'horizontal' else Contact.create( net, layer, firstCutXCenter, firstCutYCenter + i*(height_cut + spacing_cut), width_cut, height_cut )
if direction == 'horizontal':
segment = Contact.create( net, layer
, int(firstCutXCenter + i*(width_cut + spacing_cut))
, int(firstCutYCenter)
, width_cut
, height_cut )
else:
segment = Contact.create( net
, layer, int(firstCutXCenter)
, int(firstCutYCenter + i*(height_cut + spacing_cut))
, width_cut
, height_cut )
return segment
@ -829,7 +837,7 @@ class CapacitorUnit():
def scriptMain( **kw ):
editor = None
if kw.has_key('editor') and kw['editor']:
if 'editor' in kw and kw['editor']:
editor = kw['editor']
UpdateSession.open()

View File

@ -38,7 +38,7 @@ import numpy
# is not respected.
class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
class VerticalRoutingTracks ( CapacitorStack ):
rules = oroshi.getRules()
@ -128,10 +128,10 @@ class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
if self.vRoutingTrackXCenter[j][key] is not None:
Vertical.create( netsDistribution[j][k]
, vRoutingTracksLayer
, self.vRoutingTrackXCenter[j][key]
, self.vRoutingTrack_width
, self.getVTrackYMin()
, self.getVTrackYMax() )
, int(self.vRoutingTrackXCenter[j][key])
, int(self.vRoutingTrack_width)
, int(self.getVTrackYMin())
, int(self.getVTrackYMax() ))
k = k + 1 if k < len(key)-1 else 0
return
@ -265,18 +265,18 @@ class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
capIdsToEliminate = []
capIdsj = capIdsToEliminatePerColumn[0]
#print('capIdsj',capIdsj)
sharedVRTIds = self.capacitorIds[0:self.capacitorsNumber/2] if self.capacitorsNumber % 2 == 0 else self.capacitorIds[0: int(self.capacitorsNumber/2+1)]
sharedVRTIds = self.capacitorIds[0:self.capacitorsNumber//2] if self.capacitorsNumber % 2 == 0 else self.capacitorIds[0: int(self.capacitorsNumber//2+1)]
#print('sharedVRTIds',sharedVRTIds)
intersection2 = list( set(capIdsj).intersection(set(sharedVRTIds)) )
capIdsToEliminate.append( [None] ) if intersection2 == [] else capIdsToEliminate.append( intersection2 )
capIdsToEliminate.append( [None] ) if len(intersection2) == 0 else capIdsToEliminate.append( intersection2 )
for j in range(0, len(capIdsToEliminatePerColumn) ):
capIdsj = capIdsToEliminatePerColumn[j]
if (j % 2 == 0):
sharedVRTIds = self.capacitorIds[self.capacitorsNumber/2 : self.capacitorsNumber] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber/2+1) : self.capacitorsNumber]
sharedVRTIds = self.capacitorIds[self.capacitorsNumber//2 : self.capacitorsNumber] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[int(self.capacitorsNumber//2+1) : self.capacitorsNumber]
else:
sharedVRTIds = self.capacitorIds[0:self.capacitorsNumber/2] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0: int(self.capacitorsNumber/2+1)]
sharedVRTIds = self.capacitorIds[0:self.capacitorsNumber//2] if (self.capacitorsNumber % 2 == 0) else self.capacitorIds[0: int(self.capacitorsNumber//2+1)]
#print('sharedVRTIds',sharedVRTIds)
@ -287,7 +287,7 @@ class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
intersection1 = list( set(capIdsj).intersection(set(capIdsjp1)) )
intersection2 = list( set(intersection1).intersection(set(sharedVRTIds)) )
capIdsToEliminate.append( [None] ) if intersection2 == [] else capIdsToEliminate.append( intersection2 )
capIdsToEliminate.append( [None] ) if len(intersection2) == 0 else capIdsToEliminate.append( intersection2 )
return capIdsToEliminate
@ -347,8 +347,12 @@ class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
def __setVRTsDistribution__( self ):
element = [ self.capacitorIds[0:self.capacitorsNumber/2], self.capacitorIds[self.capacitorsNumber/2:self.capacitorsNumber] ] if self.capacitorsNumber % 2 == 0 else [ self.capacitorIds[0:int( self.capacitorsNumber/2 + 1 )], self.capacitorIds[int( self.capacitorsNumber/2 + 1 ):self.capacitorsNumber] ]
if self.capacitorsNumber % 2 == 0:
element = [ self.capacitorIds[0:self.capacitorsNumber//2]
, self.capacitorIds[self.capacitorsNumber//2:self.capacitorsNumber] ]
else:
element = [ self.capacitorIds[0:int( self.capacitorsNumber//2 + 1 )]
, self.capacitorIds[int( self.capacitorsNumber//2 + 1 ):self.capacitorsNumber] ]
u = 0
for j in range(0,self.matrixDim["columns"]+1) :
self.vRTsDistribution.append( element[u] )
@ -363,7 +367,12 @@ class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
def __setNetsDistribution__( self ):
netsList = self.nets[0:len(self.nets)-1] if self.dummyRing == True and self.dummyElement == False else self.nets
element = [ netsList[0:len(netsList)/2], netsList[len(netsList)/2:len(netsList)] ] if len(netsList) % 2 == 0 else [ netsList[0:int( len(netsList)/2 + 1 )], netsList[int( len(netsList)/2 + 1 ):len(netsList)] ]
if len(netsList) % 2 == 0:
element = [ netsList[0:len(netsList)//2]
, netsList[len(netsList)//2:len(netsList)] ]
else:
element = [ netsList[0:int( len(netsList)//2 + 1 )]
, netsList[int( len(netsList)//2 + 1 ):len(netsList)] ]
u = 0
netsDistribution = []
for j in range(0,self.matrixDim["columns"]+1) :
@ -382,7 +391,7 @@ class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
def __setPlatesDistribution__( self ):
element = [ self.capacitorIds[0:self.capacitorsNumber/2], self.capacitorIds[self.capacitorsNumber/2:self.capacitorsNumber] ] if self.capacitorsNumber % 2 == 0 else [ self.capacitorIds[0:int( self.capacitorsNumber/2 + 1 )], self.capacitorIds[int( self.capacitorsNumber/2 + 1 ):self.capacitorsNumber] ]
element = [ self.capacitorIds[0:self.capacitorsNumber//2], self.capacitorIds[self.capacitorsNumber//2:self.capacitorsNumber] ] if self.capacitorsNumber % 2 == 0 else [ self.capacitorIds[0:int( self.capacitorsNumber//2 + 1 )], self.capacitorIds[int( self.capacitorsNumber//2 + 1 ):self.capacitorsNumber] ]
u = 0
for j in range(0,self.matrixDim["columns"]+1) :
@ -420,7 +429,7 @@ class VerticalRoutingTracks ( CapacitorUnit, CapacitorStack ):
def scriptMain( **kw ):
editor = None
if kw.has_key('editor') and kw['editor']:
if 'editor' in kw and kw['editor']:
editor = kw['editor']
UpdateSession.open()

View File

@ -166,7 +166,7 @@ def layout ( device, bbMode ):
trace( 100, '++' )
#paramsMatrix.trace()
except Exception, e:
except Exception as e:
helpers.io.catch( e )
trace( 100, '---' )

View File

@ -224,7 +224,7 @@ class NonUnitCapacitor(CapacitorUnit):
def scriptMain( **kw ):
editor = None
if kw.has_key('editor') and kw['editor']:
if 'editor' in kw and kw['editor']:
editor = kw['editor']
UpdateSession.open()

View File

@ -7,7 +7,7 @@ from Hurricane import Box
from Hurricane import Net
import helpers
import helpers.io
from helpers import trace
from helpers import trace, l, u, n
#helpers.setTraceLevel( 100 )
@ -45,7 +45,12 @@ def layout ( device, bbMode ):
length = device.getParameter( 'L' ).getValue()
bends = device.getParameter( 'bends' ).getValue()
width = u( 8.0)
length = u(100.0)
bends = 1
trace( 100, '\tpR:{0}\n'.format(device.getParameter('R')) )
trace( 100, '\tpW:{0}\n'.format(device.getParameter('W')) )
trace( 100, '\tpL:{0}\n'.format(device.getParameter('L')) )
trace( 100, '\tresistance:{0}, width:{1}, length:{2}\n'.format(resistance,width,length) )
typeArg = 'UnknownType'
@ -72,7 +77,7 @@ def layout ( device, bbMode ):
trace( 100, '++' )
#paramsMatrix.trace()
except Exception, e:
except Exception as e:
helpers.io.catch( e )
trace( 100, '---' )

View File

@ -1,6 +1,6 @@
#!/usr/bin/python
import sys
import sys
from Hurricane import *
from CRL import *
import Constant
@ -16,8 +16,8 @@ def doBreak( level, message ):
Breakpoint.stop( level, message )
UpdateSession.open()
def toDbU ( l ): return DbU.fromPhysical( l, DbU.UnitPowerMicro )
def toPhy ( l ): return DbU.toPhysical ( l, DbU.UnitPowerMicro )
def toDbU ( l ): return DbU.fromPhysical( l , DbU.UnitPowerMicro )
def toPhy ( l ): return DbU.toPhysical ( int(l), DbU.UnitPowerMicro )
def toFoundryGrid ( l ):
twoGrid = DbU.fromGrid( 2.0 )
@ -152,7 +152,8 @@ class Resistor ( object ):
self.setSidesDimRules()
if resdim.keys() == ["width","length"] and side in ["width","length"]:
print( resdim )
if list(resdim.keys()) == ["width","length"] and side in ["width","length"]:
if side == "width" :
rule = self.minWidth_resistorPlate
@ -304,7 +305,7 @@ class Resistor ( object ):
if self.resistorType == "RPOLYH" : self.layers["hres" ] = technology.getLayer( "hres" )
if self.resistorType == "RPOLY2PH" : self.layers["restrm"] = technology.getLayer( "restrm" )
return self.layers
return self.layers
def create( self, bbMode = False ):
@ -312,7 +313,7 @@ class Resistor ( object ):
UpdateSession.open()
layerDict = self.getLayers()
self.computeDimensions(bbMode)
self.computeDimensions(bbMode)
self.drawAbutmentBox ()
self.device.setAbutmentBox( self.abutmentBox )
@ -436,7 +437,7 @@ class Resistor ( object ):
abutmentBoxSide2 = self.resDim ["length"] + 2*self.resPlateExtrimities["length"] + 2*self.enclosure_resistor_abutmentBox
if self.snakeMode :
if self.resistorType == "RPOLYH" : resistor_width = self.hresLayerDict.values()[0]
if self.resistorType == "RPOLYH" : resistor_width = list(self.hresLayerDict.values())[0]
if self.resistorType == "RPOLY2PH" : resistor_width = (self.bends+1)*self.snakeSegmentDict["width"] + self.bends*self.snakeSegments_spacing
abutmentBoxSide1 = resistor_width + 2*self.enclosure_resistor_abutmentBox #width
@ -479,8 +480,8 @@ class Resistor ( object ):
self.resistorPlateDict["width" ] = self.resDim["width" ]
self.resistorPlateDict["length" ] = self.resDim["length"]
if self.direction == "vertical" : keysList = ["XCenter","YMin","YMax","XMin","width" ]
if self.direction == "horizontal" : keysList = ["YCenter","XMin","XMax","YMin","height"]
if self.direction == "vertical" : keysList = ["XCenter","YMin","YMax","XMin","width" ]
if self.direction == "horizontal" : keysList = ["YCenter","XMin","XMax","YMin","height"]
self.resistorPlateDict[ keysList[0] ] = self.abutmentBoxDict [keysList[3]] + self.abutmentBoxDict [keysList[4]]/2
self.resistorPlateDict[ keysList[1] ] = self.abutmentBoxDict [keysList[1]] + self.enclosure_resistor_abutmentBox + self.resPlateExtrimities["length"]
@ -512,7 +513,7 @@ class Resistor ( object ):
## The first bend is the lowest one (horizontally)
def computeFirstSnakeSegmentPosition( self ) :
if self.direction == "vertical" :
if self.direction == "vertical" :
if self.bends > 1 : firstExtrimity_width = self.resPlateExtrimities["width"]
if self.bends == 1 : firstExtrimity_width = self.resPlateExtrimity1 ["width"]
@ -528,7 +529,7 @@ class Resistor ( object ):
self.snakeSegmentDict ["YMax" ] = self.snakeSegmentDict["YMin"] + self.snakeSegmentDict["length"]
if self.direction == "horizontal" :
if self.direction == "horizontal" :
if self.bends > 1 : firstExtrimity_length = self.resPlateExtrimities["length"]
if self.bends == 1 : firstExtrimity_length = self.resPlateExtrimity1 ["length"]
@ -543,26 +544,19 @@ class Resistor ( object ):
self.snakeSegmentDict ["XMax" ] = self.snakeSegmentDict["XMin"] + self.snakeSegmentDict["length"]
return
def computeHRESLayerPosition( self ):
if self.direction == "vertical" :
if self.direction == "vertical" :
self.hresLayerDict["XCenter"] = self.abutmentBox.getXCenter()
self.hresLayerDict["YMin" ] = self.abutmentBox.getYMin() + self.enclosure_resistor_abutmentBox
self.hresLayerDict["YMax" ] = self.abutmentBox.getYMax() - self.enclosure_resistor_abutmentBox
if self.direction == "horizontal" :
if self.direction == "horizontal" :
self.hresLayerDict["YCenter"] = self.abutmentBox.getYCenter()
self.hresLayerDict["XMin" ] = self.abutmentBox.getXMin() + self.enclosure_resistor_abutmentBox
self.hresLayerDict["XMax" ] = self.abutmentBox.getXMax() - self.enclosure_resistor_abutmentBox
return
def drawLayer( self, layerLabel, layer):
thiknessKey = "width"
@ -588,25 +582,25 @@ class Resistor ( object ):
if self.direction == "vertical" :
for i in range(0, maxIterations) :
print self.nets[0], layer \
print( self.nets[0], layer \
, positionParams["XCenter" ] + i*centerTranslation \
, positionParams[thiknessKey] \
, positionParams["YMin" ] \
, positionParams["YMax" ]
, positionParams["YMax" ] )
Vertical.create ( self.nets[0], layer
, positionParams["XCenter" ] + i*centerTranslation
, positionParams[thiknessKey]
, positionParams["YMin" ]
, positionParams["YMax" ]
, int(positionParams["XCenter" ] + i*centerTranslation)
, int(positionParams[thiknessKey])
, int(positionParams["YMin" ])
, int(positionParams["YMax" ])
)
if self.direction == "horizontal" :
for i in range(0, maxIterations) :
Horizontal.create( self.nets[0], layer
, positionParams["YCenter" ] + i*centerTranslation
, positionParams[thiknessKey]
, positionParams["XMin" ]
, positionParams["XMax" ]
, int(positionParams["YCenter" ] + i*centerTranslation)
, int(positionParams[thiknessKey])
, int(positionParams["XMin" ])
, int(tositionParams["XMax" ] )
)
return
@ -629,18 +623,18 @@ class Resistor ( object ):
if self.direction == "vertical" :
Vertical.create ( self.nets[0], layer
, self.resdefLayerDict["XCenter"]
, self.resdefLayerDict["width" ]
, self.resdefLayerDict["YMin" ]
, self.resdefLayerDict["YMax" ]
, int(self.resdefLayerDict["XCenter"])
, int(self.resdefLayerDict["width" ])
, int(self.resdefLayerDict["YMin" ])
, int(self.resdefLayerDict["YMax" ])
)
if self.direction == "horizontal" :
Horizontal.create( self.nets[0], layer
, self.resdefLayerDict["YCenter"]
, self.resdefLayerDict["width" ]
, self.resdefLayerDict["XMin" ]
, self.resdefLayerDict["XMax" ]
, int(self.resdefLayerDict["YCenter"])
, int(self.resdefLayerDict["width" ])
, int(self.resdefLayerDict["XMin" ])
, int(self.resdefLayerDict["XMax" ])
)
print("self.resdefLayerDict['width' ]",self.resdefLayerDict["width" ])
print("self.resistorPlateDict['width' ]",self.resistorPlateDict["width" ])
@ -664,10 +658,10 @@ class Resistor ( object ):
factor0 = 0 if ( i == self.bends and self.bends % 2 == 0 ) else 1
factor1 = 0 if ( i == self.bends and self.bends % 2 != 0 ) or i == 0 else 1
Vertical.create ( self.nets[0], layer
, self.resdefLayerDict["XCenter"] + i*centerTranslation
, self.resdefLayerDict["width" ]
, self.resdefLayerDict["YMin" ] + factor0*extrimityTranslation
, self.resdefLayerDict["YMax" ] - factor1*extrimityTranslation
, int(self.resdefLayerDict["XCenter"] + i*centerTranslation)
, int(self.resdefLayerDict["width" ])
, int(self.resdefLayerDict["YMin" ] + factor0*extrimityTranslation)
, int(self.resdefLayerDict["YMax" ] - factor1*extrimityTranslation)
)
if self.direction == "horizontal" :
@ -678,10 +672,10 @@ class Resistor ( object ):
factor0 = 0 if i == 0 or (i == self.bends and self.bends % 2 != 0) else 1
factor1 = 0 if i == self.bends and self.bends % 2 == 0 else 1
Horizontal.create( self.nets[0], layer
, self.resdefLayerDict["YCenter"] + i*centerTranslation
, self.resdefLayerDict["width" ]
, self.resdefLayerDict["XMin" ] + factor0*extrimityTranslation
, self.resdefLayerDict["XMax" ] - factor1*extrimityTranslation
, int(self.resdefLayerDict["YCenter"] + i*centerTranslation)
, int(self.resdefLayerDict["width" ])
, int(self.resdefLayerDict["XMin" ] + factor0*extrimityTranslation)
, int(self.resdefLayerDict["XMax" ] - factor1*extrimityTranslation)
)
return
@ -706,10 +700,10 @@ class Resistor ( object ):
for i in range(0,self.bends) :
Horizontal.create( self.nets[0], layer
, snakeCornersYCenters[k]
, self.snakeCornerDict["width"] + widthExtension
, self.snakeCornerDict["XMin" ] - self.minWidth_contact/4 + i*translation
, self.snakeCornerDict["XMax" ] + self.minWidth_contact/4 + i*translation
, int(snakeCornersYCenters[k] )
, int(self.snakeCornerDict["width"] + widthExtension )
, int(self.snakeCornerDict["XMin" ] - self.minWidth_contact/4 + i*translation)
, int(self.snakeCornerDict["XMax" ] + self.minWidth_contact/4 + i*translation)
)
k = k+1 if k<1 else 0
@ -719,10 +713,10 @@ class Resistor ( object ):
for i in range(0,self.bends) :
Vertical.create ( self.nets[0], layer
, snakeCornersXCenters[k]
, self.snakeCornerDict["width"] + widthExtension
, self.snakeCornerDict["YMin" ] - self.minWidth_contact/4 + i*translation
, self.snakeCornerDict["YMax" ] + self.minWidth_contact/4 + i*translation
, int(snakeCornersXCenters[k])
, int(self.snakeCornerDict["width"] + widthExtension )
, int(self.snakeCornerDict["YMin" ] - self.minWidth_contact/4 + i*translation)
, int(self.snakeCornerDict["YMax" ] + self.minWidth_contact/4 + i*translation)
)
k = k+1 if k<1 else 0
@ -769,13 +763,13 @@ class Resistor ( object ):
heightAdjust = height % (2*self.hpitch)
if heightAdjust:
heightAdjust = 2*self.hpitch - heightAdjust
ab.inflate( 0, heightAdjust/2 )
ab.inflate( 0, heightAdjust//2 )
width = ab.getWidth()
widthAdjust = width % (2*self.vpitch)
if widthAdjust:
widthAdjust = 2*self.vpitch - widthAdjust
ab.inflate( widthAdjust/2, 0 )
ab.inflate( widthAdjust//2, 0 )
self.abutmentBox = ab
return
@ -848,16 +842,16 @@ class Resistor ( object ):
if self.snakeMode and self.bends % 2 == 0 : [ hTranslation , vTranslation ] = [ translation2 , translation1 ]
if self.snakeMode and self.bends % 2 != 0 : [ hTranslation , vTranslation ] = [ translation2 , 0 ]
self.terminal1Box = Box( self.resPlateExtensions["ex1"]["XMin"]
, self.resPlateExtensions["ex1"]["YMin"]
, self.resPlateExtensions["ex1"]["XMax"]
, self.resPlateExtensions["ex1"]["YMax"]
self.terminal1Box = Box( int(self.resPlateExtensions["ex1"]["XMin"])
, int(self.resPlateExtensions["ex1"]["YMin"])
, int(self.resPlateExtensions["ex1"]["XMax"])
, int(self.resPlateExtensions["ex1"]["YMax"])
)
self.terminal2Box = Box( self.resPlateExtensions["ex1"]["XMin"] - hTranslation
, self.resPlateExtensions["ex1"]["YMin"] + vTranslation
, self.resPlateExtensions["ex1"]["XMax"] - hTranslation
, self.resPlateExtensions["ex1"]["YMax"] + vTranslation
self.terminal2Box = Box( int(self.resPlateExtensions["ex1"]["XMin"] - hTranslation)
, int(self.resPlateExtensions["ex1"]["YMin"] + vTranslation)
, int(self.resPlateExtensions["ex1"]["XMax"] - hTranslation)
, int(self.resPlateExtensions["ex1"]["YMax"] + vTranslation)
)
if self.direction == "horizontal" :
@ -927,18 +921,18 @@ class Resistor ( object ):
if self.direction == "vertical" :
for i in [0,1] : Horizontal.create( self.nets[i], layer
, self.pImplant_layerDict["YCenter"] + i*centerTranslation
, self.pImplant_layerDict["length" ]
, self.pImplant_layerDict["XMin" ] - i*extrimitiesTranslation
, self.pImplant_layerDict["XMax" ] - i*extrimitiesTranslation
, int(self.pImplant_layerDict["YCenter"] + i*centerTranslation)
, int(self.pImplant_layerDict["length" ])
, int(self.pImplant_layerDict["XMin" ] - i*extrimitiesTranslation)
, int(self.pImplant_layerDict["XMax" ] - i*extrimitiesTranslation)
)
if self.direction == "horizontal" :
for i in [0,1] : Vertical.create ( self.nets[i], layer
, self.pImplant_layerDict["XCenter"] + i*centerTranslation
, self.pImplant_layerDict["length" ]
, self.pImplant_layerDict["YMin" ] + i*extrimitiesTranslation
, self.pImplant_layerDict["YMax" ] + i*extrimitiesTranslation
, int(self.pImplant_layerDict["XCenter"] + i*centerTranslation)
, int(self.pImplant_layerDict["length" ])
, int(self.pImplant_layerDict["YMin" ] + i*extrimitiesTranslation)
, int(self.pImplant_layerDict["YMax" ] + i*extrimitiesTranslation)
)
@ -1030,16 +1024,17 @@ class Resistor ( object ):
if self.direction == "vertical" :
Horizontal.create( self.nets[0]
, layer, self.t1CutCenterDict["YCenter"]
, layer_width
, source1
, target1 )
, layer
, int(self.t1CutCenterDict["YCenter"])
, int(layer_width)
, int(source1)
, int(target1) )
Horizontal.create( self.nets[1]
, layer
, self.t2CutCenterDict["YCenter"]
, layer_width
, source2
, target2)
, int(self.t2CutCenterDict["YCenter"])
, int(layer_width)
, int(source2)
, int(target2))
trace( 101, '\tIN PAD self.t1CutCenterDict["XCenter"] = {0}\n'.format(DbU.getValueString(self.t1CutCenterDict["XCenter"])) )
trace( 101, '\tIN PAD source1 = {0}\n'.format(DbU.getValueString(source1)) )
@ -1260,8 +1255,8 @@ class Resistor ( object ):
, [rx8 , ry8 ] , [rx9, ry9 ]
]
for p in rightCorCordinatesList :
self.rightCorPointsVector.append(Point(p[0],p[1]))
self.leftCorPointsVector.append (Point(p[0],p[1]))
self.rightCorPointsVector.append(Point(int(p[0]),int(p[1])))
self.leftCorPointsVector.append (Point(int(p[0]),int(p[1])))
translationList = [ self.snakeSegmentDict["length"]
, self.snakeSegmentDict["length"] + 2*param1
@ -1276,9 +1271,9 @@ class Resistor ( object ):
]
if self.direction == "vertical" :
for i in range(0, len(self.leftCorPointsVector)) : self.leftCorPointsVector[i].translate( 0 , translationList[i] )
for i in range(0, len(self.leftCorPointsVector)) : self.leftCorPointsVector[i].translate( 0 , int(translationList[i]) )
if self.direction == "horizontal" :
for i in range(0, len(self.leftCorPointsVector)) : self.leftCorPointsVector[i].translate( - translationList[i] , 0)
for i in range(0, len(self.leftCorPointsVector)) : self.leftCorPointsVector[i].translate( int(- translationList[i]) , 0)
return
@ -1286,8 +1281,8 @@ class Resistor ( object ):
def drawCorners135( self, layer ):
self.computeFirstSnakeCornerPosition135()
if self.bends % 2 == 0 : [ rightCornersNum, leftCornersNum ] = [ self.bends/2 , self.bends/2 ]
if self.bends % 2 != 0 : [ rightCornersNum, leftCornersNum ] = [ (self.bends+1)/2 , (self.bends-1)/2 ]
if self.bends % 2 == 0 : [ rightCornersNum, leftCornersNum ] = [ self.bends//2 , self.bends//2 ]
if self.bends % 2 != 0 : [ rightCornersNum, leftCornersNum ] = [ (self.bends+1)//2 , (self.bends-1)//2 ]
translationFactor = 2*(self.snakeSegmentDict["width"] + self.snakeSegments_spacing)
@ -1299,12 +1294,12 @@ class Resistor ( object ):
for i in range(0, leftCornersNum ) :
if i == 0 :
if self.direction == "vertical" : Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(dxTranslation/2,dyTranslation)
if self.direction == "horizontal": Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(dxTranslation,dyTranslation/2)
if self.direction == "vertical" : Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(dxTranslation//2,dyTranslation)
if self.direction == "horizontal": Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(dxTranslation,dyTranslation//2)
if i != 0 :
if self.direction == "vertical" : Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(i*3*dxTranslation/2,dyTranslation)
if self.direction == "horizontal": Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(dxTranslation,i*3*dyTranslation/2)
if self.direction == "vertical" : Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(i*3*dxTranslation//2,dyTranslation)
if self.direction == "horizontal": Rectilinear.create(self.nets[0], layer, self.leftCorPointsVector).translate(dxTranslation,i*3*dyTranslation//2)
return
@ -1332,7 +1327,20 @@ class Resistor ( object ):
def cutLine( self, net, layer, firstCutXCenter, firstCutYCenter, width_cut, height_cut, spacing_cut, cutNumber, direction ):
for i in range(0, cutNumber) :
segment = Contact.create( net, layer, firstCutXCenter + i*(width_cut + spacing_cut), firstCutYCenter, width_cut, height_cut ) if direction == 'horizontal' else Contact.create( net, layer, firstCutXCenter, firstCutYCenter + i*(height_cut + spacing_cut), width_cut, height_cut )
if direction == 'horizontal':
segment = Contact.create( net
, layer
, int(firstCutXCenter + i*(width_cut + spacing_cut))
, int(firstCutYCenter)
, int(width_cut)
, int(height_cut) )
else:
segment = Contact.create( net
, layer
, int(firstCutXCenter)
, int(firstCutYCenter + i*(height_cut + spacing_cut))
, int(width_cut)
, int(height_cut) )
return segment
@ -1389,32 +1397,32 @@ class Resistor ( object ):
edgeDelta = self.minWidth_contact/2 + self.minEnclosure_metal1_cut0
if t1OnNorth:
t1BoxM1 = Box( 0
, self.t1CutCenterDict["YCenter"] - edgeDelta
, m1Width
, t1YM2 + VIA1overhang
t1BoxM1 = Box( int(0)
, int(self.t1CutCenterDict["YCenter"] - edgeDelta)
, int(m1Width)
, int(t1YM2 + VIA1overhang)
)
else:
t1BoxM1 = Box( 0
, t1YM2 - VIA1overhang
, m1Width
, self.t1CutCenterDict["YCenter"] + edgeDelta
t1BoxM1 = Box( int(0)
, int(t1YM2 - VIA1overhang)
, int(m1Width)
, int(self.t1CutCenterDict["YCenter"] + edgeDelta)
)
t1BoxM1.translate( self.t1CutCenterDict["XCenter"] - edgeDelta, 0 )
t1BoxM1.translate( int(self.t1CutCenterDict["XCenter"] - edgeDelta), 0 )
if t2OnNorth:
t2BoxM1 = Box( 0
, self.t2CutCenterDict["YCenter"] - edgeDelta
, m1Width
, t2YM2 + VIA1overhang
t2BoxM1 = Box( int(0)
, int(self.t2CutCenterDict["YCenter"] - edgeDelta)
, int(m1Width)
, int(t2YM2 + VIA1overhang)
)
else:
t2BoxM1 = Box( 0
, t2YM2 - VIA1overhang
, m1Width
, self.t2CutCenterDict["YCenter"] + edgeDelta
t2BoxM1 = Box( int(0)
, int(t2YM2 - VIA1overhang)
, int(m1Width)
, int(self.t2CutCenterDict["YCenter"] + edgeDelta)
)
t2BoxM1.translate( self.t2CutCenterDict["XCenter"] - edgeDelta, 0 )
t2BoxM1.translate( int(self.t2CutCenterDict["XCenter"] - edgeDelta), 0 )
self.drawM2Terminal( t1net, t1BoxM1, t1YM2 )
self.drawM2Terminal( t2net, t2BoxM1, t2YM2 )
@ -1426,43 +1434,43 @@ class Resistor ( object ):
ab = self.device.getAbutmentBox()
minBoxM1 = Box( boxM1.getCenter().getX(), axisM2 )
minBoxM1.inflate( self.minWidth_cut1/2 + self.minEnclosure_metal1_cut1 )
minBoxM1.inflate( int(self.minWidth_cut1/2 + self.minEnclosure_metal1_cut1) )
boxM1.merge( minBoxM1 )
h = Horizontal.create( net
, self.metal2
, axisM2
, self.metal2Width
, ab.getXMin()
, ab.getXMax() )
, int(axisM2)
, int(self.metal2Width)
, int(ab.getXMin())
, int(ab.getXMax()) )
NetExternalComponents.setExternal( h )
Vertical.create( net
, self.metal1
, boxM1.getCenter().getX()
, boxM1.getWidth()
, boxM1.getYMin()
, boxM1.getYMax()
, int(boxM1.getCenter().getX())
, int(boxM1.getWidth())
, int(boxM1.getYMin())
, int(boxM1.getYMax())
)
cutNumber = ((boxM1.getWidth() - 2*self.minEnclosure_metal1_cut1 - self.minWidth_cut1) \
/ (self.minSpacing_cut1 + self.minWidth_cut1))
// (self.minSpacing_cut1 + self.minWidth_cut1))
if cutNumber <= 0: cutNumber = 1
centering = (boxM1.getWidth() - 2*self.minEnclosure_metal1_cut1 \
- cutNumber * self.minWidth_cut1 \
- (cutNumber-1) * self.minSpacing_cut1) / 2
- (cutNumber-1) * self.minSpacing_cut1) // 2
xcut1 = boxM1.getXMin() + centering \
+ self.minEnclosure_metal1_cut1 + self.minWidth_cut1/2
+ self.minEnclosure_metal1_cut1 + self.minWidth_cut1//2
trace( 101, '\tcutNumber = {0}\n'.format(cutNumber) )
for i in range(cutNumber):
trace( 101, '\t[{0}]\n'.format(i) )
Contact.create( net
, self.cut1
, xcut1
, axisM2
, self.minWidth_cut1
, self.minWidth_cut1
, int(xcut1)
, int(axisM2)
, int(self.minWidth_cut1)
, int(self.minWidth_cut1)
)
xcut1 += self.minWidth_cut1 + self.minSpacing_cut1
@ -1473,7 +1481,7 @@ class Resistor ( object ):
def scriptMain( **kw ):
editor = None
if kw.has_key('editor') and kw['editor']:
if 'editor' in kw and kw['editor']:
editor = kw['editor']
UpdateSession.open()