move analogic features in separate package

This commit is contained in:
The Coriolis Project 2008-03-07 11:42:41 +00:00
parent 5cf6b33727
commit bf59d5b2c4
22 changed files with 0 additions and 3580 deletions

View File

@ -1,5 +1,4 @@
ADD_SUBDIRECTORY(hurricane)
ADD_SUBDIRECTORY(analogic)
ADD_SUBDIRECTORY(viewer)
ADD_SUBDIRECTORY(editor)
ADD_SUBDIRECTORY(pyext)

View File

@ -1,45 +0,0 @@
// ****************************************************************************************************
// File: AnalogicalCommons.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_ANALOGICALCOMMONS
#define HURRICANE_ANALOGICALCOMMONS
// *********************************************************************
// Macros Declaration.
// *********************************************************************
# define TRANSN 'N'
# define TRANSP 'P'
# define MAXNBCONTACT 8
# define IF_DEBUG_HUR_ANALOG \
if(getenv("DEBUG_HUR_ANALOG")) {
# ifndef END_IF
# define END_IF \
}
# endif
// *********************************************************************
// Analogical Unit declaration.
// *********************************************************************
# if !defined(__DOXYGEN_PROCESSOR__)
typedef double Micro;
typedef double MicroPower2;
typedef long Nano;
# endif
#include "TwoSpaces.h"
#endif // HURRICANE_ANALOGICALCOMMONS

View File

@ -1,49 +0,0 @@
set(includes RdsUnit.h)
add_custom_target(DTRParser echo "Creating DTRParser")
set(source_dir ${HURRICANE_SOURCE_DIR}/src/analogic)
set(binary_dir ${HURRICANE_BINARY_DIR}/src/analogic)
add_custom_command(
SOURCE ${source_dir}/ParserDtrScan.ll
COMMAND ${FLEX_EXECUTABLE}
ARGS -Pdtr -o${binary_dir}/ParserDtrScan.cpp
${source_dir}/ParserDtrScan.ll
TARGET DTRParser
OUTPUTS ${binary_dir}/ParserDtrScan.cpp)
add_custom_command(
SOURCE ${source_dir}/ParserDtrGram.yy
COMMAND ${BISON_EXECUTABLE}
ARGS -d -v -p dtr -y ${source_dir}/ParserDtrGram.yy
-o ${binary_dir}/ParserDtrGram.cpp
TARGET DSTParser
DEPENDS ${binary_dir}/ParserDtrScan.cpp
OUTPUTS ${binary_dir}/ParserDtrGram.cpp)
set(DST_SRCS ${DST_SRCS} ${binary_dir}/ParserDtrGram.cpp
${binary_dir}/ParserDtrScan.cpp)
SET_SOURCE_FILES_PROPERTIES(${binary_dir}/ParserDtrGram.cpp GENERATED)
SET_SOURCE_FILES_PROPERTIES(${binary_dir}/ParserDtrScan.cpp GENERATED)
INCLUDE_DIRECTORIES(${binary_dir}
${HURRICANE_SOURCE_DIR}/src/hurricane
${source_dir}
)
add_library(analogic SHARED
${DST_SRCS}
DtrAccess.cpp
GenericDtrAccess.cpp
GenV1Trans.cpp
MetaTransistor.cpp
RdsUnit.cpp
Transistor.cpp
TwoSpaces.cpp)
target_link_libraries(analogic hurricane)
install(FILES ${includes} DESTINATION /include/hurricane)
install(TARGETS analogic DESTINATION /lib)

View File

@ -1,307 +0,0 @@
// ****************************************************************************************************
// File: DtrAccess.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "DtrAccess.h"
#include "RdsUnit.h"
#include "Error.h"
#include "DataBase.h"
#include "Technology.h"
extern void ParseDtr(const char*, Hurricane::DtrAccess*);
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// DtrAccess implementation
// ****************************************************************************************************
// static data defintion
// *********************
DtrAccess* DtrAccess::_instance = NULL;
map<string, DtrAccess*> DtrAccess::_registry;
DtrAccess::DtrAccess()
// *******************
{
}
DtrAccess * DtrAccess::Create()
// *****************************
{
DtrAccess * dtraccess = new DtrAccess();
dtraccess->_PostCreate();
return dtraccess;
}
void DtrAccess::_PostCreate()
// **************************
{
const char * dtrfilename = getenv("DTR_FILE");
if(!dtrfilename) {
throw Error("Can't not get Macro DTR_FILE.");
}
// Use API of DtrParser for get technology informations
// ****************************************************
ParseDtr(dtrfilename, this);
// Traduit Micro to RdsUnit
// ************************
map<string, list<double> >::iterator it_rulemap = _label2ruleMap.begin(),
it_end_rulemap = _label2ruleMap.end();
while(it_rulemap!=it_end_rulemap) {
list<double>::iterator m = ((*it_rulemap).second).begin()
, n = ((*it_rulemap).second).end();
while(m!=n) {
_label2RdsRuleMap[(*it_rulemap).first].push_back(ConvertRealToRdsUnit(*m));
m++;
}
it_rulemap++;
}
// Get Objet Layer from Technology with its name.
// **********************************************
DataBase * db = GetDataBase();
if(!db) throw Error("In GetV1Trans::Generate : can't find DataBase.");
Technology * tech = db->GetTechnology();
map<string, list<string> >::iterator it_layermap = _label2layerNameMap.begin(),
it_end_layermap = _label2layerNameMap.end();
while(it_layermap != it_end_layermap) {
list<string>::iterator m = (*it_layermap).second.begin(),
n = (*it_layermap).second.end();
while(m!=n) {
Layer * layer = tech->GetLayer(Name(*m));
if(!layer) {
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");
}
_label2layerMap[(*it_layermap).first].push_back(layer);
m++;
}
it_layermap++;
}
}
DtrAccess * DtrAccess::Instance()
// *****************************
{
// User or environnement supplies this at startup
// **********************************************
const char * singleton_name = getenv("DTRACCESS_SINGLETON");
if(!singleton_name) { // if MACRO IS INVALID
if(!_instance) {
_instance = DtrAccess::Create();
}
}
else {
if(!_instance){
if( !(_instance=LookUp(string(singleton_name))) ) // if singleton hasn't been registered
_instance = DtrAccess::Create();
}
}
return _instance;
}
void DtrAccess::_PreDelete()
// ***********************
{
// Do something
// ************
}
void DtrAccess::Delete()
// ********************
{
_PreDelete();
delete this;
}
GenericCollection<double> DtrAccess::GetRuleByLabel(const string& label) const
// ***************************************************************************
{
map<string, list<double> >::const_iterator i = _label2ruleMap.find(label);
if(i==_label2ruleMap.end())
throw Error("Can't find in DtrFile rule the label : " + GetString(label));
return GetCollection((*i).second);
}
GenericCollection<long> DtrAccess::GetRdsRuleByLabel(const string& label) const
// ******************************************************************************
{
map<string, list<long> >::const_iterator i = _label2RdsRuleMap.find(label);
if(i==_label2RdsRuleMap.end())
throw Error("Can't find in DtrFile The Rds Value of Rule by label : " + GetString(label));
return GetCollection((*i).second);
}
GenericCollection<string> DtrAccess::GetLayerNamesByLabel(const string& label) const
// *********************************************************************************
{
map<string, list<string> >::const_iterator i = _label2layerNameMap.find(label);
if(i==_label2layerNameMap.end())
throw Error("Can't find in DtrFile layers the label : " + label);
return GetCollection((*i).second);
}
GenericCollection<Layer*> DtrAccess::GetLayersByLabel(const string& label) const
// ******************************************************************************
{
map<string, list<Layer*> >::const_iterator i = _label2layerMap.find(label);
if(i==_label2layerMap.end())
throw Error("Can't find in DtrFile objet Layer by label : " + label );
return GetCollection((*i).second);
}
GenericCollection<double> DtrAccess::GetElectricalsByLabel(const string& label) const
// **********************************************************************************
{
map<string, list<double> >::const_iterator i = _label2electricalMap.find(label);
if(i==_label2electricalMap.end())
throw Error("Can't find in DtrFile electricals by label : " + label);
return GetCollection((*i).second);
}
int DtrAccess::GetModellingByLabel(const string& label) const
// **********************************************************
{
map<string, int>::const_iterator i = _label2modellingMap.find(label);
if(i==_label2modellingMap.end())
throw Error("Can't find in DtrFile modelling by label : " + GetString(label));
return (*i).second;
}
double DtrAccess::GetSimpleCapaMimByLabel(const string& label) const
// ****************************************************************
{
map<string, double>::const_iterator i = _label2simplecapamimMap.find(label);
if(i==_label2simplecapamimMap.end())
throw Error("Can't find in DtrFile simple capa mim by label : " + GetString(label));
return (*i).second;
}
// ------------------------------------------------------
// Function "DtrAccess::LookUp(const string&)".
//
/* \static DtrAccess* DtrAccess::LookUp(const string& singletonname)
* \param singletonname normally the name of derive class of DtrAccess.
* \return addresse of objet singleton of derive class if success.
* NULL if failure.
*
* Find the singleton objet if it exist according to the singletonname.
*
*/
DtrAccess* DtrAccess::LookUp(const string& singletonname)
// ******************************************************
{
map<string, DtrAccess*>::iterator i = _registry.find(singletonname);
if(i==_registry.end())
return NULL;
return (*i).second;
}
// ------------------------------------------------------------------------
// Function Register(const string&, DtrAccess*)
/* \void DtrAccess::Register(const string& singletonname, DtrAccess* dtraccess)
* \param singletonname the name of derive class.
* \param dtraccess addresse of objet singleton of derive class.
*
*
* This function is to be called when the singleton objet of derive class is
* created.
*
*/
void DtrAccess::Register(const string& singletonname, DtrAccess* dtraccess)
// *************************************************************************
{
_registry[singletonname]=dtraccess;
}
string DtrAccess::_GetString() const
// **********************************
{
string s("Singleton DtrAccess");
return s;
}
Record* DtrAccess::_GetRecord() const
// **********************************
{
Record* record = new Record(_GetString());
return record;
}
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::DtrAccess& access)
// **********************************************
{
return access._GetString();
}

View File

@ -1,187 +0,0 @@
// ****************************************************************************************************
// File: DtrAccess.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_DTRACCESS
#define HURRICANE_DTRACCESS
#include "Layer.h"
#include "Layers.h"
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class DtrAccess {
// **************
// Types
// *****
# if !defined(__DOXYGEN_PROCESSOR__)
// Attributes
// **********
private : static DtrAccess * _instance;
private : map<string, list<double> > _label2ruleMap;
private : map<string, list<string> > _label2layerNameMap;
private : map<string, list<double> > _label2electricalMap;
private : map<string, int> _label2modellingMap;
private : map<string, double> _label2simplecapamimMap;
private : map<string, list<long> > _label2RdsRuleMap;
private : map<string, list<Layer*> > _label2layerMap;
// For reusability of software
// ***************************
private : static map<string, DtrAccess*> _registry;
// Constructors
// ************
protected : DtrAccess();
private : DtrAccess(const DtrAccess&);
private : DtrAccess& operator=(const DtrAccess&);
protected : static DtrAccess * Create();
protected : virtual void _PostCreate();
# endif
public : static DtrAccess* Instance();
// Destructors
// ***********
# if !defined(__DOXYGEN_PROCESSOR__)
protected : virtual ~DtrAccess() {};
protected : virtual void _PreDelete();
# endif
public : virtual void Delete();
// Accessors
// *********
// If can't find data , throw Hurricane::Error
// *******************************************
public : GenericCollection<double> GetRuleByLabel(const string&) const;
public : GenericCollection<long> GetRdsRuleByLabel(const string&) const;
public : GenericCollection<string> GetLayerNamesByLabel(const string&) const;
public : Layers GetLayersByLabel(const string&) const;
public : GenericCollection<double> GetElectricalsByLabel(const string& ) const;
public : int GetModellingByLabel(const string&) const;
public : double GetSimpleCapaMimByLabel(const string&) const;
# if !defined(__DOXYGEN_PROCESSOR__)
public : double GetSingleRealRuleByLabel(const string& s) const
// *************************************************
{
GenericLocator<double> locator = GetRuleByLabel(s).GetLocator();
return locator.GetElement();
}
public : long GetSingleRdsRuleByLabel(const string& s) const
// ************************************************
{
GenericLocator<long> locator = GetRdsRuleByLabel(s).GetLocator();
return locator.GetElement();
}
public : string GetSingleLayerNameByLabel(const string& s) const
// ****************************************************
{
GenericLocator<string> locator = GetLayerNamesByLabel(s).GetLocator();
return locator.GetElement();
}
public : Layer* GetSingleLayerByLabel(const string& s) const
// ************************************************
{
LayerLocator locator = GetLayersByLabel(s).GetLocator();
return locator.GetElement();
}
public : double GetSingleRealRuleByLabel(char* prefix, const string& type, char* suffix) const
// **********************************************************************************
{
return GetSingleRealRuleByLabel(prefix + type + suffix);
}
public : long GetSingleRdsRuleByLabel(char* prefix, const string& type, char* suffix) const
// *******************************************************************************
{
return GetSingleRdsRuleByLabel(prefix + type + suffix);
}
public : string GetSingleLayerNameByLabel(char* prefix, const string& type, const string& suffix) const
// ************************************************************************************
{
return GetSingleLayerNameByLabel(prefix + type + suffix);
}
public : Layer* GetSingleLayerByLabel(char* prefix, const string& type, const string& suffix) const
// ***************************************************************************************
{
return GetSingleLayerByLabel(prefix + type + suffix);
}
# endif
// Updators
// ********
public : void AddRuleByLabel(const string& label, const list<double>& rule){ _label2ruleMap[label]=rule; };
public : void AddLayersByLabel(const string& label, const list<string>& layers) { _label2layerNameMap[label]=layers; };
public : void AddElectricalsByLabel(const string& label, const list<double>& electricals)
{ _label2electricalMap[label]=electricals; };
public : void AddModellingByLabel(const string& label, const int modelling) { _label2modellingMap[label]=modelling; };
public : void AddSimpleCapaMimByLabel(const string& label, const double capamim) { _label2simplecapamimMap[label]=capamim; };
// Operations
// **********
// For reusability of software
// ***************************
protected : static DtrAccess* LookUp(const string&);
protected : static void Register(const string& , DtrAccess* );
# if !defined(__DOXYGEN_PROCESSOR__)
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("DtrAccess");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
public: map<string, list<double> >& _GetLabel2RuleMap() { return _label2ruleMap; };
public: map<string, list<string> >& _GetLabel2LayerNameMap() { return _label2layerNameMap; };
public: map<string, list<double> >& _GetLabel2ElectricalMap()
{ return _label2electricalMap; };
public: map<string, int>& _GetLabel2ModellingMap() { return _label2modellingMap; };
public: map<string, double>& _GetLabel2SimpleCapaMimMap()
{ return _label2simplecapamimMap; };
# endif
};
}
//END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::DtrAccess&);
#endif // HURRICANE_DTRACCESS

View File

@ -1,220 +0,0 @@
// ****************************************************************************************************
// File: GenTrans.h
// Authors: Wu YiFei
// Date : 04/04/2007
// ****************************************************************************************************
#ifndef HURRICANE_GENTRANS
#define HURRICANE_GENTRANS
#include "Transistor.h"
#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()<rw_cont) \
nbcontact = 0; \
else \
nbcontact = (underbox.getHeight()-rw_cont)/(rw_cont + rd_cont) + 1 ;\
\
\
tmp_xcenter = underbox.getXMin() + (rw_cont/2); \
tmp_ycenter = underbox.getYMin() + (rw_cont/2); \
\
\
for(unsigned i=0; i<nbcolumn; i++) { \
\
for(unsigned j=0; j<nbcontact; j++) { \
Contact::Create(net, layer \
, tmp_xcenter \
, tmp_ycenter \
, rw_cont \
, rw_cont \
); \
\
tmp_ycenter += (rw_cont + rd_cont); \
} \
\
tmp_xcenter += (rw_cont + rd_cont); \
tmp_ycenter = underbox.getYMin() + (rw_cont/2); \
}
// ------------------------------------------------------------------
// Macro Function : "BOX_IS_VALID(box)"
// This Macro Function is for check if the box is correctly in the
// grille of fondor. It will check if the value of x,y,dx,dy are all
// pair.
/*
* box the box is to check. must be a objet Box.
*/
# 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 )
BEGIN_NAMESPACE_HURRICANE
class GenTrans {
// *************
// Attributes
// **********
protected : map<string, Box> _mapString2Box;
// Constructors
// *************
public : GenTrans() {};
// Destructors
// ***********
public : virtual ~GenTrans() {};
// Operators
// **********
public : virtual void Calculate(Transistor*) = 0;
public : virtual void Generate(Transistor*) = 0;
};
class GenV1Trans : public GenTrans {
// *********************************
// Types
// *****
public : typedef GenTrans Inherit;
// Attributs
// *********
public : const Transistor::MaskV1Info* _masqueV1Info;
// Constructors
// ************
public : GenV1Trans(Transistor::MaskV1Info*);
// Destructors
// ************
public : virtual ~GenV1Trans() {};
// Operators
// *********
public : virtual void Calculate(Transistor*) ;
public : virtual void Generate(Transistor*) ;
};
END_NAMESPACE_HURRICANE
#endif

View File

@ -1,539 +0,0 @@
// ****************************************************************************************************
// File: GenV1Trans.cpp
// Authors: Wu YiFei
// Date : 04/04/2007
// ****************************************************************************************************
#include "Collection.h"
#include "RdsUnit.h"
#include "GenTrans.h"
#include "DtrAccess.h"
#include "GenericDtrAccess.h"
#include "Technology.h"
#include "UpdateSession.h"
#include "DataBase.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Globals Datas
// ****************************************************************************************************
string segsforsource[] = {string("20"), string("23")};
string segsfordrain[] = {string("40"), string("43")};
string segsforgrid[] = {string("00"), string("01"), string("30"), string("31")};
//string segsforgrid[] = {string("00"), string("30") };
string segsforanonym[] = {string("10"), string("11"), string("12"), string("50")};
// ****************************************************************************************************
// Class GetV1Trans implementation
// ****************************************************************************************************
GenV1Trans::GenV1Trans(Transistor::MaskV1Info* masqueinfo)
// *********************************************************
: _masqueV1Info(masqueinfo)
{
}
void GenV1Trans::Calculate(Transistor* transistor)
// **********************************************
{
DtrAccess * dtraccess = DtrAccess::Instance();
// Check out mask param.
// *********************
if(_masqueV1Info->GetL() < dtraccess->GetSingleRealRuleByLabel("L_TRANS") ||
_masqueV1Info->GetL() > dtraccess->GetSingleRealRuleByLabel("L_TRANS_MAX") ||
_masqueV1Info->GetW() < dtraccess->GetSingleRealRuleByLabel("W_TRANS") ||
_masqueV1Info->GetW() > dtraccess->GetSingleRealRuleByLabel("W_TRANS_MAX") )
throw Error("Can't launch function GenV1Trans::Calculate for " + GetString(transistor)
+ " the L " + GetString(_masqueV1Info->GetL())
+ " or the W " + GetString(_masqueV1Info->GetW())
+ " of this transistor is invalid."
);
if(_masqueV1Info->GetNbSourceColumn() < 1 || _masqueV1Info->GetNbSourceColumn() > MAXNBCONTACT ||
_masqueV1Info->GetNbDrainColumn() < 1 || _masqueV1Info->GetNbDrainColumn() > MAXNBCONTACT )
throw Error("Can't launch function GenV1Trans::Calculate for " + GetString(transistor)
+ " the nbsourcecolumn " + GetString(_masqueV1Info->GetNbSourceColumn())
+ " or the nbdraincolumn " + GetString(_masqueV1Info->GetNbDrainColumn())
+ " of this transistor is invalid."
);
IF_DEBUG_HUR_ANALOG
cout << ts << GetString(transistor) + " 's masqueinfo is " + GetString(_masqueV1Info)
<< endl;
END_IF
// Tempory Variable.
// **************************
long x00, y00, dx00, dy00;
long x10, y10, dx10, dy10;
long x11, y11, dx11, dy11;
long x12, y12, dx12, dy12;
long x20, y20, dx20, dy20;
long x23, y23, dx23, dy23;
long x30, y30, dx30, dy30;
long x31, y31, dx31, dy31;
long x01, y01, dx01, dy01;
long x40, y40, dx40, dy40;
long x43, y43, dx43, dy43;
long x50, y50, dx50, dy50;
long xmin = 999999L, ymin = 999999L;
long realw = 0;
// Tempory Variable.
// **************************
long extension1 = 0;
long extension2 = 0;
long extension3 = 0;
long extension4 = 0;
long ymax = 0;
string mostype; // Get Mos Type (N/P).
if(transistor->IsNmos())
mostype='N';
else
mostype='P';
//string mostype; // Get Mos Type (N/P).
//mostype=transistor->GetType();
// -------------------------------------------------------------
// Begin Calculate.
//long re_imp_acti = GET_RULE_BYNP("RE_", mostype, "IMP_ACTI");
long re_imp_acti = GET_RULE_BYNP("RE_", mostype, "IMP_ACTI");
long re_imp_poly = GET_RULE_BYNP("RE_", mostype, "IMP_POLY");
long re_imp_cont = GET_RULE_BYNP("RE_", mostype, "IMP_CONT");
long re_imp_gate = GET_RULE_BYNP("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") );
dx00 = ConvertRealToRdsUnit(_masqueV1Info->GetL());
realw = ConvertRealToRdsUnit(_masqueV1Info->GetW());
dy00 = realw + 2*(-y00);
SAVE_RECTANGLE("00", x00, y00, dx00, dy00)
// Calculate Rectangle 30
// **********************
// cout << "RD_ACTI_CONT is " << GET_RULE("RD_ACTI_CONT")<<endl;
// cout << "RD_ACTI_POLY is " << GET_RULE("RD_ACTI_POLY")<<endl;
// cout << "RE_POLY_CONT is " << GET_RULE("RE_POLY_CONT")<<endl;
// cout << "MAX RD_ACTI_POLY is " << (MAXLONG(GET_RULE("RD_ACTI_CONT"), GET_RULE("RD_ACTI_POLY") + GET_RULE("RE_POLY_CONT"))) <<endl;
//
dx31 = GET_RULE("RW_CONT") + 2*GET_RULE("RE_POLY_CONT");
if (dx31 >= dx00) {
dx30 = GET_RULE("RW_CONT");
dy30 = dx30;
y30 = 0 + realw + MAXLONG(GET_RULE("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");
}
x30 = x00 + dx00/2 - dx30/2;
SAVE_RECTANGLE("30", x30, y30, dx30, dy30)
// 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");
SAVE_RECTANGLE("31", x31, y31, dx31, dy31)
// Calculate Rectangle 01
// **********************
if ( y31 <= (y00+dy00) ) {
x01 = 0; y01 = 0; dx01 = 0; dy01 = 0;
}
else {
x01 = x00;
y01 = y00 + dy00;
dx01 = dx00;
dy01 = y31 - (y00 + dy00);
}
SAVE_RECTANGLE("01", x01, y01, dx01, dy01)
// Calculate Rectangle 12
// **********************
x12 = MINLONG(x31, x00) - re_imp_poly;
y12 = MINLONG(0 - re_imp_acti, y00 - re_imp_poly);
dx12 = MAXLONG(dx31, dx00) + 2 * re_imp_poly;
ymax = MAXLONG( MAXLONG( y30 + dy30 + re_imp_cont
, MAXLONG(y31 + dy31, y00 + dy00) + re_imp_poly )
, realw + re_imp_acti );
dy12 = ymax - y12 ;
SAVE_RECTANGLE("12", x12, y12, dx12, dy12)
// 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") );
SAVE_RECTANGLE("20", x20, y20, dx20, dy20)
// 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");
dy40 = dy20;
SAVE_RECTANGLE("40", x40, y40, dx40, dy40)
// Calculate Rectangle 10
// **********************
y10 = 0;
x10 = MINLONG(x20 - GET_RULE("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"));
dx10 = 0 - x10 + extension1;
SAVE_RECTANGLE("10", x10, y10, dx10, dy10)
// Calculate Rectangle 23
// ***********************
x23 = x10;
y23 = y10;
dx23 = 0 - x10;
dy23 = realw;
SAVE_RECTANGLE("23", x23, y23, dx23, dy23)
// Calculate Rectangle 43
// **********************
x43 = x00 + dx00 ;
y43 = y10;
dx43 = x10 + dx10 - (x00 + dx00);
dy43 = realw;
SAVE_RECTANGLE("43", x43, y43, dx43, dy43)
// Calculate Rectangle 11
// **********************
extension1 = re_imp_gate;
extension2 = re_imp_cont + 0 - x20;
extension3 = re_imp_acti + 0 - x10;
extension4 = MAXLONG(MAXLONG(extension1, extension2), extension3);
x11 = 0 - extension4;
extension1 = re_imp_gate + x00 + dx00;
extension2 = re_imp_cont + x40 + dx40;
extension3 = re_imp_acti + x10 + dx10;
extension4 = MAXLONG(MAXLONG(extension1, extension2), extension3);
dx11 = 0 - x11 + extension4;
y11 = MINLONG(y20 - re_imp_cont, y23 - re_imp_acti);
ymax = MAXLONG(y20 + dy20 + re_imp_cont, y23 + dy23 + re_imp_acti);
dy11 = ymax - y11;
SAVE_RECTANGLE("11", x11, y11, dx11, dy11);
// 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");
SAVE_RECTANGLE("50", x50, y50, dx50, dy50);
}
// End Calculate.
// -------------------------------------------------------------
// Translate rectangles.
// *********************
map<string, Box>::iterator i = _mapString2Box.begin(),
j = _mapString2Box.end();
while(i!=j) {
_mapString2Box[(*i).first] = (*i).second.translate(-xmin, -ymin);
IF_DEBUG_HUR_ANALOG
cout << ts << (*i).first <<" " << GetString((*i).second) << endl;
END_IF
assert(BOX_IS_VALID((*i).second));
i++;
}
}
void GenV1Trans::Generate(Transistor* transistor)
// *********************************************
{
OpenUpdateSession();
Net* source = transistor->GetNet(Name(transistor->GetSourceName()));
Net* drain = transistor->GetNet(Name(transistor->GetDrainName()) );
Net* grid = transistor->GetNet(Name(transistor->GetGridName()) );
DtrAccess * dtraccess = DtrAccess::Instance();
//string mostype(1, transistor->GetType()); // Get Mos Type (N/P).
string mostype; // Get Mos Type (N/P).
if(transistor->IsNmos())
mostype='N';
else
mostype='P';
long rw_cont = GetUnit(GET_RULE("RW_CONT"));
long rd_cont = GetUnit(GET_RULE("RD_CONT"));
unsigned nbcontact = 0;
long tmp_xcenter = 0;
long tmp_ycenter = 0;
DataBase * db = GetDataBase();
if(!db) throw Error("In GetV1Trans::Generate : can't find DataBase");
//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");
// -------------------------------------------------------------
// Begin Generation.
// Cenerate Components For Net Source.
// ***********************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Source of " << GetString(transistor) << endl;
END_IF
for(size_t i=0; i<sizeof(segsforsource)/sizeof(string); i++) {
if(segsforsource[i]=="20") {
//cout << ts << " Begin create contact for source , Under Box is " << GetString(GET_BOX(segsforsource[i])) <<endl;
Box underbox = GET_BOX(segsforsource[i]);
CREATE_CONTACT_MATRIX_UNDER(underbox, transistor->GetNbSourceColumn(), layer_20, source)
//cout << ts << " Finish create contact for source " <<endl;
}
else {
Contact::Create(source, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforsource[i])
, GET_BOX(segsforsource[i]).getXCenter()
, GET_BOX(segsforsource[i]).getYCenter()
, GET_BOX(segsforsource[i]).getWidth()
, GET_BOX(segsforsource[i]).getHeight()
);
}
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Source of " << GetString(transistor) << endl;
END_IF
// Generate Components For Net Grid.
// *********************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Grid of " << GetString(transistor) << endl;
END_IF
for(size_t i=0; i<sizeof(segsforgrid)/sizeof(string); i++) {
if(segsforgrid[i]=="30"){
if( GET_BOX(segsforgrid[i]).getWidth()==GET_RULE("RW_CONT") ) {
Contact::Create(grid, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforgrid[i])
, GET_BOX(segsforgrid[i]).getXCenter()
, GET_BOX(segsforgrid[i]).getYCenter()
, GET_BOX(segsforgrid[i]).getWidth()
, GET_BOX(segsforgrid[i]).getHeight()
);
}
else {
unsigned int nbcolumn = (GET_BOX(segsforgrid[i]).getWidth()-rw_cont)/(rw_cont + rd_cont) + 1;
IF_DEBUG_HUR_ANALOG
cout << ts << "nbcolumn in rectangle 30 is " << nbcolumn <<endl;
END_IF
Box underbox = GET_BOX(segsforgrid[i]);
CREATE_CONTACT_MATRIX_UNDER(underbox, nbcolumn, layer_30, grid)
}
}
else {
if(GET_BOX(segsforgrid[i]).getXMin() < GET_BOX(segsforgrid[i]).getXMax()) {
Contact::Create(grid, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsforgrid[i])
, GET_BOX(segsforgrid[i]).getXCenter()
, GET_BOX(segsforgrid[i]).getYCenter()
, GET_BOX(segsforgrid[i]).getWidth()
, GET_BOX(segsforgrid[i]).getHeight()
);
}
}
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Grid of " << GetString(transistor) << endl;
END_IF
// Generate Components For Net Drain.
// **********************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Drain of " << GetString(transistor) << endl;
END_IF
for(size_t i=0; i<sizeof(segsfordrain)/sizeof(string); i++) {
if(segsfordrain[i]=="40") {
//cout << ts << " Begin create contact for drain, Under Box is " << GetString(GET_BOX(segsforsource[i])) <<endl;
Box underbox = GET_BOX(segsfordrain[i]);
CREATE_CONTACT_MATRIX_UNDER(underbox, transistor->GetNbDrainColumn(), layer_40, drain)
//cout << ts << " Finish create contact for drain" <<endl;
}
else {
Contact::Create(drain, GET_LAYER_BYNP("TRANS_",mostype,"_LAYER_"+segsfordrain[i])
, GET_BOX(segsfordrain[i]).getXCenter()
, GET_BOX(segsfordrain[i]).getYCenter()
, GET_BOX(segsfordrain[i]).getWidth()
, GET_BOX(segsfordrain[i]).getHeight()
);
}
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Drain of " << GetString(transistor) << endl;
END_IF
// Generate Components For Anonyms Nets.
// *************************************
IF_DEBUG_HUR_ANALOG
cout << ts << "Begin for create components for net Anonyme of " << GetString(transistor) << endl;
END_IF
Net * anonym = Net::Create(transistor, Name("anonym"));
for(size_t i=0; i<sizeof(segsforanonym)/sizeof(string);i++) {
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()
);
}
IF_DEBUG_HUR_ANALOG
cout << ts << "End for create components for net Anonyme of " << GetString(transistor) << endl;
END_IF
// End Generation.
// -------------------------------------------------------------
CloseUpdateSession();
// Set Transistor::_mapNet2Box.
// ****************************
(*(transistor->_GetMapNet2Box()))[grid] = _mapString2Box[string("30")];
(*(transistor->_GetMapNet2Box()))[source] = _mapString2Box[string("20")];
(*(transistor->_GetMapNet2Box()))[drain] = _mapString2Box[string("40")];
cout<< GetString(_mapString2Box[string("30")]) <<endl;
cout<< GetString(_mapString2Box[string("20")]) <<endl;
cout<< GetString(_mapString2Box[string("40")]) <<endl;
// Set Abutment Box.
// *****************
switch(transistor->GetAbutmentType().GetCode()) {
case Transistor::Type::INTERNAL :
transistor->SetAbutmentBox( Box(GET_BOX(string("20")).getXCenter()
, transistor->GetBoundingBox().getYMin()
, GET_BOX(string("40")).getXCenter()
, transistor->GetBoundingBox().getYMax()
)
);
break;
case Transistor::Type::LEFT:
transistor->SetAbutmentBox( Box(GET_BOX(string("11")).getXMin()
, transistor->GetBoundingBox().getYMin()
, GET_BOX(string("40")).getXCenter()
, transistor->GetBoundingBox().getYMax()
)
);
break ;
case Transistor::Type::RIGHT:
transistor->SetAbutmentBox( Box(GET_BOX(string("20")).getXCenter()
, transistor->GetBoundingBox().getYMin()
, GET_BOX(string("11")).getXMax()
, transistor->GetBoundingBox().getYMax()
)
);
break ;
case Transistor::Type::SINGLE:
transistor->SetAbutmentBox( Box(GET_BOX(string("11")).getXMin()
, transistor->GetBoundingBox().getYMin()
, GET_BOX(string("11")).getXMax()
, transistor->GetBoundingBox().getYMax()
)
);
break ;
default :
break;
}
}
END_NAMESPACE_HURRICANE

View File

@ -1,61 +0,0 @@
// ****************************************************************************************************
// File: GenericDtrAccess.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "DtrAccess.h"
#include "GenericDtrAccess.h"
//#include "DtrAccess.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// GenericDtrAccess implementation
// ****************************************************************************************************
GenericDtrAccess GenericDtrAccess::instance(NULL);
GenericDtrAccess::GenericDtrAccess(DtrAccess* dtraccess):_dtrAccess(dtraccess)
// **************************************************************************
{
}
void GenericDtrAccess::Instance(DtrAccess* dtraccess)
// **************************************************
{
if(!(instance._dtrAccess))
instance._dtrAccess = dtraccess;
}
GenericDtrAccess::~GenericDtrAccess()
// *********************************
{
if(_dtrAccess) { cout<<GetString(_dtrAccess)<<" is delete "<<endl; _dtrAccess->Delete();}
}
string GenericDtrAccess::_GetString() const
// ****************************************
{
string s("Singleton GenericDtrAccess");
return s;
}
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::GenericDtrAccess& access)
// ************************************************
{
return access._GetString();
}

View File

@ -1,77 +0,0 @@
// ****************************************************************************************************
// File: GenericDtrAccess.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_GENERICDTRACCESS
#define HURRICANE_GENERICDTRACCESS
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class DtrAccess;
class GenericDtrAccess {
// *********************
// Types
// *****
# if !defined(__DOXYGEN_PROCESSOR__)
// Attributes
// **********
private : static GenericDtrAccess instance;
private : DtrAccess * _dtrAccess;
// Constructors
// ************
protected : GenericDtrAccess(DtrAccess*);
private : GenericDtrAccess(const GenericDtrAccess&);
private : GenericDtrAccess& operator=(const GenericDtrAccess&);
# endif
public : static void Instance(DtrAccess*);
// Destructors
// ***********
protected : virtual ~GenericDtrAccess();
// Accessors
// *********
// Updators
// ********
// Operations
// **********
# if !defined(__DOXYGEN_PROCESSOR__)
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("GenericDtrAccess");};
public: virtual string _GetString() const;
# endif
};
//END_NAMESPACE_HURRICANE
}
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::GenericDtrAccess&);
#endif // HURRICANE_GENERICDTRACCESS

View File

@ -1,184 +0,0 @@
// ****************************************************************************************************
// File: MetaTransistor.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "MetaTransistor.h"
#include "Transistor.h"
#include "Instances.h"
#include "UpdateSession.h"
#include "Vertical.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// MetaTransistor implementation
// ****************************************************************************************************
MetaTransistor::MetaTransistor(Library* library, const Name& name, char type)
// **************************************************************************
: Inherit(library, name),
_type(type),
_m(1),
_le(0.0),
_we(0.0)
{
}
MetaTransistor* MetaTransistor::Create(Library* library, const Name& name, char type)
// **********************************************************************************
{
MetaTransistor* metatransistor = new MetaTransistor(library, name, type);
metatransistor->_PostCreate();
return metatransistor;
}
void MetaTransistor::_PreDelete()
// ******************************
{
// do something
// ************
Inherit::_PreDelete();
}
void MetaTransistor::_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);
}
void MetaTransistor::CreateConnection()
// ***********************************
{
for_each_instance(instance, this->GetInstances())
Cell * mastercell = instance->GetMasterCell();
// Assurance of unique instanciation
// *********************************
if(mastercell->_GetSlaveInstanceSet()._GetSize()!=1) {
string err_msg = "Can't create connection : " + GetString(mastercell) + " hasn't only one slave instance";
assert(err_msg.c_str());
}
instance->GetPlug(mastercell->GetNet(Name("DRAIN")))->SetNet(GetNet(Name("DRAIN")));
instance->GetPlug(mastercell->GetNet(Name("SOURCE")))->SetNet(GetNet(Name("SOURCE")));
instance->GetPlug(mastercell->GetNet(Name("GRID")))->SetNet(GetNet(Name("GRID")));
instance->GetPlug(mastercell->GetNet(Name("BULK")))->SetNet(GetNet(Name("BULK")));
end_for
}
void MetaTransistor::CreateLayout()
// ********************************
{
// OpenUpdateSession();
if((_le == 0.0) || (_we == 0.0)) {
throw Error("Can't generate layout : " + GetString(this) + " hasn't been dimensionned");
}
SetTerminal(false);
Transistor * internal_ref = NULL;
Transistor * left_ref = NULL;
Transistor * right_ref = NULL;
for_each_instance(instance, this->GetInstances())
Cell * mastercell = instance->GetMasterCell();
// Assurance of unique instanciation
// *********************************
if(mastercell->_GetSlaveInstanceSet()._GetSize()!=1) {
string err_msg = "Can't generate layout : " + GetString(mastercell) + " hasn't only one slave instance";
assert(err_msg.c_str());
}
Transistor * trans = dynamic_cast<Transistor*>(mastercell);
if(!trans){
string err_msg = "Can't genrate layout : " + GetString(mastercell) + " isn't a Transistor";
}
if(trans->IsInternal()) {
if(!internal_ref) {
trans->CreateLayout();
internal_ref = trans;
}
else {
trans->DuplicateLayout(internal_ref);
}
}
else if(trans->IsLeft()) {
if(!left_ref) {
trans->CreateLayout();
left_ref=trans;
}
else
trans->DuplicateLayout(left_ref);
}
else if(trans->IsRight()) {
if(!right_ref) {
trans->CreateLayout();
right_ref=trans;
}
else
trans->DuplicateLayout(right_ref);
}
else
trans->CreateLayout();
end_for
Materialize();
// CloseUpdateSession();
}
void MetaTransistor::Flush()
// *************************
{
OpenUpdateSession();
for_each_instance(instance, this->GetInstances())
Cell * mastercell = instance->GetMasterCell();
instance->Delete();
mastercell->Delete();
end_for
CloseUpdateSession();
}
string MetaTransistor::_GetString() const
// ***************************************
{
string s= Inherit::_GetString();
s.insert(s.length()-1, " " + GetString(GetType()) );
s.insert(s.length()-1, " " + GetString(GetM()) );
return s;
}
Record* MetaTransistor::_GetRecord() const
// ***************************************
{
Record* record = Inherit::_GetRecord();
return record;
}
END_NAMESPACE_HURRICANE

View File

@ -1,133 +0,0 @@
// ****************************************************************************************************
// File: MetaTransistor.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_METATRANSISTOR
#define HURRICANE_METATRANSISTOR
#include "Cell.h"
#include "AnalogicalCommons.h"
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class Library;
class Name;
class Symbol;
class Record;
class MetaTransistor: public Cell {
// ********************************
// Types
// *****
public : typedef Cell Inherit;
# if !defined(__DOXYGEN_PROCESSOR__)
// Logicals Attributes
// *******************
private : char _type;
private : unsigned _m;
private : Micro _le, _we; // length and width expected
private : Micro _lr, _wr; // real length and real width
private : unsigned _nSex, _nDex, nSin, _nDin, _nSsh, _nDsh;
private : Micro _dgg, _de;
private : MicroPower2 _as, _ad;
private : Micro _ps, _pd;
private : double _capaDrain, _capaGate, _capaSource;
private : double _cgb, _cgs, _cdb, _cds, _csb, _cgd;
// Behaviorals attributes
// **********************
private : double _temp, _vds, _vgs; // DC
private : double _vg, _vd, _vs, _vb;
private : char _region;
private : double _ids;
private : double _vth, _vdsat; // AC
# endif
// Constructors
// ************
# if !defined(__DOXYGEN_PROCESSOR__)
protected : MetaTransistor(Library* library, const Name& name, char type);
# endif
public : static MetaTransistor* Create(Library* library, const Name& name, char type);
# if !defined(__DOXYGEN_PROCESSOR__)
protected : virtual void _PostCreate();
// Destructors
// ***********
protected : ~MetaTransistor() {};
protected : virtual void _PreDelete();
# endif
// Operations
// **********
// Create the connection between all instances.
// ********************************************
public : void CreateConnection();
// Create the layout of all motifs in this metatransistor.
// *******************************************************
public : void CreateLayout();
# if !defined(__DOXYGEN_PROCESSOR__)
// Get all paramters after generation of Layout (capa..).
// *****************************************************
public : void GetParameterOfGeneration() { /* to do */};
// Delete all instances and all motifs in this metatransistor.
// ***********************************************************
public : void Flush();
# endif
// Accessors
// *********
public : const Micro& GetLe() const { return _le; };
public : const Micro& GetWe() const { return _we; };
public : const char GetType() const { return _type; };
public : const unsigned GetM() const { return _m; };
// Updators
// ********
public : void SetLe (const Micro le) { _le=le; };
public : void SetWe (const Micro we) { _we=we; };
public : void SetType(const char type) { _type=type; };
public : void SetM (const unsigned m) { _m=m; };
//#endif
# if !defined(__DOXYGEN_PROCESSOR__)
// Others
// ******
public: virtual string _GetTypeName() const {return _TName("MetaTransistor");};
public: virtual string _GetString() const;
public: virtual Record* _GetRecord() const;
# endif
};
}
//END_NAMESPACE_HURRICANE
#endif // HURRICANE_METATRANSISTOR

View File

@ -1,59 +0,0 @@
// ****************************************************************************************************
// File: MetaTransistors.h
// Authors: YIFEI WU
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_METATRANSISTORS
#define HURRICANE_METATRANSISTORS
#include "Collection.h"
BEGIN_NAMESPACE_HURRICANE
class MetaTransistor;
// ****************************************************************************************************
// MetaTransistors declaration
// ****************************************************************************************************
typedef GenericCollection<MetaTransistor*> MetaTransistors;
// ****************************************************************************************************
// MetaTransistorLocator declaration
// ****************************************************************************************************
typedef GenericLocator<MetaTransistor*> MetaTransistorLocator;
// ****************************************************************************************************
// MetaTransistorFilter declaration
// ****************************************************************************************************
typedef GenericFilter<MetaTransistor*> MetaTransistorFilter;
// ****************************************************************************************************
// for_each_metatransistor declaration
// ****************************************************************************************************
#define for_each_metatransistor(metatransistor, metatransistors)\
/******************************/\
{\
MetaTransistorLocator _locator = metatransistors.GetLocator();\
while (_locator.IsValid()) {\
MetaTransistor* metatransistor = _locator.GetElement();\
_locator.Progress();
END_NAMESPACE_HURRICANE
#endif // HURRICANE_METATRANSISTORS

View File

@ -1,72 +0,0 @@
/* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
T_TABLE = 258,
T_TABLE_END = 259,
T_DOUBLE = 260,
T_ID = 261
};
#endif
/* Tokens. */
#define T_TABLE 258
#define T_TABLE_END 259
#define T_DOUBLE 260
#define T_ID 261
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 47 "/home/xtof/workspace/hurricane/src/analogic/ParserDtrGram.yy"
{ double _value;
char * _text;
}
/* Line 1489 of yacc.c. */
#line 65 "/home/xtof/workspace/hurricane/src/analogic/ParserDtrGram.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE dtrlval;

View File

@ -1,202 +0,0 @@
%{
#include <stdio.h>
#include <map>
#include <list>
#include <string>
#include "Error.h"
#include "DtrAccess.h"
using namespace Hurricane;
#include "ParserDtrGram.hpp"
extern FILE * dtrin;
extern int dtrlex(void);
extern char * dtrtext;
extern int DTRlineno;
// *************************************************************************
// Static Function&Data
// *************************************************************************
static int dtrerror( char * message)
// *********************************
{
char * str = (char*)malloc(200*sizeof(char));
sprintf(str, "ParserDtr():\n %s before %s at line %d.\n", message, dtrtext, DTRlineno);
string errmsg = str;
throw Error (errmsg);
return 0;
}
static DtrAccess * dtraccess = NULL;
static char* table_name = NULL;
static list<double> doubleList;
static list<string> stringList;
%}
%union { double _value;
char * _text;
};
%token T_TABLE T_TABLE_END T_DOUBLE T_ID
%type < _value > T_DOUBLE
%type < _text > T_ID
%start file
%%
file: lines tables
;
lines : '\n'
| lines '\n'
;
tables: table
|tables table
;
table: T_TABLE T_ID '\n'
{ table_name = $2; }
items T_TABLE_END lines
;
items: item
|items item
;
item: T_ID elems '\n'
{
string label = $1;
delete $1;
if( strcmp(table_name, "RULES")==0 ) {
if ( doubleList.empty() ) {
dtrerror("ParserDtr detect no data in a line of table RULES : Please check it");
}
list<double>::iterator i = doubleList.begin()
, j = doubleList.end();
while(i!=j) {
(dtraccess->_GetLabel2RuleMap())[label].push_back(*i);
i++;
}
}
else if( strcmp(table_name, "LAYERS")==0 ) {
if ( stringList.empty() ) {
dtrerror("ParserDtr detect no data in a line of table LAYERS : Please check it");
}
list<string>::iterator i = stringList.begin()
, j = stringList.end();
while(i!=j) {
(dtraccess->_GetLabel2LayerNameMap())[label].push_back(*i);;
i++;
}
}
else if( strcmp(table_name, "ELECTRICAL") == 0 ) {
if ( doubleList.empty() ) {
dtrerror("ParserDtr detect no data in a line of table ELECTRICAL : Please check it");
}
list<double>::iterator i = doubleList.begin()
, j = doubleList.end();
while(i!=j) {
(dtraccess->_GetLabel2ElectricalMap())[label].push_back(*i);
i++;
}
}
else if( strcmp(table_name, "MODELLING") == 0 ) {
if ( (doubleList.empty()) || (doubleList.size()!=1) ) {
dtrerror("ParserDtr detect no data or mutli datas in a line of table MODELLING: Please check it");
}
list<double>::iterator i = doubleList.begin();
(dtraccess->_GetLabel2ModellingMap())[label] = (int)(*i);
}
else if( strcmp(table_name, "SIMPLE_CAPA_MIM")==0 ) {
if( (doubleList.empty()) || (doubleList.size()!=1) ) {
dtrerror("ParserDtr detect no data or mutli datas in a line of table SIMPLE_CAPA_MIM : Please check it");
}
list<double>::iterator i = doubleList.begin();
(dtraccess->_GetLabel2SimpleCapaMimMap())[label] = (*i);
}
else {
throw Error("ParserDtr detect unknown table name " + string(table_name));
}
// Vide temporary list
// ********************
doubleList.clear();
stringList.clear();
}
| lines
;
elems: elem
|elems elem
;
elem: T_ID
{
if(!(doubleList.empty())) {
dtrerror("ParserDtr detect incompatibles datas : Please check it");
}
stringList.push_back(string($1));
delete $1;
}
| T_DOUBLE
{
if(!(stringList.empty())) {
dtrerror("ParserDtr detect incompatibles datas : Please check it");
}
doubleList.push_back($1);
}
;
%%
// *************************************************************************
// Generic Function
// *************************************************************************
void ParseDtr(const char* dtrfilename, DtrAccess* dtr)
// ***************************************************
{
dtraccess = dtr;
if((dtrin=fopen(dtrfilename, "r"))==NULL)
{
throw Error("Can't open dtr file : " + string(dtrfilename));
}
dtrparse();
}

View File

@ -1,27 +0,0 @@
%{
#include <map>
#include <vector>
#include <iostream>
using namespace std;
#include "ParserDtrGram.hpp"
#define YY_NO_UNPUT
int DTRlineno = 1;
%}
%%
([ \t]+|#.*) {/* nothing to do */}
\n { DTRlineno++; return '\n'; }
TABLE_1DM { return T_TABLE;}
END_TABLE_1DM { return T_TABLE_END;}
[1-9]?[0-9]*(\.)?[0-9]+ { dtrlval._value=atof(dtrtext); return T_DOUBLE;}
[a-zA-Z0-9]+(_?[a-zA-Z0-9]+)* {dtrlval._text=strdup(dtrtext); return T_ID;}
. { return *dtrtext; }
%%
int dtrwrap() {return 1;}

View File

@ -1,260 +0,0 @@
// ****************************************************************************************************
// File: RdsUnit.cpp
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "Error.h"
#include "stdio.h"
#include "regex.h"
#include "math.h"
#include "Commons.h"
#include "RdsUnit.h"
// ****************************************************************************************************
// Static data&function
// ****************************************************************************************************
static long RDS_UNIT = -1;
static long RDS_PHYSICAL_GRID = 2;
static long RDS_LAMBDA = -1;
// -----------------------------------------------------------------------
// Function : "GetPattern()".
/* \static char * GetPattern (const string& str, const char* pattern)
* \param str the string to check for regex.
* \param pattern the pattern to find.
*
* Get and return the march substring from str according to the pattern.
*
* \return NULL if Failure.
* \return the according substring if Success.
*/
static char* GetPattern(const string& str, const char* pattern)
// ************************************************************
{
int err;
regex_t preg;
const char *str_request = str.c_str();
const char *str_regex = pattern;
/* (1) */
err = regcomp (&preg, str_regex, REG_EXTENDED);
if (err == 0)
{
int match;
size_t nmatch = 0;
regmatch_t *pmatch = NULL;
nmatch= 1;
pmatch = (regmatch_t*)malloc (sizeof (*pmatch) * nmatch);
if (pmatch)
{
/* (2) */
match = regexec (&preg, str_request, nmatch, pmatch, 0);
/* (3) */
regfree (&preg);
/* (4) */
if (match == 0)
{
char *site = NULL;
int start = pmatch[0].rm_so;
int end = pmatch[0].rm_eo;
size_t size = end - start;
site = (char*)malloc (sizeof (*site) * (size + 1));
if (site)
{
strncpy (site, &str_request[start], size);
site[size] = '\0';
return site;
}
else {
fprintf (stderr, "Memoire insuffisante\n");
exit (EXIT_FAILURE);
}
}
/* (5) */
else if (match == REG_NOMATCH)
{
printf ("%s doesn't accord to %s\n", str_request, str_regex);
return NULL;
}
/* (6) */
else
{
char *text;
size_t size;
/* (7) */
size = regerror (err, &preg, NULL, 0);
text = (char*)malloc (sizeof (*text) * size);
if (text)
{
/* (8) */
regerror (err, &preg, text, size);
fprintf (stderr, "%s\n", text);
free (text);
}
else
{
fprintf (stderr, "Memoire insuffisante\n");
}
exit (EXIT_FAILURE);
}
}
else
{
fprintf (stderr, "Memoire insuffisante\n");
exit (EXIT_FAILURE);
}
}
else {
fprintf (stderr, "Regcomp fail\n");
exit (EXIT_FAILURE);
}
}
// -------------------------------------------------------------------
// Function : "CalculateRdsUnit()".
/* static void CalculateRdsUnit()
*
* Open rds techno file who's name is MACRO RDS_TECHNO_FILE,
* and get values technology : rds_physical_grid, rds_lambda.
* Calculate the RDS_UNIT according to these values.
*
* If RDS_TECHNO_FILE is invalid or operaton of reading values technologys
* fail, a Hurricane Error will be throwed to explain the reason of failure.
*/
static void CalculateRdsUnit()
// ***************************
{
using Hurricane::Error;
const char * rdsfilename = getenv("RDS_TECHNO_NAME");
FILE * rdstechnofile;
if(!rdsfilename) {
throw Error("Can't not find macro RDS_TECHNO_FILE");
}
if( !(rdstechnofile = fopen(rdsfilename, "r")) ) {
throw Error("Can't not open rds techno file : " + GetString(rdsfilename));
}
char buffer[80]; // For stock a line of the rds techno file
double rds_physical_grid = -0.1; // For stock value of physical_grid
double rds_lambda = -0.1; // For stock value of lamba
while(fgets(buffer, 80, rdstechnofile )!=NULL){
string tmp = buffer;
if( tmp.find("define physical_grid")!=string::npos) { // Find the ligne begin with "define physical_grid"
string pattern;
if( (pattern = GetPattern(tmp, "[[:digit:]\\.]+")).size()==0 ) { // Get the value behind
throw Error("Can't get rds_physical_grid : GetPattern(string&, char*) return NULL");
}
if(!Scan(pattern, rds_physical_grid)){ // Convert from string to double
throw Error("Can't get rds_physical_grid " + pattern + " : Hurricane::Scan(string&, double&) return false");
}
}
if( tmp.find("define lambda")!=string::npos ) {
string pattern;
if( (pattern = GetPattern(tmp, "[[:digit:]\\.]+")).size()==0 ) {
throw Error("Can't get rds_lambda : GetPattern(string&, char*) return NULL");
}
if(!Scan(pattern, rds_lambda)){
throw Error("Can't get rds_lambda " + pattern + " : Hurricane::Scan(string&, double&) return false");
}
}
// if rds_physical_grid and rds_lambda are finded, break the loop
// **************************************************************
if( (rds_physical_grid!=-0.1) && (rds_lambda!=-0.1) )
break;
} // end of while
if( (rds_physical_grid==-0.1) && (rds_lambda==-0.1) ) {
throw Error("Can't get rds_physical_grid and rds_lambda from rds techno file : \n" + string(rdsfilename));
}
long rds_physical_grid_nano = (long)rint(rds_physical_grid*(double)1000);
rds_physical_grid_nano = (long)rint( (double)1000/(double)rds_physical_grid_nano );
RDS_UNIT = rds_physical_grid_nano << 1;
long rds_lambda_nano = (long)rint( rds_lambda*(double)1000 );
RDS_LAMBDA = rds_lambda_nano * RDS_UNIT / 1000 ;
fclose(rdstechnofile);
}
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Utilitarians
// ****************************************************************************************************
const long& GetRdsUnit()
// *********************
{
if ( RDS_UNIT == -1)
CalculateRdsUnit();
return RDS_UNIT;
}
const long& GetRdsPhysicalGrid()
// *****************************
{
return RDS_PHYSICAL_GRID;
}
const long& GetRdsLambda()
// ***********************
{
if ( RDS_LAMBDA == -1)
CalculateRdsUnit();
return RDS_LAMBDA;
}
END_NAMESPACE_HURRICANE

View File

@ -1,54 +0,0 @@
// ****************************************************************************************************
// File: RdsUnit.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_RDSUNIT
#define HURRICANE_RDSUNIT
#include <math.h>
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
// ****************************************************************************************************
// Utilitarians
// ****************************************************************************************************
extern const long& GetRdsUnit();
extern const long& GetRdsPhysicalGrid();
extern const long& GetRdsLambda();
// ------------------------------------------------------------------------
// Function : "ConvertRealToRdsUnit(const double&)".
//
/* \inline long ConvertRealToRdsUnit(const double& value)
* \param value the value en Micro to convert to RdsUnit.
*
* Get and return the value en RdsUnit.
*
*/
inline long ConvertRealToRdsUnit(const double& value)
// *******************************************************
{
long tmp_value = (long)rint(value*GetRdsUnit());
return (tmp_value%2)==0?tmp_value:(tmp_value+1);
}
//END_NAMESPACE_HURRICANE
}
#endif // HURRICANE_RDSUNIT

View File

@ -1,505 +0,0 @@
// ****************************************************************************************************
// File: Transistor.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#include "AnalogicalCommons.h"
#include "Transistor.h"
#include "GenTrans.h"
#include "Vertical.h"
#include "Horizontal.h"
#include "UpdateSession.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// 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;
}
bool Transistor::MaskVersion::operator==(const MaskVersion& version) const
// ***************************************************************************
{
return _code==version._code;
}
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;
}
void Transistor::MaskInfo::_PostCreate()
// ***************************************
{
}
void Transistor::MaskInfo::_PreDelete()
// **************************************
{
}
void Transistor::MaskInfo::Delete()
// **********************************
{
_PreDelete();
delete 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::MaskV1Info* Transistor::MaskV1Info::Create(const double& l, const double& w
, const Type::Code& type
, const unsigned& nbDrainColumn
, const unsigned& nbSourceColumn)
// **********************************************************************************************
{
MaskV1Info* masquev1info = new MaskV1Info(l, w, type, nbDrainColumn, nbSourceColumn);
masquev1info->_PostCreate();
return masquev1info;
}
Transistor::MaskInfo& Transistor::MaskV1Info::operator=(const MaskInfo& masqueinfo)
// **************************************************************************************
{
// (*(static_cast<Inherit*>(this)))=masqueinfo;
Inherit::operator=(masqueinfo);
return *this;
}
void Transistor::MaskV1Info::_PostCreate()
// *****************************************
{
Inherit::_PostCreate();
}
void Transistor::MaskV1Info::_PreDelete()
// ****************************************
{
Inherit::_PreDelete();
}
bool Transistor::MaskV1Info::operator == (const MaskInfo& masqueinfo)
// **********************************************************************
{
//return (*(static_cast<Inherit*>(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, char type)
// *******************************************************************
: Inherit(library, name),
_type(type),
_masqueInfo(NULL),
_genTrans(NULL)
{
}
Transistor* Transistor::Create(Library* library, const Name& name, char type)
// **************************************************************************
{
Transistor* transistor = new Transistor(library, name, type);
transistor->_PostCreate();
return transistor;
}
void Transistor::_PreDelete()
// ******************************
{
// Delete aggregated objets.
// *************************
if(_masqueInfo)
_masqueInfo->Delete();
if(_genTrans)
delete _genTrans;
Inherit::_PreDelete();
}
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(_type));
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<MaskV1Info*>(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 MaskV1Info::Create(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.
_masqueInfo->Delete();
_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<MaskV1Info*>(_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)
// *****************************************************
{
OpenUpdateSession();
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<Contact*>(component)) ){
Contact::Create(tmp, component->GetLayer(), con->GetX(), con->GetY(), con->GetWidth(), con->GetHeight());
}
else if( (seg=dynamic_cast<Vertical*>(component)) ) {
Vertical::Create(tmp, component->GetLayer(), seg->GetSourceX(), seg->GetWidth(), seg->GetSourceY(),
seg->GetTargetY());
}
else if( (seg=dynamic_cast<Horizontal*>(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<Net*, Box>::iterator i = transistor->_GetMapNet2Box()->begin(),
j = transistor->_GetMapNet2Box()->end();
while(i!=j) {
_mapNet2Box[GetNet((*i).first->GetName())]=(*i).second;
i++;
}
Materialize();
CloseUpdateSession();
}
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::Transistor::MaskInfo& masqueinfo)
// **********************************************************
{
return masqueinfo._GetString();
}

View File

@ -1,344 +0,0 @@
// ****************************************************************************************************
// File: Transistor.h
// Authors: Wu YiFei
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_TRANSISTOR
#define HURRICANE_TRANSISTOR
#include "Cell.h"
#include "AnalogicalCommons.h"
//BEGIN_NAMESPACE_HURRICANE
namespace Hurricane {
class Library;
class Name;
class Symbol;
class Record;
class GenTrans;
class Transistor : public Cell {
// ********************************
//# if !defined(__DOXYGEN_PROCESSOR__)
// Types
// *****
public : typedef Cell Inherit;
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 : bool operator==(const MaskVersion&) const;
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& );
protected : virtual void _PostCreate();
// Destructors
// ***********
protected: virtual ~MaskInfo() {};
protected: virtual void _PreDelete();
public : virtual void Delete();
// 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: static MaskV1Info* Create(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&);
protected : void _PostCreate();
// Destructor
// ***********
public : virtual ~MaskV1Info() {};
protected: void _PreDelete();
// 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 : char _type;
private : MaskInfo* _masqueInfo;
private : GenTrans * _genTrans;
//public : RealInfo * _realInfo;
private : map<Net*, Box> _mapNet2Box; // This Map Is For localize The Position Of Routing.
# endif
// Constructors
// ************
# if !defined(__DOXYGEN_PROCESSOR__)
protected : Transistor(Library* library, const Name& name, char type);
# endif
public : static Transistor* Create(Library* library, const Name& name, char type);
# if !defined(__DOXYGEN_PROCESSOR__)
protected : virtual void _PostCreate();
// Destructors
// ***********
protected : ~Transistor() {};
protected : virtual void _PreDelete();
# endif
// Accessors
// *********
public : char GetType() const { return _type; };
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 _type==TRANSN; };
public : bool IsPmos() const { return _type==TRANSP; };
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<Net*, Box>* _GetMapNet2Box() { return &_mapNet2Box; };
# endif
// Operators
// *********
public : void SetMaskInfo(MaskInfo*);
public : void CreateLayout();
public : void DuplicateLayout(Transistor* transistor) ;
};
# if !defined(__DOXYGEN_PROCESSOR__)
// -------------------------------------------------------------------
// Class : "Proxy...<const Transistor::MaskVersion::Code*>".
template<>
inline string ProxyTypeName<Transistor::MaskVersion::Code>
( const Transistor::MaskVersion::Code* object )
{ return "<PointerSlotAdapter<Transistor::MaskVersion::Code>>"; }
template<>
inline string ProxyString <Transistor::MaskVersion::Code>
( const Transistor::MaskVersion::Code* object )
{
switch ( *object ) {
case Transistor::MaskVersion::VERSION1: return "VERSION1";
}
return "ABNORMAL";
}
template<>
inline Record* ProxyRecord <Transistor::MaskVersion::Code>
( const Transistor::MaskVersion::Code* object )
{
Record* record = new Record(GetString(object));
record->Add(GetSlot("Code", (unsigned int*)object));
return record;
}
// -------------------------------------------------------------------
// Class : "Proxy...<const Transistor::Type::Code*>".
template<>
inline string ProxyTypeName<Transistor::Type::Code>
( const Transistor::Type::Code* object )
{ return "<PointerSlotAdapter<Transistor::Type::Code>>"; }
template<>
inline string ProxyString <Transistor::Type::Code>
( 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 <Transistor::Type::Code>
( const Transistor::Type::Code* object )
{
Record* record = new Record(GetString(object));
record->Add(GetSlot("Code", (unsigned int*)object));
return record;
}
# endif
}
//END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::Transistor::MaskInfo&);
#endif // HURRICANE_TRANSISTOR

View File

@ -1,59 +0,0 @@
// ****************************************************************************************************
// File: Transistors.h
// Authors: YIFEI WU
// Date : 21/12/2006
// ****************************************************************************************************
#ifndef HURRICANE_TRANSISTORS
#define HURRICANE_TRANSISTORS
#include "Collection.h"
BEGIN_NAMESPACE_HURRICANE
class Transistor;
// ****************************************************************************************************
// Transistors declaration
// ****************************************************************************************************
typedef GenericCollection<Transistor*> Transistors;
// ****************************************************************************************************
// TransistorLocator declaration
// ****************************************************************************************************
typedef GenericLocator<Transistor*> TransistorLocator;
// ****************************************************************************************************
// TransistorFilter declaration
// ****************************************************************************************************
typedef GenericFilter<Transistor*> TransistorFilter;
// ****************************************************************************************************
// for_each_transistor declaration
// ****************************************************************************************************
#define for_each_transistor(transistor, transistors)\
/******************************/\
{\
TransistorLocator _locator = transistors.GetLocator();\
while (_locator.IsValid()) {\
Transistor* transistor = _locator.GetElement();\
_locator.Progress();
END_NAMESPACE_HURRICANE
#endif // HURRICANE_TRANSISTORS

View File

@ -1,123 +0,0 @@
// **************************************************************
// TwoSpaces.cpp
// Author : Wu YiFei
// Date : 12/04/2007
// ***************************************************************
#include "TwoSpaces.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Two Spaces definition.
// ****************************************************************************************************
TwoSpaces::TwoSpaces(const string& s)
// *********************************
: _s(s)
,_n(1)
{
}
TwoSpaces::TwoSpaces(const TwoSpaces& ts)
// **************************************
: _s(ts._s)
,_n(ts._n)
{
}
TwoSpaces& TwoSpaces::operator=(const TwoSpaces& ts)
// ************************************************
{
_s = ts._s;
_n = ts._n;
return *this;
}
TwoSpaces& TwoSpaces::operator++()
// *******************************
{
if(_n<100) _n++;
return *this;
}
TwoSpaces TwoSpaces::operator++(int)
// *********************************
{
TwoSpaces ts = *this;
if(_n<100) _n++;
return ts;
}
TwoSpaces& TwoSpaces::operator--()
// *******************************
{
if(_n>1) _n--;
return *this;
}
TwoSpaces TwoSpaces::operator--(int)
// *********************************
{
TwoSpaces ts = *this;
if(_n>1) _n--;
return ts;
}
TwoSpaces TwoSpaces::operator+(int count)
// **************************************
{
TwoSpaces ts = *this;
if( (_n+count) <= 100 ) ts._n = _n + count;
return ts;
}
TwoSpaces TwoSpaces::operator-(int count)
// **************************************
{
TwoSpaces ts = *this;
if ( (_n - count) >= 1 ) ts._n = _n - count;
return ts;
}
string TwoSpaces::_GetString() const
// *********************************
{
string s;
unsigned n = _n;
while(n--) {
s += _s;
}
return s;
}
// ****************************************************************************************************
// Variables definition.
// ****************************************************************************************************
TwoSpaces ts(" ");
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::TwoSpaces& ts)
// ***********************************
{
return ts._GetString();
}

View File

@ -1,72 +0,0 @@
// **************************************************************
// TwoSpaces.h
// Author : Wu YiFei
// Date : 12/04/2007
// ***************************************************************
# ifndef HURRICANE_TWOSPACES
# define HURRICANE_TWOSPACES
# include "Commons.h"
BEGIN_NAMESPACE_HURRICANE
// ****************************************************************************************************
// TwoSpaces declaration.
// ****************************************************************************************************
class TwoSpaces {
// ***************
// Attributes
// **********
private : string _s;
private : unsigned _n;
// Constructors
// *************
public : TwoSpaces(const string& s = " ");
public : TwoSpaces(const TwoSpaces&);
// Destructors
// ***********
public : ~TwoSpaces(){};
// Operators
// *********
public : TwoSpaces& operator=(const TwoSpaces&);
public : TwoSpaces& operator++();
public : TwoSpaces operator++(int);
public : TwoSpaces& operator--();
public : TwoSpaces operator--(int);
public : TwoSpaces operator+(int);
public : TwoSpaces operator-(int);
// Others
// ******
public : string _GetString() const ;
};
// ****************************************************************************************************
// Variables declaration.
// ****************************************************************************************************
extern TwoSpaces ts;
END_NAMESPACE_HURRICANE
// ****************************************************************************************************
// Generic functions
// ****************************************************************************************************
string GetString(const H::TwoSpaces&);
inline ostream& operator<<(ostream& stream, const H::TwoSpaces& ts)
// ****************************************************************
{
return stream<< GetString(ts);
}
# endif // END HURRICANE_TWOSPACES