From 8bc0ade86925ce24a5ea503348c90cca5e0a14e3 Mon Sep 17 00:00:00 2001 From: Pierre Nguyen Tuong Date: Thu, 8 Aug 2002 19:47:37 +0000 Subject: [PATCH] Ajout au niveau logique des capacites, resistances et inductances. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modifications de: typedef struct lofig /* logical figure */ { struct lofig *NEXT ; /* next figure */ struct chain *MODELCHAIN ; /* list of models */ struct locon *LOCON ; /* connector list head */ struct losig *LOSIG ; /* signal list head */ struct ptype *BKSIG ; /* signal block list head */ struct loins *LOINS ; /* instance list head */ struct lotrs *LOTRS ; /* transistor list head */ struct locap *LOCAP ; /* capacitance list head */ struct lores *LORES ; /* resistance list head */ struct loself *LOSELF ; /* inductor list head */ char *NAME ; /* figure name (unique) */ char MODE ; /* 'A' or 'P' */ struct ptype *USER ; /* Application specific */ } lofig_list ; Ajout de : ***** LOCAP: * Structure typedef struct locap /* analog capacitance */ { struct locap *NEXT ; /* next capacitor */ struct locon *TCON ; /* top plate connector */ struct locon *BCON ; /* bottom plate connector */ char *NAME ; /* capacitor instance name */ double CAPA ; /* capacitor value (unite FF) */ char TYPE ; /* capacitor type */ struct ptype *USER ; /* application specific */ } locap_list ; Notes : le TYPE est necessaire pour la generation d'une netlist spice. Il existe plusieurs types de modeles spice de capacites. : Les capacités parasites pourront être attachées aux signaux sur les connecteurs. * Fonctions: locap_list *addlocap(lofig_list *ptfig,char type,double capa,losig_list *pttcon,losig_list *ptbcon,char *name) int dellocap(lofig_list *ptfig,locap_list *ptcap) locap_list *getlocap(lofig_list *ptfig,const char *name) void dellocapuser(locap_list *) ***** LORES: * Structure typedef struct lores /* analog resistor */ { struct lores *NEXT ; /* next resistor */ struct locon *RCON1 ; /* first connector */ struct locon *RCON2 ; /* second connector */ char *NAME ; /* resistor instance name */ double RESI ; /* resistance value (ohms) */ char TYPE ; /* resistor type */ struct ptype *USER ; /* application specific */ } lores_list ; Note: Les capacités parasites pourront être attachées aux signaux sur les connecteurs. * Fonctions lores_list *addlores(lofig_list *ptfig,double resi,losig_list *ptrcon1,losig_list *ptrcon2,char *name) int dellores(lofig_list *ptfig,lores_list *ptres) lores_list *getlores(lofig_list *ptfig,const char *name) void delloresuser(lores_list *) ***** LOSELF * Structure typedef struct loself /* analog inductor */ { struct loself *NEXT ; /* next inductor */ struct locon *SCON1 ; /* first connector */ struct locon *SCON2 ; /* second connector */ char *NAME ; /* inductor instance name */ double SELF ; /* inductance value (unite H) */ char TYPE ; /* inductor type */ struct ptype *USER ; /* application specific */ } loself_list ; Note: Les capacités parasites (PB et les résistances parasites ? le coeff de qualité ?) pourront être attachées aux signaux sur les connecteurs. * Fonctions loself_list *addloself(lofig_list *ptfig,double self,losig_list *ptscon1,losig_list *ptscon2,char *name) int delloself(lofig_list *ptfig,loself_list *ptself) loself_list *getloself(lofig_list *ptfig,const char *name) void delloselfuser(loself_list *) --- alliance/src/mbk/src/mbk_lo.c | 855 ++++++++++++++++++++++++++++- alliance/src/mbk/src/mbk_lo.h | 27 +- alliance/src/mbk/src/mbk_lo_util.c | 593 +++++++++++++++++++- alliance/src/mbk/src/mbk_lo_util.h | 16 +- alliance/src/mbk/src/mlo.h | 151 ++++- alliance/src/mbk/src/mlu.h | 16 +- 6 files changed, 1647 insertions(+), 11 deletions(-) diff --git a/alliance/src/mbk/src/mbk_lo.c b/alliance/src/mbk/src/mbk_lo.c index 06bac0ce..b2812131 100644 --- a/alliance/src/mbk/src/mbk_lo.c +++ b/alliance/src/mbk/src/mbk_lo.c @@ -27,9 +27,10 @@ * Author : Frederic Petrot * Modified by Czo 1997,98 * Modified by 1997,98 + * Modified by pnt 2002 */ -#ident "$Id: mbk_lo.c,v 1.1 2002/03/08 13:51:05 fred Exp $" +#ident "$Id: mbk_lo.c,v 1.2 2002/08/08 19:47:37 pnt Exp $" #include #include @@ -73,6 +74,9 @@ char *name; ptfig->MODELCHAIN = NULL; ptfig->LOINS = NULL; ptfig->LOTRS = NULL; + ptfig->LOCAP = NULL; + ptfig->LORES = NULL; + ptfig->LOSELF = NULL; ptfig->LOCON = NULL; ptfig->LOSIG = NULL; ptfig->BKSIG = NULL; @@ -111,6 +115,9 @@ char *name = namealloc(fname); fig->MODELCHAIN = NULL; fig->LOINS = NULL; fig->LOTRS = NULL; + fig->LOCAP = NULL; + fig->LORES = NULL; + fig->LOSELF = NULL; fig->LOCON = NULL; fig->LOSIG = NULL; fig->BKSIG = NULL; @@ -443,6 +450,9 @@ losig_list *ptsig; loins_list *ptins; locon_list *ptcon; lotrs_list *pttrs; +locap_list *ptcap; +lores_list *ptres; +loself_list *ptself; ptype_list *pt; char *name = namealloc(fname); @@ -503,6 +513,46 @@ void *ptold=NULL, *ptt; dellotrsuser( pttrs ); mbkfree((void *)pttrs); } + + for(ptcap = ptfig -> LOCAP ; ptcap != NULL ; ptcap = (locap_list *)ptold) + { + delloconuser(ptcap -> TCON) ; + delloconuser(ptcap -> BCON) ; + + mbkfree((void *)ptcap -> TCON) ; + mbkfree((void *)ptcap -> BCON) ; + ptold = (void *)ptcap -> NEXT ; + + dellocapuser(ptcap) ; + mbkfree((void *)ptcap) ; + } + + for(ptres = ptfig -> LORES ; ptres != NULL ; ptres = (lores_list *)ptold) + { + delloconuser(ptres -> RCON1) ; + delloconuser(ptres -> RCON2) ; + + mbkfree((void *)ptres -> RCON1) ; + mbkfree((void *)ptres -> RCON2) ; + ptold = (void *)ptres -> NEXT ; + + delloresuser(ptres) ; + mbkfree((void *)ptres) ; + } + + for(ptself = ptfig -> LOSELF ; ptself != NULL ; ptself = (loself_list *)ptold) + { + delloconuser(ptself -> SCON1) ; + delloconuser(ptself -> SCON2) ; + + mbkfree((void *)ptself -> SCON1) ; + mbkfree((void *)ptself -> SCON2) ; + ptold = (void *)ptself -> NEXT ; + + delloselfuser(ptself) ; + mbkfree((void *)ptself) ; + } + dellofiguser( ptfig ); freechain(ptfig->MODELCHAIN); mbkfree((void *)ptfig); @@ -842,6 +892,9 @@ locon_list *ptcon = NULL; losig_list *ptsig = NULL; loins_list *ptins = NULL; lotrs_list *pttrs = NULL; +locap_list *ptcap = NULL; +lores_list *ptres = NULL; +loself_list *ptself = NULL; ptype_list *ptype = NULL; if (ptfig->MODE == 'P') { @@ -903,8 +956,48 @@ ptype_list *ptype = NULL; (void *)pttrs->BULK); } } + + /* scan capacitor list */ + + for(ptcap = ptfig -> LOCAP ; ptcap != NULL ; ptcap = ptcap -> NEXT) + { + ptsig = ptcap -> TCON -> SIG ; + ptype = getptype(ptsig -> USER,(long)LOFIGCHAIN) ; + ptype -> DATA = (void *)addchain((chain_list *)ptype -> DATA,(void *)ptcap -> TCON) ; + + ptsig = ptcap -> BCON -> SIG ; + ptype = getptype(ptsig -> USER,(long)LOFIGCHAIN) ; + ptype -> DATA = (void *)addchain((chain_list *)ptype -> DATA,(void *)ptcap -> BCON) ; + } + + /* scan resistor list */ + + for(ptres = ptfig -> LORES ; ptres != NULL ; ptres = ptres -> NEXT) + { + ptsig = ptres -> RCON1 -> SIG ; + ptype = getptype(ptsig -> USER,(long)LOFIGCHAIN) ; + ptype -> DATA = (void *)addchain((chain_list *)ptype -> DATA,(void *)ptres -> RCON1) ; + + ptsig = ptres -> RCON2 -> SIG ; + ptype = getptype(ptsig -> USER,(long)LOFIGCHAIN) ; + ptype -> DATA = (void *)addchain((chain_list *)ptype -> DATA,(void *)ptres -> RCON2) ; + } + + /* scan inductor list */ + + for(ptself = ptfig -> LOSELF ; ptself != NULL ; ptself = ptself -> NEXT) + { + ptsig = ptself -> SCON1 -> SIG ; + ptype = getptype(ptsig -> USER,(long)LOFIGCHAIN) ; + ptype -> DATA = (void *)addchain((chain_list *)ptype -> DATA,(void *)ptself -> SCON1) ; + + ptsig = ptself -> SCON2 -> SIG ; + ptype = getptype(ptsig -> USER,(long)LOFIGCHAIN) ; + ptype -> DATA = (void *)addchain((chain_list *)ptype -> DATA,(void *)ptself -> SCON2) ; + } + if (DEBUG_MODE == 'Y') - (void)printf("--- mbk --- lofigchain %s\n", ptfig->NAME); + (void)printf("--- mbk --- lofigchain %s\n", ptfig -> NAME) ; } /******************************************************************************* @@ -966,6 +1059,9 @@ locon_list *ptcon; losig_list *ptsig; loins_list *ptins; lotrs_list *pttrs; +locap_list *ptcap; +lores_list *ptres; +loself_list *ptself; chain_list *scanchain; ptype_list *pt; @@ -1006,6 +1102,42 @@ ptype_list *pt; else for (pttrs = ptfig->LOTRS; pttrs; pttrs = pttrs->NEXT) viewlotrs(pttrs); + if(ptfig -> LOCAP == NULL) + { + (void)printf(" |---empty capacitor list\n") ; + } + else + { + for(ptcap = ptfig -> LOCAP ; ptcap ; ptcap = ptcap -> NEXT) + { + viewlocap(ptcap) ; + } + } + + if(ptfig -> LORES == NULL) + { + (void)printf(" |---empty resistor list\n") ; + } + else + { + for(ptres = ptfig -> LORES ; ptres ; ptres = ptres -> NEXT) + { + viewlores(ptres) ; + } + } + + if(ptfig -> LOSELF == NULL) + { + (void)printf(" |---empty inductor list\n") ; + } + else + { + for(ptself = ptfig -> LOSELF ; ptself ; ptself = ptself -> NEXT) + { + viewloself(ptself) ; + } + } + if (ptfig->USER != NULL) { (void)printf(" |---USER field\n"); @@ -1154,6 +1286,15 @@ num_list *scannum; case 'T': printf( "(T%c : %s) ",((lotrs_list*)((locon_list*)ptchain->DATA)->ROOT)->TYPE==TRANSN?'N':'P',((lotrs_list*)((locon_list*)ptchain->DATA)->ROOT)->TRNAME ? ((lotrs_list*)((locon_list*)ptchain->DATA)->ROOT)->TRNAME : "No name" ); break; + case 'C': + printf( "(C%s : %s) ",((locap_list*)((locon_list*)ptchain->DATA)->ROOT)->TYPE==CAPMIM?"CAPMIM":"CAPPNWELL",((locap_list*)((locon_list*)ptchain->DATA)->ROOT)-> NAME ? ((locap_list*)((locon_list*)ptchain->DATA)->ROOT)->NAME : "No name" ); + break; + case 'R': + printf( "(C%s : %s) ",((lores_list*)((locon_list*)ptchain->DATA)->ROOT)->TYPE==RESMIM?"RESMIM":"RESMIM",((lores_list*)((locon_list*)ptchain->DATA)->ROOT)-> NAME ? ((lores_list*)((locon_list*)ptchain->DATA)->ROOT)->NAME : "No name" ); + break; + case 'S': + printf( "(C%s : %s) ",((loself_list*)((locon_list*)ptchain->DATA)->ROOT)->TYPE==SELFMIM?"SELFMIM":"SELFMIM",((loself_list*)((locon_list*)ptchain->DATA)->ROOT)-> NAME ? ((loself_list*)((locon_list*)ptchain->DATA)->ROOT)->NAME : "No name" ); + break; case 'I': printf( "(I : %s) ",((loins_list*)((locon_list*)ptchain->DATA)->ROOT)->INSNAME ? ((loins_list*)((locon_list*)ptchain->DATA)->ROOT)->INSNAME : "No name" ); break; @@ -1293,6 +1434,18 @@ else (void)printf(" | | |---root : %s\n" , ((lotrs_list*)(ptcon->ROOT))->TRNAME?((lotrs_list*)(ptcon->ROOT))->TRNAME:"no transistor name" ); break; + case 'C': + (void)printf(" | | |---root : %s\n" , + ((locap_list*)(ptcon->ROOT))->NAME?((locap_list*)(ptcon->ROOT))->NAME:"no capacitor name" ); + break; + case 'R': + (void)printf(" | | |---root : %s\n" , + ((lores_list*)(ptcon->ROOT))->NAME?((lores_list*)(ptcon->ROOT))->NAME:"no resistor name" ); + break; + case 'S': + (void)printf(" | | |---root : %s\n" , + ((loself_list*)(ptcon->ROOT))->NAME?((loself_list*)(ptcon->ROOT))->NAME:"no inductor name" ); + break; default: (void)printf(" | | |---root : *** BAD TYPE ***\n" ); } @@ -1572,3 +1725,701 @@ void dellosiguser(losig_list *ptlosig) prev = scanptype; } } + +/***********************************************************************************************/ +/*********************************** Analogical World ******************************************/ +/***********************************************************************************************/ + +/*********************************** Capacitor : add *******************************************/ + +locap_list *addlocap(lofig_list *ptfig,char type,double capa,losig_list *pttplate, + losig_list *ptbplate,char *name) +{ + static char *tplate = NULL ; + static char *bplate = NULL ; + locap_list *ptcap = NULL ; + locon_list *ptcon = NULL ; + + tplate = namealloc("tplate"); + bplate = namealloc("bplate"); + + if((type != CAPMIM) && (type != CAPPNWELL)) + { + (void)fflush(stdout) ; + (void)fprintf(stderr, "*** mbk error ***\n") ; + (void)fprintf(stderr, " illegal capacitor type : %ld\n",(long)type) ; + EXIT(1) ; + } + + ptcap = (locap_list *)mbkalloc(sizeof(locap_list)) ; + ptcap -> TYPE = type ; + ptcap -> NEXT = ptfig -> LOCAP ; + ptfig -> LOCAP = ptcap ; + ptcap -> USER = NULL ; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon -> NAME = tplate ; + ptcon -> SIG = pttplate ; + ptcon -> ROOT = (void *)ptcap ; + ptcon -> TYPE = TRANSCV2 ; + ptcon -> DIRECTION = INTERNAL ; + ptcon -> USER = NULL ; + ptcon -> PNODE = NULL ; + ptcap -> TCON = ptcon ; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)) ; + ptcon -> NAME = bplate ; + ptcon -> SIG = ptbplate ; + ptcon -> ROOT = (void *)ptcap ; + ptcon -> TYPE = TRANSCV2 ; + ptcon -> DIRECTION = INTERNAL ; + ptcon -> USER = NULL ; + ptcon -> PNODE = NULL ; + ptcap -> BCON = ptcon ; + + /* No check is done for capacitor name unicity */ + ptcap -> NAME = namealloc(name) ; + + if(TRACE_MODE == 'Y') + { + (void)fprintf(stdout,"--- mbk --- addlocap : %s\n",type == CAPMIM ? "CAPMIM" : "CAPPNWELL") ; + } + + return ptcap ; +} + +/*********************************** Capacitor : del *******************************************/ + +int dellocap(lofig_list *ptfig,locap_list *ptcap) +{ + locap_list *pt = NULL ; + locap_list *ptsav = NULL ; + + for(pt = ptfig -> LOCAP ; pt != NULL ; pt = pt -> NEXT) + { + if(pt == ptcap) + { + break ; + } + + ptsav = pt ; + } + + if(pt == NULL) + { + return 0 ; + } + else + { + if(pt == ptfig -> LOCAP) + { + ptfig -> LOCAP = pt -> NEXT ; + } + else + { + ptsav -> NEXT = pt -> NEXT ; + } + } + + if(pt -> TCON -> PNODE) + { + delrcnlocon(pt -> TCON) ; + } + + delloconuser(pt -> TCON) ; + mbkfree((void *)pt -> TCON) ; + + if(pt -> BCON -> PNODE) + { + delrcnlocon(pt -> BCON) ; + } + + delloconuser(pt -> BCON) ; + mbkfree((void *)pt -> BCON) ; + + dellocapuser(pt) ; + mbkfree((void *)pt) ; + + if(TRACE_MODE == 'Y') + { + (void)fprintf(stdout, "--- mbk --- dellocap : \n") ; + } + + return 1 ; +} + +/*********************************** Capacitor : getlocap **************************************/ + +locap_list *getlocap(lofig_list *ptfig, const char *cname) +{ + locap_list *ptcap = NULL ; + char *name = namealloc(cname) ; + + for(ptcap = ptfig -> LOCAP ; ptcap != NULL ; ptcap = ptcap -> NEXT) + { + if(ptcap -> NAME == name) + { + return ptcap ; + } + } + + (void)fflush(stdout) ; + (void)fprintf(stderr,"*** mbk error ***\n") ; + (void)fprintf(stderr,"getlocap impossible :\n") ; + (void)fprintf(stderr,"capacitor %s doesn't exist in figure %s\n",name,ptfig -> NAME) ; + EXIT(1) ; + + return NULL ; /* never reached */ +} + +/*********************************** Capacitor : viewlocap *************************************/ + +void viewlocap(locap_list *ptcap) +{ + (void)printf(" |---capacitor\n") ; + (void)printf(" | |---type : %s\n",IsCapMIM(ptcap->TYPE)?"MIM":"POLY/NWELL") ; + + if(ptcap -> NAME != NULL) + { + (void)printf(" | |---name : %s\n", ptcap -> NAME) ; + } + else + { + (void)printf(" | |---no name\n") ; + } + + if(ptcap -> TCON == NULL) + { + (void)printf(" | |--- !!! no signal on top plate !!! \n") ; + } + else + { + viewloinscon(ptcap -> TCON) ; + } + + if(ptcap -> BCON == NULL) + { + (void)printf(" | |--- !!! no signal on bottom plate !!! \n") ; + } + else + { + viewloinscon(ptcap -> BCON) ; + } + + (void)printf(" | |---capa : %ld\n", ptcap -> CAPA) ; + + if(ptcap -> USER != NULL) + { + (void)printf(" | |---non empty USER field\n") ; + } + + (void)printf(" |\n") ; +} + +/*********************************** Capacitor : dellocapuser **********************************/ + +void dellocapuser(locap_list *ptlocap) +{ + ptype_list *scanptype = NULL ; + ptype_list *next = NULL ; + ptype_list *prev = NULL ; + int del = 0 ; + + for(scanptype = ptlocap -> USER ; scanptype != NULL ; scanptype = next) + { + next = scanptype -> NEXT ; + del = 0 ; + + switch(scanptype -> TYPE) + { + case LOCAP_INFO : mbkfree(scanptype -> DATA) ; + del = 1 ; + break ; + default : +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n",scanptype -> TYPE) ; +#endif + } + + if(del) + { + if(prev != NULL) + { + ptlocap -> USER = next ; + } + else + { + prev -> NEXT = next ; + } + + scanptype -> NEXT = NULL ; + freeptype(scanptype ) ; + } + else + { + prev = scanptype ; + } + } +} + +/*********************************** Resistor : add ********************************************/ + +lores_list *addlores(lofig_list *ptfig,char type,double resi,losig_list *ptrcon1, + losig_list *ptrcon2,char *name) +{ + static char *rcon1 = NULL ; + static char *rcon2 = NULL ; + lores_list *ptres = NULL ; + locon_list *ptcon = NULL ; + + rcon1 = namealloc("rcon1"); + rcon2 = namealloc("rcon2"); + + if((type != RESMIM) && (type != RESMIM)) + { + (void)fflush(stdout) ; + (void)fprintf(stderr, "*** mbk error ***\n") ; + (void)fprintf(stderr, " illegal resistor type : %ld\n",(long)type) ; + EXIT(1) ; + } + + ptres = (lores_list *)mbkalloc(sizeof(lores_list)) ; + ptres -> TYPE = type ; + ptres -> NEXT = ptfig -> LORES ; + ptfig -> LORES = ptres ; + ptres -> USER = NULL ; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon -> NAME = rcon1 ; + ptcon -> SIG = ptrcon1 ; + ptcon -> ROOT = (void *)ptres ; + ptcon -> TYPE = TRANSCV3 ; + ptcon -> DIRECTION = INTERNAL ; + ptcon -> USER = NULL ; + ptcon -> PNODE = NULL ; + ptres -> RCON1 = ptcon ; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)) ; + ptcon -> NAME = rcon2 ; + ptcon -> SIG = ptrcon2 ; + ptcon -> ROOT = (void *)ptres ; + ptcon -> TYPE = TRANSCV3 ; + ptcon -> DIRECTION = INTERNAL ; + ptcon -> USER = NULL ; + ptcon -> PNODE = NULL ; + ptres -> RCON2 = ptcon ; + + /* No check is done for resistor name unicity */ + ptres -> NAME = namealloc(name) ; + + if(TRACE_MODE == 'Y') + { + (void)fprintf(stdout,"--- mbk --- addlores : %s\n",type == RESMIM ? "RESMIM" : "RESMIM") ; + } + + return ptres ; +} + +/*********************************** Resistor : del ********************************************/ + +int dellores(lofig_list *ptfig,lores_list *ptres) +{ + lores_list *pt = NULL ; + lores_list *ptsav = NULL ; + + for(pt = ptfig -> LORES ; pt != NULL ; pt = pt -> NEXT) + { + if(pt == ptres) + { + break ; + } + + ptsav = pt ; + } + + if(pt == NULL) + { + return 0 ; + } + else + { + if(pt == ptfig -> LORES) + { + ptfig -> LORES = pt -> NEXT ; + } + else + { + ptsav -> NEXT = pt -> NEXT ; + } + } + + if(pt -> RCON1 -> PNODE) + { + delrcnlocon(pt -> RCON1) ; + } + + delloconuser(pt -> RCON1) ; + mbkfree((void *)pt -> RCON1) ; + + if(pt -> RCON2 -> PNODE) + { + delrcnlocon(pt -> RCON2) ; + } + + delloconuser(pt -> RCON2) ; + mbkfree((void *)pt -> RCON2) ; + + delloresuser(pt) ; + mbkfree((void *)pt) ; + + if(TRACE_MODE == 'Y') + { + (void)fprintf(stdout, "--- mbk --- dellores : \n") ; + } + + return 1 ; +} + +/*********************************** Resistor : getlores ***************************************/ + +lores_list *getlores(lofig_list *ptfig, const char *cname) +{ + lores_list *ptres = NULL ; + char *name = namealloc(cname) ; + + for(ptres = ptfig -> LORES ; ptres != NULL ; ptres = ptres -> NEXT) + { + if(ptres -> NAME == name) + { + return ptres ; + } + } + + (void)fflush(stdout) ; + (void)fprintf(stderr,"*** mbk error ***\n") ; + (void)fprintf(stderr,"getlores impossible :\n") ; + (void)fprintf(stderr,"resistor %s doesn't exist in figure %s\n",name,ptfig -> NAME) ; + EXIT(1) ; + + return NULL ; /* never reached */ +} + +/*********************************** Resistor : viewlores ***************************************/ + +void viewlores(lores_list *ptres) +{ + (void)printf(" |---resistor\n") ; + (void)printf(" | |---type : %s\n",IsResMIM(ptres->TYPE)?"MIM":"POLY/NWELL") ; + + if(ptres -> NAME != NULL) + { + (void)printf(" | |---name : %s\n", ptres -> NAME) ; + } + else + { + (void)printf(" | |---no name\n") ; + } + + if(ptres -> RCON1 == NULL) + { + (void)printf(" | |--- !!! no signal on first connector !!! \n") ; + } + else + { + viewloinscon(ptres -> RCON1) ; + } + + if(ptres -> RCON2 == NULL) + { + (void)printf(" | |--- !!! no signal on second connector !!! \n") ; + } + else + { + viewloinscon(ptres -> RCON2) ; + } + + (void)printf(" | |---resi : %ld\n", ptres -> RESI) ; + + if(ptres -> USER != NULL) + { + (void)printf(" | |---non empty USER field\n") ; + } + + (void)printf(" |\n") ; +} + +/*********************************** Resistor : delloresuser ***********************************/ + +void delloresuser(lores_list *ptlores) +{ + ptype_list *scanptype = NULL ; + ptype_list *next = NULL ; + ptype_list *prev = NULL ; + int del = 0 ; + + for(scanptype = ptlores -> USER ; scanptype != NULL ; scanptype = next) + { + next = scanptype -> NEXT ; + del = 0 ; + + switch(scanptype -> TYPE) + { + case LORES_INFO : mbkfree(scanptype -> DATA) ; + del = 1 ; + break ; + default : +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n",scanptype -> TYPE) ; +#endif + } + + if(del) + { + if(prev != NULL) + { + ptlores -> USER = next ; + } + else + { + prev -> NEXT = next ; + } + + scanptype -> NEXT = NULL ; + freeptype(scanptype ) ; + } + else + { + prev = scanptype ; + } + } +} + +/*********************************** Inductor : add ********************************************/ + +loself_list *addloself(lofig_list *ptfig,char type,double self,losig_list *ptscon1, + losig_list *ptscon2,char *name) +{ + static char *scon1 = NULL ; + static char *scon2 = NULL ; + loself_list *ptself = NULL ; + locon_list *ptcon = NULL ; + + scon1 = namealloc("scon1"); + scon2 = namealloc("scon2"); + + if((type != SELFMIM) && (type != SELFMIM)) + { + (void)fflush(stdout) ; + (void)fprintf(stderr, "*** mbk error ***\n") ; + (void)fprintf(stderr, " illegal inductor type : %ld\n",(long)type) ; + EXIT(1) ; + } + + ptself = (loself_list *)mbkalloc(sizeof(loself_list)) ; + ptself -> TYPE = type ; + ptself -> NEXT = ptfig -> LOSELF ; + ptfig -> LOSELF = ptself ; + ptself -> USER = NULL ; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon -> NAME = scon1 ; + ptcon -> SIG = ptscon1 ; + ptcon -> ROOT = (void *)ptself ; + ptcon -> TYPE = TRANSCV4 ; + ptcon -> DIRECTION = INTERNAL ; + ptcon -> USER = NULL ; + ptcon -> PNODE = NULL ; + ptself -> SCON1 = ptcon ; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)) ; + ptcon -> NAME = scon2 ; + ptcon -> SIG = ptscon2 ; + ptcon -> ROOT = (void *)ptself ; + ptcon -> TYPE = TRANSCV4 ; + ptcon -> DIRECTION = INTERNAL ; + ptcon -> USER = NULL ; + ptcon -> PNODE = NULL ; + ptself -> SCON2 = ptcon ; + + /* No check is done for inductor name unicity */ + ptself -> NAME = namealloc(name) ; + + if(TRACE_MODE == 'Y') + { + (void)fprintf(stdout,"--- mbk --- addloself : %s\n",type == SELFMIM ? "SELFMIM" : "SELFMIM") ; + } + + return ptself ; +} + +/*********************************** Inductor : del ********************************************/ + +int delloself(lofig_list *ptfig,loself_list *ptself) +{ + loself_list *pt = NULL ; + loself_list *ptsav = NULL ; + + for(pt = ptfig -> LOSELF ; pt != NULL ; pt = pt -> NEXT) + { + if(pt == ptself) + { + break ; + } + + ptsav = pt ; + } + + if(pt == NULL) + { + return 0 ; + } + else + { + if(pt == ptfig -> LOSELF) + { + ptfig -> LOSELF = pt -> NEXT ; + } + else + { + ptsav -> NEXT = pt -> NEXT ; + } + } + + if(pt -> SCON1 -> PNODE) + { + delrcnlocon(pt -> SCON1) ; + } + + delloconuser(pt -> SCON1) ; + mbkfree((void *)pt -> SCON1) ; + + if(pt -> SCON2 -> PNODE) + { + delrcnlocon(pt -> SCON2) ; + } + + delloconuser(pt -> SCON2) ; + mbkfree((void *)pt -> SCON2) ; + + delloselfuser(pt) ; + mbkfree((void *)pt) ; + + if(TRACE_MODE == 'Y') + { + (void)fprintf(stdout, "--- mbk --- delloself : \n") ; + } + + return 1 ; +} + +/*********************************** Inductor : getloself ***************************************/ + +loself_list *getloself(lofig_list *ptfig, const char *cname) +{ + loself_list *ptself = NULL ; + char *name = namealloc(cname) ; + + for(ptself = ptfig -> LOSELF ; ptself != NULL ; ptself = ptself -> NEXT) + { + if(ptself -> NAME == name) + { + return ptself ; + } + } + + (void)fflush(stdout) ; + (void)fprintf(stderr,"*** mbk error ***\n") ; + (void)fprintf(stderr,"getloself impossible :\n") ; + (void)fprintf(stderr,"inductor %s doesn't exist in figure %s\n",name,ptfig -> NAME) ; + EXIT(1) ; + + return NULL ; /* never reached */ +} + +/*********************************** Inductor : viewloself ***************************************/ + +void viewloself(loself_list *ptself) +{ + (void)printf(" |---inductor\n") ; + (void)printf(" | |---type : %s\n",IsSelfMIM(ptself->TYPE)?"MIM":"POLY/NWELL") ; + + if(ptself -> NAME != NULL) + { + (void)printf(" | |---name : %s\n", ptself -> NAME) ; + } + else + { + (void)printf(" | |---no name\n") ; + } + + if(ptself -> SCON1 == NULL) + { + (void)printf(" | |--- !!! no signal on first connector !!! \n") ; + } + else + { + viewloinscon(ptself -> SCON1) ; + } + + if(ptself -> SCON2 == NULL) + { + (void)printf(" | |--- !!! no signal on second connector !!! \n") ; + } + else + { + viewloinscon(ptself -> SCON2) ; + } + + (void)printf(" | |---self : %ld\n", ptself -> SELF) ; + + if(ptself -> USER != NULL) + { + (void)printf(" | |---non empty USER field\n") ; + } + + (void)printf(" |\n") ; +} + +/*********************************** Inductor : delloselfuser ***********************************/ + +void delloselfuser(loself_list *ptloself) +{ + ptype_list *scanptype = NULL ; + ptype_list *next = NULL ; + ptype_list *prev = NULL ; + int del = 0 ; + + for(scanptype = ptloself -> USER ; scanptype != NULL ; scanptype = next) + { + next = scanptype -> NEXT ; + del = 0 ; + + switch(scanptype -> TYPE) + { + default : +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n",scanptype -> TYPE) ; +#endif + } + + if(del) + { + if(prev != NULL) + { + ptloself -> USER = next ; + } + else + { + prev -> NEXT = next ; + } + + scanptype -> NEXT = NULL ; + freeptype(scanptype ) ; + } + else + { + prev = scanptype ; + } + } +} + diff --git a/alliance/src/mbk/src/mbk_lo.h b/alliance/src/mbk/src/mbk_lo.h index 73bf46cd..5b3fc4d5 100644 --- a/alliance/src/mbk/src/mbk_lo.h +++ b/alliance/src/mbk/src/mbk_lo.h @@ -26,7 +26,8 @@ * Date : 18/12/91 * Author : Frederic Petrot * Modified by Czo 1997,98 - * $Id: mbk_lo.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + * Modified by pnt 2002 + * $Id: mbk_lo.h,v 1.2 2002/08/08 19:47:37 pnt Exp $ */ #ifndef _MBK_LO_H_ @@ -68,6 +69,30 @@ extern void viewlosig __P((losig_list *ptsig)); extern void viewlotrs __P((lotrs_list *pttrs)); +/*************************** Analogical world ***************************************/ + +extern locap_list *addlocap __P((lofig_list *ptfig,char type,double capa,losig_list *pttplate, + losig_list *ptbplate,char *name)) ; +extern int dellocap __P((lofig_list *ptfig,locap_list *ptcap)) ; +extern locap_list *getlocap __P((lofig_list *ptfig,const char *name)) ; +extern void dellocapuser __P((locap_list *)) ; +extern void viewlocap __P((locap_list *ptcap)) ; + +extern lores_list *addlores __P((lofig_list *ptfig,char type,double resi,losig_list *ptrcon1, + losig_list *ptrcon2,char *name)) ; +extern int dellores __P((lofig_list *ptfig,lores_list *ptres)) ; +extern lores_list *getlores __P((lofig_list *ptfig,const char *name)) ; +extern void delloresuser __P((lores_list *)) ; +extern void viewlores __P((lores_list *ptres)) ; + +extern loself_list *addloself __P((lofig_list *ptfig,char type,double self,losig_list *ptscon1, + losig_list *ptscon2,char *name)) ; +extern int delloself __P((lofig_list *ptfig,loself_list *ptself)) ; +extern loself_list *getloself __P((lofig_list *ptfig,const char *name)) ; +extern void delloselfuser __P((loself_list *)) ; +extern void viewloself __P((loself_list *ptself)) ; + +/************************************************************************************/ #endif diff --git a/alliance/src/mbk/src/mbk_lo_util.c b/alliance/src/mbk/src/mbk_lo_util.c index 05272559..40caba67 100644 --- a/alliance/src/mbk/src/mbk_lo_util.c +++ b/alliance/src/mbk/src/mbk_lo_util.c @@ -28,7 +28,7 @@ * Modified by Czo 1997,98 */ -#ident "$Id: mbk_lo_util.c,v 1.1 2002/03/08 13:51:05 fred Exp $" +#ident "$Id: mbk_lo_util.c,v 1.2 2002/08/08 19:47:37 pnt Exp $" #include #include @@ -71,6 +71,9 @@ char *figname = namealloc(fname); ptfig->MODELCHAIN = NULL; ptfig->LOINS = NULL; ptfig->LOTRS = NULL; + ptfig->LOCAP = NULL; + ptfig->LORES = NULL; + ptfig->LOSELF = NULL; ptfig->LOCON = NULL; ptfig->LOSIG = NULL; ptfig->BKSIG = NULL; @@ -186,6 +189,9 @@ void flattenlofig(lofig_list *ptfig, const char *iname, char concat) int verif; lotrs_list *scantrs; + locap_list *scancap; + lores_list *scanres; + loself_list *scanself; loins_list *scanins; int i; @@ -941,6 +947,90 @@ while(ptfig->LOINS != NULL) scanchain->DATA = concatname( insname, (char*)(scanchain->DATA) ); } } + + for(scancap = figins -> LOCAP ; scancap != NULL ; scancap = scancap -> NEXT) + { + if(scancap -> NAME != NULL) + { + scancap -> NAME = concatname(insname,scancap -> NAME) ; + } + + ptptype = getptype(scancap -> TCON -> USER,PNODENAME) ; + + if(ptptype) + { + for(scanchain = (chain_list *)(ptptype -> DATA) ; scanchain ; scanchain = scanchain->NEXT) + { + scanchain -> DATA = concatname(insname,(char *)(scanchain -> DATA)) ; + } + } + + ptptype = getptype( scancap -> BCON -> USER,PNODENAME) ; + + if(ptptype) + { + for(scanchain = (chain_list *)(ptptype -> DATA) ; scanchain ; scanchain = scanchain->NEXT) + { + scanchain -> DATA = concatname(insname,(char *)(scanchain -> DATA)) ; + } + } + } + + for(scanres = figins -> LORES ; scanres != NULL ; scanres = scanres -> NEXT) + { + if(scanres -> NAME != NULL) + { + scanres -> NAME = concatname(insname,scanres -> NAME) ; + } + + ptptype = getptype(scanres -> RCON1 -> USER,PNODENAME) ; + + if(ptptype) + { + for(scanchain = (chain_list *)(ptptype -> DATA) ; scanchain ; scanchain = scanchain->NEXT) + { + scanchain -> DATA = concatname(insname,(char *)(scanchain -> DATA)) ; + } + } + + ptptype = getptype( scanres -> RCON2 -> USER,PNODENAME) ; + + if(ptptype) + { + for(scanchain = (chain_list *)(ptptype -> DATA) ; scanchain ; scanchain = scanchain->NEXT) + { + scanchain -> DATA = concatname(insname,(char *)(scanchain -> DATA)) ; + } + } + } + + for(scanself = figins -> LOSELF ; scanself != NULL ; scanself = scanself -> NEXT) + { + if(scanself -> NAME != NULL) + { + scanself -> NAME = concatname(insname,scanself -> NAME) ; + } + + ptptype = getptype(scanself -> SCON1 -> USER,PNODENAME) ; + + if(ptptype) + { + for(scanchain = (chain_list *)(ptptype -> DATA) ; scanchain ; scanchain = scanchain->NEXT) + { + scanchain -> DATA = concatname(insname,(char *)(scanchain -> DATA)) ; + } + } + + ptptype = getptype( scanself -> SCON2 -> USER,PNODENAME) ; + + if(ptptype) + { + for(scanchain = (chain_list *)(ptptype -> DATA) ; scanchain ; scanchain = scanchain->NEXT) + { + scanchain -> DATA = concatname(insname,(char *)(scanchain -> DATA)) ; + } + } + } } for( scanins = figins->LOINS ; scanins ; scanins = scanins->NEXT ) @@ -959,9 +1049,23 @@ while(ptfig->LOINS != NULL) ptfig->LOTRS = (lotrs_list*)append( (chain_list*)figins->LOTRS, (chain_list*)ptfig->LOTRS ); + ptfig->LOCAP = (locap_list*)append( (chain_list*)figins->LOCAP, + (chain_list*)ptfig->LOCAP ); + + ptfig->LORES = (lores_list*)append( (chain_list*)figins->LORES, + (chain_list*)ptfig->LORES ); + + ptfig->LOSELF = (loself_list*)append( (chain_list*)figins->LOSELF, + (chain_list*)ptfig->LOSELF ); + figins->LOINS = NULL; figins->LOTRS = NULL; + figins->LOCAP = NULL; + figins->LORES = NULL; + figins->LOSELF = NULL; + + for( scanlocon = figins->LOCON ; scanlocon ; scanlocon = nextlocon ) { nextlocon = scanlocon->NEXT; @@ -989,6 +1093,9 @@ while(ptfig->LOINS != NULL) figins->BKSIG || figins->LOINS || figins->LOTRS || + figins->LOCAP || + figins->LORES || + figins->LOSELF || figins->USER ) { fflush( stdout ); @@ -2124,7 +2231,18 @@ struct typoin /* structure used by dast_dbg */ #define VHD_ptypeDFN 34 #define VHD_dataDFN 35 -#define VHD_MAXDFN 37 +#define VHD_locapDFN 36 +#define VHD_loresDFN 37 +#define VHD_loselfDFN 38 +#define VHD_tconDFN 39 +#define VHD_bconDFN 40 +#define VHD_rcon1DFN 41 +#define VHD_rcon2DFN 42 +#define VHD_scon1DFN 43 +#define VHD_scon2DFN 44 + +#define VHD_MAXDFN 45 + static int vhd_getcmd(); static int vhd_hash(); @@ -2162,6 +2280,10 @@ char *stru_name; struct loins *loins_pnt; struct lotrs *lotrs_pnt; + struct locap *locap_pnt; + struct lores *lores_pnt; + struct loself *loself_pnt; + key[VHD_lofigDFN] = vhd_hash ("lofig"); key[VHD_nextDFN] = vhd_hash ("next"); key[VHD_modelchainDFN] = vhd_hash ("modelchain"); @@ -2193,6 +2315,16 @@ key[VHD_capaDFN] = vhd_hash ("capa"); key[VHD_indexDFN] = vhd_hash ("index"); key[VHD_ptypeDFN] = vhd_hash ("ptype"); +key[VHD_locapDFN] = vhd_hash ("locap"); +key[VHD_loresDFN] = vhd_hash ("lores"); +key[VHD_loselfDFN] = vhd_hash ("loself"); +key[VHD_tconDFN] = vhd_hash ("tcon"); +key[VHD_bconDFN] = vhd_hash ("bcon"); +key[VHD_rcon1DFN] = vhd_hash ("rcon1"); +key[VHD_rcon2DFN] = vhd_hash ("rcon2"); +key[VHD_scon1DFN] = vhd_hash ("scon1"); +key[VHD_scon2DFN] = vhd_hash ("scon2"); + /* ###------------------------------------------------------### */ /* Set of predefined commands */ /* ###------------------------------------------------------### */ @@ -2311,6 +2443,27 @@ key[VHD_ptypeDFN] = vhd_hash ("ptype"); nxt[VHD_lotrsDFN] = (void *)lofig_pnt->LOTRS; typ[VHD_lotrsDFN] = VHD_lotrsDFN; } + + if (lofig_pnt->LOCAP != NULL) + { + tab[VHD_locapDFN] = avail; + nxt[VHD_locapDFN] = (void *)lofig_pnt->LOCAP; + typ[VHD_locapDFN] = VHD_locapDFN; + } + if (lofig_pnt->LORES != NULL) + { + tab[VHD_loresDFN] = avail; + nxt[VHD_loresDFN] = (void *)lofig_pnt->LORES; + typ[VHD_loresDFN] = VHD_loresDFN; + } + if (lofig_pnt->LOSELF != NULL) + { + tab[VHD_loselfDFN] = avail; + nxt[VHD_loselfDFN] = (void *)lofig_pnt->LOSELF; + typ[VHD_loselfDFN] = VHD_loselfDFN; + } + + if (lofig_pnt->USER != NULL) { tab[VHD_userDFN] = avail; @@ -2333,6 +2486,11 @@ key[VHD_ptypeDFN] = vhd_hash ("ptype"); (void)printf ("-> bksig : %s\n",tab[VHD_bksigDFN]); (void)printf ("-> loins : %s\n",tab[VHD_loinsDFN]); (void)printf ("-> lotrs : %s\n",tab[VHD_lotrsDFN]); + + (void)printf ("-> locap : %s\n",tab[VHD_locapDFN]); + (void)printf ("-> lores : %s\n",tab[VHD_loresDFN]); + (void)printf ("-> loself : %s\n",tab[VHD_loselfDFN]); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); @@ -2395,6 +2553,126 @@ key[VHD_ptypeDFN] = vhd_hash ("ptype"); break; + + case (VHD_locapDFN): + + /* ###--------- locap ---------### */ + + locap_pnt = (struct locap *)(current_pnt.data); + + if (locap_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)locap_pnt->NEXT; + typ[VHD_nextDFN] = VHD_locapDFN; + } + if (locap_pnt->TCON != NULL) + { + tab[VHD_tconDFN] = avail; + nxt[VHD_tconDFN] = (void *)locap_pnt->TCON; + typ[VHD_tconDFN] = VHD_loconDFN; + } + if (locap_pnt->BCON != NULL) + { + tab[VHD_bconDFN] = avail; + nxt[VHD_bconDFN] = (void *)locap_pnt->BCON; + typ[VHD_bconDFN] = VHD_loconDFN; + } + if (locap_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)locap_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf ("-> tcon : %s\n",tab[VHD_tconDFN]); + (void)printf ("-> bcon : %s\n",tab[VHD_bconDFN]); + (void)printf (" type : %c\n",locap_pnt->TYPE); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + + case (VHD_loresDFN): + + /* ###--------- lores ---------### */ + + lores_pnt = (struct lores *)(current_pnt.data); + + if (lores_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)lores_pnt->NEXT; + typ[VHD_nextDFN] = VHD_loresDFN; + } + if (lores_pnt->RCON1 != NULL) + { + tab[VHD_rcon1DFN] = avail; + nxt[VHD_rcon1DFN] = (void *)lores_pnt->RCON1; + typ[VHD_rcon1DFN] = VHD_loconDFN; + } + if (lores_pnt->RCON2 != NULL) + { + tab[VHD_rcon2DFN] = avail; + nxt[VHD_rcon2DFN] = (void *)lores_pnt->RCON2; + typ[VHD_rcon2DFN] = VHD_loconDFN; + } + if (lores_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)lores_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf ("-> rcon1 : %s\n",tab[VHD_rcon1DFN]); + (void)printf ("-> rcon2 : %s\n",tab[VHD_rcon2DFN]); + (void)printf (" type : %c\n",lores_pnt->TYPE); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_loselfDFN): + + /* ###--------- loself ---------### */ + + loself_pnt = (struct loself *)(current_pnt.data); + + if (loself_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)loself_pnt->NEXT; + typ[VHD_nextDFN] = VHD_loselfDFN; + } + if (loself_pnt->SCON1 != NULL) + { + tab[VHD_scon1DFN] = avail; + nxt[VHD_scon1DFN] = (void *)loself_pnt->SCON1; + typ[VHD_scon1DFN] = VHD_loconDFN; + } + if (loself_pnt->SCON2 != NULL) + { + tab[VHD_scon2DFN] = avail; + nxt[VHD_scon2DFN] = (void *)loself_pnt->SCON2; + typ[VHD_scon2DFN] = VHD_loconDFN; + } + if (loself_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)loself_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf ("-> scon1 : %s\n",tab[VHD_scon1DFN]); + (void)printf ("-> scon2 : %s\n",tab[VHD_scon2DFN]); + (void)printf (" type : %c\n",loself_pnt->TYPE); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_loinsDFN): /* ###--------- loins ---------### */ @@ -2974,7 +3252,7 @@ lofig_list *lofig_ptr; /* contents : duplicate a lofig and return a pointer on the new */ /* structure. */ /* called func. : mbkalloc(), dupchainlst(), */ -/* note : the LOCON, LOSIG, BKSIG, LOINS, LOTRS pointers are */ +/* note : the LOCON, LOSIG, BKSIG, LOINS, LOTRS, LOCAP, LORES, LOSELF pointers are */ /* also duplicated */ /*##------------------------------------------------------------------##*/ @@ -2994,6 +3272,9 @@ lofig_list *lofig_ptr; lofig_rpt->BKSIG = lofig_ptr->BKSIG; lofig_rpt->LOINS = lofig_ptr->LOINS; lofig_rpt->LOTRS = lofig_ptr->LOTRS; + lofig_rpt->LOCAP = lofig_ptr->LOCAP; + lofig_rpt->LORES = lofig_ptr->LORES; + lofig_rpt->LOSELF = lofig_ptr->LOSELF; lofig_rpt->NAME = lofig_ptr->NAME; lofig_rpt->MODE = lofig_ptr->MODE; @@ -3017,6 +3298,9 @@ lofig_list *lofig_ptr; locon_list *locon_pt = NULL; loins_list *loins_pt = NULL; lotrs_list *lotrs_pt = NULL; + locap_list *locap_pt = NULL; + lores_list *lores_pt = NULL; + loself_list *loself_pt = NULL; losig_list *losig_pt = NULL; chain_list *headctc; chain_list *scanchain; @@ -3030,6 +3314,10 @@ lofig_list *lofig_ptr; lofig_rpt->LOINS = duploinslst(lofig_rpt->LOINS); lofig_rpt->LOTRS = duplotrslst(lofig_rpt->LOTRS); + lofig_rpt->LOCAP = duplocaplst(lofig_rpt->LOCAP); + lofig_rpt->LORES = duploreslst(lofig_rpt->LORES); + lofig_rpt->LOSELF = duploselflst(lofig_rpt->LOSELF); + /* Now verify and restitute the coherence of the figure */ /* Restitute coherence in the LOTRS List */ @@ -3090,6 +3378,146 @@ lofig_list *lofig_ptr; lotrs_pt = lotrs_pt->NEXT; } + + /* Restitute coherence in the LOCAP List */ + locap_pt = lofig_rpt->LOCAP; + while(locap_pt != NULL) + { + locap_pt->TCON = duplocon(locap_pt->TCON); + locon_pt = locap_pt->TCON; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)locap_pt; + + locon_pt = locon_pt->NEXT; + } + + locap_pt->BCON = duplocon(locap_pt->BCON); + locon_pt = locap_pt->BCON; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)locap_pt; + + locon_pt = locon_pt->NEXT; + } + + while(locon_pt != NULL) + { + if( locon_pt->SIG ) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + } + else + { + locon_pt->SIG = NULL; + } + locon_pt->ROOT = (void *)locap_pt; + + locon_pt = locon_pt->NEXT; + } + + locap_pt = locap_pt->NEXT; + } + + + /* Restitute coherence in the LORES List */ + lores_pt = lofig_rpt->LORES; + while(lores_pt != NULL) + { + lores_pt->RCON1 = duplocon(lores_pt->RCON1); + locon_pt = lores_pt->RCON1; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)lores_pt; + + locon_pt = locon_pt->NEXT; + } + + lores_pt->RCON2 = duplocon(lores_pt->RCON2); + locon_pt = lores_pt->RCON2; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)lores_pt; + + locon_pt = locon_pt->NEXT; + } + + while(locon_pt != NULL) + { + if( locon_pt->SIG ) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + } + else + { + locon_pt->SIG = NULL; + } + locon_pt->ROOT = (void *)lores_pt; + + locon_pt = locon_pt->NEXT; + } + + lores_pt = lores_pt->NEXT; + } + + + /* Selftitute coherence in the LOSELF List */ + loself_pt = lofig_rpt->LOSELF; + while(loself_pt != NULL) + { + loself_pt->SCON1 = duplocon(loself_pt->SCON1); + locon_pt = loself_pt->SCON1; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)loself_pt; + + locon_pt = locon_pt->NEXT; + } + + loself_pt->SCON2 = duplocon(loself_pt->SCON2); + locon_pt = loself_pt->SCON2; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)loself_pt; + + locon_pt = locon_pt->NEXT; + } + + while(locon_pt != NULL) + { + if( locon_pt->SIG ) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + } + else + { + locon_pt->SIG = NULL; + } + locon_pt->ROOT = (void *)loself_pt; + + locon_pt = locon_pt->NEXT; + } + + loself_pt = loself_pt->NEXT; + } + + + /* Restitute coherence in the LOINS List */ loins_pt = lofig_rpt->LOINS; while(loins_pt != NULL) @@ -3337,3 +3765,162 @@ its_first: delht(table); return 0; } + +/*************************** Analogical world ***************************************/ + +/*##------------------------------------------------------------------##*/ +/* Function : duplocaplst() */ +/* contents : duplicate a locap list and return a pointer on the new */ +/* structure. */ +/* called func. : duplocap(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +locap_list *duplocaplst(locap_ptr) +locap_list *locap_ptr; + { + locap_list *locap_rpt = NULL; /* Returned locap pointer */ + locap_list *locap_tmpptr = NULL; /* Temporary pointer */ + + while(locap_ptr != NULL) + { + locap_tmpptr = duplocap(locap_ptr); + locap_tmpptr->NEXT = locap_rpt; + locap_rpt = locap_tmpptr; + + locap_ptr = locap_ptr->NEXT; + } + locap_rpt = (locap_list *)reverse((chain_list *)locap_rpt); + return(locap_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplocap() */ +/* contents : duplicate a locap and return a pointer on the new */ +/* structure. */ +/* called func. : mbkalloc(), duplocon() */ +/* note : the TCON, BCON pointers are also duplicated */ +/*##------------------------------------------------------------------##*/ + +locap_list *duplocap(locap_ptr) +locap_list *locap_ptr; + { + locap_list *locap_rpt = NULL; /* Returned locap pointer */ + + locap_rpt = (locap_list *)mbkalloc(sizeof(locap_list)); + locap_rpt->NEXT = NULL; + locap_rpt->NAME = locap_ptr->NAME; + locap_rpt->TCON = locap_ptr->TCON; + locap_rpt->BCON = locap_ptr->BCON; + locap_rpt->TYPE = locap_ptr->TYPE; + locap_rpt->CAPA = locap_ptr->CAPA; + locap_rpt->USER = NULL; /* The ptype_list is not duplicated */ + + return(locap_rpt); + } + + +/*##------------------------------------------------------------------##*/ +/* Function : duploreslst() */ +/* contents : duplicate a lores list and return a pointer on the new */ +/* structure. */ +/* called func. : duplores(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +lores_list *duploreslst(lores_ptr) +lores_list *lores_ptr; + { + lores_list *lores_rpt = NULL; /* Returned lores pointer */ + lores_list *lores_tmpptr = NULL; /* Temporary pointer */ + + while(lores_ptr != NULL) + { + lores_tmpptr = duplores(lores_ptr); + lores_tmpptr->NEXT = lores_rpt; + lores_rpt = lores_tmpptr; + + lores_ptr = lores_ptr->NEXT; + } + lores_rpt = (lores_list *)reverse((chain_list *)lores_rpt); + return(lores_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplores() */ +/* contents : duplicate a lores and return a pointer on the new */ +/* structure. */ +/* called func. : mbkalloc(), duplocon() */ +/* note : the RCON1, RCON2 pointers are also duplicated */ +/*##------------------------------------------------------------------##*/ + +lores_list *duplores(lores_ptr) +lores_list *lores_ptr; + { + lores_list *lores_rpt = NULL; /* Returned lores pointer */ + + lores_rpt = (lores_list *)mbkalloc(sizeof(lores_list)); + lores_rpt->NEXT = NULL; + lores_rpt->NAME = lores_ptr->NAME; + lores_rpt->RCON1 = lores_ptr->RCON1; + lores_rpt->RCON2 = lores_ptr->RCON2; + lores_rpt->TYPE = lores_ptr->TYPE; + lores_rpt->RESI = lores_ptr->RESI; + lores_rpt->USER = NULL; /* The ptype_list is not duplicated */ + + return(lores_rpt); + } + + +/*##------------------------------------------------------------------##*/ +/* Function : duploselflst() */ +/* contents : duplicate a loself list and return a pointer on the new */ +/* structure. */ +/* called func. : duploself(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +loself_list *duploselflst(loself_ptr) +loself_list *loself_ptr; + { + loself_list *loself_rpt = NULL; /* Returned loself pointer */ + loself_list *loself_tmpptr = NULL; /* Temporary pointer */ + + while(loself_ptr != NULL) + { + loself_tmpptr = duploself(loself_ptr); + loself_tmpptr->NEXT = loself_rpt; + loself_rpt = loself_tmpptr; + + loself_ptr = loself_ptr->NEXT; + } + loself_rpt = (loself_list *)reverse((chain_list *)loself_rpt); + return(loself_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duploself() */ +/* contents : duplicate a loself and return a pointer on the new */ +/* structure. */ +/* called func. : mbkalloc(), duplocon() */ +/* note : the RCON1, RCON2 pointers are also duplicated */ +/*##------------------------------------------------------------------##*/ + +loself_list *duploself(loself_ptr) +loself_list *loself_ptr; + { + loself_list *loself_rpt = NULL; /* Returned loself pointer */ + + loself_rpt = (loself_list *)mbkalloc(sizeof(loself_list)); + loself_rpt->NEXT = NULL; + loself_rpt->NAME = loself_ptr->NAME; + loself_rpt->SCON1 = loself_ptr->SCON1; + loself_rpt->SCON2 = loself_ptr->SCON2; + loself_rpt->TYPE = loself_ptr->TYPE; + loself_rpt->SELF = loself_ptr->SELF; + loself_rpt->USER = NULL; /* The ptype_list is not duplicated */ + + return(loself_rpt); + } + + + + + diff --git a/alliance/src/mbk/src/mbk_lo_util.h b/alliance/src/mbk/src/mbk_lo_util.h index 7916bd0e..12d358a0 100644 --- a/alliance/src/mbk/src/mbk_lo_util.h +++ b/alliance/src/mbk/src/mbk_lo_util.h @@ -26,10 +26,11 @@ * Date : 06/03/92 * Author : Frederic Petrot * Modified by Czo 1997,98 - * $Id: mbk_lo_util.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + * Modified by pnt 2002 + * $Id: mbk_lo_util.h,v 1.2 2002/08/08 19:47:37 pnt Exp $ */ -/* $Id: mbk_lo_util.h,v 1.1 2002/03/08 13:51:05 fred Exp $ */ +/* $Id: mbk_lo_util.h,v 1.2 2002/08/08 19:47:37 pnt Exp $ */ #ifndef _MBK_LO_UTIL_H_ #define _MBK_LO_UTIL_H_ @@ -62,5 +63,16 @@ lofig_list *givelofig(); extern lofig_list * duplofig __P((lofig_list *lofig_ptr)); extern lofig_list * rduplofig __P((lofig_list *lofig_ptr)); +/*************************** Analogical world ***************************************/ + +extern locap_list *duplocaplst __P((locap_list *locap_ptr)) ; +extern locap_list *duplocap __P((locap_list *locap_ptr)) ; +extern lores_list *duploreslst __P((lores_list *lores_ptr)) ; +extern lores_list *duplores __P((lores_list *lores_ptr)) ; +extern loself_list *duploselflst __P((loself_list *loself_ptr)) ; +extern loself_list *duploself __P((loself_list *loself_ptr)) ; + +/************************************************************************************/ + #endif diff --git a/alliance/src/mbk/src/mlo.h b/alliance/src/mbk/src/mlo.h index 9318b862..0cf2f770 100644 --- a/alliance/src/mbk/src/mlo.h +++ b/alliance/src/mbk/src/mlo.h @@ -26,7 +26,8 @@ * Date : 05/08/93 * Author : Frederic Petrot * Modified by Czo 1997,98 - * $Id: mlo.h,v 1.3 2002/06/01 15:51:29 ac Exp $ + * Modified by pnt 2002 + * $Id: mlo.h,v 1.4 2002/08/08 19:47:37 pnt Exp $ */ #ifndef _MLO_H_ @@ -73,6 +74,9 @@ extern "C" { #define UNKNOWN 'X' #define TRISTATE 'Z' #define TRANSCV 'T' +#define TRANSCV2 'C' +#define TRANSCV3 'R' +#define TRANSCV4 'S' /******************************************************************************* * netlist structures types * @@ -86,6 +90,9 @@ struct losig *LOSIG; /* signal list head */ struct ptype *BKSIG; /* signal block list head */ struct loins *LOINS; /* instance list head */ struct lotrs *LOTRS; /* transistor list head */ +struct locap *LOCAP ; /* capacitance list head */ +struct lores *LORES ; /* resistance list head */ +struct loself *LOSELF ; /* inductor list head */ char *NAME; /* figure name (unique) */ char MODE; /* 'A' or 'P' */ struct ptype *USER; /* Application specific */ @@ -143,6 +150,126 @@ struct ptype *USER; /* application specific */ } losig_list; + +/************************************************************************************/ +/************************* Analogical specific structures ***************************/ +/************************************************************************************/ + +/********************** Complementary transitor informations ************************/ + +/* The structure is put in the USER field of the transistor */ +/* with the LOTRS_INFO ptype */ + +#define LOTRS_INFO 200208071 /* USER field code */ + +typedef struct s_lotrs_info + { + double AS,AD ; /* Source and drain area */ + double PS,PD ; /* Source and drain perimeter */ + int M ; /* Number of fingers */ + } lotrs_info ; + + +/********************************* Capacitance **************************************/ + +#define CAPMIM 0 /* Metal-Inter-Metal type */ +#define CAPPNWELL 1 /* Poly-NWell type */ + +#define IsCapMIM(type) ((type == CAPMIM) ? 1 : 0) +#define IsCapPNWELL(type) ((type == CAPPNWELL) ? 1 : 0) + +typedef struct locap /* analog capacitance */ + { + struct locap *NEXT ; /* next capacitor */ + struct locon *TCON ; /* top plate connector */ + struct locon *BCON ; /* bottom plate connector */ + char *NAME ; /* capacitor instance name */ + double CAPA ; /* capacitor value (unite FF) */ + char TYPE ; /* capacitor type */ + struct ptype *USER ; /* application specific */ + } locap_list ; + + +/************************* Complementary capacitance information ********************/ + +/* The structure is put in the USER field of the capacitance */ +/* with the LOCAP_INFO ptype */ + +#define LOCAP_INFO 200208072 /* USER field code */ + +typedef struct s_locap_info + { + union + { + struct + { + double AT,AB ; /* Top and bottom plate area */ + double PT,PB ; /* Top et bottom plate perimeter */ + } mim ; + struct + { + double L,W ; /* POLY/NWELL capacitance */ + } pnwell ; + } data ; + } locap_info ; + + +/*********************************** Resistor ***************************************/ + +#define RESMIM 0 /* Metal-Inter-Metal type */ + +#define IsResMIM(type) ((type == RESMIM) ? 1 : 0) + + +typedef struct lores /* analog resistor */ + { + struct lores *NEXT ; /* next resistor */ + struct locon *RCON1 ; /* first connector */ + struct locon *RCON2 ; /* second connector */ + char *NAME ; /* resistor instance name */ + double RESI ; /* resistance value (ohms) */ + char TYPE ; /* resistor type */ + struct ptype *USER ; /* application specific */ +} lores_list ; + + +/*************************** Complementary resistor information *********************/ + +/* The structure is put in the USER field of the resistor */ +/* with the LORES_INFO ptype */ + +#define LORES_INFO 200208073 /* USER field code */ + +typedef struct s_lores_info + { + double L,W ; + } lores_info ; + + +/************************************ Inductor **************************************/ + +#define SELFMIM 0 /* Metal-Inter-Metal type */ + +#define IsSelfMIM(type) ((type == SELFMIM) ? 1 : 0) + +typedef struct loself /* analog inductor */ + { + struct loself *NEXT ; /* next inductor */ + struct locon *SCON1 ; /* first connector */ + struct locon *SCON2 ; /* second connector */ + char *NAME ; /* inductor instance name */ + double SELF ; /* inductance value (unite H) */ + char TYPE ; /* inductor type */ + struct ptype *USER ; /* application specific */ +} loself_list ; + + + +/************************************************************************************/ +/************************************************************************************/ +/************************************************************************************/ + + /******************************************************************************* * externals for mbk netlist view * *******************************************************************************/ @@ -179,6 +306,28 @@ losig_list; extern void delloconuser __P((locon_list*)); extern void dellofiguser __P((lofig_list*)); +/*************************** Analogical world ***************************************/ + +extern locap_list *addlocap __P((lofig_list *ptfig,char type,double capa,losig_list *pttplate, + losig_list *ptbplate,char *name)) ; +extern int dellocap __P((lofig_list *ptfig,locap_list *ptcap)) ; +extern locap_list *getlocap __P((lofig_list *ptfig,const char *name)) ; +extern void dellocapuser __P((locap_list *)) ; + +extern lores_list *addlores __P((lofig_list *ptfig,char type,double resi,losig_list *ptrcon1, + losig_list *ptrcon2,char *name)) ; +extern int dellores __P((lofig_list *ptfig,lores_list *ptres)) ; +extern lores_list *getlores __P((lofig_list *ptfig,const char *name)) ; +extern void delloresuser __P((lores_list *)) ; + +extern loself_list *addloself __P((lofig_list *ptfig,char type,double self,losig_list *ptscon1, + losig_list *ptscon2,char *name)) ; +extern int delloself __P((lofig_list *ptfig,loself_list *ptself)) ; +extern loself_list *getloself __P((lofig_list *ptfig,const char *name)) ; +extern void delloselfuser __P((loself_list *)) ; + +/************************************************************************************/ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/alliance/src/mbk/src/mlu.h b/alliance/src/mbk/src/mlu.h index 99521c2c..2ca4a214 100644 --- a/alliance/src/mbk/src/mlu.h +++ b/alliance/src/mbk/src/mlu.h @@ -26,7 +26,8 @@ * Date : 05/08/93 * Author : Frederic Petrot * Modified by Czo 1997,98 - * $Id: mlu.h,v 1.3 2002/06/01 15:51:29 ac Exp $ + * Modified by pnt 2002 + * $Id: mlu.h,v 1.4 2002/08/08 19:47:37 pnt Exp $ */ #ifndef _MLU_H_ @@ -69,7 +70,18 @@ extern "C" { extern int restoredirvbe __P((lofig_list *lof)); extern int guessextdir __P((lofig_list *lof)); extern int restorealldir __P((lofig_list *lf)); - + +/*************************** Analogical world ***************************************/ + +extern locap_list *duplocaplst __P((locap_list *locap_ptr)) ; +extern locap_list *duplocap __P((locap_list *locap_ptr)) ; +extern lores_list *duploreslst __P((lores_list *lores_ptr)) ; +extern lores_list *duplores __P((lores_list *lores_ptr)) ; +extern loself_list *duploselflst __P((loself_list *loself_ptr)) ; +extern loself_list *duploself __P((loself_list *loself_ptr)) ; + +/************************************************************************************/ + #ifdef __cplusplus } #endif /* __cplusplus */