diff --git a/chamsin/src/analogic/CMakeLists.txt b/chamsin/src/analogic/CMakeLists.txt index 3ee358ac..437bbf26 100644 --- a/chamsin/src/analogic/CMakeLists.txt +++ b/chamsin/src/analogic/CMakeLists.txt @@ -1,8 +1,6 @@ INCLUDE_DIRECTORIES(${CHAMSIN_SOURCE_DIR}/src/dtr ${HURRICANE_INCLUDE_DIR} ${source_dir}) ADD_LIBRARY(analogic SHARED -GenV1Trans.cpp -MetaTransistor.cpp Transistor.cpp) TARGET_LINK_LIBRARIES(analogic dtr ${HURRICANE_LIBRARIES}) diff --git a/chamsin/src/analogic/GenTrans.h b/chamsin/src/analogic/GenTrans.h index ffbde722..08412edb 100644 --- a/chamsin/src/analogic/GenTrans.h +++ b/chamsin/src/analogic/GenTrans.h @@ -13,154 +13,6 @@ #include "Box.h" -// -------------------------------------------------------------------- -// Macro Method : "MAXLONG(a,b), MINLONG(a,b)" -// Comparaison Method Macro For Calculate Rectangles. - -#define MAXLONG(a,b) (a>b?a:b) -#define MINLONG(a,b) (a>b?b:a) - - -// -------------------------------------------------------------------- -// Macro Method : "GET_RULE(s)" -// This Method Macro is For geting The Value in RdsUnit of a DRM Rule. -// To Use This Macro, you must predefine Pointeur dtraccess. - -#define GET_RULE(s) \ - dtraccess->getSingleRdsRuleByLabel(string(s)) - - - -// -------------------------------------------------------------------- -// Macro Method "GET_RULE_BYNP(prefix, type, suffix)" -// This Method Macro is For geting The Value in RdsUnit of a DRM Rule -// selected by string type which is mostype . - - /* \prefix must be a chain character. - * \type mos type('N'/'P'), must be a string. - * \suffix must be a chain character. - */ - -// To Use This Macro, you must Predefine Pointeur dtraccess. - -#define GET_RULE_BYNP(prefix, type, suffix) \ - dtraccess->getSingleRdsRuleByLabel(prefix, type, suffix) - - - -// -------------------------------------------------------------------- -// Macro Method : "get_LAYER_BYNP(prefix, type, suffix)" -// This Method Macro is For geting the Layer of a Layer Rule Selected -// by string type which is mostype. To Use This Macro, you must predefine -// Pointeur dtraccess. - - /* \prefix must be a chain of character. - * \type mos type('N'/'P'), must be a string. - * \suffix must be a string. - */ - -// To Use This Macro, you must Predefine Pointeur dtraccess. - -#define GET_LAYER_BYNP(prefix, type, suffix) \ - dtraccess->getSingleLayerByLabel(prefix, type, suffix) - - - -// -------------------------------------------------------------------- -// Macro Method : "SAVE_RECTANGLE(S, x, y, dx, dy)" -// This Method Macro is For Saving A Rectangle in a map . - - /* \s name of rectangle, must be a chain of character. - * \x xmin, must be a long. - * \y ymin, must be a long. - * \dx width, must be a long. - * \dy height, must be a long. - */ - -// This Method Macro must be used in Membre Function Calculate. - -#define SAVE_RECTANGLE(s, x, y, dx, dy) \ - _mapString2Box[string(s)] = Box(getUnit(x), getUnit(y), getUnit(x+dx), getUnit(y+dy)); \ - xmin = MINLONG(xmin, getUnit(x)); \ - ymin = MINLONG(ymin, getUnit(y)); - - -// -------------------------------------------------------------------- -// Macro Method : "GET_BOX(s)" -// This Method Macro is For get the box According to the its name. - - /* - * \s name of rectangle, must be a string. - */ - -// This Method Macro must be used in member function of Class GenTrans. -// - -#define GET_BOX(s) \ - _mapString2Box[s] - - -// --------------------------------------------------------------------- -// Macro Method : "CREATE_CONTACT_MATRIX_UNDER(boxname, nbcolumn, layer, net)" -// This Method Macro is For Create a matrix of Contact under a zone for -// a net specified. - - /* \underbox A rectangle under which contacts will be placed, must be a objet Box. - * \nbcolumn the number of column, must be a integer. - * \layer the layer of contact, must be a pointer of type Layer*. - * \net the net to be hooked, must be a pointer of type Net*. - */ - -// To use this Macro Function. You Must also définir variable nbcontact, -// tmp_xcenter, tmp_ycenter, rw_cont, rd_cont. -// - -#define CREATE_CONTACT_MATRIX_UNDER(underbox, nbcolumn, layer, net) \ - \ - if(underbox.getHeight()b?a:b) +#define MINLONG(a,b) (a>b?b:a) + +#define SAVE_RECTANGLE(s, x, y, dx, dy) \ + _mapString2Box[string(s)] = Box(getUnit(x), getUnit(y), getUnit(x+dx), getUnit(y+dy)); \ + xmin = MINLONG(xmin, getUnit(x)); \ + ymin = MINLONG(ymin, getUnit(y)); + +#define GET_RULE(s) \ + dtraccess->getSingleRdsRuleByLabel(string(s)) + +#define BOX_IS_VALID(box) \ + ( (long)(getValue(box.getXMin()))%2==0 )&& \ + ( (long)(getValue(box.getXMax()))%2==0 )&& \ + ( (long)(getValue(box.getYMin()))%2==0 )&& \ + ( (long)(getValue(box.getYMax()))%2==0 ) + +#define CREATE_CONTACT_MATRIX_UNDER(underbox, nbcolumn, layer, net) \ + \ + if(underbox.getHeight()getSingleRdsRuleByLabel("RE_", mostype, "IMP_ACTI"); + long re_imp_poly = dtraccess->getSingleRdsRuleByLabel("RE_", mostype, "IMP_POLY"); + long re_imp_cont = dtraccess->getSingleRdsRuleByLabel("RE_", mostype, "IMP_CONT"); + long re_imp_gate = dtraccess->getSingleRdsRuleByLabel("RE_", mostype, "IMP_GATE"); //long re_well_acti = GET_RULE_BYNP("RE_", mostype, "WELL_ACTI"); // Calculate Rectangle 00 // ********************** x00 = 0; - y00 = -( GET_RULE("RE_GATE_ACTI") ); + y00 = -dtraccess->getSingleRdsRuleByLabel("RE_GATE_ACTI"); dx00 = ConvertRealToRdsUnit(_masqueV1Info->getL()); realw = ConvertRealToRdsUnit(_masqueV1Info->getW()); dy00 = realw + 2*(-y00); - SAVE_RECTANGLE("00", x00, y00, dx00, dy00) + SAVE_RECTANGLE("00", x00, y00, dx00, dy00); // Calculate Rectangle 30 // ********************** -// cout << "RD_ACTI_CONT is " << GET_RULE("RD_ACTI_CONT")<getSingleRdsRuleByLabel("RD_ACTI_CONT")<getSingleRdsRuleByLabel("RD_ACTI_POLY")<getSingleRdsRuleByLabel("RE_POLY_CONT")<getSingleRdsRuleByLabel("RD_ACTI_CONT"), GET_RULE("RD_ACTI_POLY") + GET_RULE("RE_POLY_CONT"))) <getSingleRdsRuleByLabel("RW_CONT") + 2*GET_RULE("RE_POLY_CONT"); if (dx31 >= dx00) { - dx30 = GET_RULE("RW_CONT"); + dx30 = dtraccess->getSingleRdsRuleByLabel("RW_CONT"); dy30 = dx30; - y30 = 0 + realw + MAXLONG(GET_RULE("RD_ACTI_CONT"), GET_RULE("RD_ACTI_POLY") + GET_RULE("RE_POLY_CONT")); + y30 = 0 + realw + MAXLONG(dtraccess->getSingleRdsRuleByLabel("RD_ACTI_CONT"), GET_RULE("RD_ACTI_POLY") + GET_RULE("RE_POLY_CONT")); } else { - dx30 = dx00 - 2*GET_RULE("RE_POLY_CONT"); - dy30 = GET_RULE("RW_CONT"); - y30 = 0 + realw + GET_RULE("RD_ACTI_CONT"); + dx30 = dx00 - 2*dtraccess->getSingleRdsRuleByLabel("RE_POLY_CONT"); + dy30 = dtraccess->getSingleRdsRuleByLabel("RW_CONT"); + y30 = 0 + realw + dtraccess->getSingleRdsRuleByLabel("RD_ACTI_CONT"); } x30 = x00 + dx00/2 - dx30/2; @@ -156,10 +203,10 @@ void GenV1Trans::Calculate(Transistor* transistor) // Calculate Rectangle 31 // ********************** - dx31 = dx30 + 2*GET_RULE("RE_POLY_CONT"); - dy31 = dy30 + 2*GET_RULE("RE_POLY_CONT"); - x31 = x30 - GET_RULE("RE_POLY_CONT"); - y31 = y30 - GET_RULE("RE_POLY_CONT"); + dx31 = dx30 + 2*dtraccess->getSingleRdsRuleByLabel("RE_POLY_CONT"); + dy31 = dy30 + 2*dtraccess->getSingleRdsRuleByLabel("RE_POLY_CONT"); + x31 = x30 - dtraccess->getSingleRdsRuleByLabel("RE_POLY_CONT"); + y31 = y30 - dtraccess->getSingleRdsRuleByLabel("RE_POLY_CONT"); SAVE_RECTANGLE("31", x31, y31, dx31, dy31) @@ -196,11 +243,11 @@ void GenV1Trans::Calculate(Transistor* transistor) // Calculate Rectangle 20 // ********************** - y20 = 0 + GET_RULE("RE_ACTI_CONT"); - dy20 = realw - 2 * GET_RULE("RE_ACTI_CONT"); - dx20 = (_masqueV1Info->getNbSourceColumn()) * GET_RULE("RW_CONT") + - ((_masqueV1Info->getNbSourceColumn()) - 1) * GET_RULE("RD_CONT"); - x20 = 0 - ( dx20 + GET_RULE("RD_CONT_GATE") ); + y20 = 0 + dtraccess->getSingleRdsRuleByLabel("RE_ACTI_CONT"); + dy20 = realw - 2 * dtraccess->getSingleRdsRuleByLabel("RE_ACTI_CONT"); + dx20 = (_masqueV1Info->getNbSourceColumn()) * dtraccess->getSingleRdsRuleByLabel("RW_CONT") + + ((_masqueV1Info->getNbSourceColumn()) - 1) * dtraccess->getSingleRdsRuleByLabel("RD_CONT"); + x20 = 0 - ( dx20 + dtraccess->getSingleRdsRuleByLabel("RD_CONT_GATE") ); SAVE_RECTANGLE("20", x20, y20, dx20, dy20) @@ -208,9 +255,9 @@ void GenV1Trans::Calculate(Transistor* transistor) // Calculate Rectangle 40 // ********************** y40 = y20; - x40 = x00 + dx00 + GET_RULE("RD_CONT_GATE"); - dx40 = (_masqueV1Info->getNbDrainColumn()) * GET_RULE("RW_CONT") + - ((_masqueV1Info->getNbDrainColumn()) - 1) * GET_RULE("RD_CONT"); + x40 = x00 + dx00 + dtraccess->getSingleRdsRuleByLabel("RD_CONT_GATE"); + dx40 = (_masqueV1Info->getNbDrainColumn()) * dtraccess->getSingleRdsRuleByLabel("RW_CONT") + + ((_masqueV1Info->getNbDrainColumn()) - 1) * dtraccess->getSingleRdsRuleByLabel("RD_CONT"); dy40 = dy20; SAVE_RECTANGLE("40", x40, y40, dx40, dy40) @@ -218,10 +265,10 @@ void GenV1Trans::Calculate(Transistor* transistor) // Calculate Rectangle 10 // ********************** y10 = 0; - x10 = MINLONG(x20 - GET_RULE("RE_ACTI_CONT"), 0 - GET_RULE("RE_ACTI_GATE")); + x10 = MINLONG(x20 - dtraccess->getSingleRdsRuleByLabel("RE_ACTI_CONT"), 0 - GET_RULE("RE_ACTI_GATE")); dy10 = realw; - extension1 = MAXLONG(0 + x40 + dx40 + GET_RULE("RE_ACTI_CONT"), dx00 + GET_RULE("RE_ACTI_GATE")); + extension1 = MAXLONG(0 + x40 + dx40 + dtraccess->getSingleRdsRuleByLabel("RE_ACTI_CONT"), dx00 + GET_RULE("RE_ACTI_GATE")); dx10 = 0 - x10 + extension1; @@ -278,10 +325,10 @@ void GenV1Trans::Calculate(Transistor* transistor) // Calculate Rectangle 50 just for PMOS. // ------------------------------------------------------------- if (transistor->isPmos()) { // Calculate Rectangle 50 for PMos. - x50 = x10 - GET_RULE("RE_NWELL_ACTI"); - y50 = y10 - GET_RULE("RE_NWELL_ACTI"); - dx50 = dx10 + 2 * GET_RULE("RE_NWELL_ACTI"); - dy50 = dy10 + 2 * GET_RULE("RE_NWELL_ACTI"); + x50 = x10 - dtraccess->getSingleRdsRuleByLabel("RE_NWELL_ACTI"); + y50 = y10 - dtraccess->getSingleRdsRuleByLabel("RE_NWELL_ACTI"); + dx50 = dx10 + 2 * dtraccess->getSingleRdsRuleByLabel("RE_NWELL_ACTI"); + dy50 = dy10 + 2 * dtraccess->getSingleRdsRuleByLabel("RE_NWELL_ACTI"); SAVE_RECTANGLE("50", x50, y50, dx50, dy50); } @@ -327,8 +374,8 @@ void GenV1Trans::Generate(Transistor* transistor) else mostype='P'; - long rw_cont = getUnit(GET_RULE("RW_CONT")); - long rd_cont = getUnit(GET_RULE("RD_CONT")); + long rw_cont = getUnit(dtraccess->getSingleRdsRuleByLabel("RW_CONT")); + long rd_cont = getUnit(dtraccess->getSingleRdsRuleByLabel("RD_CONT")); unsigned nbcontact = 0; long tmp_xcenter = 0; long tmp_ycenter = 0; @@ -339,9 +386,9 @@ void GenV1Trans::Generate(Transistor* transistor) //Technology * tech = db->getTechnology(); - Layer * layer_20 = GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_20"); - Layer * layer_30 = GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_30"); - Layer * layer_40 = GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_40"); + Layer* layer_20 = dtraccess->getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_20"); + Layer* layer_30 = dtraccess->getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_30"); + Layer* layer_40 = dtraccess->getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_40"); // ------------------------------------------------------------- @@ -356,18 +403,18 @@ END_IF for(size_t i=0; igetNbSourceColumn(), layer_20, source) //cout << " Finish create contact for source " <getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_"+segsforsource[i]) + // , _mapString2Box[segsforsource[i]].getXCenter() + // , _mapString2Box[segsforsource[i]].getYCenter() + // , _mapString2Box[segsforsource[i]].getWidth() + // , _mapString2Box[segsforsource[i]].getHeight() + // ); } } @@ -383,32 +430,32 @@ IF_DEBUG_HUR_ANALOG END_IF for(size_t i=0; igetSingleRdsRuleByLabel("RW_CONT") ) { + Contact::create(grid, dtraccess->getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_"+segsforgrid[i]) + , _mapString2Box[segsforgrid[i]].getXCenter() + , _mapString2Box[segsforgrid[i]].getYCenter() + , _mapString2Box[segsforgrid[i]].getWidth() + , _mapString2Box[segsforgrid[i]].getHeight() ); } else { - unsigned int nbcolumn = (GET_BOX(segsforgrid[i]).getWidth()-rw_cont)/(rw_cont + rd_cont) + 1; + unsigned int nbcolumn = (_mapString2Box[segsforgrid[i]].getWidth()-rw_cont)/(rw_cont + rd_cont) + 1; IF_DEBUG_HUR_ANALOG cout << "nbcolumn in rectangle 30 is " << nbcolumn <getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_"+segsforgrid[i]) + , _mapString2Box[segsforgrid[i]].getXCenter() + , _mapString2Box[segsforgrid[i]].getYCenter() + , _mapString2Box[segsforgrid[i]].getWidth() + , _mapString2Box[segsforgrid[i]].getHeight() ); } } @@ -428,17 +475,17 @@ END_IF for(size_t i=0; igetNbDrainColumn(), layer_40, drain) //cout << " Finish create contact for drain" <getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_"+segsfordrain[i]) + , _mapString2Box[segsfordrain[i]].getXCenter() + , _mapString2Box[segsfordrain[i]].getYCenter() + , _mapString2Box[segsfordrain[i]].getWidth() + , _mapString2Box[segsfordrain[i]].getHeight() ); } } @@ -457,11 +504,11 @@ END_IF if(transistor->isNmos() && segsforanonym[i]=="50") continue; - Contact::create(anonym, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforanonym[i]) - , GET_BOX(segsforanonym[i]).getXCenter() - , GET_BOX(segsforanonym[i]).getYCenter() - , GET_BOX(segsforanonym[i]).getWidth() - , GET_BOX(segsforanonym[i]).getHeight() + Contact::create(anonym, dtraccess->getSingleLayerByLabel("M1TRANS_",mostype,"_LAYER_"+segsforanonym[i]) + , _mapString2Box[segsforanonym[i]].getXCenter() + , _mapString2Box[segsforanonym[i]].getYCenter() + , _mapString2Box[segsforanonym[i]].getWidth() + , _mapString2Box[segsforanonym[i]].getHeight() ); } @@ -489,36 +536,36 @@ END_IF switch(transistor->getAbutmentType().getCode()) { case Transistor::Type::INTERNAL : - transistor->setAbutmentBox( Box(GET_BOX(string("20")).getXCenter() + transistor->setAbutmentBox( Box(_mapString2Box[string("20")].getXCenter() , transistor->getBoundingBox().getYMin() - , GET_BOX(string("40")).getXCenter() + , _mapString2Box[string("40")].getXCenter() , transistor->getBoundingBox().getYMax() ) ); break; case Transistor::Type::LEFT: - transistor->setAbutmentBox( Box(GET_BOX(string("11")).getXMin() + transistor->setAbutmentBox( Box(_mapString2Box[string("11")].getXMin() , transistor->getBoundingBox().getYMin() - , GET_BOX(string("40")).getXCenter() + , _mapString2Box[string("40")].getXCenter() , transistor->getBoundingBox().getYMax() ) ); break ; case Transistor::Type::RIGHT: - transistor->setAbutmentBox( Box(GET_BOX(string("20")).getXCenter() + transistor->setAbutmentBox( Box(_mapString2Box[string("20")].getXCenter() , transistor->getBoundingBox().getYMin() - , GET_BOX(string("11")).getXMax() + , _mapString2Box[string("11")].getXMax() , transistor->getBoundingBox().getYMax() ) ); break ; case Transistor::Type::SINGLE: - transistor->setAbutmentBox( Box(GET_BOX(string("11")).getXMin() + transistor->setAbutmentBox( Box(_mapString2Box[string("11")].getXMin() , transistor->getBoundingBox().getYMin() - , GET_BOX(string("11")).getXMax() + , _mapString2Box[string("11")].getXMax() , transistor->getBoundingBox().getYMax() ) ); diff --git a/chamsin/src/analogic/Transistor.cpp b/chamsin/src/analogic/Transistor.cpp index cdc2c530..236c993a 100644 --- a/chamsin/src/analogic/Transistor.cpp +++ b/chamsin/src/analogic/Transistor.cpp @@ -1,462 +1 @@ -// **************************************************************************************************** -// File: Transistor.h -// Authors: Wu YiFei -// Date : 21/12/2006 -// **************************************************************************************************** - -#include "Vertical.h" -#include "Horizontal.h" -#include "UpdateSession.h" -using namespace Hurricane; - -#include "AnalogicalCommons.h" -#include "GenTrans.h" - #include "Transistor.h" - -namespace Hurricane { - -// **************************************************************************************************** -// Transistor::Polarity implementation -// **************************************************************************************************** - -Transistor::Polarity::Polarity(const Code& code) :_code(code) -{} - - -Transistor::Polarity::Polarity(const Polarity& type) :_code(type._code) -{} - - -Transistor::Polarity& Transistor::Polarity::operator=(const Polarity& type) { - _code = type._code; - return *this; -} - - -string Transistor::Polarity::_getString() const { - switch(_code) { - case N : return "N"; - case P : return "P"; - } - return "ABNORMAL"; -} - - -Record* Transistor::Polarity::_getRecord() const -// ***************************************** -{ - Record* record = new Record(getString(this)); - record->add(getSlot("Code", _code)); - return record; -} - - -// **************************************************************************************************** -// Transistor::MaskVersion implementation -// **************************************************************************************************** -Transistor::MaskVersion::MaskVersion(const Code& code) -// ******************************************************* -:_code(code) -{ -} - -Transistor::MaskVersion::MaskVersion(const MaskVersion& version) -// ******************************************************************* -:_code(version._code) -{ -} - - -Transistor::MaskVersion& Transistor::MaskVersion::operator=(const MaskVersion& version) -// ****************************************************************************************** -{ - _code = version._code; - return *this; -} - - -string Transistor::MaskVersion::_getString() const -// ************************************************* -{ - switch(_code) { - case VERSION1 : return "VERSION1"; - } - return "ABNORMAL"; -} - - -Record* Transistor::MaskVersion::_getRecord() const -// ************************************************** -{ - Record* record = new Record(getString(this)); - record->add(getSlot("Code", _code)); - return record; -} - - -// **************************************************************************************************** -// Transistor::Type implementation -// **************************************************************************************************** -Transistor::Type::Type(const Code& code) -// ************************************* -:_code(code) -{ -} - - -Transistor::Type::Type(const Type& type) -// ************************************* -:_code(type._code) -{ -} - - -Transistor::Type& Transistor::Type::operator=(const Type& type) -// ************************************************************ -{ - _code = type._code; - return *this; -} - - -string Transistor::Type::_getString() const -// ***************************************** -{ - switch(_code) { - case INTERNAL : return "INTERNAL"; - case LEFT : return "LEFT"; - case RIGHT : return "RIGHT"; - case SINGLE : return "SINGLE"; - } - - return "ABNORMAL"; -} - - -Record* Transistor::Type::_getRecord() const -// ***************************************** -{ - Record* record = new Record(getString(this)); - record->add(getSlot("Code", _code)); - return record; -} - - -// **************************************************************************************************** -// Transistor::MaskInfo implementation -// **************************************************************************************************** -Transistor::MaskInfo::MaskInfo(const double& l, const double& w, const Type::Code& type - , const unsigned& nbDrainColumn - , const unsigned& nbSourceColumn) -// **************************************************************************************************** -: _l(l) - , _w(w) - , _type(type) - , _nbDrainColumn(nbDrainColumn) - , _nbSourceColumn(nbSourceColumn) -{}; - - -Transistor::MaskInfo& Transistor::MaskInfo::operator=(const MaskInfo& masqueinfo) -// ************************************************************************************ -{ - _l = masqueinfo.getL(); - _w = masqueinfo.getW(); - _type= masqueinfo.getType(); - _nbDrainColumn = masqueinfo.getNbDrainColumn(); - _nbSourceColumn = masqueinfo.getNbSourceColumn(); - - return *this; -} - - -bool Transistor::MaskInfo::operator==(const MaskInfo& masqueinfo) -// ****************************************************************** -{ - if(_l == masqueinfo.getL() && - _w == masqueinfo.getW() && - _type== masqueinfo.getType() && - _nbDrainColumn == masqueinfo.getNbDrainColumn() && - _nbSourceColumn == masqueinfo.getNbSourceColumn() - ) - return true; - - return false; -} - - -string Transistor::MaskInfo::_getString() const -// ********************************************** -{ - string s = "<" + _getTypeName() + " " - + getString(_l) + " " - + getString(_w) + " " - + _type._getString() + " " - + getString(_nbSourceColumn) + " " - + getString(_nbDrainColumn) - + ">"; - return s; -} - - -Record* Transistor::MaskInfo::_getRecord() const -// *********************************************** -{ - Record * record = new Record(_getString()); - return record; -} - - -// **************************************************************************************************** -// Transistor::MaskV1Info implementation -// **************************************************************************************************** -Transistor::MaskV1Info::MaskV1Info(const double& l, const double& w, const Type::Code& type - , const unsigned& nbDrainColumn - , const unsigned& nbSourceColumn) -// **************************************************************************************************** -: Inherit(l - , w - , type - , nbDrainColumn - , nbSourceColumn - ) -{} - -Transistor::MaskInfo& Transistor::MaskV1Info::operator=(const MaskInfo& masqueinfo) -// ************************************************************************************** -{ -// (*(static_cast(this)))=masqueinfo; - Inherit::operator=(masqueinfo); - - return *this; -} - -bool Transistor::MaskV1Info::operator == (const MaskInfo& masqueinfo) -// ********************************************************************** -{ - //return (*(static_cast(this)))==masqueinfo; - return Inherit::operator==(masqueinfo); -} - - -string Transistor::MaskV1Info::_getString() const -// ************************************************ -{ - string s = Inherit::_getString(); - return s; -} - -Record* Transistor::MaskV1Info::_getRecord() const -// ************************************************* -{ - Record* record = Inherit::_getRecord(); - return record; -} - -// **************************************************************************************************** -// Transistor implementation -// **************************************************************************************************** - -Transistor::Transistor(Library* library, const Name& name, const Polarity& polarity) : - Inherit(library, name), - _polarity(polarity), - _masqueInfo(NULL), - _genTrans(NULL) -{} - - -Transistor* Transistor::create(Library* library, const Name& name, const Polarity& polarity) { - Transistor* transistor = new Transistor(library, name, polarity); - - transistor->_postCreate(); - - return transistor; -} - - - -void Transistor::_preDestroy() { - // Delete aggregated objets. - // ************************* - if(_masqueInfo) - delete _masqueInfo; - - if(_genTrans) - delete _genTrans; - - Inherit::_preDestroy(); -} - - -void Transistor::_postCreate() -// ******************************* -{ - Inherit::_postCreate(); - - (Net::create(this, Name("DRAIN")))->setExternal(true); - (Net::create(this, Name("SOURCE")))->setExternal(true); - (Net::create(this, Name("GRID")))->setExternal(true); - (Net::create(this, Name("BULK")))->setExternal(true); - - // By default, transistor's length and heigth is NULL, and is internal. - // ******************************************************************** - _masqueInfo = new MaskV1Info(0.0, 0.0); -} - - -string Transistor::_getString() const { - string s = Inherit::_getString(); - s.insert(s.length()-1, " " + getString(_polarity)); - s.insert(s.length()-1, " " + getAbutmentType()._getString()); - return s; -} - - -Record* Transistor::_getRecord() const { - Record* record = Inherit::_getRecord(); - return record; -} - - -Transistor::MaskVersion Transistor::_getMaskInfoVersion(MaskInfo* masqueinfo) -// *************************************************************************************** -{ - if(!masqueinfo) - throw Error("Error : In Transistor::_getMaskInfoVersion, param masqueinfo is NULL"); - - if(dynamic_cast(masqueinfo)) - return MaskVersion(MaskVersion::VERSION1); - - throw Error("Error : In Transistor::_getMaskInfoVersion, can't dynamic cast param masqueinfo"); - return MaskVersion(MaskVersion::VERSION1); -} - - -Transistor::MaskInfo* Transistor::_createMaskInfo(const MaskVersion& version) -// ******************************************************************************* -{ - switch((const MaskVersion::Code&)version) { - case MaskVersion::VERSION1 : - return new MaskV1Info(0.0, 0.0); - - default : - throw Error ("Error : In Transistor::_createMaskInfoBy, unknown param version"); - return NULL; - } -} - - -void Transistor::setMaskInfo(MaskInfo* masqueinfo) -// *************************************************** -{ - if(!masqueinfo) - throw Error("Error : In Transistor::createLayout : masqueinfo is NULL"); - - // Set new Param. - // *************** - MaskVersion newversion = _getMaskInfoVersion(masqueinfo); - MaskVersion oldversion = _getMaskInfoVersion(_masqueInfo); - - if(newversion == oldversion) { // If they are the same version. - if((*_masqueInfo)==(*masqueinfo)) // If they are identical. - return; - else - (*_masqueInfo)=(*masqueinfo); - } - else { // If change the version. - delete _masqueInfo; - _masqueInfo = _createMaskInfo(newversion); - (*_masqueInfo) == (*masqueinfo); - } -} - - -void Transistor::createLayout() -// **************************** -{ - MaskVersion version = _getMaskInfoVersion(_masqueInfo); - MaskV1Info* masquev1info = NULL; - - // Select algorithme with technology and masque version. - // ***************************************************** - switch((const MaskVersion::Code&)version) { - - case MaskVersion::VERSION1 : - masquev1info = dynamic_cast(_masqueInfo); - _genTrans = new GenV1Trans(masquev1info); - break; - - default : - break; - } - - setTerminal(false); - - // Launch the selected algorithme. - // ****************************** - _genTrans->Calculate(this); - _genTrans->Generate(this); - - materialize(); - - delete _genTrans; - _genTrans = NULL; - -} - - -void Transistor::duplicateLayout(Transistor* transistor) -// ***************************************************** -{ - UpdateSession::open(); - - setTerminal(false); - - Net * tmp = NULL; - Contact * con = NULL; - Segment * seg = NULL; - - for_each_net(net, transistor->getNets()) - if( !( tmp=getNet(net->getName()) ) ) { // - tmp = Net::create(this, net->getName()); - tmp->setExternal(net->isExternal()); - } - - for_each_component(component, net->getComponents()) - if( (con=dynamic_cast(component)) ){ - Contact::create(tmp, component->getLayer(), con->getX(), con->getY(), con->getWidth(), con->getHeight()); - } - else if( (seg=dynamic_cast(component)) ) { - Vertical::create(tmp, component->getLayer(), seg->getSourceX(), seg->getWidth(), seg->getSourceY(), - seg->getTargetY()); - } - else if( (seg=dynamic_cast(component)) ){ - Horizontal::create(tmp, component->getLayer(), seg->getSourceY(), seg->getWidth(), seg->getSourceX(), - seg->getTargetX()); - } - else - throw Error ("Error : In Transistor::DuplicateLayout, find illegal elem : " + getString(component) + - "In Transistor, all component must be contact or segment" ) ; - end_for - end_for - - setAbutmentBox(transistor->getAbutmentBox()); - - _mapNet2Box.clear(); - - map::iterator i = transistor->_getMapNet2Box()->begin(), - j = transistor->_getMapNet2Box()->end(); - - while(i!=j) { - _mapNet2Box[getNet((*i).first->getName())]=(*i).second; - i++; - } - - materialize(); - - UpdateSession::close(); - -} - -} diff --git a/chamsin/src/analogic/Transistor.cpp.backup b/chamsin/src/analogic/Transistor.cpp.backup new file mode 100644 index 00000000..cdc2c530 --- /dev/null +++ b/chamsin/src/analogic/Transistor.cpp.backup @@ -0,0 +1,462 @@ +// **************************************************************************************************** +// File: Transistor.h +// Authors: Wu YiFei +// Date : 21/12/2006 +// **************************************************************************************************** + +#include "Vertical.h" +#include "Horizontal.h" +#include "UpdateSession.h" +using namespace Hurricane; + +#include "AnalogicalCommons.h" +#include "GenTrans.h" + +#include "Transistor.h" + +namespace Hurricane { + +// **************************************************************************************************** +// Transistor::Polarity implementation +// **************************************************************************************************** + +Transistor::Polarity::Polarity(const Code& code) :_code(code) +{} + + +Transistor::Polarity::Polarity(const Polarity& type) :_code(type._code) +{} + + +Transistor::Polarity& Transistor::Polarity::operator=(const Polarity& type) { + _code = type._code; + return *this; +} + + +string Transistor::Polarity::_getString() const { + switch(_code) { + case N : return "N"; + case P : return "P"; + } + return "ABNORMAL"; +} + + +Record* Transistor::Polarity::_getRecord() const +// ***************************************** +{ + Record* record = new Record(getString(this)); + record->add(getSlot("Code", _code)); + return record; +} + + +// **************************************************************************************************** +// Transistor::MaskVersion implementation +// **************************************************************************************************** +Transistor::MaskVersion::MaskVersion(const Code& code) +// ******************************************************* +:_code(code) +{ +} + +Transistor::MaskVersion::MaskVersion(const MaskVersion& version) +// ******************************************************************* +:_code(version._code) +{ +} + + +Transistor::MaskVersion& Transistor::MaskVersion::operator=(const MaskVersion& version) +// ****************************************************************************************** +{ + _code = version._code; + return *this; +} + + +string Transistor::MaskVersion::_getString() const +// ************************************************* +{ + switch(_code) { + case VERSION1 : return "VERSION1"; + } + return "ABNORMAL"; +} + + +Record* Transistor::MaskVersion::_getRecord() const +// ************************************************** +{ + Record* record = new Record(getString(this)); + record->add(getSlot("Code", _code)); + return record; +} + + +// **************************************************************************************************** +// Transistor::Type implementation +// **************************************************************************************************** +Transistor::Type::Type(const Code& code) +// ************************************* +:_code(code) +{ +} + + +Transistor::Type::Type(const Type& type) +// ************************************* +:_code(type._code) +{ +} + + +Transistor::Type& Transistor::Type::operator=(const Type& type) +// ************************************************************ +{ + _code = type._code; + return *this; +} + + +string Transistor::Type::_getString() const +// ***************************************** +{ + switch(_code) { + case INTERNAL : return "INTERNAL"; + case LEFT : return "LEFT"; + case RIGHT : return "RIGHT"; + case SINGLE : return "SINGLE"; + } + + return "ABNORMAL"; +} + + +Record* Transistor::Type::_getRecord() const +// ***************************************** +{ + Record* record = new Record(getString(this)); + record->add(getSlot("Code", _code)); + return record; +} + + +// **************************************************************************************************** +// Transistor::MaskInfo implementation +// **************************************************************************************************** +Transistor::MaskInfo::MaskInfo(const double& l, const double& w, const Type::Code& type + , const unsigned& nbDrainColumn + , const unsigned& nbSourceColumn) +// **************************************************************************************************** +: _l(l) + , _w(w) + , _type(type) + , _nbDrainColumn(nbDrainColumn) + , _nbSourceColumn(nbSourceColumn) +{}; + + +Transistor::MaskInfo& Transistor::MaskInfo::operator=(const MaskInfo& masqueinfo) +// ************************************************************************************ +{ + _l = masqueinfo.getL(); + _w = masqueinfo.getW(); + _type= masqueinfo.getType(); + _nbDrainColumn = masqueinfo.getNbDrainColumn(); + _nbSourceColumn = masqueinfo.getNbSourceColumn(); + + return *this; +} + + +bool Transistor::MaskInfo::operator==(const MaskInfo& masqueinfo) +// ****************************************************************** +{ + if(_l == masqueinfo.getL() && + _w == masqueinfo.getW() && + _type== masqueinfo.getType() && + _nbDrainColumn == masqueinfo.getNbDrainColumn() && + _nbSourceColumn == masqueinfo.getNbSourceColumn() + ) + return true; + + return false; +} + + +string Transistor::MaskInfo::_getString() const +// ********************************************** +{ + string s = "<" + _getTypeName() + " " + + getString(_l) + " " + + getString(_w) + " " + + _type._getString() + " " + + getString(_nbSourceColumn) + " " + + getString(_nbDrainColumn) + + ">"; + return s; +} + + +Record* Transistor::MaskInfo::_getRecord() const +// *********************************************** +{ + Record * record = new Record(_getString()); + return record; +} + + +// **************************************************************************************************** +// Transistor::MaskV1Info implementation +// **************************************************************************************************** +Transistor::MaskV1Info::MaskV1Info(const double& l, const double& w, const Type::Code& type + , const unsigned& nbDrainColumn + , const unsigned& nbSourceColumn) +// **************************************************************************************************** +: Inherit(l + , w + , type + , nbDrainColumn + , nbSourceColumn + ) +{} + +Transistor::MaskInfo& Transistor::MaskV1Info::operator=(const MaskInfo& masqueinfo) +// ************************************************************************************** +{ +// (*(static_cast(this)))=masqueinfo; + Inherit::operator=(masqueinfo); + + return *this; +} + +bool Transistor::MaskV1Info::operator == (const MaskInfo& masqueinfo) +// ********************************************************************** +{ + //return (*(static_cast(this)))==masqueinfo; + return Inherit::operator==(masqueinfo); +} + + +string Transistor::MaskV1Info::_getString() const +// ************************************************ +{ + string s = Inherit::_getString(); + return s; +} + +Record* Transistor::MaskV1Info::_getRecord() const +// ************************************************* +{ + Record* record = Inherit::_getRecord(); + return record; +} + +// **************************************************************************************************** +// Transistor implementation +// **************************************************************************************************** + +Transistor::Transistor(Library* library, const Name& name, const Polarity& polarity) : + Inherit(library, name), + _polarity(polarity), + _masqueInfo(NULL), + _genTrans(NULL) +{} + + +Transistor* Transistor::create(Library* library, const Name& name, const Polarity& polarity) { + Transistor* transistor = new Transistor(library, name, polarity); + + transistor->_postCreate(); + + return transistor; +} + + + +void Transistor::_preDestroy() { + // Delete aggregated objets. + // ************************* + if(_masqueInfo) + delete _masqueInfo; + + if(_genTrans) + delete _genTrans; + + Inherit::_preDestroy(); +} + + +void Transistor::_postCreate() +// ******************************* +{ + Inherit::_postCreate(); + + (Net::create(this, Name("DRAIN")))->setExternal(true); + (Net::create(this, Name("SOURCE")))->setExternal(true); + (Net::create(this, Name("GRID")))->setExternal(true); + (Net::create(this, Name("BULK")))->setExternal(true); + + // By default, transistor's length and heigth is NULL, and is internal. + // ******************************************************************** + _masqueInfo = new MaskV1Info(0.0, 0.0); +} + + +string Transistor::_getString() const { + string s = Inherit::_getString(); + s.insert(s.length()-1, " " + getString(_polarity)); + s.insert(s.length()-1, " " + getAbutmentType()._getString()); + return s; +} + + +Record* Transistor::_getRecord() const { + Record* record = Inherit::_getRecord(); + return record; +} + + +Transistor::MaskVersion Transistor::_getMaskInfoVersion(MaskInfo* masqueinfo) +// *************************************************************************************** +{ + if(!masqueinfo) + throw Error("Error : In Transistor::_getMaskInfoVersion, param masqueinfo is NULL"); + + if(dynamic_cast(masqueinfo)) + return MaskVersion(MaskVersion::VERSION1); + + throw Error("Error : In Transistor::_getMaskInfoVersion, can't dynamic cast param masqueinfo"); + return MaskVersion(MaskVersion::VERSION1); +} + + +Transistor::MaskInfo* Transistor::_createMaskInfo(const MaskVersion& version) +// ******************************************************************************* +{ + switch((const MaskVersion::Code&)version) { + case MaskVersion::VERSION1 : + return new MaskV1Info(0.0, 0.0); + + default : + throw Error ("Error : In Transistor::_createMaskInfoBy, unknown param version"); + return NULL; + } +} + + +void Transistor::setMaskInfo(MaskInfo* masqueinfo) +// *************************************************** +{ + if(!masqueinfo) + throw Error("Error : In Transistor::createLayout : masqueinfo is NULL"); + + // Set new Param. + // *************** + MaskVersion newversion = _getMaskInfoVersion(masqueinfo); + MaskVersion oldversion = _getMaskInfoVersion(_masqueInfo); + + if(newversion == oldversion) { // If they are the same version. + if((*_masqueInfo)==(*masqueinfo)) // If they are identical. + return; + else + (*_masqueInfo)=(*masqueinfo); + } + else { // If change the version. + delete _masqueInfo; + _masqueInfo = _createMaskInfo(newversion); + (*_masqueInfo) == (*masqueinfo); + } +} + + +void Transistor::createLayout() +// **************************** +{ + MaskVersion version = _getMaskInfoVersion(_masqueInfo); + MaskV1Info* masquev1info = NULL; + + // Select algorithme with technology and masque version. + // ***************************************************** + switch((const MaskVersion::Code&)version) { + + case MaskVersion::VERSION1 : + masquev1info = dynamic_cast(_masqueInfo); + _genTrans = new GenV1Trans(masquev1info); + break; + + default : + break; + } + + setTerminal(false); + + // Launch the selected algorithme. + // ****************************** + _genTrans->Calculate(this); + _genTrans->Generate(this); + + materialize(); + + delete _genTrans; + _genTrans = NULL; + +} + + +void Transistor::duplicateLayout(Transistor* transistor) +// ***************************************************** +{ + UpdateSession::open(); + + setTerminal(false); + + Net * tmp = NULL; + Contact * con = NULL; + Segment * seg = NULL; + + for_each_net(net, transistor->getNets()) + if( !( tmp=getNet(net->getName()) ) ) { // + tmp = Net::create(this, net->getName()); + tmp->setExternal(net->isExternal()); + } + + for_each_component(component, net->getComponents()) + if( (con=dynamic_cast(component)) ){ + Contact::create(tmp, component->getLayer(), con->getX(), con->getY(), con->getWidth(), con->getHeight()); + } + else if( (seg=dynamic_cast(component)) ) { + Vertical::create(tmp, component->getLayer(), seg->getSourceX(), seg->getWidth(), seg->getSourceY(), + seg->getTargetY()); + } + else if( (seg=dynamic_cast(component)) ){ + Horizontal::create(tmp, component->getLayer(), seg->getSourceY(), seg->getWidth(), seg->getSourceX(), + seg->getTargetX()); + } + else + throw Error ("Error : In Transistor::DuplicateLayout, find illegal elem : " + getString(component) + + "In Transistor, all component must be contact or segment" ) ; + end_for + end_for + + setAbutmentBox(transistor->getAbutmentBox()); + + _mapNet2Box.clear(); + + map::iterator i = transistor->_getMapNet2Box()->begin(), + j = transistor->_getMapNet2Box()->end(); + + while(i!=j) { + _mapNet2Box[getNet((*i).first->getName())]=(*i).second; + i++; + } + + materialize(); + + UpdateSession::close(); + +} + +} diff --git a/chamsin/src/analogic/Transistor.h b/chamsin/src/analogic/Transistor.h index 7a36a96d..5e881a4e 100644 --- a/chamsin/src/analogic/Transistor.h +++ b/chamsin/src/analogic/Transistor.h @@ -1,378 +1,34 @@ -// **************************************************************************************************** -// File: Transistor.h -// Authors: Wu YiFei -// Date : 21/12/2006 -// **************************************************************************************************** - -#ifndef HURRICANE_TRANSISTOR -#define HURRICANE_TRANSISTOR +#ifndef TRANSISTOR_H +#define TRANSISTOR_H #include "Cell.h" using namespace Hurricane; -#include "Transistors.h" - namespace Hurricane { -class GenTrans; - - - class Transistor : public Cell { - -//# if !defined(__DOXYGEN_PROCESSOR__) - -// Types -// ***** - - public: typedef Cell Inherit; - - public: class Polarity { - public: enum Code {N=0, P=1}; - - private: Code _code; - - public : Polarity(const Code& code=N); - public : Polarity(const Polarity&); - public : Polarity& operator=(const Polarity&); - - public : operator const Code& () const { return _code; }; - public : const Code& getCode() const { return _code; }; - - public : string _getTypeName() const { return _TName("Transistor::Polarity"); }; - public : string _getString() const; - public : Record* _getRecord() const; - }; - - - - public : class MaskVersion { - public : enum Code { VERSION1=0 }; - - private: Code _code; - - public : explicit MaskVersion(const Code& code=VERSION1); - public : MaskVersion(const MaskVersion&); - public : MaskVersion& operator=(const MaskVersion&); - - public : operator const Code& () const { return _code; }; - public : const Code& getCode() const { return _code; }; - - public : string _getTypeName() const { return _TName("Transistor::MaskVersion"); }; - public : string _getString() const; - public : Record* _getRecord() const; - - }; - - - public : class Type { - // ********* - - public : enum Code { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3}; - - private: Code _code; - - public : explicit Type(const Code& code=INTERNAL); - public : Type(const Type& type); - public : Type& operator=(const Type& type); - public : operator const Code&() const { return _code; }; - - public : void setCode(const Code& code) { _code = code; }; - - public : const Code& getCode() const { return _code; }; - - public : string _getTypeName() const { return _TName("Transistor::Type"); }; - public : string _getString() const; - public : Record* _getRecord() const; - - }; - - - public : class MaskInfo { - // *************** - - // Attributs - // ********* - private : double _l; - private : double _w ; - private : Type _type; - private : unsigned _nbDrainColumn; - private : unsigned _nbSourceColumn; - - // Constructors - // ************ - public : MaskInfo(const double& l, const double& w, const Type::Code& type=Type::INTERNAL - , const unsigned& nbDrainColumn=1 - , const unsigned& nbSourceColumn=1); - - public : virtual MaskInfo& operator=(const MaskInfo&); - - private : MaskInfo(const MaskInfo& ); - - - // Destructors - // *********** - public: virtual ~MaskInfo() {}; - - // Accessors - // ********* - public : const double& getL() const { return _l; }; - public : const double& getW() const { return _w; }; - public : const unsigned & getNbDrainColumn() const { return _nbDrainColumn; }; - public : const unsigned & getNbSourceColumn() const { return _nbSourceColumn; }; - public : const Type& getType() const { return _type; }; - - // Update - // ****** - public : void setL(const double& l) { _l=l;}; - public : void setW(const double& w) { _w=w;}; - public : void setNbDrainColumn(const unsigned& column) { _nbDrainColumn=column; }; - public : void setNbSourceColumn(const unsigned& column) { _nbSourceColumn=column; }; - public : void setType(const Type::Code& code) { _type.setCode(code); }; - public : void setType(const Type& type) { _type = type; }; - - // Predicats - // ********* - - // Operators - // ********* - public : virtual bool operator==(const MaskInfo&); - - // Others - // ****** - public : virtual string _getTypeName() const =0; - public : virtual string _getString() const; - public : virtual Record* _getRecord() const; - - }; - - - public : class MaskV1Info : public MaskInfo { - // ************************************* - - // type - // ***** - public : typedef MaskInfo Inherit ; - - // Attributs - // ********* - - // Constructors - // ************ - public: MaskV1Info(const double& l, const double& w, const Type::Code& type=Type::INTERNAL - , const unsigned& nbDrainColumn = 1 - , const unsigned& nbSourceColumn = 1); - - public : MaskInfo& operator=(const MaskInfo&); - - - // Destructor - // *********** - public : virtual ~MaskV1Info() {}; - - // Operators - // ********* - public : bool operator==(const MaskInfo&); - - // Others - // ********* - public : virtual string _getTypeName() const { return _TName("Transistor::MaskV1Info"); }; - public : virtual string _getString() const; - public : virtual Record* _getRecord() const; - }; - - -# if !defined(__DOXYGEN_PROCESSOR__) - -// Attributes -// ******************* - private : Polarity _polarity; - private : MaskInfo* _masqueInfo; - private : GenTrans * _genTrans; - //public : RealInfo * _realInfo; - - private : map _mapNet2Box; // This Map Is For localize The Position Of Routing. - -# endif - -// Constructors -// ************ -# if !defined(__DOXYGEN_PROCESSOR__) - protected : Transistor(Library* library, const Name& name, const Polarity& polarity); -# endif - - public : static Transistor* create(Library* library, const Name& name, const Polarity& polarity); - -# if !defined(__DOXYGEN_PROCESSOR__) - protected : virtual void _postCreate(); - - -// Destructors -// *********** - protected : ~Transistor() {}; - protected : virtual void _preDestroy(); -# endif - -// Accessors -// ********* - public : const Polarity& getPolarity() const { return _polarity; }; - public : MaskVersion getMaskVersion() const { return _getMaskInfoVersion(_masqueInfo); }; - public : const MaskInfo* getMaskInfo() const { return _masqueInfo; }; - public : const double getL() const { return _masqueInfo->getL(); }; - public : const double getW() const { return _masqueInfo->getW(); }; - public : const unsigned& getNbDrainColumn() const { return _masqueInfo->getNbDrainColumn(); }; - public : const unsigned& getNbSourceColumn() const { return _masqueInfo->getNbSourceColumn(); }; - public : const char* getDrainName() const { return "DRAIN"; }; - public : const char* getSourceName() const { return "SOURCE"; }; - public : const char* getGridName() const { return "GRID"; }; - public : Net* getDrain() const { return getNet(getDrainName()); }; - public : Net* getSource() const { return getNet(getSourceName()); }; - public : Net* getGrid() const { return getNet(getGridName()); }; - public : const Type& getAbutmentType() const { return _masqueInfo->getType(); }; - -// Predicats -// ********* - public : bool isNmos() const { return _polarity==Polarity::N; }; - public : bool isPmos() const { return _polarity==Polarity::P; }; - public : bool isInternal() const { return getAbutmentType().getCode()==Type::INTERNAL; }; - public : bool isLeft() const { return getAbutmentType().getCode()==Type::LEFT; }; - public : bool isRight() const { return getAbutmentType().getCode()==Type::RIGHT; }; - public : bool isSingle() const { return getAbutmentType().getCode()==Type::SINGLE; }; - -// Updators -// ******** - public : void setL(const double& l) { _masqueInfo->setL(l); }; - public : void setW(const double& w) { _masqueInfo->setW(w); }; - -//# endif - -# if !defined(__DOXYGEN_PROCESSOR__) -// Others -// ****** - public : virtual string _getTypeName() const {return _TName("Transistor");}; - public : virtual string _getString() const; - public : virtual Record* _getRecord() const; - public : const GenTrans* _getGenTrans() const {return _genTrans; }; - public : static MaskVersion _getMaskInfoVersion(MaskInfo*) ; - public : static MaskInfo* _createMaskInfo(const MaskVersion&) ; - public : map* _getMapNet2Box() { return &_mapNet2Box; }; - -# endif - -// Operators -// ********* - public : void setMaskInfo(MaskInfo*); - public : void createLayout(); - public : void duplicateLayout(Transistor* transistor) ; - - -}; -#if !defined(__DOXYGEN_PROCESSOR__) - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Transistor::Polarity::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( const Transistor::Polarity::Code* object ) - { - switch ( *object ) { - case Transistor::Polarity::N: return "N"; - case Transistor::Polarity::P: return "P"; - } - return "ABNORMAL"; - } - -template<> - inline Record* ProxyRecord - ( const Transistor::Polarity::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - - - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Transistor::MaskVersion::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( const Transistor::MaskVersion::Code* object ) - { - switch ( *object ) { - case Transistor::MaskVersion::VERSION1: return "VERSION1"; - } - return "ABNORMAL"; - } - -template<> - inline Record* ProxyRecord - ( const Transistor::MaskVersion::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - -// ------------------------------------------------------------------- -// Class : "Proxy...". - -template<> - inline string ProxyTypeName - ( const Transistor::Type::Code* object ) - { return ">"; } - -template<> - inline string ProxyString - ( const Transistor::Type::Code* object ) - { - switch ( *object ) { - case Transistor::Type::LEFT : return "LEFT"; - case Transistor::Type::SINGLE: return "SINGLE"; - case Transistor::Type::RIGHT: return "RIGHT"; - case Transistor::Type::INTERNAL: return "INTERNAL"; - } - return "ABNORMAL"; - } - -template<> - inline Record* ProxyRecord - ( const Transistor::Type::Code* object ) - { - Record* record = new Record(getString(object)); - record->add(getSlot("Code", (unsigned int*)object)); - return record; - } - - -#endif + public: + enum Polarity {N=0, P=1}; + enum AbutmentType { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3}; + + static Transistor* create(Library* library, const Name& name, const Polarity& polarity); + void createLayout(); + void duplicateLayout(); + + bool isNmos() const { return polarity == N; }; + bool isPmos() const { return polarity == P; }; + bool isInternal() const { return abutmentType == INTERNAL; }; + bool isLeft() const { return abutmentType == LEFT; }; + bool isRight() const { return abutmentType == RIGHT; }; + bool isSingle() const { return abutmentType == SINGLE; }; + + private: + Polarity polarity; + AbutmentType abutmentType; + double l; + double w; +}; } - - -// **************************************************************************************************** -// Generic functions -// **************************************************************************************************** - -string getString(const Hurricane::Transistor::MaskInfo&); - - - - -#endif // HURRICANE_TRANSISTOR +#endif // TRANSISTOR_H diff --git a/chamsin/src/analogic/Transistor.h.backup b/chamsin/src/analogic/Transistor.h.backup new file mode 100644 index 00000000..7a36a96d --- /dev/null +++ b/chamsin/src/analogic/Transistor.h.backup @@ -0,0 +1,378 @@ +// **************************************************************************************************** +// File: Transistor.h +// Authors: Wu YiFei +// Date : 21/12/2006 +// **************************************************************************************************** + +#ifndef HURRICANE_TRANSISTOR +#define HURRICANE_TRANSISTOR + +#include "Cell.h" +using namespace Hurricane; + +#include "Transistors.h" + +namespace Hurricane { + +class GenTrans; + + + +class Transistor : public Cell { + +//# if !defined(__DOXYGEN_PROCESSOR__) + +// Types +// ***** + + public: typedef Cell Inherit; + + public: class Polarity { + public: enum Code {N=0, P=1}; + + private: Code _code; + + public : Polarity(const Code& code=N); + public : Polarity(const Polarity&); + public : Polarity& operator=(const Polarity&); + + public : operator const Code& () const { return _code; }; + public : const Code& getCode() const { return _code; }; + + public : string _getTypeName() const { return _TName("Transistor::Polarity"); }; + public : string _getString() const; + public : Record* _getRecord() const; + }; + + + + public : class MaskVersion { + public : enum Code { VERSION1=0 }; + + private: Code _code; + + public : explicit MaskVersion(const Code& code=VERSION1); + public : MaskVersion(const MaskVersion&); + public : MaskVersion& operator=(const MaskVersion&); + + public : operator const Code& () const { return _code; }; + public : const Code& getCode() const { return _code; }; + + public : string _getTypeName() const { return _TName("Transistor::MaskVersion"); }; + public : string _getString() const; + public : Record* _getRecord() const; + + }; + + + public : class Type { + // ********* + + public : enum Code { INTERNAL=0, LEFT=1, RIGHT=2, SINGLE=3}; + + private: Code _code; + + public : explicit Type(const Code& code=INTERNAL); + public : Type(const Type& type); + public : Type& operator=(const Type& type); + public : operator const Code&() const { return _code; }; + + public : void setCode(const Code& code) { _code = code; }; + + public : const Code& getCode() const { return _code; }; + + public : string _getTypeName() const { return _TName("Transistor::Type"); }; + public : string _getString() const; + public : Record* _getRecord() const; + + }; + + + public : class MaskInfo { + // *************** + + // Attributs + // ********* + private : double _l; + private : double _w ; + private : Type _type; + private : unsigned _nbDrainColumn; + private : unsigned _nbSourceColumn; + + // Constructors + // ************ + public : MaskInfo(const double& l, const double& w, const Type::Code& type=Type::INTERNAL + , const unsigned& nbDrainColumn=1 + , const unsigned& nbSourceColumn=1); + + public : virtual MaskInfo& operator=(const MaskInfo&); + + private : MaskInfo(const MaskInfo& ); + + + // Destructors + // *********** + public: virtual ~MaskInfo() {}; + + // Accessors + // ********* + public : const double& getL() const { return _l; }; + public : const double& getW() const { return _w; }; + public : const unsigned & getNbDrainColumn() const { return _nbDrainColumn; }; + public : const unsigned & getNbSourceColumn() const { return _nbSourceColumn; }; + public : const Type& getType() const { return _type; }; + + // Update + // ****** + public : void setL(const double& l) { _l=l;}; + public : void setW(const double& w) { _w=w;}; + public : void setNbDrainColumn(const unsigned& column) { _nbDrainColumn=column; }; + public : void setNbSourceColumn(const unsigned& column) { _nbSourceColumn=column; }; + public : void setType(const Type::Code& code) { _type.setCode(code); }; + public : void setType(const Type& type) { _type = type; }; + + // Predicats + // ********* + + // Operators + // ********* + public : virtual bool operator==(const MaskInfo&); + + // Others + // ****** + public : virtual string _getTypeName() const =0; + public : virtual string _getString() const; + public : virtual Record* _getRecord() const; + + }; + + + public : class MaskV1Info : public MaskInfo { + // ************************************* + + // type + // ***** + public : typedef MaskInfo Inherit ; + + // Attributs + // ********* + + // Constructors + // ************ + public: MaskV1Info(const double& l, const double& w, const Type::Code& type=Type::INTERNAL + , const unsigned& nbDrainColumn = 1 + , const unsigned& nbSourceColumn = 1); + + public : MaskInfo& operator=(const MaskInfo&); + + + // Destructor + // *********** + public : virtual ~MaskV1Info() {}; + + // Operators + // ********* + public : bool operator==(const MaskInfo&); + + // Others + // ********* + public : virtual string _getTypeName() const { return _TName("Transistor::MaskV1Info"); }; + public : virtual string _getString() const; + public : virtual Record* _getRecord() const; + }; + + +# if !defined(__DOXYGEN_PROCESSOR__) + +// Attributes +// ******************* + private : Polarity _polarity; + private : MaskInfo* _masqueInfo; + private : GenTrans * _genTrans; + //public : RealInfo * _realInfo; + + private : map _mapNet2Box; // This Map Is For localize The Position Of Routing. + +# endif + +// Constructors +// ************ +# if !defined(__DOXYGEN_PROCESSOR__) + protected : Transistor(Library* library, const Name& name, const Polarity& polarity); +# endif + + public : static Transistor* create(Library* library, const Name& name, const Polarity& polarity); + +# if !defined(__DOXYGEN_PROCESSOR__) + protected : virtual void _postCreate(); + + +// Destructors +// *********** + protected : ~Transistor() {}; + protected : virtual void _preDestroy(); +# endif + +// Accessors +// ********* + public : const Polarity& getPolarity() const { return _polarity; }; + public : MaskVersion getMaskVersion() const { return _getMaskInfoVersion(_masqueInfo); }; + public : const MaskInfo* getMaskInfo() const { return _masqueInfo; }; + public : const double getL() const { return _masqueInfo->getL(); }; + public : const double getW() const { return _masqueInfo->getW(); }; + public : const unsigned& getNbDrainColumn() const { return _masqueInfo->getNbDrainColumn(); }; + public : const unsigned& getNbSourceColumn() const { return _masqueInfo->getNbSourceColumn(); }; + public : const char* getDrainName() const { return "DRAIN"; }; + public : const char* getSourceName() const { return "SOURCE"; }; + public : const char* getGridName() const { return "GRID"; }; + public : Net* getDrain() const { return getNet(getDrainName()); }; + public : Net* getSource() const { return getNet(getSourceName()); }; + public : Net* getGrid() const { return getNet(getGridName()); }; + public : const Type& getAbutmentType() const { return _masqueInfo->getType(); }; + +// Predicats +// ********* + public : bool isNmos() const { return _polarity==Polarity::N; }; + public : bool isPmos() const { return _polarity==Polarity::P; }; + public : bool isInternal() const { return getAbutmentType().getCode()==Type::INTERNAL; }; + public : bool isLeft() const { return getAbutmentType().getCode()==Type::LEFT; }; + public : bool isRight() const { return getAbutmentType().getCode()==Type::RIGHT; }; + public : bool isSingle() const { return getAbutmentType().getCode()==Type::SINGLE; }; + +// Updators +// ******** + public : void setL(const double& l) { _masqueInfo->setL(l); }; + public : void setW(const double& w) { _masqueInfo->setW(w); }; + +//# endif + +# if !defined(__DOXYGEN_PROCESSOR__) +// Others +// ****** + public : virtual string _getTypeName() const {return _TName("Transistor");}; + public : virtual string _getString() const; + public : virtual Record* _getRecord() const; + public : const GenTrans* _getGenTrans() const {return _genTrans; }; + public : static MaskVersion _getMaskInfoVersion(MaskInfo*) ; + public : static MaskInfo* _createMaskInfo(const MaskVersion&) ; + public : map* _getMapNet2Box() { return &_mapNet2Box; }; + +# endif + +// Operators +// ********* + public : void setMaskInfo(MaskInfo*); + public : void createLayout(); + public : void duplicateLayout(Transistor* transistor) ; + + +}; +#if !defined(__DOXYGEN_PROCESSOR__) + +// ------------------------------------------------------------------- +// Class : "Proxy...". + +template<> + inline string ProxyTypeName + ( const Transistor::Polarity::Code* object ) + { return ">"; } + +template<> + inline string ProxyString + ( const Transistor::Polarity::Code* object ) + { + switch ( *object ) { + case Transistor::Polarity::N: return "N"; + case Transistor::Polarity::P: return "P"; + } + return "ABNORMAL"; + } + +template<> + inline Record* ProxyRecord + ( const Transistor::Polarity::Code* object ) + { + Record* record = new Record(getString(object)); + record->add(getSlot("Code", (unsigned int*)object)); + return record; + } + + + + + +// ------------------------------------------------------------------- +// Class : "Proxy...". + +template<> + inline string ProxyTypeName + ( const Transistor::MaskVersion::Code* object ) + { return ">"; } + +template<> + inline string ProxyString + ( const Transistor::MaskVersion::Code* object ) + { + switch ( *object ) { + case Transistor::MaskVersion::VERSION1: return "VERSION1"; + } + return "ABNORMAL"; + } + +template<> + inline Record* ProxyRecord + ( const Transistor::MaskVersion::Code* object ) + { + Record* record = new Record(getString(object)); + record->add(getSlot("Code", (unsigned int*)object)); + return record; + } + + +// ------------------------------------------------------------------- +// Class : "Proxy...". + +template<> + inline string ProxyTypeName + ( const Transistor::Type::Code* object ) + { return ">"; } + +template<> + inline string ProxyString + ( const Transistor::Type::Code* object ) + { + switch ( *object ) { + case Transistor::Type::LEFT : return "LEFT"; + case Transistor::Type::SINGLE: return "SINGLE"; + case Transistor::Type::RIGHT: return "RIGHT"; + case Transistor::Type::INTERNAL: return "INTERNAL"; + } + return "ABNORMAL"; + } + +template<> + inline Record* ProxyRecord + ( const Transistor::Type::Code* object ) + { + Record* record = new Record(getString(object)); + record->add(getSlot("Code", (unsigned int*)object)); + return record; + } + + +#endif + +} + + + +// **************************************************************************************************** +// Generic functions +// **************************************************************************************************** + +string getString(const Hurricane::Transistor::MaskInfo&); + + + + +#endif // HURRICANE_TRANSISTOR diff --git a/chamsin/src/device/CMakeLists.txt b/chamsin/src/device/CMakeLists.txt index 53e7c0a0..9497c1a8 100644 --- a/chamsin/src/device/CMakeLists.txt +++ b/chamsin/src/device/CMakeLists.txt @@ -1,5 +1,5 @@ -INCLUDE_DIRECTORIES(${HURRICANE_INCLUDE_DIR} -${CHAMSIN_SOURCE_DIR}/src/dtr ${CHAMSIN_SOURCE_DIR}/src/analogic) +INCLUDE_DIRECTORIES(${CHAMSIN_SOURCE_DIR}/src/dtr ${CHAMSIN_SOURCE_DIR}/src/analogic +${HURRICANE_INCLUDE_DIR}) ADD_LIBRARY(device SHARED Device.cpp TrMos.cpp TrMos_PlaceRoute.cpp) diff --git a/chamsin/src/device/Device.cpp b/chamsin/src/device/Device.cpp index c9aec5e5..e4208e20 100644 --- a/chamsin/src/device/Device.cpp +++ b/chamsin/src/device/Device.cpp @@ -86,23 +86,6 @@ void Device::SaveLogicalView() // } } - - -string Device::_getString() const -// *************************************** -{ - string s= Inherit::_getString(); - return s; -} - -Record* Device::_getRecord() const -// ********************************* -{ - Record* record = Inherit::_getRecord(); - return record; -} - - void Device::_Place(Instance* ins, const Transformation::Orientation& orientation, const Point& point) // ************************************************************************************************** { diff --git a/chamsin/src/device/Device.h b/chamsin/src/device/Device.h index 14d084d5..2744777f 100644 --- a/chamsin/src/device/Device.h +++ b/chamsin/src/device/Device.h @@ -5,39 +5,16 @@ // Date : 21/12/2006 // **************************************************************************************************** -#ifndef DEVICE_DEVICE -#define DEVICE_DEVICE +#ifndef DEVICE_H +#define DEVICE_H #include "Cell.h" -using Hurricane::Cell; -using Hurricane::_TName; - - -namespace Hurricane { - - class Library; - class Name; - class Record; - class Point; - class Transformation; - class Instance; - -} - - -namespace DEVICE { - -using Hurricane::Library; -using Hurricane::Name; -using Hurricane::Record; -using Hurricane::Point; -using Hurricane::Transformation; -using Hurricane::Instance; +using namespace Hurricane; class Device : public Cell { -# if !defined(__DOXYGEN_PROCESSOR__) +#if !defined(__DOXYGEN_PROCESSOR__) // Types // ***** public : typedef Cell Inherit; @@ -52,7 +29,7 @@ class Device : public Cell { protected : virtual void _postCreate(); -# endif +#endif // Operations // ********** @@ -74,9 +51,6 @@ class Device : public Cell { // Others // ****** - public: virtual string _getTypeName() const {return _TName("Device"); }; - public: virtual string _getString() const; - public: virtual Record* _getRecord() const; public : virtual void _Flush() = 0; // Description of Layout @@ -88,10 +62,6 @@ class Device : public Cell { #endif -} ; +}; - -} // end namespace Device - - -#endif +#endif // DEVICE_H diff --git a/chamsin/src/device/TrMos.cpp b/chamsin/src/device/TrMos.cpp index bea0e560..3ebc72bf 100644 --- a/chamsin/src/device/TrMos.cpp +++ b/chamsin/src/device/TrMos.cpp @@ -4,8 +4,6 @@ // Date : 21/12/2006 // **************************************************************************************************** - - #include "Instance.h" #include "MetaTransistor.h" #include "Net.h" @@ -27,8 +25,8 @@ namespace DEVICE { // **************************************************************************************************** TrMos::TrMos(Library* library, const Name& name): - Inherit(library, name), - _polarity(Transistor::Polarity::N), + Device(library, name), + _polarity(Transistor::N), _isBsConnected(false), _m(1), _sourceIsFirst(true), @@ -70,12 +68,6 @@ void TrMos::_postCreate() { } - -Transistors TrMos::getTransistors() const { - return getCollection(_transistorList); -} - - void TrMos::create(const Transistor::Polarity& polarity, const bool isbsconnected) { if( _tr1 ) { diff --git a/chamsin/src/device/TrMos.h b/chamsin/src/device/TrMos.h index 5ed8b894..d470da32 100644 --- a/chamsin/src/device/TrMos.h +++ b/chamsin/src/device/TrMos.h @@ -4,27 +4,19 @@ // Date : 21/12/2006 // **************************************************************************************************** -#ifndef DEVICE_TRMOS -#define DEVICE_TRMOS +#ifndef TRMOS_H +#define TRMOS_H #include "Net.h" using namespace Hurricane; -#include "Device.h" #include "Transistor.h" -#include "MetaTransistor.h" - -namespace DEVICE { +//#include "MetaTransistor.h" +#include "Device.h" class TrMos : public Device { -// ************************** - -# if !defined(__DOXYGEN_PROCESSOR__) -// Types -// ***** - public : typedef Device Inherit; public : enum PinName { D, G, S, B }; @@ -68,18 +60,15 @@ class TrMos : public Device { // ************ protected : TrMos(Library* library, const Name& name); protected : virtual void _postCreate(); -#endif public : static TrMos* create(Library* library, const Name & name); -# if !defined(__DOXYGEN_PROCESSOR__) // Operations // ********** public : virtual void dses() { /* to do */}; public : virtual void shape() { /* to do */}; -#endif public : void create(const Transistor::Polarity& polarity, const bool isbsconnected); @@ -93,7 +82,6 @@ class TrMos : public Device { public : const double getWidthOfSourceWire() const { return _widthOfSourceWire; }; public : const double getWidthOfDrainWire() const { return _widthOfDrainWire; }; public : MetaTransistor* getTr1() const { return _tr1; }; - public : Transistors getTransistors() const ; // Updators // ******** @@ -127,11 +115,8 @@ class TrMos : public Device { public : virtual void _Flush(); protected : void _PlaceAndRoute(); -# endif - -} ; - -} // end of namespace Device - - #endif + +}; + +#endif // TRMOS_H diff --git a/chamsin/src/dtr/DtrAccess.cpp b/chamsin/src/dtr/DtrAccess.cpp index 15761527..ae32d760 100644 --- a/chamsin/src/dtr/DtrAccess.cpp +++ b/chamsin/src/dtr/DtrAccess.cpp @@ -4,12 +4,14 @@ // Date : 21/12/2006 // **************************************************************************************************** -#include "DtrAccess.h" -#include "RdsUnit.h" -#include "Error.h" - #include "DataBase.h" #include "Technology.h" +#include "BasicLayer.h" +#include "Error.h" + +#include "RdsUnit.h" +#include "DtrAccess.h" + extern void ParseDtr(const char*, Hurricane::DtrAccess*); @@ -86,12 +88,9 @@ void DtrAccess::_postCreate() { while(m!=n) { Layer * layer = tech->getLayer(Name(*m)); if(!layer) { - for_each_layer(l, tech->getLayers()) { - cerr << l << endl; - end_for; - } - throw Error("Error : in function DtrAccess::_postCreate , Can't find Layer " - + getString(*m) + " in technology file when parser DtrFile."); + layer = BasicLayer::create(tech, Name(*m), BasicLayer::Type::UNDEFINED, 100); + //throw Error("Error : in function DtrAccess::_postCreate , Can't find Layer " + // + getString(*m) + " in technology file when parser DtrFile."); // cerr << Warning("In function DtrAccess::_postCreate , Can't find Layer " // + getString(*m) + " in technology file when parser DtrFile"); } diff --git a/chamsin/src/tests/AnalogicTest.cpp b/chamsin/src/tests/AnalogicTest.cpp index a2e3910e..5d69fb7c 100644 --- a/chamsin/src/tests/AnalogicTest.cpp +++ b/chamsin/src/tests/AnalogicTest.cpp @@ -15,6 +15,13 @@ int main() { //Library* workLibrary = Library::create(db->getRootLibrary(), Name("WorkLibrary")); //TrMos* trmos = TrMos::create(workLibrary, Name("MosTr")); AEnv::create("toto"); + trmos->create(Transistor::Polarity::P, true); + + trmos->setMosLength(3); + trmos->setMosWidth(3); + + trmos->generate(5, true, false, 3, 3); + exit(0); } catch (Hurricane::Warning& w) { cerr << w.what() << endl;