This commit was generated by cvs2svn to track changes on a CVS vendor

branch.
This commit is contained in:
Ludovic Jacomme 2002-03-20 14:05:33 +00:00
commit ea127fd5ff
15 changed files with 3222 additions and 0 deletions

View File

@ -0,0 +1 @@
SUBDIRS = src

View File

@ -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 <Frederic.Petrot@lip6.fr>
dnl $Id: configure.in,v 1.1 2002/03/20 14:05:32 ludo Exp $
dnl
dnl
AC_INIT(src/abt.h)
AM_INIT_AUTOMAKE(abt, 2.1)
AC_PROG_INSTALL
AC_PROG_CC
AC_HEADER_STDC
AC_C_CONST
AC_PROG_RANLIB
AM_ALLIANCE
AC_OUTPUT([
Makefile
src/Makefile
])

View File

@ -0,0 +1,8 @@
CFLAGS = @CFLAGS@ \
-DALLIANCE_TOP=\"${ALLIANCE_TOP}\"
lib_LIBRARIES = libAbt.a
include_HEADERS = abt.h
libAbt_a_SOURCES = \
abt.h bhl_depend.c bhl_freabl.c bhl_makgex.c \
bhl_delaux.c bhl_error.c bhl_makbdd.c bhl_orderbdd.c \
bhl_delaux.h bhl_error.h bhl_makbdd.h bhl_orderbdd.h

View File

@ -0,0 +1,60 @@
/*------------------------------------------------------------\
| |
| 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. |
| |
\------------------------------------------------------------*/
/* ###--------------------------------------------------------------### */
/* */
/* file : bhl200.h */
/* date : Feb 15 1995 */
/* version : v200 */
/* author : Pirouz BAZARGAN SABET */
/* contents : defines and structure definitions used in BHL library */
/* */
/* ###--------------------------------------------------------------### */
#ifndef ABT_BHLDEF
#define ABT_BHLDEF
/* ###------------------------------------------------------### */
/* defines */
/* ###------------------------------------------------------### */
/* ###------------------------------------------------------### */
/* structure definitions */
/* ###------------------------------------------------------### */
/* ###------------------------------------------------------### */
/* functions */
/* ###------------------------------------------------------### */
extern void beh_debug ();
extern void beh_makbdd ();
extern void beh_makgex ();
extern void beh_freabl ();
extern struct chain *beh_depend ();
extern void beh_delauxabl ();
#endif

View File

@ -0,0 +1,404 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : bhl_delaux.c |
| |
| Date : 01.02.95 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "abl.h"
# include "abe.h"
# include "abt.h"
# include <stdio.h>
# include "bhl_error.h"
# include "bhl_delaux.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static chain_list *BhlHeadName = (chain_list *)0;
static befig_list *BhlBehFigure = (befig_list *)0;
static char *BhlDelayedName = (char *)0;
static authtable *BhlHashTableInput = (authtable *)0;
static authtable *BhlHashTableAux = (authtable *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Bhl DelAux Expr |
| |
\------------------------------------------------------------*/
static chain_list *bhl_delauxexpr( Expr )
chain_list *Expr;
{
char *AtomValue;
chain_list *FirstExpr;
beaux_list *ScanAux;
chain_list *ScanChain;
authelem *Element;
long Oper;
FirstExpr = Expr;
if ( Expr == (chain_list *)0 )
{
bhlerror( BHL_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( FirstExpr );
}
Element = searchauthelem( BhlHashTableInput, AtomValue );
if ( Element != (authelem *)0 )
{
return( FirstExpr );
}
for ( ScanAux = BhlBehFigure->BEAUX;
ScanAux != (beaux_list *)0;
ScanAux = ScanAux->NEXT )
{
if ( ScanAux->NAME == AtomValue ) break;
}
if ( ScanAux == (beaux_list *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
for ( ScanChain = BhlHeadName;
ScanChain != (chain_list *)0;
ScanChain = ScanChain->NEXT )
{
if ( ScanChain->DATA == AtomValue )
{
bhlerror( BHL_EXPR_LOOP_ERROR, AtomValue );
}
}
Element = searchauthelem( BhlHashTableAux, AtomValue );
if ( Element == (authelem *)0 )
{
BhlHeadName = addchain( BhlHeadName, AtomValue );
ScanAux->ABL = bhl_delauxexpr( ScanAux->ABL );
BhlHeadName = delchain( BhlHeadName, BhlHeadName );
addauthelem( BhlHashTableAux, AtomValue, (long)ScanAux->ABL );
}
freeablexpr( FirstExpr );
return( dupablexpr( ScanAux->ABL ) );
}
Oper = ABL_OPER( Expr );
Expr = ABL_CDR( Expr );
if ( Oper == ABL_NOT )
{
if ( ABL_CDR( Expr ) != (chain_list *)0 )
{
bhlerror( BHL_OPERATOR_ERROR, Oper );
}
ABL_CAR( Expr ) = bhl_delauxexpr( ABL_CAR( Expr ) );
return( FirstExpr );
}
if ( Oper == ABL_STABLE )
{
Expr = ABL_CAR( Expr );
if ( ! ABL_ATOM( Expr ) )
{
bhlerror( BHL_ILLEGAL_STABLE_ERROR, (char *)0 );
}
AtomValue = ABL_ATOM_VALUE( Expr );
Element = searchauthelem( BhlHashTableInput, AtomValue );
if ( Element == (authelem *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
BhlDelayedName = autresizeblock( BhlDelayedName, 0, strlen( AtomValue ) + 9 );
sprintf( BhlDelayedName, "%s'delayed", AtomValue );
AtomValue = namealloc( BhlDelayedName );
Element = searchauthelem( BhlHashTableInput, AtomValue );
if ( Element == (authelem *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
return( FirstExpr );
}
if ( ( isablunaryoper( Oper ) ) ||
( ABL_CDR( Expr ) == (chain_list *)0 ) )
{
bhlerror( BHL_OPERATOR_ERROR, Oper );
}
ABL_CAR( Expr ) = bhl_delauxexpr( ABL_CAR( Expr ) );
while ( ( Expr = ABL_CDR( Expr ) ) != (chain_list *)0 )
{
ABL_CAR( Expr ) = bhl_delauxexpr( ABL_CAR( Expr ) );
}
return( FirstExpr );
}
/*------------------------------------------------------------\
| |
| Beh DelAux Bdd |
| |
\------------------------------------------------------------*/
static chain_list *bhl_delauxabl( Name, Expr )
char *Name;
chain_list *Expr;
{
if ( Name != (char *)0 )
{
BhlHeadName = addchain( BhlHeadName, Name );
}
Expr = bhl_delauxexpr( Expr );
if ( Name != (char *)0 )
{
BhlHeadName = delchain( BhlHeadName, BhlHeadName );
}
return( Expr );
}
/*------------------------------------------------------------\
| |
| Beh Del Aux Abl |
| |
\------------------------------------------------------------*/
void beh_delauxabl( BehFigure )
befig_list *BehFigure;
{
struct berin *BehRin;
struct beaux *BehAux;
struct beaux *BehDly;
struct bemsg *BehMsg;
struct beout *BehOut;
struct bebus *BehBus;
struct bebux *BehBux;
struct bereg *BehReg;
struct biabl *BiAbl;
authelem *Element;
long NumberIn;
long NumberAux;
BhlBehFigure = BehFigure;
BhlHeadName = (chain_list *)0;
NumberIn = 1;
NumberAux = 1;
BehAux = BehFigure->BEAUX;
while ( BehAux != NULL )
{
BehFigure->BERIN = beh_rmvberin( BehFigure->BERIN, BehAux->NAME );
NumberAux = NumberAux + 1;
BehAux = BehAux->NEXT;
}
BehRin = BehFigure->BERIN;
while ( BehRin != NULL )
{
NumberIn = NumberIn + 1;
BehRin = BehRin->NEXT;
}
BhlHashTableInput = createauthtable( NumberIn << 1 );
BhlHashTableAux = createauthtable( NumberAux << 1 );
BehRin = BehFigure->BERIN;
while ( BehRin != NULL )
{
addauthelem( BhlHashTableInput, BehRin->NAME, 0 );
BehRin = BehRin->NEXT;
}
BehAux = BehFigure->BEAUX;
while ( BehAux != NULL )
{
Element = searchauthelem( BhlHashTableAux, BehAux->NAME );
if ( Element == (authelem *)0 )
{
BehAux->ABL = bhl_delauxabl( BehAux->NAME, BehAux->ABL );
addauthelem( BhlHashTableAux, BehAux->NAME, (long)BehAux->ABL );
}
BehAux = BehAux->NEXT;
}
BehDly = BehFigure->BEDLY;
while ( BehDly != NULL )
{
BehDly->ABL = bhl_delauxabl( BehDly->NAME, BehDly->ABL );
BehDly = BehDly->NEXT;
}
BehMsg = BehFigure->BEMSG;
while ( BehMsg != NULL )
{
BehMsg->ABL = bhl_delauxabl( (char *)0, BehMsg->ABL );
BehMsg = BehMsg->NEXT;
}
BehOut = BehFigure->BEOUT;
while ( BehOut != NULL )
{
BehOut->ABL = bhl_delauxabl( BehOut->NAME, BehOut->ABL );
BehOut = BehOut->NEXT;
}
BehBus = BehFigure->BEBUS;
while ( BehBus != NULL )
{
BiAbl = BehBus->BIABL;
while ( BiAbl != NULL )
{
BiAbl->CNDABL = bhl_delauxabl( (char *)0 , BiAbl->CNDABL );
BiAbl->VALABL = bhl_delauxabl( BehBus->NAME, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
}
BehBus = BehBus->NEXT;
}
BehBux = BehFigure->BEBUX;
while ( BehBux != NULL )
{
BiAbl = BehBux->BIABL;
while (BiAbl != NULL)
{
BiAbl->CNDABL = bhl_delauxabl( (char *)0, BiAbl->CNDABL );
BiAbl->VALABL = bhl_delauxabl( (char *)0, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
}
BehBux = BehBux->NEXT;
}
BehReg = BehFigure->BEREG;
while ( BehReg != NULL )
{
BiAbl = BehReg->BIABL;
while (BiAbl != NULL)
{
BiAbl->CNDABL = bhl_delauxabl( (char *)0, BiAbl->CNDABL );
BiAbl->VALABL = bhl_delauxabl( (char *)0, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
}
BehReg = BehReg->NEXT;
}
destroyauthtable( BhlHashTableInput );
destroyauthtable( BhlHashTableAux );
beh_frebeaux( BehFigure->BEAUX );
BehFigure->BEAUX = (beaux_list *)NULL;
}

View File

@ -0,0 +1,67 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : bhl_makbdd.h |
| |
| Date : 01.02.95 |
| |
| Author : Pirouz Bazargan Sabet |
| |
| Modified by Jacomme Ludovic |
| |
\------------------------------------------------------------*/
# ifndef BHL_MAKBDD_H
# define BHL_MAKBDD_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void beh_delauxabl();
# endif

View File

@ -0,0 +1,399 @@
/*------------------------------------------------------------\
| |
| 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. |
| |
\------------------------------------------------------------*/
/* ###--------------------------------------------------------------### */
/* */
/* file : beh_depend.c */
/* date : Apr 15 1995 */
/* version : v108 */
/* authors : Pirouz BAZARGAN SABET */
/* description : high level function */
/* */
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include "mut.h"
#include "aut.h"
#include "abl.h"
#include "bdd.h"
#include "abe.h"
static ht *rin_list = NULL;
/* ###--------------------------------------------------------------### */
/* function : beh_terminals */
/* description : find the list of terminals for an expression */
/* called func. : beh_terminals, namealloc, addchain */
/* ###--------------------------------------------------------------### */
static struct chain *beh_terminals (pt_exp)
struct chain *pt_exp;
{
struct chain *res_chain = NULL;
struct chain *tmp_chain = NULL;
struct chain *pt_opr ;
char *name ;
char buffer [128];
static char *str_z = NULL;
static char *str_o = NULL;
static char *str_d = NULL;
if (str_z == NULL)
{
str_z = namealloc ("'0'");
str_o = namealloc ("'1'");
str_d = namealloc ("'d'");
}
if (pt_exp->NEXT != NULL)
{
if (((int) ((struct chain *) pt_exp->DATA)->DATA) == ABL_STABLE)
{
name = ((struct chain *) pt_exp->NEXT->DATA)->DATA;
res_chain = addchain (NULL, name);
sprintf (buffer, "%s'delayed", name);
name = namealloc (buffer);
res_chain = addchain (res_chain, name);
}
else
{
pt_opr = pt_exp->NEXT;
while (pt_opr != NULL)
{
tmp_chain = beh_terminals (pt_opr->DATA);
res_chain = append (res_chain, tmp_chain);
pt_opr = pt_opr->NEXT;
}
}
}
else
{
if ((pt_exp->DATA != str_z) && (pt_exp->DATA != str_o) &&
(pt_exp->DATA != str_d))
{
res_chain = addchain (NULL, pt_exp->DATA);
}
}
return (res_chain);
}
/* ###--------------------------------------------------------------### */
/* function : beh_expdepend */
/* description : find dependencies for an expression */
/* called func. : beh_terminals, gethtitem */
/* ###--------------------------------------------------------------### */
static struct chain *beh_expdepend (pt_fig, pt_exp)
struct befig *pt_fig;
struct chain *pt_exp;
{
struct chain *res_chain = NULL;
int value ;
if (pt_fig->ERRFLG == 0)
{
/* ###------------------------------------------------------### */
/* if there is no error in the current figure, find the list */
/* of terminals for the expression */
/* ###------------------------------------------------------### */
res_chain = beh_terminals (pt_exp);
/* ###------------------------------------------------------### */
/* scan the list of terminals to replace terminal names by */
/* pointer on the corresponding primary input (berin). */
/* ###------------------------------------------------------### */
while (res_chain != NULL)
{
value = gethtitem (rin_list, res_chain->DATA);
if (value == EMPTYHT)
beh_error (3, res_chain->DATA);
else
res_chain->DATA = (void *) value ;
res_chain = res_chain->NEXT;
}
}
return (res_chain);
}
/* ###--------------------------------------------------------------### */
/* function : beh_depend */
/* description : find dependencies between signals for a behavioural */
/* description. */
/* called func. : beh_expdepend, addht, addhtitem, addchain, freechain, */
/* append, delhtitem */
/* ###--------------------------------------------------------------### */
void beh_depend (pt_fig)
struct befig *pt_fig;
{
struct chain *res_chain = NULL;
struct beaux *pt_aux;
struct beaux *pt_dly;
struct bebux *pt_bux;
struct bereg *pt_reg;
struct bemsg *pt_msg;
struct berin *pt_rin;
struct beout *pt_out;
struct bebus *pt_bus;
struct biabl *pt_biabl;
unsigned int count = 0;
/* ###------------------------------------------------------### */
/* if there is no error in the current figure ... */
/* ###------------------------------------------------------### */
if ((pt_fig != NULL) && (pt_fig->ERRFLG == 0))
{
/* ###------------------------------------------------------### */
/* initialize a hash table with inputs */
/* ###------------------------------------------------------### */
pt_rin = pt_fig->BERIN;
while (pt_rin != NULL)
{
count++;
pt_rin = pt_rin->NEXT;
}
pt_rin = pt_fig->BERIN;
if (pt_rin != NULL)
rin_list = addht (count);
while (pt_rin != NULL)
{
addhtitem (rin_list, pt_rin->NAME, (long)pt_rin);
pt_rin = pt_rin->NEXT;
}
/* ###------------------------------------------------------### */
/* process simple internal signals. */
/* check that the signal does not already belong to the */
/* dependency list before adding it to the list */
/* ###------------------------------------------------------### */
pt_aux = pt_fig->BEAUX;
while (pt_aux != NULL)
{
res_chain = beh_expdepend (pt_fig, pt_aux->ABL);
while (res_chain != NULL)
{
pt_rin = (struct berin *) res_chain->DATA;
if ((pt_rin->AUX_REF == NULL) || (pt_rin->AUX_REF->DATA != pt_aux))
pt_rin->AUX_REF = addchain (pt_rin->AUX_REF, pt_aux);
res_chain = res_chain->NEXT;
}
freechain (res_chain);
pt_aux = pt_aux->NEXT;
}
/* ###------------------------------------------------------### */
/* process delayed internal signals */
/* check that the signal does not already belong to the */
/* dependency list before adding it to the list */
/* ###------------------------------------------------------### */
pt_dly = pt_fig->BEDLY;
while (pt_dly != NULL)
{
res_chain = beh_expdepend (pt_fig, pt_dly->ABL);
while (res_chain != NULL)
{
pt_rin = (struct berin *) res_chain->DATA;
if ((pt_rin->DLY_REF == NULL) || (pt_rin->DLY_REF->DATA != pt_dly))
pt_rin->DLY_REF = addchain (pt_rin->DLY_REF, pt_dly);
res_chain = res_chain->NEXT;
}
freechain (res_chain);
pt_dly = pt_dly->NEXT;
}
/* ###------------------------------------------------------### */
/* process simple ouputs. */
/* check that the signal does not already belong to the */
/* dependency list before adding it to the list */
/* ###------------------------------------------------------### */
pt_out = pt_fig->BEOUT;
while (pt_out != NULL)
{
res_chain = beh_expdepend (pt_fig, pt_out->ABL);
while (res_chain != NULL)
{
pt_rin = (struct berin *) res_chain->DATA;
if ((pt_rin->OUT_REF == NULL) || (pt_rin->OUT_REF->DATA != pt_out))
pt_rin->OUT_REF = addchain (pt_rin->OUT_REF, pt_out);
res_chain = res_chain->NEXT;
}
freechain (res_chain);
pt_out = pt_out->NEXT;
}
/* ###------------------------------------------------------### */
/* process bussed ouputs. */
/* check that the signal does not already belong to the */
/* dependency list before adding it to the list */
/* ###------------------------------------------------------### */
res_chain = NULL;
pt_bus = pt_fig->BEBUS;
while (pt_bus != NULL)
{
pt_biabl = pt_bus->BIABL;
while (pt_biabl != NULL)
{
res_chain = append (res_chain, beh_expdepend (pt_fig,pt_biabl->VALABL));
res_chain = append (res_chain, beh_expdepend (pt_fig,pt_biabl->CNDABL));
pt_biabl = pt_biabl->NEXT;
}
while (res_chain != NULL)
{
pt_rin = (struct berin *) res_chain->DATA;
if ((pt_rin->BUS_REF == NULL) || (pt_rin->BUS_REF->DATA != pt_bus))
pt_rin->BUS_REF = addchain (pt_rin->BUS_REF, pt_bus);
res_chain = res_chain->NEXT;
}
freechain (res_chain);
pt_bus = pt_bus->NEXT;
}
/* ###------------------------------------------------------### */
/* process bussed internal signals. */
/* check that the signal does not already belong to the */
/* dependency list before adding it to the list */
/* ###------------------------------------------------------### */
res_chain = NULL;
pt_bux = pt_fig->BEBUX;
while (pt_bux != NULL)
{
pt_biabl = pt_bux->BIABL;
while (pt_biabl != NULL)
{
res_chain = append (res_chain, beh_expdepend (pt_fig,pt_biabl->VALABL));
res_chain = append (res_chain, beh_expdepend (pt_fig,pt_biabl->CNDABL));
pt_biabl = pt_biabl->NEXT;
}
while (res_chain != NULL)
{
pt_rin = (struct berin *) res_chain->DATA;
if ((pt_rin->BUX_REF == NULL) || (pt_rin->BUX_REF->DATA != pt_bux))
pt_rin->BUX_REF = addchain (pt_rin->BUX_REF, pt_bux);
res_chain = res_chain->NEXT;
}
freechain (res_chain);
pt_bux = pt_bux->NEXT;
}
/* ###------------------------------------------------------### */
/* process internal registers. */
/* check that the signal does not already belong to the */
/* dependency list before adding it to the list */
/* ###------------------------------------------------------### */
res_chain = NULL;
pt_reg = pt_fig->BEREG;
while (pt_reg != NULL)
{
pt_biabl = pt_reg->BIABL;
while (pt_biabl != NULL)
{
res_chain = append (res_chain, beh_expdepend (pt_fig,pt_biabl->VALABL));
res_chain = append (res_chain, beh_expdepend (pt_fig,pt_biabl->CNDABL));
pt_biabl = pt_biabl->NEXT;
}
while (res_chain != NULL)
{
pt_rin = (struct berin *) res_chain->DATA;
if ((pt_rin->REG_REF == NULL) || (pt_rin->REG_REF->DATA != pt_reg))
pt_rin->REG_REF = addchain (pt_rin->REG_REF, pt_reg);
res_chain = res_chain->NEXT;
}
freechain (res_chain);
pt_reg = pt_reg->NEXT;
}
/* ###------------------------------------------------------### */
/* process assert statements. */
/* check that the statement does not already belong to the */
/* dependency list before adding it to the list */
/* ###------------------------------------------------------### */
res_chain = NULL;
pt_msg = pt_fig->BEMSG;
while (pt_msg != NULL)
{
res_chain = beh_expdepend (pt_fig, pt_msg->ABL);
while (res_chain != NULL)
{
pt_rin = (struct berin *) res_chain->DATA;
if ((pt_rin->MSG_REF == NULL) || (pt_rin->MSG_REF->DATA != pt_msg))
pt_rin->MSG_REF = addchain (pt_rin->MSG_REF, pt_msg);
res_chain = res_chain->NEXT;
}
freechain (res_chain);
pt_msg = pt_msg->NEXT;
}
/* ###------------------------------------------------------### */
/* release hash tables and lists that they contain */
/* ###------------------------------------------------------### */
if (pt_fig->BERIN != NULL)
delht(rin_list);
}
}

View File

@ -0,0 +1,131 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : Bhl Errors |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 01.02.95 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <string.h>
# include "mut.h"
# include "aut.h"
# include "abl.h"
# include "bhl_error.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
void bhl_error( Error, Text, File, Line )
int Error;
char *Text;
char *File;
int Line;
{
char *Name;
Name = strdup( File );
Name[ strlen( File ) - 1 ] = '\0';
fprintf( stderr, "%s%d ", Name, Line );
switch( Error )
{
case BHL_EXPR_NULL_ERROR :
fprintf( stderr, "null expression !\n" );
break;
case BHL_EXPR_LOOP_ERROR :
fprintf( stderr, "combinatory loop on %s !\n", Text );
break;
case BHL_UNKNOWN_ATOM_ERROR :
fprintf( stderr, "unknown atom %s !\n", Text );
break;
case BHL_SIMPLIFY_ERROR :
fprintf( stderr, "cannot simplify internal signals\n" );
break;
case BHL_ILLEGAL_STABLE_ERROR :
fprintf( stderr, "illegal use of STABLE operator\n" );
break;
case BHL_OPERATOR_ERROR :
fprintf( stderr, "illegal use of operator %ld\n", (long)Text );
break;
default :
fprintf( stderr, "unknown internal error %d !\n", Error );
}
autexit( 1 );
}

View File

@ -0,0 +1,81 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : Bhl Errors |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 01.02.95 |
| |
\------------------------------------------------------------*/
# ifndef BHL_ERROR_H
# define BHL_ERROR_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BHL_EXPR_NULL_ERROR 0
# define BHL_EXPR_LOOP_ERROR 1
# define BHL_UNKNOWN_ATOM_ERROR 2
# define BHL_SIMPLIFY_ERROR 3
# define BHL_ILLEGAL_STABLE_ERROR 4
# define BHL_OPERATOR_ERROR 5
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macros |
| |
\------------------------------------------------------------*/
# define bhlerror( E, V ) (bhl_error( (E), (V), __FILE__, __LINE__ ))
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void bhl_error();
# endif

View File

@ -0,0 +1,205 @@
/*------------------------------------------------------------\
| |
| 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. |
| |
\------------------------------------------------------------*/
/* ###--------------------------------------------------------------### */
/* */
/* file : beh_freabl.c */
/* date : Sep 9 1993 */
/* version : v106 */
/* authors : Pirouz BAZARGAN SABET */
/* description : high level function */
/* */
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include "mut.h"
#include "aut.h"
#include "abl.h"
#include "bdd.h"
#include "abe.h"
/* ###--------------------------------------------------------------### */
/* function : beh_freabl */
/* description : free all ABLs in BEFIG structure */
/* called func. : freeablexpr */
/* ###--------------------------------------------------------------### */
void beh_freabl (ptr_befig)
struct befig *ptr_befig; /* pointer on current BEFIG */
{
struct beaux *ptr_beaux;
struct bemsg *ptr_bemsg;
struct beout *ptr_beout;
struct bebus *ptr_bebus;
struct biabl *ptr_biabl;
struct bebux *ptr_bebux;
struct bereg *ptr_bereg;
/* ###------------------------------------------------------### */
/* check that the unit exists */
/* ###------------------------------------------------------### */
if (ptr_befig != NULL)
{
/* ###------------------------------------------------------### */
/* release expression in simple internal signals' list */
/* ###------------------------------------------------------### */
ptr_beaux = ptr_befig->BEAUX;
while (ptr_beaux != NULL)
{
if (ptr_beaux->ABL != NULL)
{
freeablexpr (ptr_beaux->ABL);
ptr_beaux->ABL = NULL;
}
ptr_beaux = ptr_beaux->NEXT;
}
/* ###------------------------------------------------------### */
/* release expression in delayed signals' list */
/* ###------------------------------------------------------### */
ptr_beaux = ptr_befig->BEDLY;
while (ptr_beaux != NULL)
{
if (ptr_beaux->ABL != NULL)
{
freeablexpr (ptr_beaux->ABL);
ptr_beaux->ABL = NULL;
}
ptr_beaux = ptr_beaux->NEXT;
}
/* ###------------------------------------------------------### */
/* release expression in assertions' list */
/* ###------------------------------------------------------### */
ptr_bemsg = ptr_befig->BEMSG;
while (ptr_bemsg != NULL)
{
if (ptr_bemsg->ABL != NULL)
{
freeablexpr (ptr_bemsg->ABL);
ptr_bemsg->ABL = NULL;
}
ptr_bemsg = ptr_bemsg->NEXT;
}
/* ###------------------------------------------------------### */
/* release expression in simple output ports' list */
/* ###------------------------------------------------------### */
ptr_beout = ptr_befig->BEOUT;
while (ptr_beout != NULL)
{
if (ptr_beout->ABL != NULL)
{
freeablexpr (ptr_beout->ABL);
ptr_beout->ABL = NULL;
}
ptr_beout = ptr_beout->NEXT;
}
/* ###------------------------------------------------------### */
/* release expression in bussed output ports' list */
/* ###------------------------------------------------------### */
ptr_bebus = ptr_befig->BEBUS;
while (ptr_bebus != NULL)
{
ptr_biabl = ptr_bebus->BIABL;
while (ptr_biabl != NULL)
{
if (ptr_biabl->CNDABL != NULL)
{
freeablexpr(ptr_biabl->CNDABL);
ptr_biabl->CNDABL = NULL;
}
if (ptr_biabl->VALABL != NULL)
{
freeablexpr(ptr_biabl->VALABL);
ptr_biabl->VALABL = NULL;
}
ptr_biabl = ptr_biabl->NEXT;
}
ptr_bebus = ptr_bebus->NEXT;
}
/* ###------------------------------------------------------### */
/* release expression in bussed internal signals' list */
/* ###------------------------------------------------------### */
ptr_bebux = ptr_befig->BEBUX;
while (ptr_bebux != NULL)
{
ptr_biabl = ptr_bebux->BIABL;
while (ptr_biabl != NULL)
{
if (ptr_biabl->CNDABL != NULL)
{
freeablexpr (ptr_biabl->CNDABL);
ptr_biabl->CNDABL = NULL;
}
if (ptr_biabl->VALABL != NULL)
{
freeablexpr (ptr_biabl->VALABL);
ptr_biabl->VALABL = NULL;
}
ptr_biabl = ptr_biabl->NEXT;
}
ptr_bebux = ptr_bebux->NEXT;
}
/* ###------------------------------------------------------### */
/* release expression in internal registers' list */
/* ###------------------------------------------------------### */
ptr_bereg = ptr_befig->BEREG;
while (ptr_bereg != NULL)
{
ptr_biabl = ptr_bereg->BIABL;
while (ptr_biabl != NULL)
{
if ( ptr_biabl->CNDABL != NULL )
{
freeablexpr(ptr_biabl->CNDABL);
ptr_biabl->CNDABL = NULL;
}
if ( ptr_biabl->VALABL != NULL )
{
freeablexpr(ptr_biabl->VALABL);
ptr_biabl->VALABL = NULL;
}
ptr_biabl = ptr_biabl->NEXT;
}
ptr_bereg = ptr_bereg->NEXT;
}
}
}

View File

@ -0,0 +1,494 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : bhl_makbdd.c |
| |
| Date : 01.02.95 |
| |
| Author : Pirouz Bazargan Sabet |
| |
| Modified by Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "abl.h"
# include "bdd.h"
# include "abe.h"
# include "abt.h"
# include <stdio.h>
# include "bhl_error.h"
# include "bhl_makbdd.h"
# include "bhl_orderbdd.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static chain_list *BhlHeadName = (chain_list *)0;
static befig_list *BhlBehFigure = (befig_list *)0;
static char *BhlDelayedName = (char *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Bhl Abl 2 Bdd |
| |
\------------------------------------------------------------*/
static bddnode *bhl_expr2bdd( Expr )
chain_list *Expr;
{
bddnode *BddNode;
bddnode *BddFirst;
char *AtomValue;
beaux_list *ScanAux;
chain_list *ScanChain;
long Oper;
int Negative;
if ( Expr == (chain_list *)0 )
{
bhlerror( BHL_EXPR_NULL_ERROR, (char *)0 );
}
if ( ABL_ATOM( Expr ) )
{
AtomValue = ABL_ATOM_VALUE( Expr );
if ( AtomValue == ABL_ATOM_NAME_ONE )
{
return( BddLocalSystem->ONE );
}
if ( ( AtomValue == ABL_ATOM_NAME_ZERO ) ||
( AtomValue == ABL_ATOM_NAME_DC ) )
{
return( BddLocalSystem->ZERO );
}
BddNode = searchbddcircuitin( (bddcircuit *)0, AtomValue );
if ( BddNode != (bddnode *)0 )
{
return( incbddrefext( BddNode ) );
}
for ( ScanAux = BhlBehFigure->BEAUX;
ScanAux != (beaux_list *)0;
ScanAux = ScanAux->NEXT )
{
if ( ScanAux->NAME == AtomValue ) break;
}
if ( ScanAux == (beaux_list *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
for ( ScanChain = BhlHeadName;
ScanChain != (chain_list *)0;
ScanChain = ScanChain->NEXT )
{
if ( ScanChain->DATA == AtomValue )
{
bhlerror( BHL_EXPR_LOOP_ERROR, AtomValue );
}
}
if ( ScanAux->NODE == (void *)0 )
{
BhlHeadName = addchain( BhlHeadName, AtomValue );
ScanAux->NODE = bhl_expr2bdd( ScanAux->ABL );
BhlHeadName = delchain( BhlHeadName, BhlHeadName );
}
return( incbddrefext( ScanAux->NODE ) );
}
Oper = ABL_OPER( Expr );
Expr = ABL_CDR( Expr );
if ( Oper == ABL_NOT )
{
if ( ABL_CDR( Expr ) != (chain_list *)0 )
{
bhlerror( BHL_OPERATOR_ERROR, Oper );
}
BddFirst = bhl_expr2bdd( ABL_CAR( Expr ) );
BddNode = applybddnodenot( (bddsystem *)0, decbddrefext( BddFirst ) );
return( BddNode );
}
if ( Oper == ABL_STABLE )
{
Expr = ABL_CAR( Expr );
if ( ! ABL_ATOM( Expr ) )
{
bhlerror( BHL_ILLEGAL_STABLE_ERROR, (char *)0 );
}
AtomValue = ABL_ATOM_VALUE( Expr );
BddFirst = searchbddcircuitin( (bddcircuit *)0, AtomValue );
if ( BddFirst == (bddnode *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
BhlDelayedName = autresizeblock( BhlDelayedName, 0, strlen( AtomValue ) + 9 );
sprintf( BhlDelayedName, "%s'delayed", AtomValue );
AtomValue = namealloc( BhlDelayedName );
BddNode = searchbddcircuitin( (bddcircuit *)0, AtomValue );
if ( BddNode == (bddnode *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
BddNode = applybddnode( (bddsystem *)0, ABL_NXOR, BddNode, BddFirst );
return( BddNode );
}
if ( ( isablunaryoper( Oper ) ) ||
( ABL_CDR( Expr ) == (chain_list *)0 ) )
{
bhlerror( BHL_OPERATOR_ERROR, Oper );
}
if ( ( getabloperpolar( Oper ) == ABL_POLAR_POSITIVE ) ||
( ABL_CDDR( Expr ) == (chain_list *)0 ) )
{
Negative = 0;
}
else
{
Negative = 1;
Oper = getablopernot( Oper );
}
BddFirst = bhl_expr2bdd( ABL_CAR( Expr ) );
while ( ( Expr = ABL_CDR( Expr ) ) != (chain_list *)0 )
{
BddNode = bhl_expr2bdd( ABL_CAR( Expr ) );
BddFirst = applybddnode( (bddsystem *)0, Oper,
decbddrefext( BddFirst ),
decbddrefext( BddNode ) );
}
if ( Negative )
{
BddFirst = applybddnodenot( (bddsystem *)0,
decbddrefext( BddFirst ) );
}
return( BddFirst );
}
/*------------------------------------------------------------\
| |
| Beh Abl 2 Bdd |
| |
\------------------------------------------------------------*/
static bddnode *bhl_abl2bdd( Name, Expr )
char *Name;
chain_list *Expr;
{
bddnode *BddNode;
if ( Name != (char *)0 )
{
BhlHeadName = addchain( BhlHeadName, Name );
}
BddNode = bhl_expr2bdd( Expr );
if ( Name != (char *)0 )
{
BhlHeadName = delchain( BhlHeadName, BhlHeadName );
BddNode = addbddcircuitout( (bddcircuit *)0, Name, BddNode );
}
return( BddNode );
}
/*------------------------------------------------------------\
| |
| Beh Make Bdd Total |
| |
\------------------------------------------------------------*/
void bhl_mbddtot( BehFigure )
befig_list *BehFigure;
{
struct beaux *BehAux;
struct beaux *BehDly;
struct bemsg *BehMsg;
struct beout *BehOut;
struct bebus *BehBus;
struct bebux *BehBux;
struct bereg *BehReg;
struct biabl *BiAbl;
struct binode *BiNode;
BhlBehFigure = BehFigure;
BhlHeadName = (chain_list *)0;
BehAux = BehFigure->BEAUX;
while ( BehAux != NULL )
{
if ( BehAux->NODE == NULL )
{
BehAux->NODE = bhl_abl2bdd( BehAux->NAME, BehAux->ABL );
}
BehAux = BehAux->NEXT;
}
BehDly = BehFigure->BEDLY;
while ( BehDly != NULL )
{
if ( BehDly->NODE == NULL )
{
BehDly->NODE = bhl_abl2bdd( BehDly->NAME, BehDly->ABL );
}
BehDly = BehDly->NEXT;
}
BehMsg = BehFigure->BEMSG;
while ( BehMsg != NULL )
{
if ( BehMsg->NODE == NULL )
{
BehMsg->NODE = bhl_abl2bdd( (char *)0, BehMsg->ABL );
}
BehMsg = BehMsg->NEXT;
}
BehOut = BehFigure->BEOUT;
while ( BehOut != NULL )
{
if ( BehOut->NODE == NULL )
{
BehOut->NODE = bhl_abl2bdd( BehOut->NAME, BehOut->ABL );
}
BehOut = BehOut->NEXT;
}
BehBus = BehFigure->BEBUS;
while ( BehBus != NULL )
{
BiAbl = BehBus->BIABL;
BiNode = BehBus->BINODE;
while (BiAbl != NULL)
{
BiNode->CNDNODE = bhl_abl2bdd( (char *)0, BiAbl->CNDABL );
BiNode->VALNODE = bhl_abl2bdd( BehBus->NAME, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
BiNode = BiNode->NEXT;
}
BehBus = BehBus->NEXT;
}
BehBux = BehFigure->BEBUX;
while ( BehBux != NULL )
{
BiAbl = BehBux->BIABL;
BiNode = BehBux->BINODE;
while ( BiAbl != NULL )
{
BiNode->CNDNODE = bhl_abl2bdd( (char *)0 , BiAbl->CNDABL );
BiNode->VALNODE = bhl_abl2bdd( BehBux->NAME, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
BiNode = BiNode->NEXT;
}
BehBux = BehBux->NEXT;
}
BehReg = BehFigure->BEREG;
while ( BehReg != NULL )
{
BiAbl = BehReg->BIABL;
BiNode = BehReg->BINODE;
while ( BiAbl != NULL )
{
BiNode->CNDNODE = bhl_abl2bdd( (char *)0 , BiAbl->CNDABL );
BiNode->VALNODE = bhl_abl2bdd( BehReg->NAME, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
BiNode = BiNode->NEXT;
}
BehReg = BehReg->NEXT;
}
}
/*------------------------------------------------------------\
| |
| Beh Make Bdd |
| |
\------------------------------------------------------------*/
void beh_makbdd( ptr_befig, aux_flag, order_flag )
befig_list *ptr_befig;
char aux_flag;
char order_flag;
{
berin_list *ptr_rin;
beaux_list *ptr_aux;
beout_list *ptr_out;
bebus_list *ptr_bus;
long count_rin = 1;
long count_out = 1;
if ( ! aux_flag )
{
if ( ptr_befig->BEDLY == NULL )
{
ptr_aux = ptr_befig->BEAUX;
while ( ptr_aux != NULL )
{
ptr_befig->BERIN = beh_rmvberin( ptr_befig->BERIN, ptr_aux->NAME );
ptr_aux = ptr_aux->NEXT;
count_out++;
}
}
else
{
bhlerror( BHL_SIMPLIFY_ERROR, (char *)0 );
}
}
else
{
ptr_aux = ptr_befig->BEAUX;
while ( ptr_aux != NULL )
{
ptr_aux = ptr_aux->NEXT;
count_out++;
}
}
ptr_rin = ptr_befig->BERIN;
while (ptr_rin != NULL)
{
ptr_rin = ptr_rin->NEXT;
count_rin++;
}
ptr_out = ptr_befig->BEOUT;
while (ptr_out != NULL)
{
ptr_out = ptr_out->NEXT;
count_out++;
}
ptr_bus = ptr_befig->BEBUS;
while (ptr_bus != NULL)
{
ptr_bus = ptr_bus->NEXT;
count_out++;
}
ptr_befig->CIRCUI = createbddcircuit( ptr_befig->NAME,
count_rin, count_out, (bddsystem *)0 );
bhl_orderbdd( ptr_befig, aux_flag, order_flag );
bhl_mbddtot( ptr_befig );
if ( ! aux_flag )
{
ptr_aux = ptr_befig->BEAUX;
while ( ptr_aux != NULL )
{
if ( ptr_aux->NODE != (void *)0 )
{
decbddrefext( ptr_aux->NODE );
delbddcircuitout( (bddcircuit *)0, ptr_aux->NAME );
}
ptr_aux = ptr_aux->NEXT;
}
beh_frebeaux( ptr_befig->BEAUX );
ptr_befig->BEAUX = NULL;
}
sweepbddsystem( (bddsystem *)0 );
}

View File

@ -0,0 +1,65 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : bhl_makbdd.h |
| |
| Date : 01.02.95 |
| |
| Author : Pirouz Bazargan Sabet |
| |
| Modified by Jacomme Ludovic |
| |
\------------------------------------------------------------*/
# ifndef BHL_MAKBDD_H
# define BHL_MAKBDD_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,758 @@
/*------------------------------------------------------------\
| |
| 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. |
| |
\------------------------------------------------------------*/
/* ###--------------------------------------------------------------### */
/* */
/* file : beh_makgex.c */
/* date : Mar 20 1994 */
/* version : v108 */
/* authors : Xavier Picat */
/* description : high level function */
/* */
/* ###--------------------------------------------------------------### */
#include <stdio.h>
#include "mut.h"
#include "aut.h"
#include "abl.h"
#include "bdd.h"
#include "abe.h"
#define BEH_GEXBLK 256
static struct begex *BEH_GEXHED = NULL;
static ht *HashTable = NULL;
/* ###--------------------------------------------------------------### */
/* function : beh_addgexex */
/* description : create a GEX expression */
/* called func. : mbkalloc */
/* ###--------------------------------------------------------------### */
static struct begex *beh_addgexex (oper, type)
unsigned int oper;
unsigned short type;
{
struct begex *ptgex;
int i;
if (BEH_GEXHED == NULL)
{
/* ###------------------------------------------------------### */
/* if there is no more structure allocate a new block */
/* (use OPERAND field to chain structures in a list) */
/* ###------------------------------------------------------### */
BEH_GEXHED = mbkalloc (sizeof (struct begex) * BEH_GEXBLK);
ptgex = BEH_GEXHED;
for (i=1 ; i<BEH_GEXBLK ; i++)
{
ptgex->OPERAND = (struct chain *) (ptgex + 1);
ptgex++;
}
ptgex->OPERAND = NULL;
}
ptgex = BEH_GEXHED;
BEH_GEXHED = (struct begex *) BEH_GEXHED->OPERAND;
ptgex->TERM = oper;
ptgex->TYPE = type;
ptgex->OPERAND = NULL;
return (ptgex);
}
/* ###--------------------------------------------------------------### */
/* function : beh_addterm */
/* description : create a GEX for a terminal. For each terminal there */
/* is a unique GEX */
/* called func. : beh_addgexex, mbkalloc, addchain */
/* ###--------------------------------------------------------------### */
static struct begex *beh_addterm (oper)
unsigned int oper;
{
static struct chain *term_tab = NULL;
static unsigned int bank_nbr = 0;
struct chain *tmp_chn = NULL;
struct begex *locl_tab;
unsigned int bank;
struct begex *resgex;
int i;
int j;
bank = oper / 64;
if (bank >= bank_nbr)
{
for (i=bank_nbr ; i<=bank ; i++)
{
locl_tab = (struct begex *) mbkalloc (64 * sizeof (struct begex));
for (j=0 ; j<64 ; j++)
{
(locl_tab [j]).TERM = j + (i * 64);
(locl_tab [j]).TYPE = 0;
(locl_tab [j]).OPERAND = NULL;
}
if (term_tab == NULL)
term_tab = addchain (NULL, locl_tab);
else
{
tmp_chn = term_tab;
while (tmp_chn->NEXT != NULL)
tmp_chn = tmp_chn->NEXT;
tmp_chn->NEXT = addchain (NULL, locl_tab);
}
}
bank_nbr = bank + 1;
}
tmp_chn = term_tab;
for (i=0 ; i<bank ; i++)
tmp_chn = tmp_chn->NEXT;
locl_tab = (struct begex *) tmp_chn->DATA;
resgex = & (locl_tab [oper % 64]);
return (resgex);
}
/* ###--------------------------------------------------------------### */
/* function : mad_fregex */
/* description : release a GEX expression (excluding terminals) */
/* called func. : none */
/* ###--------------------------------------------------------------### */
void mad_fregex (ptgex, mode)
struct begex *ptgex;
char mode ;
{
struct chain *tmpchn;
if (ptgex != NULL)
{
if ((tmpchn = ptgex->OPERAND) != NULL)
{
if (mode == 'a')
{
while (tmpchn != NULL)
{
mad_fregex ((struct begex *) tmpchn->DATA, 'a');
tmpchn = tmpchn->NEXT;
}
freechain (ptgex->OPERAND);
}
ptgex->OPERAND = (struct chain *) BEH_GEXHED;
BEH_GEXHED = ptgex;
}
}
}
/* ###--------------------------------------------------------------### */
/* function : flatgex */
/* description : flatten the top level of a complex expression */
/* called func. : mbkalloc */
/* ###--------------------------------------------------------------### */
static struct begex *flatgex (gexpnt)
struct begex *gexpnt;
{
int top_operator;
int operator;
struct chain *tmp_chn;
struct chain *cur_oper;
struct chain *oper_list = NULL;
struct begex *operand;
struct begex *resgex = gexpnt;
char flatflag = 0;
if ((gexpnt != NULL) && (gexpnt->OPERAND != NULL))
{
cur_oper = gexpnt->OPERAND;
while (cur_oper != NULL)
{
flatflag = 0;
top_operator = gexpnt->TERM;
operand = (struct begex *) cur_oper->DATA;
if (operand->OPERAND != NULL)
{
operator = operand->TERM;
switch (operator)
{
case ABL_OR :
if (top_operator == ABL_NOT)
{
gexpnt->TERM = ABL_NOR;
flatflag = 1;
}
else
{
if ((top_operator == ABL_OR) || (top_operator == ABL_NOR))
flatflag = 1;
}
break;
case ABL_AND :
if (top_operator == ABL_NOT)
{
gexpnt->TERM = ABL_NAND;
flatflag = 1;
}
else
{
if ((top_operator == ABL_AND) || (top_operator == ABL_NAND))
flatflag = 1;
}
break;
case ABL_XOR :
if (top_operator == ABL_NOT)
{
gexpnt->TERM = ABL_NXOR;
flatflag = 1;
}
else
{
if ((top_operator == ABL_XOR) || (top_operator == ABL_NXOR))
flatflag = 1;
}
break;
case ABL_NXOR :
if (top_operator == ABL_XOR)
{
gexpnt->TERM = ABL_NXOR;
flatflag = 1;
}
else
{
if ((top_operator == ABL_NXOR) || (top_operator == ABL_NOT))
{
gexpnt->TERM = ABL_XOR;
flatflag = 1;
}
}
break;
}
}
if (flatflag == 1)
{
tmp_chn = operand->OPERAND;
while (tmp_chn->NEXT != NULL)
tmp_chn = tmp_chn->NEXT;
tmp_chn->NEXT = oper_list;
oper_list = operand->OPERAND;
mad_fregex (operand, 'p');
}
else
oper_list = addchain (oper_list, operand);
cur_oper = cur_oper->NEXT;
}
freechain (gexpnt->OPERAND);
gexpnt->OPERAND = oper_list;
resgex = gexpnt;
}
return (resgex);
}
/* ###--------------------------------------------------------------### */
/* function : rmvconst */
/* description : remove constantes that appear at the top level of a */
/* espression */
/* called func. : addchain, freechain, mad_fregex */
/* ###--------------------------------------------------------------### */
static struct begex *rmvconst (gexpnt)
struct begex *gexpnt;
{
struct begex *resgex;
struct begex *operand;
struct begex *gex_zero;
struct begex *gex_one ;
struct chain *new_oper = NULL;
struct chain *cur_oper;
struct chain *tmp_chn = NULL;
int operator;
char freflag = 0;
resgex = gexpnt;
gex_zero = beh_addterm (0);
gex_one = beh_addterm (1);
if (gexpnt != NULL)
{
if (gexpnt->OPERAND != NULL)
{
cur_oper = gexpnt->OPERAND;
while (cur_oper != NULL)
{
operator = gexpnt->TERM;
operand = (struct begex *) cur_oper->DATA;
freflag = 0;
if (operand == gex_zero)
{
switch (operator)
{
case ABL_AND :
freflag = 2; resgex = gex_zero; break;
case ABL_NAND :
case ABL_NOT :
freflag = 2; resgex = gex_one ; break;
case ABL_OR :
case ABL_XOR :
case ABL_NOR :
case ABL_NXOR :
freflag = 1; break;
break;
}
}
if (operand == gex_one)
{
switch (operator)
{
case ABL_OR :
freflag = 2; resgex = gex_one ; break;
case ABL_NOR :
case ABL_NOT :
freflag = 2; resgex = gex_zero; break;
case ABL_NAND :
case ABL_AND :
freflag = 1; break;
break;
case ABL_XOR :
gexpnt->TERM = ABL_NXOR; freflag = 1; break;
break;
case ABL_NXOR :
gexpnt->TERM = ABL_XOR ; freflag = 1; break;
break;
}
}
if (freflag == 2)
{
mad_fregex (gexpnt);
freechain (new_oper);
gexpnt = NULL;
new_oper = NULL;
break;
}
else
{
if (freflag == 0)
new_oper = addchain (new_oper, cur_oper->DATA);
cur_oper = cur_oper->NEXT;
}
}
if (gexpnt != NULL)
{
operator = gexpnt->TERM;
if (new_oper == NULL)
{
switch (operator)
{
case ABL_AND :
case ABL_NOR :
case ABL_NXOR :
resgex = gex_one ;
break;
case ABL_OR :
case ABL_XOR :
case ABL_NAND :
resgex = gex_zero;
break;
}
mad_fregex (gexpnt);
gexpnt = NULL;
}
else
{
if (new_oper->NEXT == NULL)
{
switch (operator)
{
case ABL_AND :
case ABL_OR :
case ABL_XOR :
resgex = (struct begex *) new_oper->DATA;
freechain (new_oper);
gexpnt = NULL;
new_oper = NULL;
break;
case ABL_NOR :
case ABL_NXOR :
case ABL_NAND :
case ABL_NOT :
tmp_chn = gexpnt->OPERAND;
gexpnt->OPERAND = new_oper;
gexpnt->TERM = ABL_NOT;
freechain (tmp_chn);
tmp_chn = NULL;
resgex = gexpnt;
break;
}
}
}
}
}
}
return (resgex);
}
/* ###--------------------------------------------------------------### */
/* function : beh_abl2gex */
/* description : transform recursively abl in gex */
/* called func. : beh_toolbug, beh_abl2gex, gethtitem beh_addgexex, */
/* namealloc , addchain */
/* ###--------------------------------------------------------------### */
static struct begex *beh_abl2gex (ptr_befig, expr)
struct befig *ptr_befig;
struct chain *expr;
{
char delayed [128];
static char *str_zero = NULL;
static char *str_dc = NULL;
static char *str_one = NULL;
struct begex *resgex ;
struct begex *gex_elt ;
struct chain *oper_list ;
struct chain *operand ;
char *term ;
long term_idx ;
long operator ;
if (expr == NULL)
beh_toolbug (103, "beh_abl2gex", NULL, 0);
if (str_zero == NULL)
{
str_zero = namealloc ("'0'");
str_dc = namealloc ("'d'");
str_one = namealloc ("'1'");
}
if (expr->NEXT != NULL)
{
/* ###------------------------------------------------------### */
/* if the expression is not a terminal ... */
/* ###------------------------------------------------------### */
operator = (long) ((struct chain *)expr->DATA)->DATA;
switch (operator)
{
case ABL_STABLE:
/* ###------------------------------------------------------### */
/* translate signal'stable into a logical expression. */
/* notice : */
/* signal'stable = not (signal xor signal'delayed) */
/* ###------------------------------------------------------### */
resgex = beh_addgexex (ABL_NXOR, 0);
operand = (struct chain *) expr->NEXT->DATA;
if (operand->NEXT != NULL)
beh_toolbug (100, "beh_abl2gex", NULL, 0);
else
{
term = (char *) operand->DATA;
term_idx = gethtitem (HashTable, term);
if (term_idx == EMPTYHT)
beh_toolbug (101, "beh_abl2gex", term, 0);
else
{
gex_elt = beh_addterm (term_idx);
resgex->OPERAND = addchain (NULL, gex_elt);
sprintf (delayed, "%s'delayed", term);
term = namealloc (delayed);
term_idx = gethtitem (HashTable, term);
if (term_idx == EMPTYHT)
beh_toolbug (101, "beh_abl2gex", term, 0);
else
{
gex_elt = beh_addterm (term_idx);
resgex->OPERAND->NEXT = addchain (NULL, gex_elt);
}
}
}
break;
case ABL_OR:
case ABL_AND:
case ABL_XOR:
case ABL_NOR:
case ABL_NAND:
case ABL_NXOR:
case ABL_NOT:
/* ###------------------------------------------------------### */
/* for other operator make the top level, then, translate */
/* each operand */
/* ###------------------------------------------------------### */
resgex = beh_addgexex (operator, 0);
oper_list = expr->NEXT;
while (oper_list != NULL)
{
gex_elt = beh_abl2gex (ptr_befig, oper_list->DATA);
resgex->OPERAND = addchain (resgex->OPERAND, gex_elt);
oper_list = oper_list->NEXT;
}
break;
default:
beh_toolbug (102, "beh_abl2gex", NULL, operator);
}
resgex = rmvconst (resgex);
resgex = flatgex (resgex);
}
else
{
/* ###------------------------------------------------------### */
/* if the expression is a terminal create a terminal gex */
/* with the index correspnding to the terminal */
/* ###------------------------------------------------------### */
term = (char *) expr->DATA;
term_idx = gethtitem (HashTable, term);
if (term_idx == EMPTYHT)
{
if (expr->DATA == str_one)
resgex = beh_addterm (1);
else
{
if ((expr->DATA == str_zero) || (expr->DATA == str_dc))
resgex = beh_addterm (0);
else
beh_toolbug (101, "beh_abl2gex", term, 0);
}
}
else
resgex = beh_addterm (term_idx);
}
return (resgex);
}
/* ###--------------------------------------------------------------### */
/* function : beh_makgex */
/* description : make gex for each signal of a befig structure */
/* called func. : beh_abl2gex, addht, addhtitem, delht */
/* ###--------------------------------------------------------------### */
void beh_makgex (ptr_befig, aux_flg, trace_flg)
struct befig *ptr_befig; /* befig containing expressions */
char aux_flg ; /* ignored */
char trace_flg; /* ignored */
{
struct beaux *ptr_beaux;
struct beaux *ptr_bedly;
struct bemsg *ptr_bemsg;
struct beout *ptr_beout;
struct bebus *ptr_bebus;
struct bebux *ptr_bebux;
struct bereg *ptr_bereg;
struct biabl *ptr_biabl;
struct binode *ptr_binode;
struct berin *ptr_rin;
int i;
/* ###------------------------------------------------------### */
/* initialize hash table */
/* ###------------------------------------------------------### */
i = 1;
ptr_rin = ptr_befig->BERIN;
while (ptr_rin != NULL)
{
i++;
ptr_rin = ptr_rin->NEXT;
}
HashTable = addht (i);
i = 2;
ptr_rin = ptr_befig->BERIN;
while (ptr_rin != NULL)
{
addhtitem (HashTable, ptr_rin->NAME, i);
i++;
ptr_rin = ptr_rin->NEXT;
}
/* ###------------------------------------------------------### */
/* make a gex for each simple internal signal */
/* ###------------------------------------------------------### */
ptr_beaux = ptr_befig->BEAUX;
while (ptr_beaux != NULL)
{
ptr_beaux->NODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_beaux->ABL);
ptr_beaux = ptr_beaux->NEXT;
}
/* ###------------------------------------------------------### */
/* make a gex for each delayed internal signal */
/* ###------------------------------------------------------### */
ptr_bedly = ptr_befig->BEDLY;
while (ptr_bedly != NULL)
{
ptr_bedly->NODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_bedly->ABL);
ptr_bedly = ptr_bedly->NEXT;
}
/* ###------------------------------------------------------### */
/* make a gex for each assertion */
/* ###------------------------------------------------------### */
ptr_bemsg = ptr_befig->BEMSG;
while (ptr_bemsg != NULL)
{
ptr_bemsg->NODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_bemsg->ABL);
ptr_bemsg = ptr_bemsg->NEXT;
}
/* ###------------------------------------------------------### */
/* make a gex for each simple output */
/* ###------------------------------------------------------### */
ptr_beout = ptr_befig->BEOUT;
while (ptr_beout != NULL)
{
ptr_beout->NODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_beout->ABL);
ptr_beout = ptr_beout->NEXT;
}
/* ###------------------------------------------------------### */
/* make a gex for each bussed output */
/* ###------------------------------------------------------### */
ptr_bebus = ptr_befig->BEBUS;
while (ptr_bebus != NULL)
{
ptr_biabl = ptr_bebus->BIABL;
ptr_binode = ptr_bebus->BINODE;
while (ptr_biabl != NULL)
{
ptr_binode->CNDNODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_biabl->CNDABL);
ptr_binode->VALNODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_biabl->VALABL);
ptr_biabl = ptr_biabl->NEXT;
ptr_binode = ptr_binode->NEXT;
}
ptr_bebus = ptr_bebus->NEXT;
}
/* ###------------------------------------------------------### */
/* make a gex for each bussed internal signal */
/* ###------------------------------------------------------### */
ptr_bebux = ptr_befig->BEBUX;
while (ptr_bebux != NULL)
{
ptr_biabl = ptr_bebux->BIABL;
ptr_binode = ptr_bebux->BINODE;
while (ptr_biabl != NULL)
{
ptr_binode->CNDNODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_biabl->CNDABL);
ptr_binode->VALNODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_biabl->VALABL);
ptr_biabl = ptr_biabl->NEXT;
ptr_binode = ptr_binode->NEXT;
}
ptr_bebux = ptr_bebux->NEXT;
}
/* ###------------------------------------------------------### */
/* make a gex for each internal register */
/* ###------------------------------------------------------### */
ptr_bereg = ptr_befig->BEREG;
while (ptr_bereg != NULL)
{
ptr_biabl = ptr_bereg->BIABL;
ptr_binode = ptr_bereg->BINODE;
while (ptr_biabl != NULL)
{
ptr_binode->CNDNODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_biabl->CNDABL);
ptr_binode->VALNODE = (bddnode *) beh_abl2gex (ptr_befig, ptr_biabl->VALABL);
ptr_biabl = ptr_biabl->NEXT;
ptr_binode = ptr_binode->NEXT;
}
ptr_bereg = ptr_bereg->NEXT;
}
delht (HashTable);
}

View File

@ -0,0 +1,437 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : bhl_orderbdd.c |
| |
| Date : 01.02.95 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "abl.h"
# include "bdd.h"
# include "abe.h"
# include "abt.h"
# include <stdio.h>
# include "bhl_error.h"
# include "bhl_orderbdd.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static chain_list *BhlHeadName = (chain_list *)0;
static befig_list *BhlBehFigure = (befig_list *)0;
static char *BhlDelayedName = (char *)0;
static authtable *BhlHashTableOrder = (authtable *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Bhl Order Expr Bdd |
| |
\------------------------------------------------------------*/
static void bhl_orderexprbdd( Expr )
chain_list *Expr;
{
char *AtomValue;
beaux_list *ScanAux;
chain_list *ScanChain;
authelem *Element;
long Oper;
if ( Expr == (chain_list *)0 )
{
bhlerror( BHL_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( BhlHashTableOrder, AtomValue );
if ( Element != (authelem *)0 )
{
Element->VALUE++;
return;
}
for ( ScanAux = BhlBehFigure->BEAUX;
ScanAux != (beaux_list *)0;
ScanAux = ScanAux->NEXT )
{
if ( ScanAux->NAME == AtomValue ) break;
}
if ( ScanAux == (beaux_list *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
for ( ScanChain = BhlHeadName;
ScanChain != (chain_list *)0;
ScanChain = ScanChain->NEXT )
{
if ( ScanChain->DATA == AtomValue )
{
bhlerror( BHL_EXPR_LOOP_ERROR, AtomValue );
}
}
BhlHeadName = addchain( BhlHeadName, AtomValue );
bhl_orderexprbdd( ScanAux->ABL );
BhlHeadName = delchain( BhlHeadName, BhlHeadName );
return;
}
Oper = ABL_OPER( Expr );
Expr = ABL_CDR( Expr );
if ( Oper == ABL_NOT )
{
if ( ABL_CDR( Expr ) != (chain_list *)0 )
{
bhlerror( BHL_OPERATOR_ERROR, Oper );
}
bhl_orderexprbdd( ABL_CAR( Expr ) );
return;
}
if ( Oper == ABL_STABLE )
{
Expr = ABL_CAR( Expr );
if ( ! ABL_ATOM( Expr ) )
{
bhlerror( BHL_ILLEGAL_STABLE_ERROR, (char *)0 );
}
AtomValue = ABL_ATOM_VALUE( Expr );
Element = searchauthelem( BhlHashTableOrder, AtomValue );
if ( Element == (authelem *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
BhlDelayedName = autresizeblock( BhlDelayedName, 0, strlen( AtomValue ) + 9 );
sprintf( BhlDelayedName, "%s'delayed", AtomValue );
AtomValue = namealloc( BhlDelayedName );
Element = searchauthelem( BhlHashTableOrder, AtomValue );
if ( Element == (authelem *)0 )
{
bhlerror( BHL_UNKNOWN_ATOM_ERROR, AtomValue );
}
return;
}
if ( ( isablunaryoper( Oper ) ) ||
( ABL_CDR( Expr ) == (chain_list *)0 ) )
{
bhlerror( BHL_OPERATOR_ERROR, Oper );
}
bhl_orderexprbdd( ABL_CAR( Expr ) );
while ( ( Expr = ABL_CDR( Expr ) ) != (chain_list *)0 )
{
bhl_orderexprbdd( ABL_CAR( Expr ) );
}
}
/*------------------------------------------------------------\
| |
| Beh Order Bdd |
| |
\------------------------------------------------------------*/
static void bhl_orderablbdd( Name, Expr )
char *Name;
chain_list *Expr;
{
if ( Name != (char *)0 )
{
BhlHeadName = addchain( BhlHeadName, Name );
}
bhl_orderexprbdd( Expr );
if ( Name != (char *)0 )
{
BhlHeadName = delchain( BhlHeadName, BhlHeadName );
}
}
/*------------------------------------------------------------\
| |
| Beh Sort Compare |
| |
\------------------------------------------------------------*/
static long bhl_sortcompare( ValueArray, Index1, Index2 )
authelem *ValueArray;
long Index1;
long Index2;
{
return( ValueArray[ Index1 ].VALUE -
ValueArray[ Index2 ].VALUE );
}
/*------------------------------------------------------------\
| |
| Beh Order Bdd Total |
| |
\------------------------------------------------------------*/
void bhl_orderbdd( BehFigure, AuxFlag, OrderFlag )
befig_list *BehFigure;
int AuxFlag;
int OrderFlag;
{
struct berin *BehRin;
struct beaux *BehAux;
struct beaux *BehDly;
struct bemsg *BehMsg;
struct beout *BehOut;
struct bebus *BehBus;
struct bebux *BehBux;
struct bereg *BehReg;
struct biabl *BiAbl;
authelem *Element;
authelem *ValueArray;
long *IndexArray;
long SizeArray;
long Index;
long NumberIn;
bddindex BddIndex;
BhlBehFigure = BehFigure;
BhlHeadName = (chain_list *)0;
NumberIn = BehFigure->CIRCUI->NAME_IN_SIZE;
BehFigure->BERIN = (berin_list *)reverse( (chain_list*)BehFigure->BERIN );
BehRin = BehFigure->BERIN;
if ( ! OrderFlag )
{
while ( BehRin != NULL )
{
BddIndex = BddLocalCircuit->NUMBER_NAME_IN + BDD_INDEX_MIN;
addbddcircuitin( (bddcircuit *)0, BehRin->NAME, BddIndex,
BDD_IN_MODE_IMPOSE | BDD_IN_MODE_LAST );
BehRin = BehRin->NEXT;
}
BehFigure->BERIN = (berin_list *)reverse( (chain_list*)BehFigure->BERIN );
return;
}
BhlHashTableOrder = createauthtable( NumberIn << 1 );
while ( BehRin != NULL )
{
addauthelem( BhlHashTableOrder, BehRin->NAME, 0 );
BehRin = BehRin->NEXT;
}
if ( AuxFlag )
{
BehAux = BehFigure->BEAUX;
while ( BehAux != NULL )
{
bhl_orderablbdd( BehAux->NAME, BehAux->ABL );
BehAux = BehAux->NEXT;
}
}
BehDly = BehFigure->BEDLY;
while ( BehDly != NULL )
{
bhl_orderablbdd( BehDly->NAME, BehDly->ABL );
BehDly = BehDly->NEXT;
}
BehMsg = BehFigure->BEMSG;
while ( BehMsg != NULL )
{
bhl_orderablbdd( (char *)0, BehMsg->ABL );
BehMsg = BehMsg->NEXT;
}
BehOut = BehFigure->BEOUT;
while ( BehOut != NULL )
{
bhl_orderablbdd( BehOut->NAME, BehOut->ABL );
BehOut = BehOut->NEXT;
}
BehBus = BehFigure->BEBUS;
while ( BehBus != NULL )
{
BiAbl = BehBus->BIABL;
while ( BiAbl != NULL )
{
bhl_orderablbdd( (char *)0 , BiAbl->CNDABL );
bhl_orderablbdd( BehBus->NAME, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
}
BehBus = BehBus->NEXT;
}
BehBux = BehFigure->BEBUX;
while ( BehBux != NULL )
{
BiAbl = BehBux->BIABL;
while (BiAbl != NULL)
{
bhl_orderablbdd( (char *)0, BiAbl->CNDABL );
bhl_orderablbdd( (char *)0, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
}
BehBux = BehBux->NEXT;
}
BehReg = BehFigure->BEREG;
while ( BehReg != NULL )
{
BiAbl = BehReg->BIABL;
while (BiAbl != NULL)
{
bhl_orderablbdd( (char *)0, BiAbl->CNDABL );
bhl_orderablbdd( (char *)0, BiAbl->VALABL );
BiAbl = BiAbl->NEXT;
}
BehReg = BehReg->NEXT;
}
BehRin = BehFigure->BERIN;
# ifdef BHL_ORDER_DEBUG
viewauthtable( BhlHashTableOrder, viewauthelem );
# endif
SizeArray = BhlHashTableOrder->TABLE_SIZE;
ValueArray = BhlHashTableOrder->TABLE;
IndexArray = (long *)autallocblock( sizeof( long ) * SizeArray );
sortautarray( ValueArray, IndexArray, SizeArray, bhl_sortcompare );
for ( Index = 0; Index < SizeArray; Index++ )
{
Element = &ValueArray[ IndexArray[ Index ] ];
if ( Element->KEY != AUT_HASH_KEY_EMPTY )
{
BddIndex = BddLocalCircuit->NUMBER_NAME_IN + BDD_INDEX_MIN;
addbddcircuitin( (bddcircuit *)0, Element->KEY, BddIndex,
BDD_IN_MODE_IMPOSE | BDD_IN_MODE_LAST );
# ifdef BHL_ORDER_DEBUG
fprintf( stdout, "Var: %s Order: %d\n",
Element->KEY, Element->VALUE );
# endif
}
}
autfreeblock( IndexArray );
destroyauthtable( BhlHashTableOrder );
BehFigure->BERIN = (berin_list *)reverse( (chain_list*)BehFigure->BERIN );
}

View File

@ -0,0 +1,67 @@
/*------------------------------------------------------------\
| |
| 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 : Bhl |
| |
| File : bhl_makbdd.h |
| |
| Date : 01.02.95 |
| |
| Author : Pirouz Bazargan Sabet |
| |
| Modified by Jacomme Ludovic |
| |
\------------------------------------------------------------*/
# ifndef BHL_ORDERBDD_H
# define BHL_ORDERBDD_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void bhl_orderbdd();
# endif