This commit was generated by cvs2svn to track changes on a CVS vendor
branch.
This commit is contained in:
commit
5f0132f41a
|
@ -0,0 +1 @@
|
|||
SUBDIRS = src
|
|
@ -0,0 +1,52 @@
|
|||
dnl
|
||||
dnl This file is part of the Alliance CAD System
|
||||
dnl Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
dnl Universite Pierre et Marie Curie
|
||||
dnl
|
||||
dnl Home page : http://www-asim.lip6.fr/alliance/
|
||||
dnl E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
dnl
|
||||
dnl This library is free software; you can redistribute it and/or modify it
|
||||
dnl under the terms of the GNU Library General Public License as published
|
||||
dnl by the Free Software Foundation; either version 2 of the License, or (at
|
||||
dnl your option) any later version.
|
||||
dnl
|
||||
dnl Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
dnl Public License for more details.
|
||||
dnl
|
||||
dnl You should have received a copy of the GNU General Public License along
|
||||
dnl with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
dnl
|
||||
dnl Purpose : Auto stuffing Alliance
|
||||
dnl Almost ten years since I wrote this stuff, I just can't
|
||||
dnl believe it
|
||||
dnl Date : 01/02/2002
|
||||
dnl Author : Frederic Petrot <Frederic.Petrot@lip6.fr>
|
||||
dnl $Id: configure.in,v 1.1 2002/03/13 17:58:33 fred Exp $
|
||||
dnl
|
||||
dnl
|
||||
AC_INIT(src/spi_parse.c)
|
||||
AM_INIT_AUTOMAKE(mbkspice, 7.0)
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_CC
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(strings.h unistd.h)
|
||||
AC_C_CONST
|
||||
AC_PROG_RANLIB
|
||||
|
||||
changequote(,)dnl
|
||||
INCLUDES=-I${ALLIANCE_TOP}/include
|
||||
LDFLAGS=-L${ALLIANCE_TOP}/lib
|
||||
changequote([,])dnl
|
||||
|
||||
AC_SUBST(INCLUDES)
|
||||
AC_SUBST(LDFLAGS)
|
||||
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
])
|
|
@ -0,0 +1,4 @@
|
|||
lib_LIBRARIES = libMsl.a
|
||||
libMsl_a_SOURCES = spi_drive.c spi_drive.h spi_global.c spi_global.h \
|
||||
spi_hash.c spi_hash.h spi_int.c spi_int.h spi_msg.c \
|
||||
spi_msg.h spi_parse.c spi_parse.h
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
#ifndef MSLH
|
||||
#define MSLH
|
||||
|
||||
extern int msl_line; /* current line number */
|
||||
extern int msl_figloaded; /* TRUE if inside a SUBCKT */
|
||||
extern char *msl_figname; /* name of main SUBCKT */
|
||||
extern char *msl_subckt; /* name of current SUBCKT */
|
||||
extern lofig_list *msl_ptfig; /* last lofig parsed */
|
||||
|
||||
void mslAddExtension __P(( int(*)() )); /* add function called during parsing */
|
||||
void mslRmvExtension __P(( )); /* remove this function */
|
||||
|
||||
void mslAddCompletion __P(( int(*)() )); /* add function called after parsing */
|
||||
void mslRmvCompletion __P(( )); /* remove this function */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (1==1) /* c'est ben vrai */
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE (1==0) /* tout faux */
|
||||
#endif
|
||||
|
||||
extern int SPI_LANG;
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,944 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : August, 17th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#define SPI_MAX_COL 80
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <varargs.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
#include <mut.h>
|
||||
#include <mlo.h>
|
||||
#include <rcn.h>
|
||||
|
||||
#include "msl.h"
|
||||
#include "spi_drive.h"
|
||||
#include "spi_int.h"
|
||||
#include "spi_msg.h"
|
||||
#include "spi_global.h"
|
||||
|
||||
static char *TNMOS,
|
||||
*TPMOS;
|
||||
char *SPI_NETNAME;
|
||||
char SPI_NAMEDNODES;
|
||||
|
||||
#define SPI_NONODES (-1l)
|
||||
#define SPI_MAXSTATICNAME 16
|
||||
|
||||
char* spinamednode( losig, node )
|
||||
losig_list *losig;
|
||||
long node;
|
||||
{
|
||||
static char names[SPI_MAXSTATICNAME][255];
|
||||
static int curnames = 0;
|
||||
|
||||
ptype_list *ptptype;
|
||||
convindex *cvx;
|
||||
|
||||
curnames++;
|
||||
if( curnames == SPI_MAXSTATICNAME )
|
||||
curnames=0;
|
||||
|
||||
if( SPI_NAMEDNODES == TRUE ) {
|
||||
if( node == SPI_NONODES ) {
|
||||
if( losig->NAMECHAIN )
|
||||
sprintf( names[curnames], "%s", (char*)(losig->NAMECHAIN->DATA) );
|
||||
else
|
||||
sprintf( names[curnames], "sig%ld", losig->INDEX );
|
||||
}
|
||||
else {
|
||||
if( losig->NAMECHAIN ) {
|
||||
sprintf( names[curnames], "%s%c%ld", (char*)(losig->NAMECHAIN->DATA),
|
||||
SEPAR,
|
||||
node
|
||||
);
|
||||
}
|
||||
else {
|
||||
sprintf( names[curnames], "sig%ld%c%ld", losig->INDEX,
|
||||
SEPAR,
|
||||
node
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
ptptype = getptype( losig->USER, SPI_DRIVER_PTYPE );
|
||||
cvx = (convindex*)(ptptype->DATA);
|
||||
if( node == SPI_NONODES )
|
||||
sprintf( names[curnames], "%d", cvx->premier );
|
||||
else
|
||||
sprintf( names[curnames], "%ld", cvx->premier + node - 1 );
|
||||
}
|
||||
|
||||
return( names[curnames] );
|
||||
}
|
||||
|
||||
void cherche_alim( ptfig, vdd, vss )
|
||||
lofig_list *ptfig;
|
||||
char **vdd;
|
||||
char **vss;
|
||||
{
|
||||
locon_list *scancon;
|
||||
losig_list *signal;
|
||||
static char stvss[255], stvdd[255];
|
||||
|
||||
*vdd = 0;
|
||||
*vss = 0;
|
||||
|
||||
for( scancon = ptfig->LOCON ;
|
||||
scancon && !(*vdd && *vss) ;
|
||||
scancon = scancon->NEXT
|
||||
)
|
||||
{
|
||||
if( isvdd( scancon->NAME ) )
|
||||
{
|
||||
signal = scancon->SIG;
|
||||
if( scancon->PNODE )
|
||||
strcpy( stvdd, spinamednode( signal, scancon->PNODE->DATA ) );
|
||||
else
|
||||
strcpy( stvdd, spinamednode( signal, SPI_NONODES ) );
|
||||
|
||||
*vdd = stvdd;
|
||||
}
|
||||
|
||||
if( isvss( scancon->NAME ) )
|
||||
{
|
||||
signal = scancon->SIG;
|
||||
if( scancon->PNODE )
|
||||
strcpy( stvss, spinamednode( signal, scancon->PNODE->DATA ) );
|
||||
else
|
||||
strcpy( stvss, spinamednode( signal, SPI_NONODES ) );
|
||||
|
||||
*vss = stvss;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sortrcn( ptfig, df, vss )
|
||||
lofig_list *ptfig;
|
||||
FILE *df;
|
||||
char *vss;
|
||||
{
|
||||
losig_list *scanlosig;
|
||||
int nbr;
|
||||
convindex *cvx;
|
||||
ptype_list *ptptype;
|
||||
lowire_list *scanlowire;
|
||||
int nbctc;
|
||||
chain_list *scanchain;
|
||||
chain_list *headctc;
|
||||
loctc_list *ptctc;
|
||||
|
||||
nbctc = 0;
|
||||
|
||||
for( scanlosig = ptfig->LOSIG ; scanlosig ; scanlosig = scanlosig->NEXT )
|
||||
{
|
||||
if( !scanlosig->PRCN )
|
||||
continue;
|
||||
|
||||
ptptype = getptype( scanlosig->USER, SPI_DRIVER_PTYPE );
|
||||
cvx = (convindex*)(ptptype->DATA);
|
||||
|
||||
if( scanlosig->PRCN->PWIRE || scanlosig->PRCN->PCTC )
|
||||
{
|
||||
nbr = 1;
|
||||
|
||||
|
||||
for( scanlowire = scanlosig->PRCN->PWIRE ;
|
||||
scanlowire ;
|
||||
scanlowire = scanlowire->NEXT )
|
||||
{
|
||||
tooutput( df,
|
||||
"R%d_%d %s %s %g\n",
|
||||
scanlosig->INDEX,
|
||||
nbr,
|
||||
spinamednode( scanlosig, scanlowire->NODE1 ),
|
||||
spinamednode( scanlosig, scanlowire->NODE2 ),
|
||||
scanlowire->RESI < RESIMINI ? RESIMINI : scanlowire->RESI
|
||||
);
|
||||
|
||||
/* HSpice ne supporte pas 1e-6P : Il ne prendra pas en compte le P, et
|
||||
* on aura 1 micron au lieu de 1e-18. */
|
||||
|
||||
if( scanlowire->CAPA / 2.0 >= CAPAMINI )
|
||||
{
|
||||
tooutput( df,
|
||||
"C%d_%d1 %s %s %g\n",
|
||||
scanlosig->INDEX,
|
||||
nbr,
|
||||
spinamednode( scanlosig, scanlowire->NODE1 ),
|
||||
vss,
|
||||
scanlowire->CAPA / 2.0 * 1e-12
|
||||
);
|
||||
|
||||
tooutput( df,
|
||||
"C%d_%d2 %s %s %g\n",
|
||||
scanlosig->INDEX,
|
||||
nbr,
|
||||
spinamednode( scanlosig, scanlowire->NODE2 ),
|
||||
vss,
|
||||
scanlowire->CAPA / 2.0 * 1e-12
|
||||
);
|
||||
}
|
||||
|
||||
nbr++;
|
||||
}
|
||||
}
|
||||
|
||||
/* On ne sort la capa totale que si on a ni RCN, ni CTC */
|
||||
|
||||
if( !scanlosig->PRCN->PWIRE && !scanlosig->PRCN->PCTC )
|
||||
{
|
||||
if( scanlosig->PRCN->CAPA >= CAPAMINI )
|
||||
{
|
||||
tooutput( df,
|
||||
"C%d %s %s %g\n",
|
||||
scanlosig->INDEX,
|
||||
spinamednode( scanlosig, SPI_NONODES ),
|
||||
vss,
|
||||
scanlosig->PRCN->CAPA * 1e-12
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
headctc = getallctc( ptfig );
|
||||
|
||||
for( scanchain = headctc ; scanchain ; scanchain = scanchain->NEXT )
|
||||
{
|
||||
ptctc = (loctc_list*)scanchain->DATA ;
|
||||
|
||||
if( ptctc->CAPA >= CAPAMINI )
|
||||
{
|
||||
tooutput( df,
|
||||
"C_ctc_%d %s %s %g\n",
|
||||
nbctc,
|
||||
spinamednode( ptctc->SIG1, ptctc->NODE1 > 0 ? ptctc->NODE1 :
|
||||
SPI_NONODES ),
|
||||
spinamednode( ptctc->SIG2, ptctc->NODE2 > 0 ? ptctc->NODE2 :
|
||||
SPI_NONODES ),
|
||||
ptctc->CAPA * 1e-12
|
||||
);
|
||||
}
|
||||
|
||||
nbctc++;
|
||||
}
|
||||
|
||||
freechain( headctc );
|
||||
}
|
||||
|
||||
void signalnoeud( ptfig )
|
||||
lofig_list *ptfig;
|
||||
{
|
||||
losig_list *scanlosig;
|
||||
convindex *nouveau;
|
||||
int dernier;
|
||||
|
||||
dernier = 1;
|
||||
|
||||
for( scanlosig = ptfig -> LOSIG ; scanlosig ; scanlosig = scanlosig->NEXT )
|
||||
{
|
||||
nouveau = ( convindex* ) mbkalloc( sizeof( convindex ) );
|
||||
nouveau->sig = scanlosig;
|
||||
nouveau->premier = dernier;
|
||||
|
||||
if( scanlosig->PRCN && scanlosig->PRCN->NBNODE > 0 )
|
||||
dernier += scanlosig->PRCN->NBNODE ;
|
||||
else
|
||||
dernier++;
|
||||
|
||||
scanlosig->USER = addptype( scanlosig->USER, SPI_DRIVER_PTYPE, nouveau );
|
||||
}
|
||||
}
|
||||
|
||||
int sortconnecteur( df, c, position )
|
||||
FILE *df;
|
||||
locon_list *c;
|
||||
int position;
|
||||
{
|
||||
losig_list *signal;
|
||||
ptype_list *pt;
|
||||
convindex *noeudbase;
|
||||
num_list *tetenum,*scannum;
|
||||
char v[1024];
|
||||
int lgmot;
|
||||
|
||||
signal = c->SIG;
|
||||
pt = getptype( signal->USER, SPI_DRIVER_PTYPE );
|
||||
noeudbase = (convindex*)(pt->DATA);
|
||||
|
||||
if( c->PNODE )
|
||||
{
|
||||
tetenum = c->PNODE;
|
||||
for( scannum = tetenum ; scannum ; scannum = scannum->NEXT )
|
||||
{
|
||||
sprintf( v,"%s ", spinamednode( signal, scannum->DATA) );
|
||||
lgmot = strlen(v);
|
||||
if( lgmot + position >= SPI_MAX_COL - 2 )
|
||||
{
|
||||
tooutput( df, "\n+ " );
|
||||
position = lgmot+2;
|
||||
}
|
||||
else
|
||||
position = position + lgmot;
|
||||
|
||||
tooutput( df, v );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgmot = strlen(v);
|
||||
if( lgmot + position >= SPI_MAX_COL - 2 )
|
||||
{
|
||||
tooutput( df, "\n+ " );
|
||||
position = lgmot+2;
|
||||
}
|
||||
else
|
||||
position = position + lgmot;
|
||||
sprintf( v, "%s ", spinamednode( signal, SPI_NONODES ) );
|
||||
tooutput( df, v );
|
||||
}
|
||||
|
||||
return( position );
|
||||
}
|
||||
|
||||
int sortconnecteur_ordre( df, ordre, liste, position )
|
||||
FILE *df;
|
||||
chain_list *ordre;
|
||||
locon_list *liste;
|
||||
int position;
|
||||
{
|
||||
chain_list *scanordre;
|
||||
locon_list *scanlocon;
|
||||
int num;
|
||||
int n;
|
||||
chain_list *cpteordre;
|
||||
losig_list *signal;
|
||||
ptype_list *pt;
|
||||
convindex *noeudbase;
|
||||
num_list *scannum;
|
||||
num_list *tetenum;
|
||||
char v[1024];
|
||||
int lgmot;
|
||||
|
||||
for( scanordre = ordre ; scanordre ; scanordre = scanordre->NEXT )
|
||||
{
|
||||
for( scanlocon = liste ; scanlocon ; scanlocon = scanlocon->NEXT )
|
||||
if( scanlocon->NAME == ((char*)(scanordre->DATA)) )
|
||||
break;
|
||||
|
||||
if( !scanlocon )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "%s.\n", SPIMSG(5) );
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
num = 0;
|
||||
for( cpteordre = ordre ;
|
||||
cpteordre != scanordre ;
|
||||
cpteordre = cpteordre->NEXT
|
||||
)
|
||||
if( ((char*)(cpteordre->DATA)) == scanlocon->NAME )
|
||||
num++;
|
||||
|
||||
signal = scanlocon->SIG;
|
||||
pt = getptype( signal->USER, SPI_DRIVER_PTYPE );
|
||||
noeudbase = (convindex*)(pt->DATA);
|
||||
|
||||
if( scanlocon->PNODE )
|
||||
{
|
||||
tetenum = scanlocon->PNODE;
|
||||
for( scannum = tetenum, n=0 ; n<num ; scannum = scannum->NEXT, n++ );
|
||||
sprintf( v, "%s ", spinamednode( signal, scannum->DATA ) );
|
||||
}
|
||||
else
|
||||
sprintf( v, "%s ", spinamednode( signal, SPI_NONODES ) );
|
||||
|
||||
lgmot = strlen(v);
|
||||
if( lgmot + position >= SPI_MAX_COL )
|
||||
{
|
||||
tooutput( df, "\n+ " );
|
||||
position = lgmot + 2;
|
||||
}
|
||||
else
|
||||
position = position + lgmot;
|
||||
|
||||
tooutput( df, v );
|
||||
}
|
||||
|
||||
return( position );
|
||||
}
|
||||
|
||||
void sortnet( ptfig, df )
|
||||
lofig_list *ptfig;
|
||||
FILE *df;
|
||||
{
|
||||
losig_list *scanlosig;
|
||||
locon_list *scanlocon;
|
||||
chain_list *scanchain;
|
||||
ptype_list *ptl;
|
||||
convindex *conv;
|
||||
num_list *scannum;
|
||||
loctc_list *ptctc;
|
||||
int i;
|
||||
|
||||
for( scanlosig = ptfig->LOSIG ; scanlosig ; scanlosig = scanlosig->NEXT )
|
||||
{
|
||||
ptl = getptype(scanlosig->USER,SPI_DRIVER_PTYPE);
|
||||
conv = (convindex*)(ptl->DATA);
|
||||
if( scanlosig->TYPE == EXTERNAL )
|
||||
{
|
||||
|
||||
if( scanlosig->TYPE == EXTERNAL )
|
||||
{
|
||||
ptl = getptype( scanlosig->USER, LOFIGCHAIN );
|
||||
|
||||
if( !ptl )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "*** spi error *** : LOFIGCHAIN missing.\n" );
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
for( scanchain = (chain_list*)(ptl->DATA) ;
|
||||
scanchain ;
|
||||
scanchain = scanchain->NEXT
|
||||
)
|
||||
{
|
||||
scanlocon = (locon_list*)scanchain->DATA ;
|
||||
if( scanlocon->ROOT == ptfig )
|
||||
{
|
||||
if( scanlocon->PNODE )
|
||||
{
|
||||
for( scannum = scanlocon->PNODE ;
|
||||
scannum ;
|
||||
scannum = scannum->NEXT
|
||||
)
|
||||
{
|
||||
spi_vect( scanlocon->NAME );
|
||||
tooutput( df,
|
||||
"* %s %d = %s\n",
|
||||
SPI_NETNAME,
|
||||
scannum->DATA + conv->premier - 1 ,
|
||||
scanlocon->NAME
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spi_vect( scanlocon->NAME );
|
||||
tooutput( df,
|
||||
"* %s %d = %s\n",
|
||||
SPI_NETNAME,
|
||||
conv->premier,
|
||||
scanlocon->NAME
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if( scanlosig->NAMECHAIN )
|
||||
{
|
||||
i = 0 ;
|
||||
if( scanlosig->PRCN )
|
||||
{
|
||||
if( scanlosig->PRCN->PWIRE )
|
||||
i = scanlosig->PRCN->PWIRE->NODE1 ;
|
||||
else
|
||||
if( scanlosig->PRCN->PCTC )
|
||||
{
|
||||
ptctc = (loctc_list*)scanlosig->PRCN->PCTC->DATA;
|
||||
if( ptctc->SIG1 == scanlosig )
|
||||
i = ptctc->NODE1;
|
||||
else
|
||||
i = ptctc->NODE2;
|
||||
}
|
||||
|
||||
if( i != 0 )
|
||||
i = i + conv->premier - 1 ;
|
||||
}
|
||||
|
||||
if( i == 0 );
|
||||
i = conv->premier ;
|
||||
|
||||
spi_vect( (char*)scanlosig->NAMECHAIN->DATA );
|
||||
tooutput( df,
|
||||
"* %s %d = %s\n",
|
||||
SPI_NETNAME,
|
||||
i,
|
||||
(char*)scanlosig->NAMECHAIN->DATA
|
||||
) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sortinstance( ptfig, df )
|
||||
lofig_list *ptfig;
|
||||
FILE *df;
|
||||
{
|
||||
loins_list *scanloins;
|
||||
locon_list *scanloconins;
|
||||
ptype_list *pt;
|
||||
char v[1024];
|
||||
int lgmot;
|
||||
int colonne;
|
||||
|
||||
for( scanloins = ptfig->LOINS ; scanloins ; scanloins = scanloins->NEXT )
|
||||
{
|
||||
sprintf( v, "x%s ", scanloins->INSNAME );
|
||||
colonne = strlen( v );
|
||||
tooutput( df, v );
|
||||
|
||||
/* L'ordre des connecteurs entre la lofig et sa version instanciée n'est
|
||||
pas le meme */
|
||||
|
||||
pt = getptype( scanloins->USER, PH_INTERF );
|
||||
if( pt )
|
||||
colonne = sortconnecteur_ordre( df,
|
||||
(chain_list*)(pt->DATA),
|
||||
scanloins->LOCON,
|
||||
colonne
|
||||
);
|
||||
else
|
||||
for( scanloconins = scanloins->LOCON ;
|
||||
scanloconins ;
|
||||
scanloconins = scanloconins->NEXT
|
||||
)
|
||||
colonne = sortconnecteur( df, scanloconins, colonne );
|
||||
|
||||
sprintf( v, "%s\n", scanloins->FIGNAME );
|
||||
lgmot = strlen(v);
|
||||
if( lgmot+colonne >= SPI_MAX_COL -2 )
|
||||
tooutput( df, "\n+" );
|
||||
tooutput( df, v );
|
||||
}
|
||||
}
|
||||
|
||||
void sorttransistormos( ptfig, df, vss, vdd )
|
||||
lofig_list *ptfig;
|
||||
FILE *df;
|
||||
char *vss;
|
||||
char *vdd;
|
||||
{
|
||||
lotrs_list *scantrs;
|
||||
int nb;
|
||||
ht *trname;
|
||||
char name[1024], *ptr ;
|
||||
|
||||
for( scantrs = ptfig->LOTRS, nb=1 ; scantrs ; scantrs = scantrs->NEXT, nb++ );
|
||||
|
||||
trname = addht(nb);
|
||||
|
||||
nb = 0;
|
||||
|
||||
for( scantrs = ptfig->LOTRS; scantrs; scantrs = scantrs->NEXT )
|
||||
{
|
||||
if( scantrs->TRNAME )
|
||||
{
|
||||
if( gethtitem( trname, scantrs->TRNAME ) != EMPTYHT )
|
||||
{
|
||||
do
|
||||
{
|
||||
nb++;
|
||||
sprintf( name, "%s_%d", scantrs->TRNAME, nb );
|
||||
ptr = namealloc( name );
|
||||
}
|
||||
while( gethtitem( trname, ptr ) != EMPTYHT );
|
||||
addhtitem( trname, ptr, 1 );
|
||||
tooutput( df, "M%s ", name );
|
||||
}
|
||||
else
|
||||
{
|
||||
tooutput( df, "M%s ", scantrs->TRNAME );
|
||||
addhtitem( trname, scantrs->TRNAME, 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
nb++;
|
||||
sprintf( name, "%d", nb );
|
||||
ptr = namealloc( name );
|
||||
}
|
||||
while( gethtitem( trname, ptr ) != EMPTYHT );
|
||||
tooutput( df, "M%s ", name );
|
||||
addhtitem( trname, ptr, 1 );
|
||||
}
|
||||
|
||||
sortconnecteur( df, scantrs->DRAIN,1 );
|
||||
sortconnecteur( df, scantrs->GRID,1 );
|
||||
sortconnecteur( df, scantrs->SOURCE,1 );
|
||||
if( scantrs->BULK->SIG )
|
||||
{
|
||||
sortconnecteur( df, scantrs->BULK,1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( IsTransN(scantrs->TYPE) )
|
||||
{
|
||||
if( !vss )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr,
|
||||
"*** spi error *** : Can't find signal VSS on figure %s.\n",
|
||||
ptfig->NAME
|
||||
);
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
tooutput( df, "%s ", vss );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !vdd )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr,
|
||||
"*** spi error *** : Can't find signal VDD on figure %s.\n",
|
||||
ptfig->NAME
|
||||
);
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
tooutput( df, "%s ", vdd );
|
||||
}
|
||||
}
|
||||
|
||||
tooutput( df, "%s ", spitransmodel( scantrs->TYPE ) );
|
||||
|
||||
if(scantrs->LENGTH!=0)
|
||||
tooutput( df, "L=%gU ", (float)scantrs->LENGTH/SCALE_X );
|
||||
|
||||
if(scantrs->WIDTH!=0)
|
||||
tooutput( df, "W=%gU ", (float)scantrs->WIDTH/SCALE_X );
|
||||
|
||||
if( scantrs->XS != 0 )
|
||||
tooutput( df,
|
||||
"AS=%gP ",
|
||||
(float) scantrs->XS * scantrs->WIDTH / ( SCALE_X * SCALE_X )
|
||||
);
|
||||
|
||||
if( scantrs->XD != 0 )
|
||||
tooutput( df,
|
||||
"AD=%gP ",
|
||||
(float) scantrs->XD * scantrs->WIDTH / ( SCALE_X * SCALE_X )
|
||||
);
|
||||
|
||||
if( scantrs->PS != 0 )
|
||||
tooutput( df, "PS=%gU ", (float)scantrs->PS/SCALE_X );
|
||||
|
||||
if( scantrs->PD != 0 )
|
||||
tooutput( df, "PD=%gU ", (float)scantrs->PD/SCALE_X );
|
||||
|
||||
tooutput( df, "\n" );
|
||||
}
|
||||
|
||||
delht( trname );
|
||||
}
|
||||
|
||||
void sortcircuit( ptfig, df )
|
||||
lofig_list *ptfig;
|
||||
FILE *df;
|
||||
{
|
||||
char *vdd, *vss;
|
||||
locon_list *scancon;
|
||||
ptype_list *pt;
|
||||
int colonne;
|
||||
char v[1024];
|
||||
|
||||
cherche_alim( ptfig, &vdd, &vss );
|
||||
|
||||
/* Sortie des instances et des transistors */
|
||||
|
||||
sprintf( v, "\n.subckt %s ", ptfig->NAME );
|
||||
colonne = strlen( v );
|
||||
|
||||
tooutput( df, v );
|
||||
|
||||
pt = getptype( ptfig->USER, PH_INTERF );
|
||||
if( pt )
|
||||
colonne = sortconnecteur_ordre( df,
|
||||
(chain_list*)(pt->DATA),
|
||||
ptfig->LOCON,
|
||||
colonne
|
||||
);
|
||||
else
|
||||
for( scancon = ptfig->LOCON ; scancon ; scancon = scancon->NEXT )
|
||||
colonne = sortconnecteur( df, scancon, colonne );
|
||||
|
||||
tooutput( df,"\n" );
|
||||
|
||||
if( SPI_NAMEDNODES == FALSE ) {
|
||||
sortnet( ptfig, df );
|
||||
}
|
||||
|
||||
sortinstance( ptfig, df );
|
||||
sorttransistormos( ptfig, df, vss, vdd);
|
||||
sortrcn( ptfig, df, vss );
|
||||
|
||||
tooutput( df, ".ends %s\n\n", ptfig->NAME );
|
||||
}
|
||||
|
||||
void spicesavelofig( ptfig )
|
||||
lofig_list *ptfig;
|
||||
{
|
||||
FILE *df; /* descripteur de fichier de sortie */
|
||||
chain_list *scanchain;
|
||||
locon_list *scancon;
|
||||
num_list *scannum;
|
||||
char v[1024];
|
||||
ptype_list *pt;
|
||||
char *nom;
|
||||
time_t secondes;
|
||||
struct tm *jours;
|
||||
char *env;
|
||||
int colonne;
|
||||
int lgmot;
|
||||
|
||||
env = mbkgetenv( "MBK_SPI_TN" );
|
||||
|
||||
if(env)
|
||||
TNMOS = env;
|
||||
else
|
||||
TNMOS = "TN";
|
||||
|
||||
env = mbkgetenv( "MBK_SPI_TP" );
|
||||
|
||||
if(env)
|
||||
TPMOS = env;
|
||||
else
|
||||
TPMOS = "TP";
|
||||
|
||||
env = mbkgetenv( "MBK_SPI_NETNAME" );
|
||||
|
||||
if( env )
|
||||
SPI_NETNAME = env;
|
||||
else
|
||||
SPI_NETNAME = "NET";
|
||||
|
||||
env = mbkgetenv( "MBK_SPI_NAMEDNODES" );
|
||||
|
||||
if( env )
|
||||
SPI_NAMEDNODES = TRUE ;
|
||||
else
|
||||
SPI_NAMEDNODES = FALSE ;
|
||||
|
||||
spi_init_lang();
|
||||
|
||||
/* Ouverture du fichier de sortie */
|
||||
df = mbkfopen( ptfig->NAME, OUT_LO, WRITE_TEXT );
|
||||
if( !df )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "*** mbk error : savelofig impossible.\n" );
|
||||
fprintf( stderr,
|
||||
"Can't open file %s.%s for writing.\n",
|
||||
ptfig->NAME,
|
||||
OUT_LO
|
||||
);
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
|
||||
time( &secondes );
|
||||
jours = localtime( &secondes );
|
||||
|
||||
tooutput( df, "* Spice description of %s\n", ptfig->NAME );
|
||||
tooutput( df, "* Spice driver version %d\n",VERSION );
|
||||
tooutput( df,
|
||||
"* Date ( dd/mm/yyyy hh:mm:ss ): %2d/%02d/%04d at %2d:%02d:%02d\n\n",
|
||||
jours->tm_mday,
|
||||
jours->tm_mon+1,
|
||||
jours->tm_year+1900,
|
||||
jours->tm_hour,
|
||||
jours->tm_min,
|
||||
jours->tm_sec
|
||||
);
|
||||
|
||||
/* On va travailler sur les fonctions RCN : */
|
||||
lofigchain( ptfig );
|
||||
|
||||
signalnoeud( ptfig ); /* Calcule les noeuds Spice */
|
||||
|
||||
/* Sort la ligne *interf */
|
||||
|
||||
colonne = strlen( "* INTERF " );
|
||||
tooutput( df, "* INTERF " );
|
||||
|
||||
pt = getptype( ptfig->USER, PH_INTERF );
|
||||
if( pt )
|
||||
{
|
||||
for( scanchain = (chain_list*)(pt->DATA) ;
|
||||
scanchain ;
|
||||
scanchain = scanchain->NEXT
|
||||
)
|
||||
{
|
||||
nom = ((char*)(scanchain->DATA));
|
||||
strcpy( v, nom );
|
||||
spi_vect( v );
|
||||
|
||||
lgmot = strlen(v)+1;
|
||||
if( colonne+lgmot >= SPI_MAX_COL-2 )
|
||||
{
|
||||
colonne = strlen( "* INTERF " );
|
||||
tooutput( df, "\n* INTERF " );
|
||||
}
|
||||
colonne = colonne + lgmot;
|
||||
|
||||
tooutput( df, "%s ", v );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( scancon = ptfig->LOCON ; scancon ; scancon = scancon->NEXT )
|
||||
{
|
||||
if( scancon->PNODE )
|
||||
{
|
||||
for( scannum = scancon->PNODE ; scannum ; scannum = scannum->NEXT )
|
||||
{
|
||||
strcpy( v, scancon->NAME );
|
||||
spi_vect( v );
|
||||
|
||||
lgmot = strlen(v)+1;
|
||||
if( colonne+lgmot >= SPI_MAX_COL-2 )
|
||||
{
|
||||
colonne = strlen( "* INTERF " );
|
||||
tooutput( df, "\n* INTERF " );
|
||||
}
|
||||
colonne = colonne + lgmot;
|
||||
|
||||
tooutput( df, "%s ", v );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy( v, scancon->NAME );
|
||||
spi_vect( v );
|
||||
|
||||
lgmot = strlen(v)+1;
|
||||
if( colonne+lgmot >= SPI_MAX_COL-2 )
|
||||
{
|
||||
colonne = strlen( "* INTERF " );
|
||||
tooutput( df, "\n* INTERF " );
|
||||
}
|
||||
colonne = colonne + lgmot;
|
||||
|
||||
tooutput( df, "%s ", v );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tooutput( df, "\n\n" );
|
||||
|
||||
/* Sort les .include */
|
||||
|
||||
for( scanchain = ptfig->MODELCHAIN; scanchain; scanchain = scanchain->NEXT )
|
||||
{
|
||||
tooutput( df, ".INCLUDE %s.%s\n", (char*)scanchain->DATA, OUT_LO );
|
||||
}
|
||||
|
||||
sortcircuit( ptfig, df );
|
||||
|
||||
if( fclose(df) == -1 )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr,
|
||||
"*** mbk error *** : Can't close file %s.\n,",
|
||||
ptfig->NAME
|
||||
);
|
||||
EXIT(1);
|
||||
}
|
||||
}
|
||||
|
||||
void tooutput( va_alist )
|
||||
va_dcl
|
||||
{
|
||||
va_list index;
|
||||
FILE *fd;
|
||||
char *fmt;
|
||||
|
||||
va_start( index );
|
||||
|
||||
fd = va_arg( index, FILE* );
|
||||
fmt = va_arg( index, char* );
|
||||
|
||||
if( vfprintf( fd, fmt, index ) < 0 )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "*** spi error *** : Error while writing file.\n" );
|
||||
perror( "System say " );
|
||||
EXIT( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
void spi_vect( s )
|
||||
char *s;
|
||||
{
|
||||
int i,p1;
|
||||
|
||||
if( s == NULL )
|
||||
return;
|
||||
if( s[0] == '\0' )
|
||||
return;
|
||||
|
||||
|
||||
/* Positionne i sur le premier caractere non espace a la fin de la chaine */
|
||||
i = strlen( s ) ;
|
||||
do
|
||||
i--;
|
||||
while( s[i] == ' ' && i >0 );
|
||||
|
||||
/* passe un eventuel paquet de nombres */
|
||||
if( i )
|
||||
{
|
||||
p1 = i;
|
||||
while( isdigit( (int)s[i] ) && i >0 )
|
||||
i--;
|
||||
if( p1 != i && s[i] == ' ' )
|
||||
{
|
||||
s[i] = '[';
|
||||
s[p1+1] = ']';
|
||||
s[p1+2] = '\0' ;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef SPI_DRIVER
|
||||
#define SPI_DRIVER
|
||||
|
||||
#define SPI_DRIVER_PTYPE 6809
|
||||
|
||||
/* Capacite minimum acceptable par Spice en pf */
|
||||
#define CAPAMINI 0.000001
|
||||
/* Resistance minimum acceptable par Spice en ohm */
|
||||
#define RESIMINI 0.001
|
||||
|
||||
typedef struct sconvindex
|
||||
{
|
||||
losig_list *sig; /* Pointeur sur le signal */
|
||||
int premier; /* Index du premier noeud sur le signal */
|
||||
} convindex;
|
||||
|
||||
/* NOTE :
|
||||
Le champs premier contient le numerot du premier noeud dans le fichier
|
||||
Spice. Dans les vues RCN, le premier numérot de noeud est le 1. Le numérot
|
||||
de noeud Spice est donc donné par la relation :
|
||||
noeud_spice = noeud_rcn + premier - 1
|
||||
*/
|
||||
|
||||
char* spinamednode __P(( losig_list *losig, long node ));
|
||||
void spi_vect __P(( char* ));
|
||||
void cherche_alim __P(( lofig_list *ptfig, char **vdd, char **vss ));
|
||||
void sortrcn __P(( lofig_list *ptfig, FILE *df, char *vss ));
|
||||
void signalnoeud __P(( lofig_list *ptfig ));
|
||||
int sortconnecteur __P(( FILE *df, locon_list *c, int ));
|
||||
void sortnet __P(( lofig_list *ptfig, FILE *df ));
|
||||
void sortinstance __P(( lofig_list *ptfig, FILE *df ));
|
||||
void sorttransistormos __P(( lofig_list *ptfig,
|
||||
FILE *df,
|
||||
char *vss,
|
||||
char *vdd
|
||||
));
|
||||
void sortcircuit __P(( lofig_list *ptfig, FILE *df ));
|
||||
void tooutput __P(()); /* va_list. */
|
||||
int sortconnecteur_ordre __P(( FILE *df, chain_list*, locon_list*, int ));
|
||||
|
||||
#endif
|
|
@ -0,0 +1,185 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include <mut.h>
|
||||
#include <mlo.h>
|
||||
#include <mlu.h>
|
||||
#include "spi_global.h"
|
||||
|
||||
spimodel *SPIHEADMODEL = NULL;
|
||||
|
||||
void spiloaderror( char*, int, char* );
|
||||
|
||||
void spiloadmodel( void )
|
||||
{
|
||||
char *env, place[80], word[80], *pt, *buffer;
|
||||
FILE *ptf;
|
||||
int line;
|
||||
spimodel *new;
|
||||
|
||||
env = mbkgetenv( "MBK_SPI_MODEL" );
|
||||
|
||||
if( !env )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "*** ERROR *** : Variable MBK_SPI_MODEL not found.\n" );
|
||||
fprintf( stderr, " try ""man spi""\n");
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
ptf = fopen( env, "r" );
|
||||
if( !ptf )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "*** ERROR *** : Can't open file %s.\n", env );
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
line = 0;
|
||||
while( ! feof( ptf ) )
|
||||
{
|
||||
line++;
|
||||
fgets( place, 80, ptf );
|
||||
|
||||
/* On remplace le \n par un caractere de fin de chaine */
|
||||
buffer=place;
|
||||
while( *buffer )
|
||||
{
|
||||
if( *buffer=='\n' )
|
||||
{
|
||||
*buffer=0;
|
||||
break;
|
||||
}
|
||||
buffer++;
|
||||
}
|
||||
|
||||
buffer=place;
|
||||
/* On passe les espaces en tête de fichier */
|
||||
while( *buffer==' ' && *buffer )
|
||||
buffer++;
|
||||
|
||||
if( !*buffer )
|
||||
continue;
|
||||
if( *buffer == '#' )
|
||||
continue;
|
||||
|
||||
/* On recopie le nom */
|
||||
pt=word;
|
||||
while( *buffer!=' ' && *buffer )
|
||||
{
|
||||
*pt=*buffer;
|
||||
pt++;
|
||||
buffer++;
|
||||
}
|
||||
*pt=0;
|
||||
|
||||
new = mbkalloc( sizeof( spimodel ) );
|
||||
new->NEXT = SPIHEADMODEL ;
|
||||
new->MODEL = namealloc( word );
|
||||
new->TYPE = 0;
|
||||
SPIHEADMODEL = new;
|
||||
|
||||
while( *buffer==' ' && *buffer )
|
||||
buffer++;
|
||||
if( !*buffer )
|
||||
spiloaderror( env, line, "No type found" ); /*le type est obligatoire */
|
||||
|
||||
/* La suite est le type, N ou P */
|
||||
|
||||
switch( *buffer )
|
||||
{
|
||||
case 'N':
|
||||
case 'n':
|
||||
new->TYPE = new->TYPE | TRANSN ;
|
||||
break;
|
||||
case 'P':
|
||||
case 'p':
|
||||
new->TYPE = new->TYPE | TRANSP ;
|
||||
break;
|
||||
default :
|
||||
spiloaderror( env, line, "Bad type" );
|
||||
}
|
||||
buffer++;
|
||||
|
||||
if( *buffer!=' ' && *buffer!='\0' )
|
||||
spiloaderror( env, line, "Bad type" );
|
||||
|
||||
while( *buffer==' ' && *buffer )
|
||||
buffer++;
|
||||
|
||||
while( *buffer )
|
||||
{
|
||||
pt=word;
|
||||
while( *buffer!=' ' && *buffer )
|
||||
{
|
||||
*pt=*buffer;
|
||||
pt++;
|
||||
buffer++;
|
||||
}
|
||||
*pt=0;
|
||||
|
||||
if( strcasecmp( word, "FAST" ) == 0 )
|
||||
new->TYPE = new->TYPE | TRANSFAST;
|
||||
else
|
||||
if( strcasecmp( word, "HVIO" ) == 0 )
|
||||
new->TYPE = new->TYPE | TRANSHVIO;
|
||||
else
|
||||
spiloaderror( env, line, "Unknown option" );
|
||||
|
||||
while( *buffer==' ' && *buffer )
|
||||
buffer++;
|
||||
}
|
||||
}
|
||||
|
||||
fclose( ptf );
|
||||
}
|
||||
|
||||
void spiloaderror( char *name, int line, char *reason )
|
||||
{
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "*** ERROR *** bad model file %s line %d\n", name, line );
|
||||
fprintf( stderr, "Reason is : %s.\n", reason );
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
char* spitransmodel( char type )
|
||||
{
|
||||
spimodel *scan;
|
||||
|
||||
if( !SPIHEADMODEL )
|
||||
spiloadmodel();
|
||||
|
||||
for( scan = SPIHEADMODEL ; scan ; scan = scan->NEXT )
|
||||
{
|
||||
if( scan->TYPE == type )
|
||||
return( scan->MODEL );
|
||||
}
|
||||
|
||||
fflush( stdout );
|
||||
fprintf( stderr, "*** ERROR *** No known type.\n" );
|
||||
fprintf( stderr, "Flags : %c %s %s\n",
|
||||
IsTransN(type)?'N':'P',
|
||||
IsTransFast(type)?"FAST":"---",
|
||||
IsTransHvio(type)?"HVIO":"---"
|
||||
);
|
||||
EXIT(1);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
char spitranstype( char *model )
|
||||
{
|
||||
spimodel *scan;
|
||||
|
||||
if( !SPIHEADMODEL )
|
||||
spiloadmodel();
|
||||
|
||||
for( scan = SPIHEADMODEL ; scan ; scan = scan->NEXT )
|
||||
{
|
||||
if( strcasecmp(scan->MODEL, model) == 0 )
|
||||
return( scan->TYPE );
|
||||
}
|
||||
|
||||
return(SPI_UNK_TRANS_TYPE);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
typedef struct spimodel {
|
||||
struct spimodel *NEXT;
|
||||
char *MODEL;
|
||||
char TYPE;
|
||||
}spimodel ;
|
||||
|
||||
void spiloadmodel __P(( void ));
|
||||
char spitranstype __P(( char* ));
|
||||
char* spitransmodel __P(( char ));
|
||||
|
||||
/* Valeur pour dire que le nom de modele de transistor passé à la fonction
|
||||
* spitranstype n'est pas défini. Ce nombre doit être une valeur impossible
|
||||
* pour le champs type des transistors */
|
||||
#define SPI_UNK_TRANS_TYPE 64
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mut.h>
|
||||
#include "spi_hash.h"
|
||||
|
||||
/* 2^n elements dans la table de hash */
|
||||
#define HASH_MINI 4
|
||||
#define HASH_MAXI 15
|
||||
|
||||
/* 2^n Seuil d'augmentation */
|
||||
#define HASH_DELTA 1
|
||||
|
||||
thash* creatthash( )
|
||||
{
|
||||
thash *new;
|
||||
int i;
|
||||
int n;
|
||||
|
||||
new = ( thash* )mbkalloc( sizeof( thash ) );
|
||||
new->entree = HASH_MINI ;
|
||||
n = 1 << new->entree;
|
||||
new->table = ( hashelem** )mbkalloc( sizeof( hashelem* ) * n );
|
||||
new->nbelem = 0;
|
||||
new->tete = NULL;
|
||||
new->libere = NULL;
|
||||
|
||||
for( i = 0 ; i < n ; i++ )
|
||||
new->table[i] = NULL;
|
||||
|
||||
return( new );
|
||||
}
|
||||
|
||||
void freethash( pt )
|
||||
thash *pt;
|
||||
{
|
||||
chain_list *scanchain;
|
||||
|
||||
mbkfree( pt->table );
|
||||
/*
|
||||
if( pt->tete )
|
||||
mbkfree( pt->tete );
|
||||
*/
|
||||
|
||||
for( scanchain = pt->libere ; scanchain ; scanchain = scanchain->NEXT )
|
||||
mbkfree( scanchain->DATA );
|
||||
freechain( pt->libere );
|
||||
|
||||
mbkfree( pt );
|
||||
}
|
||||
|
||||
hashelem* nouvhashelem( table )
|
||||
thash *table;
|
||||
{
|
||||
int i;
|
||||
hashelem *elem;
|
||||
|
||||
if( ! table->tete )
|
||||
{
|
||||
table->tete = ( hashelem* ) mbkalloc ( sizeof( hashelem ) * 64 );
|
||||
table->libere = addchain( table->libere, table->tete );
|
||||
elem = table->tete;
|
||||
|
||||
for( i = 1 ; i < 64 ; i++ )
|
||||
{
|
||||
elem->suivant = elem + 1;
|
||||
elem++;
|
||||
}
|
||||
elem->suivant = NULL;
|
||||
}
|
||||
|
||||
elem = table->tete;
|
||||
table->tete = table->tete->suivant;
|
||||
|
||||
return( elem );
|
||||
}
|
||||
|
||||
void liberehashelem( table, elem )
|
||||
thash *table;
|
||||
hashelem *elem;
|
||||
{
|
||||
elem->suivant = table->tete;
|
||||
table->tete = elem;
|
||||
}
|
||||
|
||||
void addthashelem( nouveau, ptr, table )
|
||||
char *nouveau;
|
||||
void *ptr;
|
||||
thash *table;
|
||||
{
|
||||
int s;
|
||||
hashelem *elm;
|
||||
|
||||
|
||||
if( table->nbelem == 1 << ( table->entree + HASH_DELTA ) &&
|
||||
table->entree < HASH_MAXI )
|
||||
resizetable( table, table->entree + 1 );
|
||||
|
||||
s = thashsignature( nouveau, table->entree );
|
||||
elm = nouvhashelem( table );
|
||||
|
||||
elm->suivant = table->table[ s ];
|
||||
table->table[ s ] = elm;
|
||||
|
||||
elm->mot = nouveau;
|
||||
elm->ptr = ptr;
|
||||
|
||||
table->nbelem++;
|
||||
}
|
||||
|
||||
void* getthashelem( elem, table, status )
|
||||
char *elem;
|
||||
thash *table;
|
||||
int *status;
|
||||
{
|
||||
int s;
|
||||
hashelem *scan;
|
||||
|
||||
s = thashsignature( elem, table->entree );
|
||||
|
||||
for( scan = table->table[ s ] ; scan ; scan = scan->suivant )
|
||||
{
|
||||
if( scan->mot == elem || strcmp( scan->mot, elem ) == 0 )
|
||||
{
|
||||
if( status != NULL )
|
||||
*status = 1;
|
||||
return( scan->ptr );
|
||||
}
|
||||
}
|
||||
|
||||
if( status != NULL )
|
||||
*status = 0;
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
int thashsignature( c, l )
|
||||
char *c;
|
||||
int l;
|
||||
{
|
||||
int bit;
|
||||
int b;
|
||||
int dec;
|
||||
|
||||
dec = 0;
|
||||
bit = 0;
|
||||
|
||||
while( *c )
|
||||
{
|
||||
for( bit = 0; bit < 8 ; bit ++ )
|
||||
{
|
||||
b = ( *c >> bit ) & 0x1;
|
||||
|
||||
/* Polynome générateur : X^15 + X + 1 */
|
||||
dec = ( ( dec & 0x3FFE ) << 1 ) |
|
||||
( ( ( dec & 0x4000 ) >> 13 ) ^ ( ( dec & 0x1 ) << 1 ) ) |
|
||||
( ( ( dec & 0x4000 ) >> 14 ) ^ b ) ;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
|
||||
return( dec % ( 1 << l ) );
|
||||
}
|
||||
|
||||
void resizetable( table, elem )
|
||||
thash *table;
|
||||
int elem;
|
||||
{
|
||||
hashelem **new;
|
||||
hashelem *nouv;
|
||||
hashelem *scan;
|
||||
hashelem *suiv;
|
||||
int n;
|
||||
int i;
|
||||
int s;
|
||||
|
||||
n = 1 << elem;
|
||||
|
||||
new = ( hashelem** )mbkalloc( sizeof( hashelem* ) * n );
|
||||
for( i = 0 ; i < n ; i++ )
|
||||
new[ i ] = NULL;
|
||||
|
||||
n = 1 << table->entree;
|
||||
|
||||
for( i = 0 ; i < n ; i++ )
|
||||
{
|
||||
for( scan = table->table[i] ; scan ; scan = scan->suivant )
|
||||
{
|
||||
nouv = nouvhashelem( table );
|
||||
s = thashsignature( scan->mot, elem );
|
||||
|
||||
nouv->suivant = new[ s ];
|
||||
new[s] = nouv;
|
||||
nouv->mot = scan->mot;
|
||||
nouv->ptr = scan->ptr;
|
||||
}
|
||||
|
||||
for( scan = table->table[i] ; scan ; scan = suiv )
|
||||
{
|
||||
suiv = scan->suivant;
|
||||
liberehashelem( table, scan );
|
||||
}
|
||||
}
|
||||
|
||||
mbkfree( table->table );
|
||||
table->table = new;
|
||||
table->entree = elem;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef SPI_HASH
|
||||
#define SPI_HASH
|
||||
|
||||
typedef struct shashelem
|
||||
{
|
||||
struct shashelem *suivant;
|
||||
char *mot;
|
||||
void *ptr;
|
||||
} hashelem;
|
||||
|
||||
typedef struct sthash
|
||||
{
|
||||
int entree; /* Nombre d'entrées dans la table de hash 2^n */
|
||||
int nbelem; /* Nombre d'element dans les liste */
|
||||
hashelem **table; /* informations dans la table */
|
||||
hashelem *tete; /* Blocs libre pour allocation par tat */
|
||||
chain_list *libere; /* Pointeurs pour les libérations */
|
||||
} thash;
|
||||
|
||||
thash* creatthash __P(( ));
|
||||
/*
|
||||
Crée une nouvelle table de hash. Le parametre d'entrée est le nombre
|
||||
d'entrees de la nouvelle table
|
||||
*/
|
||||
|
||||
void freethash __P(( thash *pt ));
|
||||
/*
|
||||
Libère une table de hash précédement allouée
|
||||
*/
|
||||
|
||||
void addthashelem __P(( char *nouveau, void *ptr, thash *table ));
|
||||
/*
|
||||
Ajoute un élément dans la table de hash. Le premier parametre est
|
||||
la chaine identifiant l'élément, le second est l'élément que l'on place dans
|
||||
la table et finalement le troisième est l'élément vers la table de hash
|
||||
*/
|
||||
|
||||
void* getthashelem __P(( char *elem, thash *table, int *status ));
|
||||
/*
|
||||
Récupère un élément dans la table de hash à partir de son identificateur
|
||||
passé en premier paramètre. Le second argument est la table de hash sur laquelle
|
||||
la recherche est effectuée. Si le troisième élément est différent de NULL,
|
||||
la valeur 1 est plcée à cette adresse si l'élément est trouvé, 0 sinon. La
|
||||
valeur renvoyée est celle de l'élément recherché.
|
||||
*/
|
||||
|
||||
int thashsignature __P(( char *c, int l ));
|
||||
/*
|
||||
Utilisé en interne
|
||||
*/
|
||||
|
||||
void resizetable __P(( thash*, int ));
|
||||
hashelem* nouvhashelem __P(( thash* ));
|
||||
void liberehashelem __P(( thash*, hashelem* ));
|
||||
#endif
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <mut.h>
|
||||
#include "spi_int.h"
|
||||
|
||||
tableint* creattableint()
|
||||
{
|
||||
tableint *new;
|
||||
int i;
|
||||
|
||||
new = (tableint*) mbkalloc( sizeof( tableint ) * SPI_TABLEINTMAX );
|
||||
|
||||
for( i = 0 ; i < SPI_TABLEINTMAX ; i++ )
|
||||
{
|
||||
new[ i ].index = 0;
|
||||
new[ i ].data = NULL;
|
||||
new[ i ].down = NULL;
|
||||
}
|
||||
|
||||
return( new );
|
||||
}
|
||||
|
||||
int settableint( table, value, data )
|
||||
tableint *table;
|
||||
int value;
|
||||
void *data;
|
||||
{
|
||||
int p;
|
||||
int niveau;
|
||||
|
||||
niveau = 3;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
p = ( value >> ( niveau * 8 ) ) & ( SPI_TABLEINTMASK );
|
||||
|
||||
if( table[ p ].index == value )
|
||||
{
|
||||
/* L'element existe déjà : on le remplace */
|
||||
table[ p ].data = data;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
if( table[ p ].index == 0 )
|
||||
{
|
||||
/* Nouvel élément */
|
||||
table[ p ].index = value;
|
||||
table[ p ].data = data;
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
if( table[ p ].down == NULL )
|
||||
table[ p ].down = creattableint();
|
||||
|
||||
niveau--;
|
||||
|
||||
table = table[p].down;
|
||||
}
|
||||
}
|
||||
|
||||
void* tsttableint( table, value )
|
||||
tableint *table;
|
||||
int value;
|
||||
{
|
||||
int p;
|
||||
int niveau;
|
||||
|
||||
niveau = 3;
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
p = ( value >> ( niveau * 8 ) ) & (SPI_TABLEINTMASK);
|
||||
|
||||
if( table[ p ].index == value )
|
||||
return( table[ p ].data );
|
||||
|
||||
if( table[ p ].down == NULL )
|
||||
return( NULL );
|
||||
|
||||
niveau--;
|
||||
|
||||
table = table[ p ].down;
|
||||
}
|
||||
}
|
||||
|
||||
void freetableint( table )
|
||||
tableint *table;
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0 ; i < SPI_TABLEINTMAX ; i++ )
|
||||
{
|
||||
if( table[ i ].down )
|
||||
freetableint( table[ i ].down );
|
||||
}
|
||||
mbkfree( table );
|
||||
}
|
||||
|
||||
int scanint( table, n )
|
||||
tableint *table;
|
||||
int n;
|
||||
{
|
||||
int i=0, l=0 ;
|
||||
int n3, n2, n1, n0 ;
|
||||
tableint *t=NULL, *t3, *t2, *t1, *t0 ;
|
||||
|
||||
if( n == 0 )
|
||||
{
|
||||
for( i = 0 ; i < SPI_TABLEINTMAX ; i++ )
|
||||
{
|
||||
if( table[i].index )
|
||||
return( table[i].index );
|
||||
}
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
n0 = n & SPI_TABLEINTMASK;
|
||||
n1 = ( n >> 8 ) & SPI_TABLEINTMASK;
|
||||
n2 = ( n >> 16 ) & SPI_TABLEINTMASK;
|
||||
n3 = ( n >> 24 ) & SPI_TABLEINTMASK;
|
||||
|
||||
/* recherche de l'element n */
|
||||
|
||||
t3 = NULL;
|
||||
t2 = NULL;
|
||||
t1 = NULL;
|
||||
t0 = NULL;
|
||||
|
||||
if( table[ n3 ].index == n )
|
||||
{
|
||||
t = table;
|
||||
l = n3;
|
||||
t3 = t;
|
||||
}
|
||||
else
|
||||
if( table[ n3 ].down[ n2 ].index == n )
|
||||
{
|
||||
t = table[ n3 ].down ;
|
||||
l = n2;
|
||||
t3 = table;
|
||||
t2 = t;
|
||||
}
|
||||
else
|
||||
if( table[ n3 ].down[ n2 ].down[ n1 ].index == n)
|
||||
{
|
||||
t = table[ n3 ].down[ n2 ].down;
|
||||
l = n1;
|
||||
t3 = table;
|
||||
t2 = table[ n3 ].down;
|
||||
t1 = t;
|
||||
}
|
||||
else
|
||||
if( table[ n3 ].down[ n2 ].down[ n1 ].down[ n0 ].index == n )
|
||||
{
|
||||
t = table[ n3 ].down[ n2 ].down[ n1 ].down;
|
||||
l = n0;
|
||||
t3 = table;
|
||||
t2 = table[ n3 ].down;
|
||||
t1 = table[ n3 ].down[ n2 ].down;
|
||||
t0 = t;
|
||||
}
|
||||
|
||||
/* Descent d'un niveau */
|
||||
|
||||
if( t[ l ].down )
|
||||
{
|
||||
t = t[ l ].down;
|
||||
|
||||
for( i = 0 ; i < SPI_TABLEINTMAX ; i++ )
|
||||
{
|
||||
if( t[ i ].index )
|
||||
return( t[ i ].index );
|
||||
}
|
||||
/* jamais executé */
|
||||
}
|
||||
|
||||
while( 1 )
|
||||
{
|
||||
/* Parcour un niveau horizontalement */
|
||||
|
||||
for( i = l + 1 ; i < SPI_TABLEINTMAX ; i++ )
|
||||
{
|
||||
if( t[ i ].index )
|
||||
return( t[ i ].index );
|
||||
}
|
||||
|
||||
/* Remonte les niveaux */
|
||||
|
||||
if( t == t0 )
|
||||
{
|
||||
t = t1;
|
||||
l = n1;
|
||||
}
|
||||
else
|
||||
if( t == t1 )
|
||||
{
|
||||
t = t2;
|
||||
l = n2;
|
||||
}
|
||||
else
|
||||
if( t == t2 )
|
||||
{
|
||||
t = t3;
|
||||
l = n3;
|
||||
}
|
||||
else
|
||||
if( t == t3 )
|
||||
return( 0 );
|
||||
}
|
||||
/* Cette boucle se finie en interne par un return */
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef spi_int
|
||||
#define spi_int
|
||||
|
||||
typedef struct st_tableint
|
||||
{
|
||||
int index;
|
||||
void *data;
|
||||
struct st_tableint *down;
|
||||
} tableint;
|
||||
|
||||
/* Lors qu'on ajoute quelque chose dans la liste, le pointeur DATA ne doit pas
|
||||
etre NULL, cette valeur etant utilisée en interne sur ce champs */
|
||||
|
||||
#define SPI_TABLEINTMAX 256
|
||||
#define SPI_TABLEINTMASK 0x000000FF
|
||||
|
||||
tableint* creattableint __P(());
|
||||
/* Crée une nouvelle table */
|
||||
|
||||
int settableint __P(( tableint *table, int value, void *data ));
|
||||
/* Ajoute un élément dans la table. Renvoie 1 si l'élément est nouveau,
|
||||
0 sinon (l'élément précédent est alors remplacé) */
|
||||
|
||||
void* tsttableint __P(( tableint *table, int value ));
|
||||
/* Renvoie l'élément recherché par la valeur */
|
||||
|
||||
void freetableint __P(( tableint *table ));
|
||||
/* Libère la table */
|
||||
|
||||
int scanint __P(( tableint *table, int n ));
|
||||
/* Parcour des éléments mémorisés dans la table. On commence par mettre
|
||||
l'entier d'entrée à 0, puis pour les elements suivant on met la valeur
|
||||
du noeud retourné précédement. La fin est indiqué par un retour 0 */
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,188 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "spi_msg.h"
|
||||
|
||||
#include <mut.h>
|
||||
|
||||
char *spimsg[NBLANG][NBMSG] =
|
||||
{
|
||||
/* English */ {
|
||||
/* 0 */ "*** Error in parser driver Spice",
|
||||
/* 1 */ "Syntax error",
|
||||
/* 2 */ "Can't use .INCLUDE inside a subckt",
|
||||
/* 3 */ "Incorrect value for variable MBK_SPI_LANG : Using English",
|
||||
/* 4 */ "Can't find *interf in file",
|
||||
/* 5 */ "Internal error [1]",
|
||||
/* 6 */ "Identical nodes on subckt",
|
||||
/* 7 */ "Variable MBK_SPI_SEPAR must be a single character",
|
||||
/* 8 */ "Can't read lofig with this mode",
|
||||
/* 9 */ "Can't open file",
|
||||
/* 10 */ "Data structure not empty when delete",
|
||||
/* 11 */ "File",
|
||||
/* 12 */ "Line",
|
||||
/* 13 */ "Incomplete line",
|
||||
/* 14 */ "Too many element on line",
|
||||
/* 15 */ "Can't use subckt in another subckt",
|
||||
/* 16 */ "No name for subckt",
|
||||
/* 17 */ "Node for *ASIMNET must be number",
|
||||
/* 18 */ "No symbol '=' after node in *ASIMNET",
|
||||
/* 19 */ "No node in *ASIMNET",
|
||||
/* 20 */ "No name for node in *ASIMNET",
|
||||
/* 21 */ "Only one name supported in *ASIMNET",
|
||||
/* 22 */ ".ENDS without .SUBCKT",
|
||||
/* 23 */ "No name for subckt",
|
||||
/* 24 */ "Name for .ENDS differs than name of .SUBCKT",
|
||||
/* 25 */ "No name for transistor",
|
||||
/* 26 */ "Transistor is already defined",
|
||||
/* 27 */ "The transistor has no DRAIN node",
|
||||
/* 28 */ "The transistor has no GRID node",
|
||||
/* 29 */ "The transistor has no SOURCE node",
|
||||
/* 30 */ "The transistor has no BULK node",
|
||||
/* 31 */ "The transistor has no type",
|
||||
/* 32 */ "The transistor has a bad type",
|
||||
/* 33 */ "Parameter incomplete for transistor",
|
||||
/* 34 */ "Bad value",
|
||||
/* 35 */ "Parameter not supported",
|
||||
/* 36 */ "No name for resistor",
|
||||
/* 37 */ "Resistor already defined in subckt",
|
||||
/* 38 */ "No name for capacitance",
|
||||
/* 39 */ "Capacitance already defined in subckt",
|
||||
/* 40 */ "No name for subckt",
|
||||
/* 41 */ "Subckt already defined",
|
||||
/* 42 */ "Unreconized element ignored",
|
||||
/* 43 */ "No model found",
|
||||
/* 44 */ "Number of node differs between model and instance",
|
||||
/* 45 */ "Signal is both VDD and VSS",
|
||||
/* 46 */ "Many signals are VSS",
|
||||
/* 47 */ "Many signals are VDD",
|
||||
/* 48 */ "Line too long",
|
||||
/* 49 */ "Incorrect value for node",
|
||||
/* 50 */ "Incorrect name for node",
|
||||
/* 51 */ "The node has already a name",
|
||||
/* 52 */ "Illegal signal name",
|
||||
/* 53 */ "File open",
|
||||
/* 54 */ "Circuit",
|
||||
/* 55 */ "Instance",
|
||||
/* 56 */ "Model",
|
||||
/* 57 */ "Too many model of transistors",
|
||||
/* 58 */ "Model name too long"
|
||||
|
||||
},
|
||||
/* French */ {
|
||||
/* 0 */ "*** Erreur dans le parser driver Spice",
|
||||
/* 1 */ "Erreur de syntaxe",
|
||||
/* 2 */ "Un .INCLUDE n'est pas utilisable dans un subckt",
|
||||
/* 3 */ "Valeur incorrecte pour MBK_SPI_LANG : Utilisation du Francais",
|
||||
/* 4 */ "Impossible de trouver le *interf le fichier",
|
||||
/* 5 */ "Erreur interne [1] : Pas de locon correspondant au nom dans la liste de l'ordre des locons.",
|
||||
/* 6 */ "Connecteur identiques sur le subckt",
|
||||
/* 7 */ "La variable MBK_SPI_SEPAR doit etre un caractere seul",
|
||||
/* 8 */ "Mode de lecture de la lofig non supporte",
|
||||
/* 9 */ "Impossible d'acceder au fichier",
|
||||
/* 10 */ "Structure de donnee non nettoyee avant liberation",
|
||||
/* 11 */ "Fichier",
|
||||
/* 12 */ "Ligne",
|
||||
/* 13 */ "Ligne incomplete",
|
||||
/* 14 */ "Trop d'elements sur la ligne",
|
||||
/* 15 */ "Les subckt imbriques ne sont pas supportes",
|
||||
/* 16 */ "Pas de nom pour le subckt",
|
||||
/* 17 */ "Les noeuds dans les *ASIMNET doivent etre des nombres",
|
||||
/* 18 */ "Caractere '=' absent apres les noeuds de '*ASIMNET'",
|
||||
/* 19 */ "Noeud absent dans *ASIMNET",
|
||||
/* 20 */ "Pas de nom pour les noeuds dans *ASIMNET",
|
||||
/* 21 */ "Un seul nom doit etre donne dans *ASIMNET",
|
||||
/* 22 */ ".ENDS rencontre sans avoir le .SUBCKT correspondant",
|
||||
/* 23 */ "Le nom du subckt est absent",
|
||||
/* 24 */ "Le nom specifie dans le .ENDS n'est pas le meme que pour le .SUBCKT",
|
||||
/* 25 */ "Le nom du transistor n'est pas specifie",
|
||||
/* 26 */ "Le transistor existe deja dans ce subckt",
|
||||
/* 27 */ "Le transistor ne possede pas de DRAIN",
|
||||
/* 28 */ "Le transistor ne possede pas de GRILLE",
|
||||
/* 29 */ "Le transistor ne possede pas de SOURCE",
|
||||
/* 30 */ "Le transistor ne possede pas de SUBSTRAT",
|
||||
/* 31 */ "Type du transistor absent",
|
||||
/* 32 */ "Type du transistor incorrecte",
|
||||
/* 33 */ "Parametre du transistor incomplet",
|
||||
/* 34 */ "Valeur incorrect",
|
||||
/* 35 */ "Parametre non supporte",
|
||||
/* 36 */ "Le nom de la resistance n'est pas specifie",
|
||||
/* 37 */ "La resistance existe deja dans le subckt",
|
||||
/* 38 */ "Le nom de la capacite n'est pas specifie",
|
||||
/* 39 */ "La capacite existe deja dans le subckt",
|
||||
/* 40 */ "Pas de nom pour le subckt",
|
||||
/* 41 */ "Le subckt existe deja",
|
||||
/* 42 */ "Element non reconnu par le parser ignore",
|
||||
/* 43 */ "Modele non trouve",
|
||||
/* 44 */ "Le mombre de connecteurs differe entre le modele et l'instance",
|
||||
/* 45 */ "Un signal est a la fois VDD et VSS",
|
||||
/* 46 */ "Plusieurs equipotentielles sont VSS",
|
||||
/* 47 */ "Plusieurs equipotentielles sont VDD",
|
||||
/* 48 */ "Ligne trop longue",
|
||||
/* 49 */ "Valeur du noeud incorrect",
|
||||
/* 50 */ "Nom du noeud incorrect",
|
||||
/* 51 */ "Renommage d'un noeud qui possede un nom",
|
||||
/* 52 */ "Nom de signal vecteur incorrect",
|
||||
/* 53 */ "Ouverture du fichier",
|
||||
/* 54 */ "Circuit",
|
||||
/* 55 */ "Instance",
|
||||
/* 56 */ "Model",
|
||||
/* 57 */ "Trops de modeles de transistors",
|
||||
/* 58 */ "Nom de modele trop long"
|
||||
}
|
||||
};
|
||||
|
||||
int SPI_LANG = DEFAULT_SPI_LANG;
|
||||
|
||||
void spi_init_lang( void )
|
||||
{
|
||||
char *env;
|
||||
|
||||
env = mbkgetenv( "MBK_SPI_LANG" );
|
||||
|
||||
if( env )
|
||||
{
|
||||
if( strcmp( env, "Francais" ) == 0 )
|
||||
SPI_LANG = 1;
|
||||
else
|
||||
if( strcmp( env, "English" ) == 0 )
|
||||
SPI_LANG = 0;
|
||||
else
|
||||
{
|
||||
SPI_LANG = DEFAULT_SPI_LANG;
|
||||
fflush( stdout );
|
||||
fprintf( stderr,"%s.\n", SPIMSG(3) );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef SPI_MSGH
|
||||
#define SPI_MSGH
|
||||
|
||||
#define NBLANG 2
|
||||
/*
|
||||
* 0 Anglais
|
||||
* 1 Francais
|
||||
*/
|
||||
#define DEFAULT_SPI_LANG 0
|
||||
#define NBMSG 59
|
||||
|
||||
extern int SPI_LANG;
|
||||
extern char *spimsg[NBLANG][NBMSG];
|
||||
|
||||
#define SPIMSG(num) spimsg[SPI_LANG][num]
|
||||
|
||||
void spi_init_lang(void);
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,187 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* *
|
||||
* Tool : Spice parser / driver v 7.00 *
|
||||
* Author(s) : Gregoire AVOT *
|
||||
* Updates : March, 18th 1998 *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef SPI_PARSEH
|
||||
#define SPI_PARSEH
|
||||
|
||||
#define SPIEQUI 1664
|
||||
|
||||
#define TAILLENOM 4096
|
||||
|
||||
typedef struct s_circuit
|
||||
{
|
||||
struct s_noeud *NOEUD;
|
||||
struct s_trans *TRANS;
|
||||
struct s_resi *RESI;
|
||||
struct s_capa *CAPA;
|
||||
struct s_inst *INST;
|
||||
struct s_valim *VALIM;
|
||||
char *NOM;
|
||||
chain_list *CINTERF; /* DATA fiels : s_noeud */
|
||||
chain_list *FREE;
|
||||
tableint *INT_NOEUD;
|
||||
thash *NOM_NOEUD;
|
||||
thash *HASHGNAME;
|
||||
thash *HASHCAPA;
|
||||
thash *HASHRESI;
|
||||
thash *HASHVALIM;
|
||||
thash *HASHINST;
|
||||
thash *HASHTRAN;
|
||||
long TAILLE;
|
||||
char *ALLOUENOM;
|
||||
int RESTENOM;
|
||||
} circuit;
|
||||
|
||||
typedef struct s_noeud
|
||||
{
|
||||
struct s_noeud *SUIV;
|
||||
char *NOM;
|
||||
int SIGNAL;
|
||||
int RCN;
|
||||
int SPICE;
|
||||
} noeud;
|
||||
|
||||
typedef struct s_trans
|
||||
{
|
||||
struct s_trans *SUIV;
|
||||
struct s_noeud *DRAIN;
|
||||
struct s_noeud *SOURCE;
|
||||
struct s_noeud *GRILLE;
|
||||
struct s_noeud *SUBST;
|
||||
char TYPE;
|
||||
char *NOM;
|
||||
float L;
|
||||
float W;
|
||||
float AS;
|
||||
float AD;
|
||||
float PS;
|
||||
float PD;
|
||||
float X;
|
||||
float Y;
|
||||
} trans;
|
||||
|
||||
typedef struct s_inst
|
||||
{
|
||||
struct s_inst *SUIV;
|
||||
char *NOM;
|
||||
char *MODELE;
|
||||
chain_list *IINTERF;
|
||||
} inst;
|
||||
|
||||
typedef struct s_resi
|
||||
{
|
||||
struct s_resi *SUIV;
|
||||
float RESI;
|
||||
struct s_noeud *N1;
|
||||
struct s_noeud *N2;
|
||||
char *NOM;
|
||||
float CAPA;
|
||||
} resi;
|
||||
|
||||
typedef struct s_capa
|
||||
{
|
||||
struct s_capa *SUIV;
|
||||
float CAPA;
|
||||
struct s_noeud *N1;
|
||||
struct s_noeud *N2;
|
||||
char *NOM;
|
||||
} capa;
|
||||
|
||||
typedef struct s_valim
|
||||
{
|
||||
struct s_valim *SUIV;
|
||||
float TENSION;
|
||||
struct s_noeud *N1;
|
||||
struct s_noeud *N2;
|
||||
char *NOM;
|
||||
} valim;
|
||||
|
||||
typedef struct s_interf
|
||||
{
|
||||
struct s_interf *SUIV;
|
||||
char *NOM;
|
||||
chain_list *GINTERF; /* DATA field : char* nom des locons */
|
||||
} ginterf;
|
||||
|
||||
#define LONG_LIGNE 16384
|
||||
|
||||
typedef struct s_spifile
|
||||
{
|
||||
FILE *df;
|
||||
chain_list *decomp1;
|
||||
chain_list *decomp2;
|
||||
char file_line[LONG_LIGNE];
|
||||
char file_line1[LONG_LIGNE];
|
||||
char file_line2[LONG_LIGNE];
|
||||
int msl_line;
|
||||
char *filename;
|
||||
} spifile ;
|
||||
|
||||
/* Fonctions d'allocation mémoire pour un circuit */
|
||||
|
||||
void* spiciralloue __P(( circuit*, int ));
|
||||
void liberecircuit __P(( circuit* ));
|
||||
|
||||
/* Fonctions pour parser le fichier au format Spice */
|
||||
|
||||
circuit* lirecircuit __P(( spifile*, ginterf** ));
|
||||
chain_list* lireligne __P(( spifile* ));
|
||||
chain_list* decompligne __P(( spifile* ));
|
||||
noeud* ajoutenoeud __P(( circuit*, char*, spifile* ));
|
||||
void nomenoeud __P(( circuit*, noeud*, char*, spifile* ));
|
||||
char* spicenamealloc __P(( circuit*, char* ));
|
||||
void affvuespice __P(( circuit* ));
|
||||
float spicefloat __P(( char*, int* ));
|
||||
chain_list* recupereinterf __P(( char* ));
|
||||
void loconinterf __P(( lofig_list*, chain_list* ));
|
||||
ginterf* traiteinclude __P(( ginterf*, char* ));
|
||||
char* retireextention __P(( char *nom ));
|
||||
lofig_list* recuperemodele __P(( lofig_list*, char*, chain_list* ));
|
||||
ginterf* constinterf __P(( circuit*, ginterf* ));
|
||||
ginterf* spiceloading __P(( lofig_list*, char*, char, ginterf* ));
|
||||
spifile* spifileopen __P(( char* ));
|
||||
void spierror __P(( int, char*, int ));
|
||||
|
||||
/* Fonctions pour convertir la vue spice en vue Alliance */
|
||||
|
||||
void constequi __P(( circuit*, ginterf* ));
|
||||
void constlofig __P(( circuit*, lofig_list*, ginterf*, char));
|
||||
void triecapa __P(( circuit* ));
|
||||
long float2long __P(( float ));
|
||||
ptype_list* constphinterf __P(( ptype_list*, ginterf* ));
|
||||
char* spi_devect __P(( char* ));
|
||||
|
||||
int nodenameisequi __P(( char*, char* ));
|
||||
void stopchainsepar __P(( char* ));
|
||||
void spi_dump_equi __P(( char*, ptype_list* ));
|
||||
void taillevuespice __P(( circuit* ));
|
||||
#endif
|
Loading…
Reference in New Issue