From a2cfd01891cc64a886d03e56999e900a5a9364c4 Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Thu, 21 Mar 2002 12:28:55 +0000 Subject: [PATCH] Hi --- alliance/src/rtd/Makefile.am | 1 + alliance/src/rtd/configure.in | 45 ++ alliance/src/rtd/src/Makefile.am | 7 + alliance/src/rtd/src/rtd.h | 73 ++++ alliance/src/rtd/src/rtd_drive.c | 440 +++++++++++++++++++ alliance/src/rtd/src/rtd_drive.h | 75 ++++ alliance/src/rtd/src/rtd_error.c | 124 ++++++ alliance/src/rtd/src/rtd_error.h | 91 ++++ alliance/src/rtd/src/rtd_get.c | 126 ++++++ alliance/src/rtd/src/rtd_get.h | 75 ++++ alliance/src/rtd/src/rtd_parse.c | 704 +++++++++++++++++++++++++++++++ alliance/src/rtd/src/rtd_parse.h | 75 ++++ 12 files changed, 1836 insertions(+) create mode 100644 alliance/src/rtd/Makefile.am create mode 100644 alliance/src/rtd/configure.in create mode 100644 alliance/src/rtd/src/Makefile.am create mode 100644 alliance/src/rtd/src/rtd.h create mode 100644 alliance/src/rtd/src/rtd_drive.c create mode 100644 alliance/src/rtd/src/rtd_drive.h create mode 100644 alliance/src/rtd/src/rtd_error.c create mode 100644 alliance/src/rtd/src/rtd_error.h create mode 100644 alliance/src/rtd/src/rtd_get.c create mode 100644 alliance/src/rtd/src/rtd_get.h create mode 100644 alliance/src/rtd/src/rtd_parse.c create mode 100644 alliance/src/rtd/src/rtd_parse.h diff --git a/alliance/src/rtd/Makefile.am b/alliance/src/rtd/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/rtd/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/rtd/configure.in b/alliance/src/rtd/configure.in new file mode 100644 index 00000000..30f88843 --- /dev/null +++ b/alliance/src/rtd/configure.in @@ -0,0 +1,45 @@ +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 +dnl $Id: configure.in,v 1.1 2002/03/21 12:28:55 ludo Exp $ +dnl +dnl +AC_INIT(src/rtd.h) +AM_INIT_AUTOMAKE(rtd, 1.1) +AC_PROG_INSTALL +AC_PROG_CC +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/rtd/src/Makefile.am b/alliance/src/rtd/src/Makefile.am new file mode 100644 index 00000000..0c634004 --- /dev/null +++ b/alliance/src/rtd/src/Makefile.am @@ -0,0 +1,7 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libRtd.a +include_HEADERS = rtd.h +libRtd_a_SOURCES = \ +rtd.h rtd_drive.h rtd_error.h rtd_get.h rtd_parse.h \ +rtd_drive.c rtd_error.c rtd_get.c rtd_parse.c diff --git a/alliance/src/rtd/src/rtd.h b/alliance/src/rtd/src/rtd.h new file mode 100644 index 00000000..f1f1fbc5 --- /dev/null +++ b/alliance/src/rtd/src/rtd.h @@ -0,0 +1,73 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------\ +| | +| Title : Structures and fonctions for RTD | +| | +| Date : 07.04.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------*/ + +# ifndef RTD_101_H +# define RTD_101_H + +/*------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Structures | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------*/ + + extern void savertlfig __P((rtlfig_list *RtlFigure)); + extern void loadrtlfig __P((rtlfig_list *RtlFigure, char *FigureName)); + extern rtlfig_list * getrtlfig __P((char *Name)); + extern void rtlenv __P(()); + +# endif diff --git a/alliance/src/rtd/src/rtd_drive.c b/alliance/src/rtd/src/rtd_drive.c new file mode 100644 index 00000000..336f241c --- /dev/null +++ b/alliance/src/rtd/src/rtd_drive.c @@ -0,0 +1,440 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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 : RTD | +| | +| File : rtd_drive.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include VEX_H +# include RTN_H + +# include +# include +# include + +# include "rtd_error.h" +# include "rtd_drive.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *RtlFile; + static long RtlExprLength; + static char RtlBuffer[ 128 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| RtlWriteNameFile | +| | +\------------------------------------------------------------*/ + +static void RtlWriteNameFile( Name ) + + char *Name; +{ + int Length; + + Length = strlen( Name ); + + RtlExprLength += Length; + + if ( RtlExprLength > 80 ) + { + fprintf( RtlFile, "\n" ); + RtlExprLength = Length; + } + + fprintf( RtlFile, Name ); +} + +/*------------------------------------------------------------\ +| | +| RtlWriteExprPrefix | +| | +\------------------------------------------------------------*/ + +static void RtlWriteExprPrefix( Expr ) + + vexexpr *Expr; +{ + char *Name; + chain_list *ScanOper; + + if ( IsVexNodeAtom( Expr ) ) + { + sprintf( RtlBuffer, "{%d,%d,%x}%s", + Expr->LEFT, Expr->RIGHT, Expr->TYPE, GetVexAtomValue( Expr ) ); + RtlWriteNameFile( RtlBuffer ); + } + else + { + if ( IsVexNodeOper( Expr ) ) + { + Name = getvexoperuppername( GetVexOperValue( Expr ) ); + } + else + { + Name = GetVexFuncValue( Expr ); + } + + sprintf( RtlBuffer, "({%d,%d,%x}%s", + Expr->LEFT, Expr->RIGHT, Expr->TYPE, Name ); + RtlWriteNameFile( RtlBuffer ); + + for ( ScanOper = Expr->OPERAND; + ScanOper != (chain_list *)0; + ScanOper = ScanOper->NEXT ) + { + RtlWriteNameFile( "~" ); + RtlWriteExprPrefix( GetVexOperand( ScanOper ) ); + } + + RtlWriteNameFile( ")" ); + } +} + +/*------------------------------------------------------------\ +| | +| RtlWriteExpr | +| | +\------------------------------------------------------------*/ + +static void RtlWriteExpr( Label, Expr ) + + char *Label; + vexexpr *Expr; +{ + if ( Expr != (vexexpr *)0 ) + { + RtlExprLength = 0; + + fprintf( RtlFile, "%s\t\n", Label ); + RtlWriteExprPrefix( Expr ); + fprintf( RtlFile, "\n" ); + } +} + +/*------------------------------------------------------------\ +| | +| RtlWriteOneSymbol | +| | +\------------------------------------------------------------*/ + +static void RtlWriteOneSymbol( RtlSymbol ) + + rtlsym *RtlSymbol; +{ + fprintf( RtlFile, "SYMBOL\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%s\n", + (long)RtlSymbol->INDEX, + (long)RtlSymbol->INIT, + (long)RtlSymbol->DRIVE, + (long)RtlSymbol->EFFEC, + (long)RtlSymbol->EVENT, + (long)RtlSymbol->FLAGS, + RtlSymbol->NAME ); +} + +/*------------------------------------------------------------\ +| | +| RtlWriteOneDeclar | +| | +\------------------------------------------------------------*/ + +static void RtlWriteOneDeclar( RtlDeclar ) + + rtldecl_list *RtlDeclar; +{ + int Width; + int Scan; + + fprintf( RtlFile, "DECLAR\t%ld\t%ld\t%ld\t%ld\t%ld", + (long)RtlDeclar->DIR, + (long)RtlDeclar->TYPE, + (long)RtlDeclar->KIND, + (long)RtlDeclar->BASE, + (long)RtlDeclar->FLAGS ); + + RtlWriteExpr( "", RtlDeclar->VEX_ATOM ); + RtlWriteExpr( "INIT", RtlDeclar->VEX_INIT ); + + Width = RtlDeclar->VEX_ATOM->WIDTH; + + for ( Scan = 0; Scan < Width; Scan++ ) + { + RtlWriteOneSymbol( &RtlDeclar->DECL_SYM[ Scan ] ); + } +} + +/*------------------------------------------------------------\ +| | +| RtlWriteDeclar | +| | +\------------------------------------------------------------*/ + +static void RtlWriteDeclar( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + rtldecl_list *ScanDeclar; + int Type; + + for ( Type = 0; Type < RTL_MAX_DECLAR_TYPE; Type++ ) + { + for ( ScanDeclar = RtlFigure->DECLAR[ Type ]; + ScanDeclar != (rtldecl_list *)0; + ScanDeclar = ScanDeclar->NEXT ) + { + RtlWriteOneDeclar( ScanDeclar); + } + } +} + + +/*------------------------------------------------------------\ +| | +| RtlWriteAssign | +| | +\------------------------------------------------------------*/ + +static void RtlWriteAssign( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + rtlasg_list *ScanAsg; + rtlbivex_list *ScanBiVex; + + for ( ScanAsg = RtlFigure->ASSIGN; + ScanAsg != (rtlasg_list *)0; + ScanAsg = ScanAsg->NEXT ) + { + fprintf( RtlFile, "ASG\t%ld\t%ld\t%ld\n", + (long)ScanAsg->TYPE, + (long)ScanAsg->REG_TYPE, + (long)ScanAsg->FLAGS ); + + RtlWriteExpr( "ASG_ATOM", ScanAsg->VEX_ATOM ); + RtlWriteExpr( "ASG_DATA", ScanAsg->VEX_DATA ); + + for ( ScanBiVex = ScanAsg->BIVEX; + ScanBiVex != (rtlbivex_list *)0; + ScanBiVex = ScanBiVex->NEXT ) + { + fprintf( RtlFile, "ASG_BIVEX\t%ld\t%ld\n", + (long)ScanBiVex->TYPE, + (long)ScanBiVex->FLAGS ); + + RtlWriteExpr( "BIVEX_COND", ScanBiVex->VEX_COND ); + RtlWriteExpr( "BIVEX_DATA", ScanBiVex->VEX_DATA ); + } + } +} + +/*------------------------------------------------------------\ +| | +| RtlWriteFsm | +| | +\------------------------------------------------------------*/ + +static void RtlWriteFsm( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + /* TO BE DONE */ +} + +/*------------------------------------------------------------\ +| | +| RtlWriteModel | +| | +\------------------------------------------------------------*/ + +static void RtlWriteModel( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + rtlmod_list *ScanMod; + rtlport_list *ScanPort; + rtlgen_list *ScanGen; + + for ( ScanMod = RtlFigure->MODEL; + ScanMod != (rtlmod_list *)0; + ScanMod = ScanMod->NEXT ) + { + fprintf( RtlFile, "MODEL\t%ld\t%s\n", + (long)ScanMod->FLAGS, + ScanMod->NAME ); + + for ( ScanPort = ScanMod->PORT; + ScanPort != (rtlport_list *)0; + ScanPort = ScanPort->NEXT ) + { + fprintf( RtlFile, "PORT\t%ld\t%ld\t%ld", + (long)ScanPort->DIR, + (long)ScanPort->BASE, + (long)ScanPort->FLAGS ); + + RtlWriteExpr( "", ScanPort->VEX_ATOM ); + } + + for ( ScanGen = ScanMod->GENERIC; + ScanGen != (rtlgen_list *)0; + ScanGen = ScanGen->NEXT ) + { + fprintf( RtlFile, "GEN_MOD\t%ld\t%ld\t", + (long)ScanGen->BASE, + (long)ScanGen->FLAGS ); + + RtlWriteExpr( "", ScanGen->VEX_ATOM ); + + RtlWriteExpr( "GEN_EXPR", ScanGen->VEX_EXPR ); + } + } +} + +/*------------------------------------------------------------\ +| | +| RtlWriteInstance | +| | +\------------------------------------------------------------*/ + +static void RtlWriteInstance( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + rtlins_list *ScanIns; + rtlmap_list *ScanMap; + rtlgen_list *ScanGen; + + for ( ScanIns = RtlFigure->INSTANCE; + ScanIns != (rtlins_list *)0; + ScanIns = ScanIns->NEXT ) + { + fprintf( RtlFile, "INSTANCE\t%ld\t%s\n", + (long)ScanIns->FLAGS, + ScanIns->NAME ); + + fprintf( RtlFile, "INS_MOD\t%s\n", ScanIns->MODEL->NAME ); + + for ( ScanMap = ScanIns->MAP; + ScanMap != (rtlmap_list *)0; + ScanMap = ScanMap->NEXT ) + { + fprintf( RtlFile, "MAP\t%ld\n", (long)ScanMap->FLAGS ); + + RtlWriteExpr( "MAP_FOR", ScanMap->VEX_FORMAL ); + RtlWriteExpr( "MAP_ACT", ScanMap->VEX_ACTUAL ); + } + + for ( ScanGen = ScanIns->GENERIC; + ScanGen != (rtlgen_list *)0; + ScanGen = ScanGen->NEXT ) + { + fprintf( RtlFile, "GEN_MAP\t%ld\t%ld\t", + (long)ScanGen->BASE, + (long)ScanGen->FLAGS ); + + RtlWriteExpr( "", ScanGen->VEX_ATOM ); + + RtlWriteExpr( "GEN_EXPR", ScanGen->VEX_EXPR ); + } + } +} + +/*------------------------------------------------------------\ +| | +| RtlWriteFigure | +| | +\------------------------------------------------------------*/ + +static void RtlWriteFigure( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + fprintf( RtlFile, "FIGURE\t%ld\t%s\n", + (long)RtlFigure->FLAGS, + RtlFigure->NAME ); + + RtlWriteDeclar( RtlFigure ); + RtlWriteAssign( RtlFigure ); + RtlWriteFsm( RtlFigure ); + RtlWriteModel( RtlFigure ); + RtlWriteInstance( RtlFigure ); +} + +/*------------------------------------------------------------\ +| | +| savertlfig | +| | +\------------------------------------------------------------*/ + +void savertlfig( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + RtlFile = mbkfopen( RtlFigure->NAME, "rtl", "w" ); + + if ( RtlFile == (FILE *)0 ) + { + rtderror( RTD_ERROR_OPEN_FILE, RtlFigure->NAME, 0 ); + } + + RtlWriteFigure( RtlFigure ); + + fclose( RtlFile ); +} diff --git a/alliance/src/rtd/src/rtd_drive.h b/alliance/src/rtd/src/rtd_drive.h new file mode 100644 index 00000000..d7ce2a5f --- /dev/null +++ b/alliance/src/rtd/src/rtd_drive.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : RTD | +| | +| File : vpddrive.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ + +# ifndef RTD_DRIVE_H +# define RTD_DRIVE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/rtd/src/rtd_error.c b/alliance/src/rtd/src/rtd_error.c new file mode 100644 index 00000000..d948b4ff --- /dev/null +++ b/alliance/src/rtd/src/rtd_error.c @@ -0,0 +1,124 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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 : RTD | +| | +| File : rtd_error.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include MUT_H +# include AUT_H + +# include "rtd_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void rtd_error( Error, Text, Value, File, Line ) + + int Error; + char *Text; + long Value; + char *File; + int Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%d ", Name, Line ); + + switch( Error ) + { + case RTD_ERROR_OPEN_FILE : + fprintf( stderr, "Unable to open file \"%s\"\n", Text ); + break; + case RTD_ERROR_PARSE_FILE : + fprintf( stderr, "Unable to parse file \"%s\" line %ld\n", Text, Value ); + break; + default : + fprintf( stderr, "Internal error number %d\n", Error ); + } + + autexit( 1 ); +} + +void rtd_warning( Warning, Text, Value, File, Line ) + + int Warning; + char *Text; + long Value; + char *File; + int Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%d ", Name, Line ); + + switch ( Warning ) + { + default : + fprintf( stderr, "Internal warning number %d\n", Warning ); + } +} diff --git a/alliance/src/rtd/src/rtd_error.h b/alliance/src/rtd/src/rtd_error.h new file mode 100644 index 00000000..b5ca0635 --- /dev/null +++ b/alliance/src/rtd/src/rtd_error.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : RTD | +| | +| File : rtderror.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ + +# ifndef RTD_ERROR_H +# define RTD_ERROR_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define RTD_ERROR_OPEN_FILE 1 +# define RTD_ERROR_PARSE_FILE 2 + +/*------------------------------------------------------------\ +| | +| Warnings | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define rtderror( E, T, V ) (rtd_error ( (E), (T), (V), __FILE__, __LINE__ )) +# define rtdwarning( E, T, V ) (rtd_warning( (E), (T), (V), __FILE__, __LINE__ )) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void rtd_error __P((int Error, char *Text, long Value, char *File, int Line)); + extern void rtd_warning __P((int Warning, char *Text, long Value, char *File, int Line)); + +# endif diff --git a/alliance/src/rtd/src/rtd_get.c b/alliance/src/rtd/src/rtd_get.c new file mode 100644 index 00000000..bddac1c0 --- /dev/null +++ b/alliance/src/rtd/src/rtd_get.c @@ -0,0 +1,126 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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 : Vtl | +| | +| File : rtd_get.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include MUT_H +# include AUT_H +# include VEX_H +# include RTN_H +# include RTD_H + +# include "rtd_get.h" +# include "rtd_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char *RTL_IN; + char *RTL_OUT; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| rtlenv | +| | +\------------------------------------------------------------*/ + +void rtlenv() +{ +} + +/*------------------------------------------------------------\ +| | +| getrtlfig | +| | +\------------------------------------------------------------*/ + +rtlfig_list *getrtlfig( Name ) + + char *Name; +{ + rtlfig_list *Figure; + char *FigName; + + FigName = namealloc( Name ); + + for ( Figure = HEAD_RTLFIG; + Figure != (rtlfig_list *)0; + Figure = Figure->NEXT ) + { + if ( Figure->NAME == FigName ) break; + } + + if ( Figure == (rtlfig_list *)0 ) + { + Figure = addrtlfig( Name ); + + loadrtlfig( Figure, Name ); + } + + return( Figure ); +} diff --git a/alliance/src/rtd/src/rtd_get.h b/alliance/src/rtd/src/rtd_get.h new file mode 100644 index 00000000..2acff9ad --- /dev/null +++ b/alliance/src/rtd/src/rtd_get.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : RTD | +| | +| File : rtdget.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ + +# ifndef RTD_GET_H +# define RTD_GET_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/rtd/src/rtd_parse.c b/alliance/src/rtd/src/rtd_parse.c new file mode 100644 index 00000000..f5e9850e --- /dev/null +++ b/alliance/src/rtd/src/rtd_parse.c @@ -0,0 +1,704 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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 : RTD | +| | +| File : rtd_parse.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include MUT_H +# include AUT_H +# include VEX_H +# include RTN_H +# include RTD_H + +# include +# include +# include + +# include "rtd_error.h" +# include "rtd_parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *RtlFile; + static char RtlBuffer[ 512 ]; + static long RtlLine; + + static char *RtlKeyFigure = (char *)0; + static char *RtlKeyDeclar = (char *)0; + static char *RtlKeyInit = (char *)0; + static char *RtlKeySymbol = (char *)0; + static char *RtlKeyAsg = (char *)0; + static char *RtlKeyAsgData = (char *)0; + static char *RtlKeyAsgAtom = (char *)0; + static char *RtlKeyAsgBiVex = (char *)0; + static char *RtlKeyBiVexCond = (char *)0; + static char *RtlKeyBiVexData = (char *)0; + static char *RtlKeyInstance = (char *)0; + static char *RtlKeyInsMod = (char *)0; + static char *RtlKeyMap = (char *)0; + static char *RtlKeyMapFor = (char *)0; + static char *RtlKeyMapAct = (char *)0; + static char *RtlKeyModel = (char *)0; + static char *RtlKeyPort = (char *)0; + static char *RtlKeyGenMod = (char *)0; + static char *RtlKeyGenMap = (char *)0; + static char *RtlKeyGenExpr = (char *)0; + + static char *RtlScanString = (char *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| RtlInitKeyword | +| | +\------------------------------------------------------------*/ + +static void RtlInitKeyword() +{ + if ( RtlKeyFigure == (char *)0 ) + { + RtlKeyFigure = namealloc( "FIGURE" ); + RtlKeyDeclar = namealloc( "DECLAR" ); + RtlKeyInit = namealloc( "INIT" ); + RtlKeySymbol = namealloc( "SYMBOL" ); + RtlKeyAsg = namealloc( "ASG" ); + RtlKeyAsgData = namealloc( "ASG_DATA" ); + RtlKeyAsgAtom = namealloc( "ASG_ATOM" ); + RtlKeyAsgBiVex = namealloc( "ASG_BIVEX" ); + RtlKeyBiVexCond = namealloc( "BIVEX_COND" ); + RtlKeyBiVexData = namealloc( "BIVEX_DATA" ); + RtlKeyInstance = namealloc( "INSTANCE" ); + RtlKeyInsMod = namealloc( "INS_MOD" ); + RtlKeyMap = namealloc( "MAP" ); + RtlKeyMapFor = namealloc( "MAP_FOR" ); + RtlKeyMapAct = namealloc( "MAP_ACT" ); + RtlKeyModel = namealloc( "MODEL" ); + RtlKeyPort = namealloc( "PORT" ); + RtlKeyGenMap = namealloc( "GEN_MAP" ); + RtlKeyGenMod = namealloc( "GEN_MOD" ); + RtlKeyGenExpr = namealloc( "GEN_EXPR" ); + } +} + +/*------------------------------------------------------------\ +| | +| Rtl Read Name File | +| | +\------------------------------------------------------------*/ + +static char *RtlReadNameFile( Line ) + + long Line; +{ + char *Name; + char SaveChar; + + while ( ( RtlScanString == (char *)0 ) || + ( *RtlScanString == '\0' ) || + ( *RtlScanString == '\n' ) ) + { + if ( fgets( RtlBuffer, 512, RtlFile ) == (char *)0 ) + { + return( (char *)0 ); + } + + RtlScanString = RtlBuffer; + RtlLine = RtlLine + 1; + } + + if ( ( *RtlScanString == '~' ) || + ( *RtlScanString == '(' ) || + ( *RtlScanString == ')' ) ) + { + return( RtlScanString ); + } + + Name = RtlScanString; + + while ( ( *RtlScanString != '~' ) && + ( *RtlScanString != ')' ) && + ( *RtlScanString != '\0' ) && + ( *RtlScanString != '\n' ) ) + { + RtlScanString = RtlScanString + 1; + } + + SaveChar = *RtlScanString; + *RtlScanString = '\0'; + Name = namealloc( Name ); + *RtlScanString = SaveChar; + + return( Name ); +} + +/*------------------------------------------------------------\ +| | +| Rtl Read Prefix Expr | +| | +\------------------------------------------------------------*/ + +static vexexpr *RtlReadPrefixExpr() +{ + vexexpr *Expr; + chain_list **PrevOper; + chain_list *ScanOper; + vexexpr *ExprStr; + char *Name; + char *Scan; + long Oper; + long Left; + long Right; + long Type; + + Scan = RtlReadNameFile(); + + if ( ( Scan == (char *)0 ) || + ( *Scan == '~' ) || + ( *Scan == ')' ) ) + { + return( (vexexpr *)0 ); + } + + if ( *RtlScanString == '(' ) + { + RtlScanString = RtlScanString + 1; + Name = RtlReadNameFile(); + + if ( ( Name == (char *)0 ) || + ( Name[ 0 ] != '{' ) ) + { + return( (vexexpr *)0 ); + } + + Scan = strchr( Name, '}' ); + + if ( Scan == (char *)0 ) + { + return( (vexexpr *)0 ); + } + + sscanf( Name, "{%ld,%ld,%lx}", &Left, &Right, &Type ); + Name = Scan + 1; + + Oper = getvexoperbyname( Name ); + Scan = RtlReadNameFile(); + + if ( Scan == (char *)0 ) + { + return( (vexexpr *)0 ); + } + + if ( *RtlScanString == ')' ) + { + if ( Oper == -1 ) + { + Expr = createvexatomvec( Name, Left, Right ); + Expr->TYPE = Type; + } + else + { + return( (vexexpr *)0 ); + } + } + else + if ( *RtlScanString == '~' ) + { + RtlScanString = RtlScanString + 1; + + if ( Oper == -1 ) + { + Expr = createvexfunc( Name, 0 ); + } + else + { + Expr = createvexoper( Oper, 0 ); + } + + Expr->LEFT = Left; + Expr->RIGHT = Right; + Expr->TYPE = Type; + + if ( Left > Right ) Expr->WIDTH = ( Left - Right ) + 1; + else Expr->WIDTH = ( Right - Left ) + 1; + + PrevOper = &Expr->OPERAND; + + do + { + ExprStr = RtlReadPrefixExpr(); + + if ( ExprStr == (vexexpr *)0 ) + { + freevexexpr( Expr ); + return( (vexexpr *)0 ); + } + + ScanOper = addchain( (chain_list *)0, (void *)ExprStr ); + *PrevOper = ScanOper; + PrevOper = &ScanOper->NEXT; + + Scan = RtlReadNameFile(); + + if ( Scan == (char *)0 ) + { + freevexexpr( Expr ); + return( (vexexpr *)0 ); + } + + if ( *RtlScanString == '~' ) + { + RtlScanString = RtlScanString + 1; + } + } + while ( *RtlScanString != ')'); + } + else + { + return( (vexexpr *)0 ); + } + + if ( *RtlScanString == ')' ) + { + RtlScanString = RtlScanString + 1; + } + else + { + freevexexpr( Expr ); + return( (vexexpr *)0 ); + } + } + else + { + Name = Scan; + + if ( ( Name == (char *)0 ) || + ( Name[ 0 ] != '{' ) ) + { + return( (vexexpr *)0 ); + } + + Scan = strchr( Name, '}' ); + + if ( Scan == (char *)0 ) + { + return( (vexexpr *)0 ); + } + + sscanf( Name, "{%ld,%ld,%lx}", &Left, &Right, &Type ); + Name = Scan + 1; + + Oper = getvexoperbyname( Name ); + + if ( Oper == -1 ) + { + Expr = createvexatomvec( Name, Left, Right ); + Expr->TYPE = Type; + } + else + { + return( (vexexpr *)0 ); + } + } + + return( Expr ); +} + +/*------------------------------------------------------------\ +| | +| RtlReadExpr | +| | +\------------------------------------------------------------*/ + +static vexexpr *RtlReadExpr() +{ + RtlScanString = (char *)0; + + return( RtlReadPrefixExpr() ); +} + +/*------------------------------------------------------------\ +| | +| RtlLoadFigure | +| | +\------------------------------------------------------------*/ + +static int RtlLoadFigure( RtlFigure ) + + rtlfig_list *RtlFigure; +{ + rtldecl_list *RtlDeclar; + rtlasg_list *RtlAsg; + rtlgen_list *RtlGen; + rtlbivex_list *RtlBiVex; + rtlsym *RtlSymbol; + rtlmod_list *RtlModel; + rtlport_list *RtlPort; + rtlins_list *RtlInst; + rtlmap_list *RtlMap; + vexexpr *Expr; + vexexpr *Atom; + char *ScanBuffer; + char *Keyword; + char *Name; + int Index; + int Length; + int Error; + long Value1; + long Value2; + long Value3; + long Value4; + long Value5; + long Value6; + + RtlInitKeyword(); + + RtlDeclar = (rtldecl_list *)0; + RtlSymbol = (rtlsym *)0; + RtlAsg = (rtlasg_list *)0; + RtlBiVex = (rtlbivex_list *)0; + + RtlLine = 0; + + while ( fgets( RtlBuffer, 512, RtlFile ) != (char *)0 ) + { + RtlLine = RtlLine + 1; + + if ( ( RtlBuffer[ 0 ] == '#' ) || + ( RtlBuffer[ 0 ] == '\0' ) || + ( RtlBuffer[ 0 ] == '\n' ) ) continue; + + Length = strlen( RtlBuffer ); + if ( RtlBuffer[ Length - 1 ] == '\n' ) + { + Length = Length - 1; + RtlBuffer[ Length ] = '\0'; + } + + for ( Index = Length; Index >= 0; Index-- ) + { + if ( RtlBuffer[ Index ] == '\t' ) break; + } + + if ( Index < 0 ) return( 1 ); + Name = &RtlBuffer[ Index + 1 ]; + + ScanBuffer = strchr( RtlBuffer, '\t' ); + if ( ScanBuffer == (char *)0 ) return( 1 ); + + *ScanBuffer = '\0'; + Keyword = namealloc( RtlBuffer ); + ScanBuffer = ScanBuffer + 1; + + if ( Keyword == RtlKeyAsgBiVex ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", + &Value1, &Value2 ); + + RtlBiVex = addrtlasgbivex( RtlFigure, RtlAsg, (vexexpr *)0, (vexexpr *)0, Value1 ); + RtlBiVex->FLAGS = Value2; + } + else + if ( Keyword == RtlKeyBiVexData ) + { + Expr = RtlReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + RtlBiVex->VEX_DATA = Expr; + } + else + if ( Keyword == RtlKeyBiVexCond ) + { + Expr = RtlReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + RtlBiVex->VEX_COND = Expr; + } + else + if ( Keyword == RtlKeyAsg ) + { + Error = 3 - sscanf( ScanBuffer, "%ld\t%ld\t%ld", + &Value1, &Value2, &Value3 ); + + if ( Error ) return( 1 ); + + RtlAsg = addrtlasg( RtlFigure, (vexexpr *)0, Value1 ); + RtlAsg->REG_TYPE = Value2; + RtlAsg->FLAGS = Value3; + } + else + if ( Keyword == RtlKeyAsgData ) + { + Expr = RtlReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + RtlAsg->VEX_DATA = Expr; + } + else + if ( Keyword == RtlKeyAsgAtom ) + { + Atom = RtlReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + RtlAsg->VEX_ATOM = Atom; + } + else + if ( Keyword == RtlKeyDeclar ) + { + Error = 5 - sscanf( ScanBuffer, "%ld\t%ld\t%ld\t%ld\t%ld", + &Value1, &Value2, &Value3, &Value4, &Value5 ); + + if ( Error ) return( 1 ); + + Atom = RtlReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + RtlDeclar = addrtldecl( RtlFigure, Atom, Value2 ); + + RtlDeclar->DIR = Value1; + RtlDeclar->TYPE = Value2; + RtlDeclar->KIND = Value3; + RtlDeclar->BASE = Value4; + RtlDeclar->FLAGS = Value5; + } + else + if ( Keyword == RtlKeyInit ) + { + Expr = RtlReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + RtlDeclar->VEX_INIT = Expr; + } + else + if ( Keyword == RtlKeySymbol ) + { + Error = 6 - sscanf( ScanBuffer, "%ld\t%ld\t%ld\t%ld\t%ld\t%ld", + &Value1, &Value2, &Value3, &Value4, &Value5, &Value6 ); + + if ( Error ) return( 1 ); + + RtlSymbol = searchrtlsym( RtlFigure, Name, Value1 ); + + RtlSymbol->INIT = Value2; + RtlSymbol->DRIVE = Value3; + RtlSymbol->EFFEC = Value4; + RtlSymbol->EVENT = Value5; + RtlSymbol->FLAGS = Value6; + } + else + if ( Keyword == RtlKeyInstance ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + RtlInst = addrtlins( RtlFigure, Name, (rtlmod_list *)0 ); + + RtlInst->FLAGS = Value1; + } + else + if ( Keyword == RtlKeyInsMod ) + { + RtlModel = searchrtlmod( RtlFigure, Name ); + + if ( RtlModel == (rtlmod_list *)0 ) return( 1 ); + + RtlInst->MODEL = RtlModel; + } + else + if ( Keyword == RtlKeyMap ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + RtlMap = addrtlinsmap( RtlFigure, RtlInst, (vexexpr *)0, (vexexpr *)0 ); + + RtlMap->FLAGS = Value1; + } + else + if ( Keyword == RtlKeyMapFor ) + { + Atom = RtlReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + RtlMap->VEX_FORMAL = Atom; + } + else + if ( Keyword == RtlKeyMapAct ) + { + Atom = RtlReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + RtlMap->VEX_ACTUAL = Atom; + } + else + if ( Keyword == RtlKeyModel ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + RtlModel = addrtlmod( RtlFigure, Name ); + + RtlModel->FLAGS = Value1; + } + else + if ( Keyword == RtlKeyPort ) + { + Error = 3 - sscanf( ScanBuffer, "%ld\t%ld\t%ld", &Value1, &Value2, &Value3 ); + + if ( Error ) return( 1 ); + + Atom = RtlReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + RtlPort = addrtlmodport( RtlFigure, RtlModel, Atom, Value2, Value1 ); + RtlPort->FLAGS = Value3; + } + else + if ( Keyword == RtlKeyFigure ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", + &Value1 ); + + if ( Error ) return( 1 ); + + RtlFigure->NAME = namealloc( Name ); + RtlFigure->FLAGS = Value1; + } + else + if ( Keyword == RtlKeyGenMap ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + Atom = RtlReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + RtlGen = addrtlinsgen( RtlFigure, RtlInst, Atom, (vexexpr *)0 ); + + RtlGen->BASE = Value1; + RtlGen->FLAGS = Value2; + } + else + if ( Keyword == RtlKeyGenMod ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + Atom = RtlReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + RtlGen = addrtlmodgen( RtlFigure, RtlModel, Atom, (vexexpr *)0, Value1 ); + + RtlGen->FLAGS = Value2; + } + else + if ( Keyword == RtlKeyGenExpr ) + { + Expr = RtlReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + RtlGen->VEX_EXPR = Expr; + } + else return( 1 ); + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| loadrtlfig | +| | +\------------------------------------------------------------*/ + +void loadrtlfig( RtlFigure, FigureName ) + + rtlfig_list *RtlFigure; + char *FigureName; +{ + int Value; + + RtlFile = mbkfopen( FigureName, "rtl", "r" ); + + if ( RtlFile == (FILE *)0 ) + { + rtderror( RTD_ERROR_OPEN_FILE, FigureName, 0 ); + } + + Value = RtlLoadFigure( RtlFigure ); + + if ( Value ) rtderror( RTD_ERROR_PARSE_FILE, FigureName, RtlLine ); + + fclose( RtlFile ); +} diff --git a/alliance/src/rtd/src/rtd_parse.h b/alliance/src/rtd/src/rtd_parse.h new file mode 100644 index 00000000..6d961229 --- /dev/null +++ b/alliance/src/rtd/src/rtd_parse.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : RTD | +| | +| File : vpdparse.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ + +# ifndef RTD_PARSE_H +# define RTD_PARSE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif