From 88126190719e4f0803b74b25e88a7daa9b244031 Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Wed, 20 Mar 2002 14:21:51 +0000 Subject: [PATCH] Hello --- alliance/src/fsm/Makefile.am | 1 + alliance/src/fsm/configure.in | 45 +++ alliance/src/fsm/src/Makefile.am | 9 + alliance/src/fsm/src/fsm.h | 463 ++++++++++++++++++++++++++ alliance/src/fsm/src/fsmadd.c | 440 ++++++++++++++++++++++++ alliance/src/fsm/src/fsmadd.h | 75 +++++ alliance/src/fsm/src/fsmalloc.c | 191 +++++++++++ alliance/src/fsm/src/fsmalloc.h | 75 +++++ alliance/src/fsm/src/fsmbdd.c | 214 ++++++++++++ alliance/src/fsm/src/fsmbdd.h | 75 +++++ alliance/src/fsm/src/fsmdel.c | 555 +++++++++++++++++++++++++++++++ alliance/src/fsm/src/fsmdel.h | 76 +++++ alliance/src/fsm/src/fsmerror.c | 125 +++++++ alliance/src/fsm/src/fsmerror.h | 89 +++++ alliance/src/fsm/src/fsmfree.c | 184 ++++++++++ alliance/src/fsm/src/fsmfree.h | 75 +++++ alliance/src/fsm/src/fsmorder.c | 274 +++++++++++++++ alliance/src/fsm/src/fsmorder.h | 75 +++++ alliance/src/fsm/src/fsmsearch.c | 272 +++++++++++++++ alliance/src/fsm/src/fsmsearch.h | 75 +++++ alliance/src/fsm/src/fsmsimp.c | 133 ++++++++ alliance/src/fsm/src/fsmsimp.h | 75 +++++ alliance/src/fsm/src/fsmview.c | 413 +++++++++++++++++++++++ alliance/src/fsm/src/fsmview.h | 75 +++++ alliance/src/fsm/src/main.c | 183 ++++++++++ 25 files changed, 4267 insertions(+) create mode 100644 alliance/src/fsm/Makefile.am create mode 100644 alliance/src/fsm/configure.in create mode 100644 alliance/src/fsm/src/Makefile.am create mode 100644 alliance/src/fsm/src/fsm.h create mode 100644 alliance/src/fsm/src/fsmadd.c create mode 100644 alliance/src/fsm/src/fsmadd.h create mode 100644 alliance/src/fsm/src/fsmalloc.c create mode 100644 alliance/src/fsm/src/fsmalloc.h create mode 100644 alliance/src/fsm/src/fsmbdd.c create mode 100644 alliance/src/fsm/src/fsmbdd.h create mode 100644 alliance/src/fsm/src/fsmdel.c create mode 100644 alliance/src/fsm/src/fsmdel.h create mode 100644 alliance/src/fsm/src/fsmerror.c create mode 100644 alliance/src/fsm/src/fsmerror.h create mode 100644 alliance/src/fsm/src/fsmfree.c create mode 100644 alliance/src/fsm/src/fsmfree.h create mode 100644 alliance/src/fsm/src/fsmorder.c create mode 100644 alliance/src/fsm/src/fsmorder.h create mode 100644 alliance/src/fsm/src/fsmsearch.c create mode 100644 alliance/src/fsm/src/fsmsearch.h create mode 100644 alliance/src/fsm/src/fsmsimp.c create mode 100644 alliance/src/fsm/src/fsmsimp.h create mode 100644 alliance/src/fsm/src/fsmview.c create mode 100644 alliance/src/fsm/src/fsmview.h create mode 100644 alliance/src/fsm/src/main.c diff --git a/alliance/src/fsm/Makefile.am b/alliance/src/fsm/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/fsm/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/fsm/configure.in b/alliance/src/fsm/configure.in new file mode 100644 index 00000000..3ea656d2 --- /dev/null +++ b/alliance/src/fsm/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/20 14:21:51 ludo Exp $ +dnl +dnl +AC_INIT(src/fsm.h) +AM_INIT_AUTOMAKE(fsm, 1.4) +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/fsm/src/Makefile.am b/alliance/src/fsm/src/Makefile.am new file mode 100644 index 00000000..614ece05 --- /dev/null +++ b/alliance/src/fsm/src/Makefile.am @@ -0,0 +1,9 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libFsm.a +include_HEADERS = fsm.h +libFsm_a_SOURCES = \ +fsm.h fsmalloc.h fsmdel.h fsmfree.h fsmsearch.h fsmview.h \ +fsmadd.c fsmbdd.c fsmerror.c fsmorder.c fsmsimp.c \ +fsmadd.h fsmbdd.h fsmerror.h fsmorder.h fsmsimp.h \ +fsmalloc.c fsmdel.c fsmfree.c fsmsearch.c fsmview.c diff --git a/alliance/src/fsm/src/fsm.h b/alliance/src/fsm/src/fsm.h new file mode 100644 index 00000000..bf53ed54 --- /dev/null +++ b/alliance/src/fsm/src/fsm.h @@ -0,0 +1,463 @@ +/*------------------------------------------------------------\ +| | +| 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 FSM | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------*/ + +# ifndef FSM_104_H +# define FSM_104_H + +/*------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Fsm Port Direction | +| | +\------------------------------------------------------*/ + +# define FSM_DIR_IN 'I' +# define FSM_DIR_OUT 'O' +# define FSM_DIR_INOUT 'B' +# define FSM_DIR_OUT_BUS 'Z' +# define FSM_DIR_INOUT_BUS 'T' + +/*------------------------------------------------------\ +| | +| Fsm Port Type | +| | +\------------------------------------------------------*/ + +# define FSM_TYPE_SEVERITY 1 +# define FSM_TYPE_BOOLEAN 2 +# define FSM_TYPE_BIT 3 +# define FSM_TYPE_INTEGER 4 +# define FSM_TYPE_MUX_BIT 5 +# define FSM_TYPE_WOR_BIT 6 +# define FSM_TYPE_REG_BIT 7 +# define FSM_TYPE_NATURAL 8 +# define FSM_TYPE_BIT_VEC 9 +# define FSM_TYPE_MUX_VEC 10 +# define FSM_TYPE_WOR_VEC 11 +# define FSM_TYPE_REG_VEC 12 + +# define FSM_MAX_TYPE 13 + +/*------------------------------------------------------\ +| | +| Fsm Stack Control | +| | +\------------------------------------------------------*/ + +# define FSM_CTRL_NOP 0 +# define FSM_CTRL_PUSH 1 +# define FSM_CTRL_POP 2 +# define FSM_MAX_CTRL 3 + +/*------------------------------------------------------\ +| | +| Fsm Flag | +| | +\------------------------------------------------------*/ + +# define FSM_STAR_MASK (long)( 0x0001 ) +# define FSM_FIRST_MASK (long)( 0x0002 ) + +/*------------------------------------------------------\ +| | +| Fsm Fig Flag | +| | +\------------------------------------------------------*/ + +# define FSM_MIXED_RTL_MASK (long)( 0x0001 ) + +/*------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| State Type Macros | +| | +\------------------------------------------------------*/ + +# define IsFsmFirstState( T ) ( (T)->FLAGS & FSM_FIRST_MASK ) +# define SetFsmFirstState( T ) ( (T)->FLAGS |= FSM_FIRST_MASK ) +# define ClearFsmFirstState( T ) ( (T)->FLAGS &= ~FSM_FIRST_MASK ) + +# define IsFsmStarState( T ) ( (T)->FLAGS & FSM_STAR_MASK ) +# define SetFsmStarState( T ) ( (T)->FLAGS |= FSM_STAR_MASK ) +# define ClearFsmStarState( T ) ( (T)->FLAGS &= ~FSM_STAR_MASK ) + +/*------------------------------------------------------\ +| | +| Transition Type Macros | +| | +\------------------------------------------------------*/ + +# define IsFsmStarTrans( T ) ( (T)->FLAGS & FSM_STAR_MASK ) +# define SetFsmStarTrans( T ) ( (T)->FLAGS |= FSM_STAR_MASK ) +# define ClearFsmStarTrans( T ) ( (T)->FLAGS &= ~FSM_STAR_MASK ) + +/*------------------------------------------------------\ +| | +| Stack Type Macros | +| | +\------------------------------------------------------*/ + +# define IsFsmStarStack( S ) ( (S)->FLAGS & FSM_STAR_MASK ) +# define SetFsmStarStack( S ) ( (S)->FLAGS |= FSM_STAR_MASK ) +# define ClearFsmStarStack( S ) ( (S)->FLAGS &= ~FSM_STAR_MASK ) + +/*------------------------------------------------------\ +| | +| Figure Type Macros | +| | +\------------------------------------------------------*/ + +# define IsFsmFigMixedRtl( F ) ( (F)->FLAGS & FSM_MIXED_RTL_MASK ) +# define SetFsmFigMixedRtl( F ) ( (F)->FLAGS |= FSM_MIXED_RTL_MASK ) +# define ClearFsmFigMixedRtl( F ) ( (F)->FLAGS &= ~FSM_MIXED_RTL_MASK ) + +/*------------------------------------------------------\ +| | +| Structures | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Fsm Input List | +| | +\------------------------------------------------------*/ + + typedef struct fsmin_list + { + struct fsmin_list *NEXT; + char *NAME; + long FLAGS; + void *USER; + + } fsmin_list; + +/*------------------------------------------------------\ +| | +| Fsm Output List | +| | +\------------------------------------------------------*/ + + typedef struct fsmout_list + { + struct fsmout_list *NEXT; + char *NAME; + long FLAGS; + void *USER; + + } fsmout_list; + +/*------------------------------------------------------\ +| | +| Fsm Port List | +| | +\------------------------------------------------------*/ + + typedef struct fsmport_list + { + struct fsmport_list *NEXT; + char *NAME; + char DIR; + char TYPE; + long FLAGS; + void *USER; + + } fsmport_list; + +/*------------------------------------------------------\ +| | +| Fsm Local Output List | +| | +\------------------------------------------------------*/ + + typedef struct fsmlocout_list + + { + struct fsmlocout_list *NEXT; + fsmout_list *OUT; + ablexpr *ABL; + bddnode *BDD; + ablexpr *ABL_DC; + bddnode *BDD_DC; + long FLAGS; + void *USER; + + } fsmlocout_list; + +/*------------------------------------------------------\ +| | +| Fsm Transition List | +| | +\------------------------------------------------------*/ + + typedef struct fsmtrans_list + + { + struct fsmtrans_list *NEXT; + struct fsmtrans_list **PREV; + struct fsmstate_list *FROM; + struct fsmstate_list *TO; + ablexpr *ABL; + bddnode *BDD; + long FLAGS; + void *USER; + + } fsmtrans_list; + +/*------------------------------------------------------\ +| | +| Fsm State | +| | +\------------------------------------------------------*/ + + typedef struct fsmstate_list + + { + struct fsmstate_list *NEXT; + struct fsmstate_list **PREV; + char *NAME; + chain_list *FROM; + chain_list *TO; + chain_list *STACK; + fsmlocout_list *LOCOUT; + long FLAGS; + void *USER; + + } fsmstate_list; + +/*------------------------------------------------------\ +| | +| Fsm Stack List | +| | +\------------------------------------------------------*/ + + typedef struct fsmstack_list + { + struct fsmstack_list *NEXT; + struct fsmstack_list **PREV; + char CTRL; + fsmstate_list *CURRENT; + fsmstate_list *RETURN; + ablexpr *ABL; + bddnode *BDD; + long FLAGS; + void *USER; + + } fsmstack_list; + +/*------------------------------------------------------\ +| | +| Fsm Figure List | +| | +\------------------------------------------------------*/ + + typedef struct fsmfig_list + { + struct fsmfig_list *NEXT; + char *NAME; + long NUMBER_IN; + long NUMBER_OUT; + long NUMBER_PORT; + long NUMBER_STATE; + long NUMBER_TRANS; + long NUMBER_STACK; + fsmin_list *IN; + fsmout_list *OUT; + fsmport_list *PORT; + fsmstate_list *STATE; + fsmtrans_list *TRANS; + fsmstack_list *STACK; + + authtable *HASH_PORT; + authtable *HASH_IN; + authtable *HASH_OUT; + authtable *HASH_STATE; + auth2table *HASH_TRANS; + + long STACK_SIZE; + + fsmstate_list *FIRST_STATE; + fsmstate_list *STAR_STATE; + + char *CLOCK; + ablexpr *CLOCK_ABL; + + bddcircuit *CIRCUIT; + + long FLAGS; + ptype_list *PRAGMA; + + void *FIGURE; + void *USER; + + } fsmfig_list; + +/*------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------*/ + + extern fsmfig_list *HEAD_FSMFIG; + extern char *FSM_CTRL_NAME [ FSM_MAX_CTRL ]; + extern char *FSM_TYPE_NAME [ FSM_MAX_TYPE ]; + +/*------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------*/ + + extern fsmfig_list * allocfsmfig __P(()); + extern fsmstate_list * allocfsmstate __P(()); + extern fsmstack_list * allocfsmstack __P(()); + extern fsmtrans_list * allocfsmtrans __P(()); + extern fsmlocout_list * allocfsmlocout __P(()); + extern fsmout_list * allocfsmout __P(()); + extern fsmin_list * allocfsmin __P(()); + extern fsmport_list * allocfsmport __P(()); + +/*------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------*/ + + extern void freefsmfig __P((fsmfig_list *Figure)); + extern void freefsmstate __P((fsmstate_list *State)); + extern void freefsmstack __P((fsmstack_list *Stack)); + extern void freefsmtrans __P((fsmtrans_list *Trans)); + extern void freefsmlocout __P((fsmlocout_list *Locout)); + extern void freefsmout __P((fsmout_list *Output)); + extern void freefsmin __P((fsmin_list *Input)); + extern void freefsmport __P((fsmport_list *Port)); + +/*------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------*/ + + extern fsmfig_list * addfsmfig __P((char *Name)); + extern fsmstate_list * addfsmstate __P((fsmfig_list *Figure, char *Name)); + extern fsmstack_list * addfsmstack __P((fsmfig_list *Figure, char Control, fsmstate_list *Current, fsmstate_list *Return, ablexpr *Condition)); + extern fsmtrans_list * addfsmtrans __P((fsmfig_list *Figure, fsmstate_list *StateFrom, fsmstate_list *StateTo, ablexpr *Condition)); + extern fsmlocout_list * addfsmlocout __P((fsmstate_list *State, fsmout_list *Output, ablexpr *Equation, ablexpr *EquationDC)); + extern fsmout_list * addfsmout __P((fsmfig_list *Figure, char *Name)); + extern fsmin_list * addfsmin __P((fsmfig_list *Figure, char *Name)); + extern fsmport_list * addfsmport __P((fsmfig_list *Figure, char *Name, char Dir, char Type)); + +/*------------------------------------------------------\ +| | +| Del Functions | +| | +\------------------------------------------------------*/ + + extern int delfsmfig __P((char *Name)); + extern int delfsmstate __P((fsmfig_list *Figure, fsmstate_list *State)); + extern int delfsmstack __P((fsmfig_list *Figure, fsmstack_list *Stack)); + extern int delfsmtrans __P((fsmfig_list *Figure, fsmtrans_list *Trans)); + extern int delfsmlocout __P((fsmstate_list *State, fsmlocout_list *Locout)); + +/*------------------------------------------------------\ +| | +| Search Functions | +| | +\------------------------------------------------------*/ + + extern fsmfig_list * searchfsmfig __P((char *Name)); + extern fsmstate_list * searchfsmstate __P((fsmfig_list *Figure, char *Name)); + extern fsmstack_list * searchfsmstack __P((char Control, fsmstate_list *Current, fsmstate_list *Return)); + extern fsmtrans_list * searchfsmtrans __P((fsmfig_list *Figure, fsmstate_list *StateFrom, fsmstate_list *StateTo)); + extern fsmlocout_list * searchfsmlocout __P((fsmstate_list *State, fsmout_list *Out)); + extern fsmout_list * searchfsmout __P((fsmfig_list *Figure, char *Name)); + extern fsmin_list * searchfsmin __P((fsmfig_list *Figure, char *Name)); + extern fsmport_list * searchfsmport __P((fsmfig_list *Figure, char *Name)); + +/*------------------------------------------------------\ +| | +| Abl Functions | +| | +\------------------------------------------------------*/ + + extern void simpfsmablexpr __P((fsmfig_list *FsmFigure)); + +/*------------------------------------------------------\ +| | +| Bdd Functions | +| | +\------------------------------------------------------*/ + + extern void makefsmbddcircuit __P((fsmfig_list *FsmFigure, bddsystem *BddSystem, int Order)); + extern void makefsmbddnode __P((fsmfig_list *FsmFigure)); + + extern void convertfsmbddnodeabl __P((fsmfig_list *FsmFigure)); + +/*------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------*/ + + extern void viewfsmfig __P((fsmfig_list *Figure)); + extern void viewfsmstate __P((fsmstate_list *State)); + extern void viewfsmstack __P((fsmstack_list *Stack)); + extern void viewfsmtrans __P((fsmtrans_list *Trans)); + extern void viewfsmlocout __P((fsmlocout_list *Locout)); + extern void viewfsmout __P((fsmout_list *Output)); + extern void viewfsmin __P((fsmin_list *Input)); + extern void viewfsmport __P((fsmport_list *Port)); + +# endif diff --git a/alliance/src/fsm/src/fsmadd.c b/alliance/src/fsm/src/fsmadd.c new file mode 100644 index 00000000..e27048fe --- /dev/null +++ b/alliance/src/fsm/src/fsmadd.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 : Fsm | +| | +| File : fsmadd.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include "fsmadd.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Add Figure | +| | +\------------------------------------------------------------*/ + +fsmfig_list *addfsmfig( Name ) + + char *Name; +{ + fsmfig_list *Figure; + + Figure = allocfsmfig(); + + Figure->NAME = namealloc( Name ); + Figure->NEXT = HEAD_FSMFIG; + HEAD_FSMFIG = Figure; + + Figure->HASH_PORT = createauthtable( 100 ); + Figure->HASH_IN = createauthtable( 100 ); + Figure->HASH_OUT = createauthtable( 100 ); + Figure->HASH_STATE = createauthtable( 100 ); + Figure->HASH_TRANS = createauth2table( 100 ); + + return( Figure ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Add State | +| | +\------------------------------------------------------------*/ + +fsmstate_list *addfsmstate( Figure, Name ) + + fsmfig_list *Figure; + char *Name; +{ + fsmstate_list *State; + + Name = namealloc( Name ); + State = searchfsmstate( Figure, Name ); + + if ( State != (fsmstate_list *)0 ) + { + fsmerror( FSM_STATE_EXIST_ERROR, Name ); + } + + State = allocfsmstate(); + + State->NAME = namealloc( Name ); + State->NEXT = Figure->STATE; + State->PREV = &Figure->STATE; + + if ( Figure->STATE != (fsmstate_list *)0 ) + { + Figure->STATE->PREV = &State->NEXT; + } + + Figure->STATE = State; + + Figure->NUMBER_STATE++; + + addauthelem( Figure->HASH_STATE, Name, (long)State ); + + return( State ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Add Stack | +| | +\------------------------------------------------------------*/ + +fsmstack_list *addfsmstack( Figure, Control, Current, Return, Condition ) + + fsmfig_list *Figure; + char Control; + fsmstate_list *Current; + fsmstate_list *Return; + ablexpr *Condition; +{ + fsmstack_list *Stack; + + Stack = searchfsmstack( Control, Current, Return ); + + if ( Stack == (fsmstack_list *)0 ) + { + Stack = allocfsmstack(); + + Current->STACK = addchain( Current->STACK, (void *)Stack ); + + if ( Current == Figure->STAR_STATE ) + { + SetFsmStarStack( Stack ); + } + + Stack->ABL = Condition; + Stack->CTRL = Control; + Stack->CURRENT = Current; + Stack->RETURN = Return; + Stack->NEXT = Figure->STACK; + Stack->PREV = &Figure->STACK; + + if ( Figure->STACK != (fsmstack_list *)0 ) + { + Figure->STACK->PREV = &Stack->NEXT; + } + + Figure->STACK = Stack; + + Figure->NUMBER_STACK++; + } + else + if ( Condition != (ablexpr *)0 ) + { + if ( Stack->ABL != (ablexpr *)0 ) + { + Stack->ABL = + + createablbinexpr( ABL_OR, Condition, Stack->ABL ); + } + else + { + Stack->ABL = Condition; + } + } + + return( Stack ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Add Transition | +| | +\------------------------------------------------------------*/ + +fsmtrans_list *addfsmtrans( Figure, StateFrom, StateTo, Condition ) + + fsmfig_list *Figure; + fsmstate_list *StateFrom; + fsmstate_list *StateTo; + ablexpr *Condition; +{ + fsmtrans_list *Trans; + + Trans = searchfsmtrans( Figure, StateFrom, StateTo ); + + if ( Trans == (fsmtrans_list *)0 ) + { + Trans = allocfsmtrans(); + + StateFrom->FROM = addchain( StateFrom->FROM, (void *)Trans ); + StateTo->TO = addchain( StateTo->TO, (void *)Trans ); + + Trans->ABL = Condition; + Trans->FROM = StateFrom; + Trans->TO = StateTo; + Trans->NEXT = Figure->TRANS; + Trans->PREV = &Figure->TRANS; + + if ( Figure->TRANS != (fsmtrans_list *)0 ) + { + Figure->TRANS->PREV = &Trans->NEXT; + } + + Figure->TRANS = Trans; + + if ( ( StateFrom == Figure->STAR_STATE ) || + ( StateTo == Figure->STAR_STATE ) ) + { + SetFsmStarTrans( Trans ); + } + + Figure->NUMBER_TRANS++; + + addauth2elem( Figure->HASH_TRANS, (char *)StateFrom, (char *)StateTo, (long)Trans ); + } + else + if ( Condition != (ablexpr *)0 ) + { + if ( Trans->ABL != (ablexpr *)0 ) + { + Trans->ABL = + + createablbinexpr( ABL_OR, Condition, Trans->ABL ); + } + else + { + Trans->ABL = Condition; + } + } + + return( Trans ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Add Local Output | +| | +\------------------------------------------------------------*/ + +fsmlocout_list *addfsmlocout( State, Output, Equation, EquationDC ) + + fsmstate_list *State; + fsmout_list *Output; + ablexpr *Equation; + ablexpr *EquationDC; +{ + fsmlocout_list *Locout; + + Locout = searchfsmlocout( State, Output ); + + if ( Locout == (fsmlocout_list *)0 ) + { + Locout = allocfsmlocout(); + + Locout->OUT = Output; + Locout->ABL = Equation; + Locout->ABL_DC = EquationDC; + Locout->NEXT = State->LOCOUT; + State->LOCOUT = Locout; + } + else + { + if ( Equation != (ablexpr *)0 ) + { + if ( Locout->ABL != (ablexpr *)0 ) + { + Locout->ABL = + + createablbinexpr( ABL_OR, Equation, Locout->ABL ); + } + else + { + Locout->ABL = Equation; + } + } + + if ( EquationDC != (ablexpr *)0 ) + { + if ( Locout->ABL_DC != (ablexpr *)0 ) + { + Locout->ABL_DC = + + createablbinexpr( ABL_OR, EquationDC, Locout->ABL_DC ); + } + else + { + Locout->ABL_DC = EquationDC; + } + } + } + + return( Locout ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Add Output | +| | +\------------------------------------------------------------*/ + +fsmout_list *addfsmout( Figure, Name ) + + fsmfig_list *Figure; + char *Name; +{ + fsmout_list *Output; + + Name = namealloc( Name ); + Output = searchfsmout( Figure, Name ); + + if ( Output != (fsmout_list *)0 ) + { + fsmerror( FSM_OUT_EXIST_ERROR, Name ); + } + + Output = allocfsmout(); + + Output->NAME = namealloc( Name ); + Output->NEXT = Figure->OUT; + Figure->OUT = Output; + + Figure->NUMBER_OUT++; + + addauthelem( Figure->HASH_OUT, Name, (long)Output ); + + return( Output ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Add Input | +| | +\------------------------------------------------------------*/ + +fsmin_list *addfsmin( Figure, Name ) + + fsmfig_list *Figure; + char *Name; +{ + fsmin_list *Input; + + Name = namealloc( Name ); + Input = searchfsmin( Figure, Name ); + + if ( Input != (fsmin_list *)0 ) + { + fsmerror( FSM_IN_EXIST_ERROR, Name ); + } + + Input = allocfsmin(); + + Input->NAME = namealloc( Name ); + Input->NEXT = Figure->IN; + Figure->IN = Input; + + Figure->NUMBER_IN++; + + addauthelem( Figure->HASH_IN, Name, (long)Input ); + + return( Input ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Add Port | +| | +\------------------------------------------------------------*/ + +fsmport_list *addfsmport( Figure, Name, Dir, Type ) + + fsmfig_list *Figure; + char *Name; + char Dir; + char Type; +{ + fsmport_list *Port; + + Name = namealloc( Name ); + Port = searchfsmport( Figure, Name ); + + if ( Port != (fsmport_list *)0 ) + { + fsmerror( FSM_PORT_EXIST_ERROR, Name ); + } + + Port = allocfsmport(); + + Port->NAME = Name; + Port->DIR = Dir; + Port->TYPE = Type; + Port->NEXT = Figure->PORT; + Figure->PORT = Port; + + Figure->NUMBER_PORT++; + + addauthelem( Figure->HASH_PORT, Name, (long)Port ); + + return( Port ); +} diff --git a/alliance/src/fsm/src/fsmadd.h b/alliance/src/fsm/src/fsmadd.h new file mode 100644 index 00000000..6e6347c9 --- /dev/null +++ b/alliance/src/fsm/src/fsmadd.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 : Fsm | +| | +| File : fsmadd.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_ADD_H +# define FSM_ADD_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmalloc.c b/alliance/src/fsm/src/fsmalloc.c new file mode 100644 index 00000000..6ecd6f68 --- /dev/null +++ b/alliance/src/fsm/src/fsmalloc.c @@ -0,0 +1,191 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmalloc.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include +# include "fsmalloc.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + fsmfig_list *HEAD_FSMFIG = (fsmfig_list *)0; + + char *FSM_CTRL_NAME [ FSM_MAX_CTRL ] = + { + "NOP", "PUSH", "POP" + }; + + char *FSM_TYPE_NAME [ FSM_MAX_TYPE ] = + { + "NONE", + "SEVERITY", + "BOOLEAN", + "BIT", + "INTEGER", + "MUX_BIT", + "WOR_BIT", + "REG_BIT", + "NATURAL", + "BIT_VEC", + "MUX_VEC", + "WOR_VEC", + "REG_VEC" + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Alloc Figure | +| | +\------------------------------------------------------------*/ + +fsmfig_list *allocfsmfig() +{ + return( (fsmfig_list *)(autallocblock( sizeof( fsmfig_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Alloc State | +| | +\------------------------------------------------------------*/ + +fsmstate_list *allocfsmstate() +{ + return( (fsmstate_list *)(autallocheap( sizeof( fsmstate_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Alloc Stack | +| | +\------------------------------------------------------------*/ + +fsmstack_list *allocfsmstack() +{ + return( (fsmstack_list *)(autallocheap( sizeof( fsmstack_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Alloc Transition | +| | +\------------------------------------------------------------*/ + +fsmtrans_list *allocfsmtrans() +{ + return( (fsmtrans_list *)(autallocheap( sizeof( fsmtrans_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Alloc Local Output | +| | +\------------------------------------------------------------*/ + +fsmlocout_list *allocfsmlocout() +{ + return( (fsmlocout_list *)(autallocheap( sizeof( fsmlocout_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Alloc Input | +| | +\------------------------------------------------------------*/ + +fsmin_list *allocfsmin() +{ + return( (fsmin_list *)(autallocblock( sizeof( fsmin_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Alloc Output | +| | +\------------------------------------------------------------*/ + +fsmout_list *allocfsmout() +{ + return( (fsmout_list *)(autallocblock( sizeof( fsmout_list ) ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Alloc Port | +| | +\------------------------------------------------------------*/ + +fsmport_list *allocfsmport() +{ + return( (fsmport_list *)(autallocblock( sizeof( fsmport_list ) ) ) ); +} diff --git a/alliance/src/fsm/src/fsmalloc.h b/alliance/src/fsm/src/fsmalloc.h new file mode 100644 index 00000000..8a727eb8 --- /dev/null +++ b/alliance/src/fsm/src/fsmalloc.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 : Fsm | +| | +| File : fsmalloc.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_ALLOC_H +# define FSM_ALLOC_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmbdd.c b/alliance/src/fsm/src/fsmbdd.c new file mode 100644 index 00000000..c83ecc69 --- /dev/null +++ b/alliance/src/fsm/src/fsmbdd.c @@ -0,0 +1,214 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmbdd.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include "fsmbdd.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| makefsmbddnode | +| | +\------------------------------------------------------------*/ + +void makefsmbddnode( FsmFigure ) + + fsmfig_list *FsmFigure; +{ + fsmstate_list *ScanState; + fsmtrans_list *ScanTrans; + fsmstack_list *ScanStack; + fsmlocout_list *ScanLocout; + + setbddlocalcircuit( FsmFigure->CIRCUIT ); + setbddlocalsystem( BddLocalCircuit->BDD_SYSTEM ); + + for ( ScanTrans = FsmFigure->TRANS; + ScanTrans != (fsmtrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + if ( ScanTrans->ABL != (ablexpr *)0 ) + { + ScanTrans->BDD = addbddcircuitabl( (bddcircuit *)0, ScanTrans->ABL ); + } + } + + for ( ScanStack = FsmFigure->STACK; + ScanStack != (fsmstack_list *)0; + ScanStack = ScanStack->NEXT ) + { + if ( ScanStack->ABL != (ablexpr *)0 ) + { + ScanStack->BDD = addbddcircuitabl( (bddcircuit *)0, ScanStack->ABL ); + } + } + + ScanState = FsmFigure->STATE; + + while ( ScanState != (fsmstate_list *)0 ) + { + for ( ScanLocout = ScanState->LOCOUT; + ScanLocout != (fsmlocout_list *)0; + ScanLocout = ScanLocout->NEXT ) + { + if ( ScanLocout->ABL != (ablexpr *)0 ) + { + ScanLocout->BDD = addbddcircuitabl( (bddcircuit *)0, ScanLocout->ABL ); + } + + if ( ScanLocout->ABL_DC != (ablexpr *)0 ) + { + ScanLocout->BDD_DC = addbddcircuitabl( (bddcircuit *)0, ScanLocout->ABL_DC ); + } + } + + ScanState = ScanState->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| convertfsmbddnodeabl | +| | +\------------------------------------------------------------*/ + +void convertfsmbddnodeabl( FsmFigure ) + + fsmfig_list *FsmFigure; +{ + fsmstate_list *ScanState; + fsmtrans_list *ScanTrans; + fsmstack_list *ScanStack; + fsmlocout_list *ScanLocout; + + setbddlocalcircuit( FsmFigure->CIRCUIT ); + setbddlocalsystem( BddLocalCircuit->BDD_SYSTEM ); + + for ( ScanTrans = FsmFigure->TRANS; + ScanTrans != (fsmtrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + if ( ScanTrans->BDD != (bddnode *)0 ) + { + if ( ScanTrans->ABL != (ablexpr *)0 ) + { + freeablexpr( ScanTrans->ABL ); + } + + ScanTrans->ABL = convertbddcircuitabl( (bddcircuit *)0, ScanTrans->BDD ); + } + } + + for ( ScanStack = FsmFigure->STACK; + ScanStack != (fsmstack_list *)0; + ScanStack = ScanStack->NEXT ) + { + if ( ScanStack->BDD != (bddnode *)0 ) + { + if ( ScanStack->ABL != (ablexpr *)0 ) + { + freeablexpr( ScanStack->ABL ); + } + + ScanStack->ABL = convertbddcircuitabl( (bddcircuit *)0, ScanStack->BDD ); + } + } + + ScanState = FsmFigure->STATE; + + while ( ScanState != (fsmstate_list *)0 ) + { + for ( ScanLocout = ScanState->LOCOUT; + ScanLocout != (fsmlocout_list *)0; + ScanLocout = ScanLocout->NEXT ) + { + if ( ScanLocout->BDD != (bddnode *)0 ) + { + if ( ScanLocout->ABL != (ablexpr *)0 ) + { + freeablexpr( ScanLocout->ABL ); + } + + ScanLocout->ABL = convertbddcircuitabl( (bddcircuit *)0, ScanLocout->BDD ); + } + + if ( ScanLocout->BDD_DC != (bddnode *)0 ) + { + if ( ScanLocout->ABL_DC != (ablexpr *)0 ) + { + freeablexpr( ScanLocout->ABL_DC ); + } + + ScanLocout->ABL_DC = convertbddcircuitabl( (bddcircuit *)0, ScanLocout->BDD_DC ); + } + } + + ScanState = ScanState->NEXT; + } +} diff --git a/alliance/src/fsm/src/fsmbdd.h b/alliance/src/fsm/src/fsmbdd.h new file mode 100644 index 00000000..b5577995 --- /dev/null +++ b/alliance/src/fsm/src/fsmbdd.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 : Fsm | +| | +| File : fsmbdd.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_BDD_H +# define FSM_BDD_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmdel.c b/alliance/src/fsm/src/fsmdel.c new file mode 100644 index 00000000..d75c618a --- /dev/null +++ b/alliance/src/fsm/src/fsmdel.c @@ -0,0 +1,555 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmdel.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include "fsmdel.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Del Figure | +| | +\------------------------------------------------------------*/ + +int delfsmfig( Name ) + + char *Name; +{ + fsmfig_list *Figure; + fsmfig_list **Previous; + fsmport_list *Port; + fsmport_list *DelPort; + fsmin_list *Input; + fsmin_list *DelInput; + fsmout_list *Output; + fsmout_list *DelOutput; + fsmstate_list *State; + fsmstate_list *DelState; + fsmtrans_list *Trans; + fsmtrans_list *DelTrans; + fsmstack_list *Stack; + fsmstack_list *DelStack; + fsmlocout_list *Locout; + fsmlocout_list *DelLocout; + + Name = namealloc( Name ); + Previous = &HEAD_FSMFIG; + + for ( Figure = HEAD_FSMFIG; + Figure != (fsmfig_list *)0; + Figure = Figure->NEXT ) + { + if ( Figure->NAME == Name ) break; + + Previous = &Figure->NEXT; + } + + if ( Figure == (fsmfig_list *)0 ) return( 0 ); + + *Previous = Figure->NEXT; + + Port = Figure->PORT; + + while( Port != (fsmport_list *)0 ) + { + DelPort = Port; + Port = Port->NEXT; + + freefsmport( DelPort ); + } + + Input = Figure->IN; + + while( Input != (fsmin_list *)0 ) + { + DelInput = Input; + Input = Input->NEXT; + + freefsmin( DelInput ); + } + + Output = Figure->OUT; + + while( Output != (fsmout_list *)0 ) + { + DelOutput = Output; + Output = Output->NEXT; + + freefsmout( DelOutput ); + } + + State = Figure->STATE; + + while ( State != (fsmstate_list *)0 ) + { + DelState = State; + State = State->NEXT; + + freechain( DelState->STACK ); + freechain( DelState->FROM ); + freechain( DelState->TO ); + + Locout = DelState->LOCOUT; + + while ( Locout != (fsmlocout_list *)0 ) + { + DelLocout = Locout; + Locout = Locout->NEXT; + + freeablexpr( DelLocout->ABL ); + freeablexpr( DelLocout->ABL_DC ); + + freefsmlocout( DelLocout ); + } + + freefsmstate( DelState ); + } + + Trans = Figure->TRANS; + + while ( Trans != (fsmtrans_list *)0 ) + { + DelTrans = Trans; + Trans = Trans->NEXT; + + freeablexpr( DelTrans->ABL ); + + freefsmtrans( DelTrans ); + } + + Stack = Figure->STACK; + + while ( Stack != (fsmstack_list *)0 ) + { + DelStack = Stack; + Stack = Stack->NEXT; + + freeablexpr( DelStack->ABL ); + + freefsmstack( DelStack ); + } + + if ( Figure->PRAGMA != (ptype_list *)0 ) + { + freeptype( Figure->PRAGMA ); + } + + destroyauthtable( Figure->HASH_PORT ); + destroyauthtable( Figure->HASH_IN ); + destroyauthtable( Figure->HASH_OUT ); + destroyauthtable( Figure->HASH_STATE ); + destroyauth2table( Figure->HASH_TRANS ); + + freefsmfig( Figure ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Del Trans | +| | +\------------------------------------------------------------*/ + +int delfsmtrans( Figure, Trans ) + + fsmfig_list *Figure; + fsmtrans_list *Trans; +{ + fsmstate_list *State; + chain_list *ScanChain; + chain_list **PrevChain; + + if ( Trans != searchfsmtrans( Figure, Trans->FROM, Trans->TO ) ) + { + return( 0 ); + } + + *Trans->PREV = Trans->NEXT; + + if ( Trans->NEXT != (fsmtrans_list *)0 ) + { + Trans->NEXT->PREV = Trans->PREV; + } + + freeablexpr( Trans->ABL ); + + State = Trans->FROM; + + if ( State != (fsmstate_list *)0 ) + { + PrevChain = &State->FROM; + + for ( ScanChain = State->FROM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( ScanChain->DATA == (void *)Trans ) break; + + PrevChain = &ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + } + + State = Trans->TO; + + if ( State != (fsmstate_list *)0 ) + { + PrevChain = &State->TO; + + for ( ScanChain = State->TO; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( ScanChain->DATA == (void *)Trans ) break; + + PrevChain = &ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + } + + delauth2elem( Figure->HASH_TRANS, (char *)Trans->FROM, (char *)Trans->TO ); + + freefsmtrans( Trans ); + + Figure->NUMBER_TRANS--; + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Del Stack | +| | +\------------------------------------------------------------*/ + +int delfsmstack( Figure, Stack ) + + fsmfig_list *Figure; + fsmstack_list *Stack; +{ + fsmstate_list *State; + chain_list *ScanChain; + chain_list **PrevChain; + + *Stack->PREV = Stack->NEXT; + + if ( Stack->NEXT != (fsmstack_list *)0 ) + { + Stack->NEXT->PREV = Stack->PREV; + } + + freeablexpr( Stack->ABL ); + + State = Stack->CURRENT; + + if ( State != (fsmstate_list *)0 ) + { + PrevChain = &State->STACK; + + for ( ScanChain = State->STACK; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + if ( ScanChain->DATA == (void *)Stack ) break; + + PrevChain = &ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + } + + freefsmstack( Stack ); + + Figure->NUMBER_STACK--; + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Del Local Output | +| | +\------------------------------------------------------------*/ + +int delfsmlocout( State, Locout ) + + fsmstate_list *State; + fsmlocout_list *Locout; +{ + fsmlocout_list *ScanLocout; + fsmlocout_list **PrevLocout; + + PrevLocout = &State->LOCOUT; + ScanLocout = State->LOCOUT; + + while ( ScanLocout != (fsmlocout_list *)0 ) + { + if ( ScanLocout == Locout ) break; + + PrevLocout = &ScanLocout->NEXT; + ScanLocout = ScanLocout->NEXT; + } + + if ( ScanLocout == (fsmlocout_list *)0 ) return( 0 ); + + *PrevLocout = Locout->NEXT; + + freeablexpr( Locout->ABL ); + freeablexpr( Locout->ABL_DC ); + + freefsmlocout( Locout ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Del State | +| | +\------------------------------------------------------------*/ + +int delfsmstate( Figure, State ) + + fsmfig_list *Figure; + fsmstate_list *State; +{ + fsmlocout_list *DelLocout; + fsmlocout_list *ScanLocout; + fsmstate_list *TransState; + fsmtrans_list *ScanTrans; + fsmstack_list *ScanStack; + chain_list *ChainTrans; + chain_list *ScanChain; + chain_list **PrevChain; + + *State->PREV = State->NEXT; + + if ( State->NEXT != (fsmstate_list *)0 ) + { + State->NEXT->PREV = State->PREV; + } + + if ( State == Figure->FIRST_STATE ) + { + Figure->FIRST_STATE = (fsmstate_list *)0; + } + + if ( State == Figure->STAR_STATE ) + { + Figure->STAR_STATE = (fsmstate_list *)0; + } + + ScanLocout = State->LOCOUT; + + while ( ScanLocout != (fsmlocout_list *)0 ) + { + DelLocout = ScanLocout; + ScanLocout = ScanLocout->NEXT; + + freeablexpr( DelLocout->ABL ); + freeablexpr( DelLocout->ABL_DC ); + + freefsmlocout( DelLocout ); + } + + for ( ChainTrans = State->FROM; + ChainTrans != (chain_list *)0; + ChainTrans = ChainTrans->NEXT ) + { + ScanTrans = (fsmtrans_list *)ChainTrans->DATA; + TransState = ScanTrans->TO; + + PrevChain = &TransState->TO; + ScanChain = TransState->TO; + + while ( ScanChain != (chain_list *)0 ) + { + if ( ScanChain->DATA == (void *)ScanTrans ) break; + + PrevChain = &ScanChain->NEXT; + ScanChain = ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + + *ScanTrans->PREV = ScanTrans->NEXT; + + if ( ScanTrans->NEXT != (fsmtrans_list *)0 ) + { + ScanTrans->NEXT->PREV = ScanTrans->PREV; + } + + freeablexpr( ScanTrans->ABL ); + + delauth2elem( Figure->HASH_TRANS, (char *)ScanTrans->FROM, (char *)ScanTrans->TO ); + + Figure->NUMBER_TRANS--; + + freefsmtrans( ScanTrans ); + } + + for ( ChainTrans = State->TO; + ChainTrans != (chain_list *)0; + ChainTrans = ChainTrans->NEXT ) + { + ScanTrans = (fsmtrans_list *)ChainTrans->DATA; + TransState = ScanTrans->FROM; + + PrevChain = &TransState->FROM; + ScanChain = TransState->FROM; + + while ( ScanChain != (chain_list *)0 ) + { + if ( ScanChain->DATA == (void *)ScanTrans ) break; + + PrevChain = &ScanChain->NEXT; + ScanChain = ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + + *ScanTrans->PREV = ScanTrans->NEXT; + + if ( ScanTrans->NEXT != (fsmtrans_list *)0 ) + { + ScanTrans->NEXT->PREV = ScanTrans->PREV; + } + + freeablexpr( ScanTrans->ABL ); + + delauth2elem( Figure->HASH_TRANS, (char *)ScanTrans->FROM, (char *)ScanTrans->TO ); + + Figure->NUMBER_TRANS--; + + freefsmtrans( ScanTrans ); + } + + freechain( State->TO ); + freechain( State->FROM ); + + for ( ScanChain = State->STACK; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanStack = (fsmstack_list *)ScanChain->DATA; + + *ScanStack->PREV = ScanStack->NEXT; + + if ( ScanStack->NEXT != (fsmstack_list *)0 ) + { + ScanStack->NEXT->PREV = ScanStack->PREV; + } + + freeablexpr( ScanStack->ABL ); + freefsmstack( ScanStack ); + } + + freechain( State->STACK ); + + delauthelem( Figure->HASH_STATE, State->NAME ); + + freefsmstate( State ); + + Figure->NUMBER_STATE--; + + return( 1 ); +} diff --git a/alliance/src/fsm/src/fsmdel.h b/alliance/src/fsm/src/fsmdel.h new file mode 100644 index 00000000..d5b08520 --- /dev/null +++ b/alliance/src/fsm/src/fsmdel.h @@ -0,0 +1,76 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmdel.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_DEL_H +# define FSM_DEL_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmerror.c b/alliance/src/fsm/src/fsmerror.c new file mode 100644 index 00000000..19a314aa --- /dev/null +++ b/alliance/src/fsm/src/fsmerror.c @@ -0,0 +1,125 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : Fsm Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void fsm_error( Error, Text, File, Line ) + + char Error; + char *Text; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%ld ", Name, Line ); + + switch( Error ) + { + case FSM_EXPR_NULL_ERROR : + fprintf( stderr, "null expression !\n" ); + break; + + case FSM_UNKNOWN_ATOM_ERROR : + fprintf( stderr, "unknown atom %s !\n", Text ); + break; + + case FSM_OPERATOR_ERROR : + fprintf( stderr, "illegal use of operator %ld\n", (long)Text ); + break; + + case FSM_STATE_EXIST_ERROR : + fprintf( stderr, "state %s exist already !\n", Text ); + break; + + case FSM_OUT_EXIST_ERROR : + fprintf( stderr, "output %s exist already !\n", Text ); + break; + + case FSM_IN_EXIST_ERROR : + fprintf( stderr, "input %s exist already !\n", Text ); + break; + + case FSM_PORT_EXIST_ERROR : + fprintf( stderr, "port %s exist already !\n", Text ); + break; + + default : + + fprintf( stderr, "unknown internal error %d !\n", Error ); + } + + autexit( 1 ); +} diff --git a/alliance/src/fsm/src/fsmerror.h b/alliance/src/fsm/src/fsmerror.h new file mode 100644 index 00000000..d5bcb6a1 --- /dev/null +++ b/alliance/src/fsm/src/fsmerror.h @@ -0,0 +1,89 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : Fsm Errors | +| | +| Authors : Jacomme Ludovic | +| | +| Date : 04.12.96 | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_ERROR_H +# define FSM_ERROR_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define FSM_EXPR_NULL_ERROR 0 +# define FSM_UNKNOWN_ATOM_ERROR 1 +# define FSM_OPERATOR_ERROR 2 +# define FSM_STATE_EXIST_ERROR 3 +# define FSM_OUT_EXIST_ERROR 4 +# define FSM_IN_EXIST_ERROR 5 +# define FSM_PORT_EXIST_ERROR 6 + +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define fsmerror( E, V ) (fsm_error( (int)(E), (char *)(V), __FILE__, __LINE__ )) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void fsm_error __P((char Error, char *Text, char *File, long Line)); + +# endif diff --git a/alliance/src/fsm/src/fsmfree.c b/alliance/src/fsm/src/fsmfree.c new file mode 100644 index 00000000..bcf8536f --- /dev/null +++ b/alliance/src/fsm/src/fsmfree.c @@ -0,0 +1,184 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmfree.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include +# include "fsmfree.h" +# include "fsmalloc.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Free Figure | +| | +\------------------------------------------------------------*/ + +void freefsmfig( Figure ) + + fsmfig_list *Figure; +{ + autfreeblock( (char *)Figure ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Free State | +| | +\------------------------------------------------------------*/ + +void freefsmstate( State ) + + fsmstate_list *State; +{ + autfreeheap( (char *)State, sizeof( fsmstate_list )); +} + +/*------------------------------------------------------------\ +| | +| Fsm Free Stack | +| | +\------------------------------------------------------------*/ + +void freefsmstack( Stack ) + + fsmstack_list *Stack; +{ + autfreeheap( (char *)Stack, sizeof( fsmstack_list )); +} + +/*------------------------------------------------------------\ +| | +| Fsm Free Trans | +| | +\------------------------------------------------------------*/ + +void freefsmtrans( Trans ) + + fsmtrans_list *Trans; +{ + autfreeheap( (char *)Trans, sizeof( fsmtrans_list )); +} + + +/*------------------------------------------------------------\ +| | +| Fsm Free Local Output | +| | +\------------------------------------------------------------*/ + +void freefsmlocout( Locout ) + + fsmlocout_list *Locout; +{ + autfreeheap( (char *)Locout, sizeof( fsmlocout_list )); +} + +/*------------------------------------------------------------\ +| | +| Fsm Free Output | +| | +\------------------------------------------------------------*/ + +void freefsmout( Output ) + + fsmout_list *Output; +{ + autfreeblock( (char *)Output ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Free Input | +| | +\------------------------------------------------------------*/ + +void freefsmin( Input ) + + fsmin_list *Input; +{ + autfreeblock( (char *)Input ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Free Port | +| | +\------------------------------------------------------------*/ + +void freefsmport( Port ) + + fsmport_list *Port; +{ + autfreeblock( (char *)Port ); +} diff --git a/alliance/src/fsm/src/fsmfree.h b/alliance/src/fsm/src/fsmfree.h new file mode 100644 index 00000000..ddcf9300 --- /dev/null +++ b/alliance/src/fsm/src/fsmfree.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 : Fsm | +| | +| File : fsmfree.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_FREE_H +# define FSM_FREE_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmorder.c b/alliance/src/fsm/src/fsmorder.c new file mode 100644 index 00000000..e83e26bb --- /dev/null +++ b/alliance/src/fsm/src/fsmorder.c @@ -0,0 +1,274 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmorder.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include "fsmorder.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static authtable *FsmHashTableOrder = (authtable *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| sortfsmcompare | +| | +\------------------------------------------------------------*/ + +static long sortfsmcompare( ValueArray, Index1, Index2 ) + + authelem *ValueArray; + long Index1; + long Index2; +{ + return( ValueArray[ Index1 ].VALUE - + ValueArray[ Index2 ].VALUE ); +} + +/*------------------------------------------------------------\ +| | +| makefsmbddorder | +| | +\------------------------------------------------------------*/ + +static void makefsmbddorder( Expr ) + + ablexpr *Expr; +{ + char *AtomValue; + authelem *Element; + long Oper; + + if ( Expr == (ablexpr *)0 ) + { + fsmerror( FSM_EXPR_NULL_ERROR, (char *)0 ); + } + + if ( ABL_ATOM( Expr ) ) + { + AtomValue = ABL_ATOM_VALUE( Expr ); + + if ( ( AtomValue == ABL_ATOM_NAME_ONE ) || + ( AtomValue == ABL_ATOM_NAME_ZERO ) || + ( AtomValue == ABL_ATOM_NAME_DC ) ) + { + return; + } + + Element = searchauthelem( FsmHashTableOrder, AtomValue ); + + if ( Element == (authelem *)0 ) + { + fsmerror( FSM_UNKNOWN_ATOM_ERROR, AtomValue ); + } + + Element->VALUE++; + + return; + } + + Oper = ABL_OPER( Expr ); + Expr = ABL_CDR( Expr ); + + if ( Oper == ABL_NOT ) + { + if ( ABL_CDR( Expr ) != (ablexpr *)0 ) + { + fsmerror( FSM_OPERATOR_ERROR, Oper ); + } + + makefsmbddorder( ABL_CAR( Expr ) ); + + return; + } + + if ( ( isablunaryoper( Oper ) ) || + ( ABL_CDR( Expr ) == (ablexpr *)0 ) ) + { + fsmerror( FSM_OPERATOR_ERROR, Oper ); + } + + makefsmbddorder( ABL_CAR( Expr ) ); + + while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 ) + { + makefsmbddorder( ABL_CAR( Expr ) ); + } +} + +/*------------------------------------------------------------\ +| | +| makefsmbddcircuit | +| | +\------------------------------------------------------------*/ + +void makefsmbddcircuit( FsmFigure, BddSystem, Order ) + + fsmfig_list *FsmFigure; + bddsystem *BddSystem; + int Order; +{ + bddcircuit *BddCircuit; + fsmstate_list *ScanState; + fsmtrans_list *ScanTrans; + fsmstack_list *ScanStack; + fsmlocout_list *ScanLocout; + fsmin_list *ScanIn; + authelem *Element; + authelem *ValueArray; + long *IndexArray; + long SizeArray; + long Index; + + BddCircuit = createbddcircuit( FsmFigure->NAME, + FsmFigure->NUMBER_IN, + FsmFigure->NUMBER_OUT, BddSystem ); + if ( ! Order ) + { + for ( ScanIn = FsmFigure->IN; + ScanIn != (fsmin_list *)0; + ScanIn = ScanIn->NEXT ) + { + addbddcircuitin( (bddcircuit *)0, ScanIn->NAME, + (bddindex )0, BDD_IN_MODE_LAST ); + } + } + else + { + FsmHashTableOrder = createauthtable( FsmFigure->NUMBER_IN << 1 ); + + for ( ScanIn = FsmFigure->IN; + ScanIn != (fsmin_list *)0; + ScanIn = ScanIn->NEXT ) + { + addauthelem( FsmHashTableOrder, ScanIn->NAME, 0 ); + } + + for ( ScanTrans = FsmFigure->TRANS; + ScanTrans != (fsmtrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + if ( ScanTrans->ABL != (ablexpr *)0 ) + { + makefsmbddorder( ScanTrans->ABL ); + } + } + + for ( ScanStack = FsmFigure->STACK; + ScanStack != (fsmstack_list *)0; + ScanStack = ScanStack->NEXT ) + { + if ( ScanStack->ABL != (ablexpr *)0 ) + { + makefsmbddorder( ScanStack->ABL ); + } + } + + for ( ScanState = FsmFigure->STATE; + ScanState != (fsmstate_list *)0; + ScanState = ScanState->NEXT ) + { + for ( ScanLocout = ScanState->LOCOUT; + ScanLocout != (fsmlocout_list *)0; + ScanLocout = ScanLocout->NEXT ) + { + if ( ScanLocout->ABL != (ablexpr *)0 ) + { + makefsmbddorder( ScanLocout->ABL ); + } + + if ( ScanLocout->ABL_DC != (ablexpr *)0 ) + { + makefsmbddorder( ScanLocout->ABL_DC ); + } + } + } + + SizeArray = FsmHashTableOrder->TABLE_SIZE; + ValueArray = FsmHashTableOrder->TABLE; + IndexArray = (long *)autallocblock( sizeof( long ) * SizeArray ); + + sortautarray( ValueArray, IndexArray, SizeArray, sortfsmcompare ); + + for ( Index = 0; Index < SizeArray; Index++ ) + { + Element = &ValueArray[ IndexArray[ Index ] ]; + + if ( Element->KEY != AUT_HASH_KEY_EMPTY ) + { + addbddcircuitin( (bddcircuit *)0, Element->KEY, + (bddindex )0, BDD_IN_MODE_LAST ); + } + } + + autfreeblock( IndexArray ); + destroyauthtable( FsmHashTableOrder ); + } + + FsmFigure->CIRCUIT = BddCircuit; +} diff --git a/alliance/src/fsm/src/fsmorder.h b/alliance/src/fsm/src/fsmorder.h new file mode 100644 index 00000000..8501c6fc --- /dev/null +++ b/alliance/src/fsm/src/fsmorder.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 : Fsm | +| | +| File : fsmorder.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_ORDER_H +# define FSM_ORDER_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmsearch.c b/alliance/src/fsm/src/fsmsearch.c new file mode 100644 index 00000000..106713d9 --- /dev/null +++ b/alliance/src/fsm/src/fsmsearch.c @@ -0,0 +1,272 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmsearch.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include "fsmsearch.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Search Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm Search Figure | +| | +\------------------------------------------------------------*/ + +fsmfig_list *searchfsmfig( Name ) + + char *Name; +{ + fsmfig_list *Figure; + + Name = namealloc( Name ); + + for ( Figure = HEAD_FSMFIG; + Figure != (fsmfig_list *)0; + Figure = Figure->NEXT ) + { + if ( Figure->NAME == Name ) break; + } + + return( Figure ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Search State | +| | +\------------------------------------------------------------*/ + +fsmstate_list *searchfsmstate( Figure, Name ) + + fsmfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_STATE, Name ); + + if ( Element != (authelem *)0 ) + { + return( (fsmstate_list *)( Element->VALUE ) ); + } + + return( (fsmstate_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Search Output | +| | +\------------------------------------------------------------*/ + +fsmout_list *searchfsmout( Figure, Name ) + + fsmfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_OUT, Name ); + + if ( Element != (authelem *)0 ) + { + return( (fsmout_list *)( Element->VALUE ) ); + } + + return( (fsmout_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Search Input | +| | +\------------------------------------------------------------*/ + +fsmin_list *searchfsmin( Figure, Name ) + + fsmfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_IN, Name ); + + if ( Element != (authelem *)0 ) + { + return( (fsmin_list *)( Element->VALUE ) ); + } + + return( (fsmin_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Search Port | +| | +\------------------------------------------------------------*/ + +fsmport_list *searchfsmport( Figure, Name ) + + fsmfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_PORT, Name ); + + if ( Element != (authelem *)0 ) + { + return( (fsmport_list *)( Element->VALUE ) ); + } + + return( (fsmport_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Search Transition | +| | +\------------------------------------------------------------*/ + +fsmtrans_list *searchfsmtrans( Figure, StateFrom, StateTo ) + + fsmfig_list *Figure; + fsmstate_list *StateFrom; + fsmstate_list *StateTo; +{ + auth2elem *Element; + + Element = searchauth2elem( Figure->HASH_TRANS, (char *)StateFrom, (char *)StateTo ); + + if ( Element != (auth2elem *)0 ) + { + return( (fsmtrans_list *)( Element->VALUE ) ); + } + + return( (fsmtrans_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Search Stack | +| | +\------------------------------------------------------------*/ + +fsmstack_list *searchfsmstack( Control, Current, Return ) + + char Control; + fsmstate_list *Current; + fsmstate_list *Return; +{ + fsmstack_list *Stack; + chain_list *ScanChain; + + for ( ScanChain = Current->STACK; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + Stack = (fsmstack_list *)( ScanChain->DATA ); + + if ( ( Stack->CTRL == Control ) && + ( Stack->RETURN == Return ) ) return( Stack ); + } + + return( (fsmstack_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Fsm Search Local output | +| | +\------------------------------------------------------------*/ + +fsmlocout_list *searchfsmlocout( State, Out ) + + fsmstate_list *State; + fsmout_list *Out; +{ + fsmlocout_list *Locout; + + for ( Locout = State->LOCOUT; + Locout != (fsmlocout_list *)0; + Locout = Locout->NEXT ) + { + if ( Locout->OUT == Out ) break; + } + + return( Locout ); +} diff --git a/alliance/src/fsm/src/fsmsearch.h b/alliance/src/fsm/src/fsmsearch.h new file mode 100644 index 00000000..4b5ccc74 --- /dev/null +++ b/alliance/src/fsm/src/fsmsearch.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 : Fsm | +| | +| File : fsmsearch.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_SEARCH_H +# define FSM_SEARCH_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmsimp.c b/alliance/src/fsm/src/fsmsimp.c new file mode 100644 index 00000000..09e34f09 --- /dev/null +++ b/alliance/src/fsm/src/fsmsimp.c @@ -0,0 +1,133 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmsimp.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include "fsmsimp.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| simpfsmablexpr | +| | +\------------------------------------------------------------*/ + +void simpfsmablexpr( FsmFigure ) + + fsmfig_list *FsmFigure; +{ + fsmstate_list *ScanState; + fsmtrans_list *ScanTrans; + fsmstack_list *ScanStack; + fsmlocout_list *ScanLocout; + + for ( ScanTrans = FsmFigure->TRANS; + ScanTrans != (fsmtrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + if ( ScanTrans->ABL != (ablexpr *)0 ) + { + ScanTrans->ABL = simpablexpr( ScanTrans->ABL ); + } + } + + for ( ScanStack = FsmFigure->STACK; + ScanStack != (fsmstack_list *)0; + ScanStack = ScanStack->NEXT ) + { + if ( ScanStack->ABL != (ablexpr *)0 ) + { + ScanStack->ABL = simpablexpr( ScanStack->ABL ); + } + } + + for ( ScanState = FsmFigure->STATE; + ScanState != (fsmstate_list *)0; + ScanState = ScanState->NEXT ) + { + for ( ScanLocout = ScanState->LOCOUT; + ScanLocout != (fsmlocout_list *)0; + ScanLocout = ScanLocout->NEXT ) + { + if ( ScanLocout->ABL != (ablexpr *)0 ) + { + ScanLocout->ABL = simpablexpr( ScanLocout->ABL ); + } + + if ( ScanLocout->ABL_DC != (ablexpr *)0 ) + { + ScanLocout->ABL_DC = simpablexpr( ScanLocout->ABL_DC ); + } + } + } + + if ( FsmFigure->CLOCK_ABL != (ablexpr *)0 ) + { + FsmFigure->CLOCK_ABL = simpablexpr( FsmFigure->CLOCK_ABL ); + } +} diff --git a/alliance/src/fsm/src/fsmsimp.h b/alliance/src/fsm/src/fsmsimp.h new file mode 100644 index 00000000..f7552d51 --- /dev/null +++ b/alliance/src/fsm/src/fsmsimp.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 : Fsm | +| | +| File : fsmsimp.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_SIMP_H +# define FSM_SIMP_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/fsmview.c b/alliance/src/fsm/src/fsmview.c new file mode 100644 index 00000000..24c095f4 --- /dev/null +++ b/alliance/src/fsm/src/fsmview.c @@ -0,0 +1,413 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : fsmview.c | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" + +# include +# include "fsmview.h" +# include "fsmerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Fsm View Input | +| | +\------------------------------------------------------------*/ + +void viewfsmin( Input ) + + fsmin_list *Input ; +{ + fprintf( stdout, "\n--> Input" ); + fprintf( stdout, "\n\t\tNAME : %s", Input->NAME ); + fprintf( stdout, "\n\t\tFLAGS : %lx", Input->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Input->USER ); + fprintf( stdout, "\n<-- Input" ); +} + +/*------------------------------------------------------------\ +| | +| Fsm View Output | +| | +\------------------------------------------------------------*/ + +void viewfsmout( Output ) + + fsmout_list *Output ; +{ + fprintf( stdout, "\n--> Output" ); + fprintf( stdout, "\n\t\tNAME : %s", Output->NAME ); + fprintf( stdout, "\n\t\tFLAGS : %lx", Output->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Output->USER ); + fprintf( stdout, "\n<-- Output" ); +} + +/*------------------------------------------------------------\ +| | +| Fsm View Port | +| | +\------------------------------------------------------------*/ + +void viewfsmport( Port ) + + fsmport_list *Port ; +{ + fprintf( stdout, "\n--> Port" ); + fprintf( stdout, "\n\t\tNAME : %s", Port->NAME ); + fprintf( stdout, "\n\t\tDIR : %c", Port->DIR ); + if ( Port->TYPE < FSM_MAX_TYPE ) + fprintf( stdout, "\n\t\tTYPE : %s", FSM_TYPE_NAME[ Port->TYPE ] ); + else + fprintf( stdout, "\n\t\tTYPE : %d", (int)Port->TYPE ); + fprintf( stdout, "\n\t\tFLAGS : %lx", Port->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Port->USER ); + fprintf( stdout, "\n<-- Port" ); +} + +/*------------------------------------------------------------\ +| | +| Fsm View Local Output | +| | +\------------------------------------------------------------*/ + +void viewfsmlocout( Locout ) + + fsmlocout_list *Locout; +{ + fprintf( stdout, "\n--> Local output" ); + fprintf( stdout, "\n\t\tFLAGS : %lx", Locout->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Locout->USER ); + fprintf( stdout, "\n\t\tOUT : " ); + + if ( Locout->OUT != (fsmout_list *)0 ) + { + fprintf( stdout, "%s", Locout->OUT->NAME ); + } + + fprintf( stdout, "\n\t\tABL : " ); + + if ( Locout->ABL != (ablexpr *)0 ) + { + viewablexpr( Locout->ABL, ABL_VIEW_VHDL ); + } + + fprintf( stdout, "\n\t\tABL_DC : " ); + + if ( Locout->ABL_DC != (ablexpr *)0 ) + { + viewablexpr( Locout->ABL_DC, ABL_VIEW_VHDL ); + } + + fprintf( stdout, "\n<-- Local output" ); +} + +/*------------------------------------------------------------\ +| | +| Fsm View Transition | +| | +\------------------------------------------------------------*/ + +void viewfsmtrans( Trans ) + + fsmtrans_list *Trans; +{ + fprintf( stdout, "\n--> Transition" ); + fprintf( stdout, "\n\t\tFLAGS : %lx", Trans->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Trans->USER ); + + fprintf( stdout, "\n\t\tFROM : " ); + + if ( Trans->FROM != (fsmstate_list *)0 ) + { + fprintf( stdout, "%s", Trans->FROM->NAME ); + } + + fprintf( stdout, "\n\t\tTO : " ); + + if ( Trans->TO != (fsmstate_list *)0 ) + { + fprintf( stdout, "%s", Trans->TO->NAME ); + } + + fprintf( stdout, "\n\t\tABL : " ); + + if ( Trans->ABL != (ablexpr *)0 ) + { + viewablexpr( Trans->ABL, ABL_VIEW_VHDL ); + } + + fprintf( stdout, "\n<-- Transition" ); +} + +/*------------------------------------------------------------\ +| | +| Fsm View Stack | +| | +\------------------------------------------------------------*/ + +void viewfsmstack( Stack ) + + fsmstack_list *Stack; +{ + fprintf( stdout, "\n--> Stack" ); + fprintf( stdout, "\n\t\tFLAGS : %lx", Stack->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Stack->USER ); + + if ( Stack->CTRL < FSM_MAX_CTRL ) + { + fprintf( stdout, "\n\t\tCTRL : %s", FSM_CTRL_NAME[ (long)Stack->CTRL ] ); + } + else + { + fprintf( stdout, "\n\t\tCTRL : user %d ", Stack->CTRL ); + } + + fprintf( stdout, "\n\t\tCURRENT : " ); + + if ( Stack->CURRENT != (fsmstate_list *)0 ) + { + fprintf( stdout, "%s", Stack->CURRENT->NAME ); + } + + fprintf( stdout, "\n\t\tRETURN : " ); + + if ( Stack->RETURN != (fsmstate_list *)0 ) + { + fprintf( stdout, "%s", Stack->RETURN->NAME ); + } + + fprintf( stdout, "\n\t\tABL : " ); + + if ( Stack->ABL != (ablexpr *)0 ) + { + viewablexpr( Stack->ABL, ABL_VIEW_VHDL ); + } + + fprintf( stdout, "\n<-- Stack" ); +} + +/*------------------------------------------------------------\ +| | +| Fsm View State | +| | +\------------------------------------------------------------*/ + +void viewfsmstate( State ) + + fsmstate_list *State; +{ + chain_list *ScanChain; + fsmlocout_list *Locout; + + fprintf( stdout, "\n--> State" ); + fprintf( stdout, "\n\t\tNAME : %s", State->NAME ); + fprintf( stdout, "\n\t\tFLAGS : %lx", State->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)State->USER ); + fprintf( stdout, "\n\t\tFROM : " ); + + for ( ScanChain = State->FROM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewfsmtrans( (fsmtrans_list *)(ScanChain->DATA) ); + } + + fprintf( stdout, "\n\t\tTO : " ); + + for ( ScanChain = State->TO; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewfsmtrans( (fsmtrans_list *)(ScanChain->DATA) ); + } + + fprintf( stdout, "\n\t\tSTACK : " ); + + for ( ScanChain = State->STACK; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewfsmstack( (fsmstack_list *)(ScanChain->DATA) ); + } + + fprintf( stdout, "\n\t\tLOCOUT : " ); + + for ( Locout = State->LOCOUT; + Locout != (fsmlocout_list *)0; + Locout = Locout->NEXT ) + { + viewfsmlocout( Locout ); + } + + fprintf( stdout, "\n<-- State" ); +} + +/*------------------------------------------------------------\ +| | +| Fsm View Figure | +| | +\------------------------------------------------------------*/ + +void viewfsmfig( Figure ) + + fsmfig_list *Figure; +{ + fsmstate_list *State; + fsmtrans_list *Trans; + fsmstack_list *Stack; + fsmin_list *Input; + fsmout_list *Output; + fsmport_list *Port; + + fprintf( stdout, "\n--> Figure" ); + fprintf( stdout, "\n\tNAME : %s", Figure->NAME ); + + fprintf( stdout, "\n\tFLAGS : %lx", Figure->FLAGS ); + fprintf( stdout, "\n\tUSER : %lx", (long)Figure->USER ); + fprintf( stdout, "\n\tNUMBER_IN : %ld", Figure->NUMBER_IN ); + fprintf( stdout, "\n\tNUMBER_OUT : %ld", Figure->NUMBER_OUT ); + fprintf( stdout, "\n\tNUMBER_STATE : %ld", Figure->NUMBER_STATE ); + fprintf( stdout, "\n\tNUMBER_TRANS : %ld", Figure->NUMBER_TRANS ); + fprintf( stdout, "\n\tNUMBER_STACK : %ld", Figure->NUMBER_STACK ); + fprintf( stdout, "\n\tSTACK_SIZE : %ld", Figure->STACK_SIZE ); + fprintf( stdout, "\n\tCLOCK : %s", Figure->CLOCK ); + fprintf( stdout, "\n\tCLOCK_ABL : " ); + viewablexpr( Figure->CLOCK_ABL, ABL_VIEW_VHDL ); + + fprintf( stdout, "\n\tPORT : " ); + + for ( Port = Figure->PORT; + Port != (fsmport_list *)0; + Port = Port->NEXT ) + { + viewfsmport( Port ); + } + + fprintf( stdout, "\n\tIN : " ); + + for ( Input = Figure->IN; + Input != (fsmin_list *)0; + Input = Input->NEXT ) + { + viewfsmin( Input ); + } + + fprintf( stdout, "\n\tOUT : " ); + + for ( Output = Figure->OUT; + Output != (fsmout_list *)0; + Output = Output->NEXT ) + { + viewfsmout( Output ); + } + + + if ( Figure->FIRST_STATE != (fsmstate_list *)0 ) + { + fprintf( stdout, "\n\tFIRST_STATE : " ); + viewfsmstate( Figure->FIRST_STATE ); + } + + if ( Figure->STAR_STATE != (fsmstate_list *)0 ) + { + fprintf( stdout, "\n\tSTAR_STATE : " ); + viewfsmstate( Figure->STAR_STATE ); + } + + fprintf( stdout, "\n\tSTATE : " ); + + for ( State = Figure->STATE; + State != (fsmstate_list *)0; + State = State->NEXT ) + { + viewfsmstate( State ); + } + + fprintf( stdout, "\n\tTRANS : " ); + + for ( Trans = Figure->TRANS; + Trans != (fsmtrans_list *)0; + Trans = Trans->NEXT ) + { + viewfsmtrans( Trans ); + } + + fprintf( stdout, "\n\tSTACK : " ); + + for ( Stack = Figure->STACK; + Stack != (fsmstack_list *)0; + Stack = Stack->NEXT ) + { + viewfsmstack( Stack ); + } + + fprintf( stdout, "\n<-- Figure\n" ); +} diff --git a/alliance/src/fsm/src/fsmview.h b/alliance/src/fsm/src/fsmview.h new file mode 100644 index 00000000..50ded2d4 --- /dev/null +++ b/alliance/src/fsm/src/fsmview.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 : Fsm | +| | +| File : fsmview.h | +| | +| Date : 04.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef FSM_VIEW_H +# define FSM_VIEW_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/fsm/src/main.c b/alliance/src/fsm/src/main.c new file mode 100644 index 00000000..ba1b3fbf --- /dev/null +++ b/alliance/src/fsm/src/main.c @@ -0,0 +1,183 @@ +/*------------------------------------------------------------\ +| | +| 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 : Fsm | +| | +| File : main.c | +| | +| Date : 08.02.95 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "bdd.h" +# include "fsm.h" +# include "ftl.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Usage | +| | +\------------------------------------------------------------*/ + +void FsmUsage() +{ + fprintf( stderr, "\t\tfsmtest [Options] Input_name [Output_name]\n\n" ); + fprintf( stdout, "\t\tOptions : -V Sets Verbose mode on\n" ); + fprintf( stdout, "\t\t -S Saves Fsm figure\n" ); + fprintf( stdout, "\t\t -I Fsm Input format\n" ); + fprintf( stdout, "\t\t -O Fsm Output format\n" ); + fprintf( stdout, "\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + fsmfig_list *FsmFigure; + char *InputFileName; + char *OutputFileName; + int Number; + int Index; + char Option; + + int FlagVerbose = 0; + int FlagSave = 0; + + mbkenv(); + autenv(); + ablenv(); + fsmenv(); + + InputFileName = (char *)0; + + if ( argc < 2 ) FsmUsage(); + + InputFileName = (char *)0; + + for ( Number = 1; Number < argc; Number++ ) + { + if ( argv[ Number ][ 0 ] == '-' ) + { + for ( Index = 1; argv[ Number ][ Index ] != '\0'; Index++ ) + { + Option = argv[ Number ][ Index ]; + + if ( Option == 'I' ) + { + Number = Number + 1; + FSM_IN = namealloc( argv[ Number ] ); + break; + } + else + if ( Option == 'O' ) + { + Number = Number + 1; + FSM_OUT = namealloc( argv[ Number ] ); + break; + } + + switch ( Option ) + { + case 'V' : FlagVerbose = 1; + break; + case 'S' : FlagSave = 1; + break; + default : FsmUsage(); + } + } + } + else + if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ]; + else + if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ]; + else + FsmUsage(); + } + + if ( InputFileName == (char *)0 ) FsmUsage(); + if ( OutputFileName == (char *)0 ) OutputFileName = InputFileName; + + if ( ( FlagSave ) && ( InputFileName == OutputFileName ) ) + { + FsmUsage(); + } + + fprintf( stdout, "FSM_IN : %s\n", FSM_IN ); + fprintf( stdout, "FSM_OUT : %s\n", FSM_OUT ); + + FsmFigure = getfsmfig( InputFileName ); + + if ( FlagVerbose ) viewfsmfig( FsmFigure ); + + if ( FlagSave ) + { + FsmFigure->NAME = namealloc( OutputFileName ); + savefsmfig( FsmFigure ); + } + + delfsmfig( FsmFigure->NAME ); + + return( 0 ); +}