This commit is contained in:
Ludovic Jacomme 2002-03-26 12:41:55 +00:00
parent c7f03a0053
commit 33e30974b3
75 changed files with 16865 additions and 0 deletions

View File

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

View File

@ -0,0 +1,2 @@
man_MANS = boom.1
EXTRA_DIST = $(man_MANS)

View File

@ -0,0 +1,108 @@
.\" $Id: boom.1,v 1.1 2002/03/26 12:37:22 ludo Exp $
.\" @(#)Labo.l 2.2 95/09/24 UPMC; Author: Jacomme L.
.pl -.4
.TH BOOM 1 "August 25, 2000" "ASIM/LIP6" "CAO\-VLSI Reference Manual"
.SH NAME
.TP
BOOM \- BOOlean Minimization
.so man1/alc_origin.1
.SH SYNOPSIS
.TP
\f4boom [\-VTOAP] [\-l num] [\-d num] [\-i num] [\-a num] [\-sjbgpwtmorn]
filename [outname]
.br
.SH DESCRIPTION
.br
\fBBOOM\fP is used for the first step of the synthesis process.
It optimizes a behavioural description using a Reduced Ordered Binary
Decision Diagram representation of logic functions.
The file \fBfilename\fP is the input behavioural description and must
be written in vbe(5) format.
The resulting behavioural optimized description is saved with the name
\fBoutname\fP or \fBinput_name\fP_o in vbe(5) format.
.SH ENVIRONMENT VARIABLES
.br
.TP 10
\f4MBK_WORK_LIB\fR(1)
indicates the path to the read/write directory for the session.
.br
.SH OPTIONS
.TP 10
\f4\-V\fP
Verbose mode on.
Each step of the optimization is displayed on the standard output.
.TP 10
\f4\-T\fP
Trace mode on.
Some debug informations are displayed on the standard output.
.TP 10
\f4\-O\fP
Reverses initial Bdd variables order.
.TP 10
\f4\-A\fP
\fBBOOM\fP performs a local optimization and keeps the architecture of the initial description by saving most of the intermediate signals.
This mode is well-suited for big or regular circuits such as multipliers, adders.
By default \fBBOOM\fP performs a global optimization and removes most of the intermediate
signals so that the outputs are expressed in terms of the inputs or the internal registers.
This mode is well-suited for random circuits such as FSMs.
.TP 10
\f4\-P\fP
Uses a parameter file \fBinput_name\fP.boom describing
optimization directives and constraints.
(see below for the exact syntax)
.nf
# Example of .boom file
#
# The list of auxiliary signals that have to be kept
# during optimization.
# Generally carry signals, ram address signals etc ...
#
BEGIN_KEEP
carry[3:0]
ram_address[3:0]
END
#
# The list of auxiliary signals which assigned
# expression won't be modified.
# Generally it's ram output signals.
#
BEGIN_DONT_TOUCH
ram_out[7:0]
END
.fi
.TP 10
\f4\-l num\fP
Specifies the optimization level [0\-3]
(default is 0, low level).
.TP 10
\f4\-d num\fP
Specifies the delay optimization percent
(default is 0% delay, 100% surface).
.TP 10
\f4\-i num\fP
Specifies the number of iterations for the choosen optimization algorithm
(for experts only).
.TP 10
\f4\-a num\fP
Specifies the amplitude during bdd reordering (for experts only).
.TP 10
\f4\-sjbgpwtmorn\fP
Specifies which algorithm has to be used for the boolean optimization.
.SH SEE ALSO
.BR boom (5),
.BR vbe (5),
.BR asimut (1),
.BR boog (1),
.BR MBK_WORK_LIB (1).
.so man1/alc_bug_report.1

View File

@ -0,0 +1,23 @@
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = boom
boom_LDADD = @LIBS@ \
-lAbv -lAbe -lAbt -lBdd -lAbl -lAut -lMut
boom_SOURCES = \
boom_abl.c boom_cost.h boom_main.c boom_procrast.h \
boom_abl.h boom_dc.c boom_main.h boom_random.c \
boom_anneal.c boom_dc.h boom_one.c boom_random.h \
boom_anneal.h boom_debug.c boom_one.h boom_shared.c \
boom_aux.c boom_debug.h boom_optim.c boom_shared.h \
boom_aux.h boom_drive.c boom_optim.h boom_simple.c \
boom_auxinit.c boom_drive.h boom_order.c boom_simple.h \
boom_auxinit.h boom_error.c boom_order.h boom_simul.c \
boom_bdd.c boom_error.h boom_param.c boom_simul.h \
boom_bdd.h boom_gradient.c boom_param.h boom_top.c \
boom_burgun.c boom_gradient.h boom_parse.c boom_top.h \
boom_burgun.h boom_hash.c boom_parse.h boom_window.c \
boom_check.c boom_hash.h boom_post.c boom_window.h \
boom_check.h boom_logic.c boom_post.h \
boom_cost.c boom_logic.h boom_procrast.c

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_abl.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_ABL_H
# define BOOM_ABL_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehBddNode2Abl();
extern chain_list *BoomBddNode2Abl();
extern void BoomBehMapAbl();
extern void BoomBehScanAbl();
extern void BoomBehMapAblWithName();
extern void BoomBehReverseAbl();
extern void BoomBehFlatAbl();
extern void BoomBehSimplifyAbl();
extern void BoomBehUnflatAbl();
# endif

View File

@ -0,0 +1,317 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_anneal.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 08.08.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <math.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_gradient.h"
# include "boom_anneal.h"
#ifndef AUTO_HAS_DRAND48
/* The drand48() function return non-negative double-precision
* floating-point values uniformly distributed between [0.0, 1.0).
*/
#ifndef RAND_MAX
# define RAND_MAX (unsigned long)( (1L<<31) - 1)
# endif
#define drand48() ((double) rand() / (double) (RAND_MAX + 1.0))
#endif
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomDupBddOrder |
| |
\------------------------------------------------------------*/
static chain_list *BoomDupBddOrder( BddOrder )
chain_list *BddOrder;
{
chain_list *DupBddOrder;
chain_list *ScanChain;
chain_list *DupChain;
chain_list **PrevBddOrder;
DupBddOrder = (chain_list *)0;
PrevBddOrder = &DupBddOrder;
for ( ScanChain = BddOrder;
ScanChain != (chain_list *)0;
ScanChain = ScanChain->NEXT )
{
DupChain = addchain( (chain_list *)0, ScanChain->DATA );
*PrevBddOrder = DupChain;
PrevBddOrder = &DupChain->NEXT;
}
return( DupBddOrder );
}
/*------------------------------------------------------------\
| |
| BoomBehOptimizeAnneal |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeAnneal( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
boombefiginfo *FigInfo;
long Cost;
double Proba;
double MaxProba;
long NewCost;
long BestCost;
long Iteration;
long Amplitude;
long MaxIteration;
long MaxAmplitude;
chain_list *AnnealOrder;
chain_list *NewOrder;
chain_list *BestOrder;
int Level;
FigInfo = GetBoomBehFigInfo( BehFigure );
MaxIteration = FigInfo->ITERATION;
MaxAmplitude = FigInfo->AMPLITUDE;
Level = FigInfo->OPTIM_LEVEL;
if ( MaxIteration <= 0 ) MaxIteration = 100;
/*
if ( MaxAmplitude <= 0 ) MaxAmplitude = 1 + (BddLocalSystem->NUMBER_VAR / 8);
*/
/*
if ( MaxAmplitude <= 0 ) MaxAmplitude = 1 + (BddLocalSystem->NUMBER_VAR / 2);
*/
if ( MaxAmplitude <= 0 ) MaxAmplitude = 5;
MaxIteration = MaxIteration * (Level + 1);
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Compute initial cost !\n" );
}
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
/*
AnnealOrder = BoomBehGetBddOrder( BehFigure );
*/
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld\n", Cost );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Compute initial order\n" );
}
if ( Level >= 1 )
{
AnnealOrder = BoomBehGradientBddOrder( BehFigure );
}
else
{
AnnealOrder = BoomBehGetBddOrder( BehFigure );
}
BestCost = Cost;
BestOrder = (chain_list *)0;
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "done\n" );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
for ( Iteration = 0; Iteration < MaxIteration; Iteration++ )
{
Amplitude = MaxAmplitude;
/*
Amplitude = 1 + (long)( (double)MaxAmplitude *
exp( - ( (double)Iteration * 8.0 ) / (double)MaxIteration ) );
*/
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Iteration %ld, Amplitude %ld\n", Iteration, Amplitude );
}
BoomBehRandomBddOrder( BehFigure, Amplitude );
NewOrder = BoomBehGetBddOrder( BehFigure );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
MaxProba = exp( - (double)Iteration / 5.0 );
Proba = drand48();
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Proba : %g %g\n", Proba, MaxProba );
}
if ( NewCost < BestCost )
{
BestCost = NewCost;
freechain( BestOrder );
BestOrder = BoomDupBddOrder( AnnealOrder );
}
if ( ( Proba < MaxProba ) ||
( NewCost < Cost ) )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Accept new solution %ld (gain %ld)\n", NewCost, Cost - NewCost );
}
Cost = NewCost;
freechain( AnnealOrder );
AnnealOrder = NewOrder;
}
else
{
BoomBehRebuildBddNode( BehFigure, AnnealOrder );
freechain( NewOrder );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3ld\b\b\b", ( ( Iteration + 1 ) * 100 ) / MaxIteration );
fflush( stdout );
}
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Anneal cost : %ld\n", Cost );
}
if ( ( BestCost < Cost ) &&
( BestOrder != (chain_list *)0 ) )
{
freechain( AnnealOrder );
AnnealOrder = BestOrder;
BestOrder = (chain_list *)0;
}
else
{
freechain( BestOrder );
BestOrder = (chain_list *)0;
}
BoomBehRebuildBddNode( BehFigure, AnnealOrder );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -0,0 +1,74 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_anneal.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_ANNEAL_H
# define BOOM_ANNEAL_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_ANNEAL_EXPLOSION_LIMIT 10000
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeAnneal();
# endif

View File

@ -0,0 +1,682 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_aux.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_bdd.h"
# include "boom_abl.h"
# include "boom_cost.h"
# include "boom_aux.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static befig_list *BoomBehFigure = (befig_list *)0;
static char *BoomCurrentName = (char *)0;
static long BoomAuxNumber = 0;
static char BoomAuxName[ 128 ];
static authtable *BoomAuxHashTable = (authtable *)0;
static authtable *BoomNotAuxHashTable = (authtable *)0;
static authtable *BoomAuxNameHashTable = (authtable *)0;
static authtable *BoomUselessAuxHashTable = (authtable *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern bddnode *loc_applybddnot();
/*------------------------------------------------------------\
| |
| BoomGetAblDepth |
| |
\------------------------------------------------------------*/
static long BoomGetAblDepth( Expr )
ablexpr *Expr;
{
long NumberOper;
long MaxDepth;
long CarDepth;
if ( ABL_ATOM( Expr ) )
{
return( 0 );
}
/*
if ( ( ABL_ATOM( Expr ) ) ||
( ( ABL_OPER( Expr ) == ABL_NOT ) &&
( ABL_ATOM( ABL_CADR( Expr ) ) ) ) )
{
return( 0 );
}
*/
MaxDepth = 0;
NumberOper = 0;
while ( ( Expr = ABL_CDR( Expr ) ) != (chain_list *)0 )
{
CarDepth = BoomGetAblDepth( ABL_CAR( Expr ) );
if ( CarDepth > MaxDepth ) MaxDepth = CarDepth;
/* NumberOper++; */
}
NumberOper++;
if ( NumberOper > 1 ) NumberOper--;
return( MaxDepth + NumberOper );
}
/*------------------------------------------------------------\
| |
| BoomCheckIfGoodAuxAbl |
| |
\------------------------------------------------------------*/
static int BoomCheckIfGoodAuxAbl( Expr )
ablexpr *Expr;
{
if ( ( ABL_ATOM( Expr ) ) ||
( ( ABL_OPER( Expr ) == ABL_NOT ) &&
( ABL_ATOM( ABL_CADR( Expr ) ) ) ) )
{
return( 0 );
}
return( 1 );
/*
long MaxDepth;
MaxDepth = BoomGetAblDepth( Expr );
return ( MaxDepth >= BOOM_AUX_MIN_DEPTH );
*/
}
/*------------------------------------------------------------\
| |
| BoomCreateAuxAbl |
| |
\------------------------------------------------------------*/
static ablexpr *BoomCreateAuxAbl( Expr )
ablexpr *Expr;
{
bddnode *BddNode;
bddnode *BddNot;
chain_list *ScanExpr;
authelem *Element;
char *Name;
long Polar;
if ( ! ABL_ATOM( Expr ) )
{
ScanExpr = Expr;
while ( ( ScanExpr = ABL_CDR( ScanExpr ) ) != (chain_list *)0 )
{
ABL_CAR( ScanExpr ) = BoomCreateAuxAbl( ABL_CAR( ScanExpr ) );
}
BddNode = BoomGetBddMarkAbl( Expr );
if ( BddNode == NULL )
{
return( Expr );
}
BddNot = decbddrefext( loc_applybddnot( BddNode ) );
if ( IsBoomDebugLevel2() )
{
viewablexprln( ScanExpr, ABL_VIEW_VHDL );
fprintf( stdout, "BddNode->MARK %d\n", BddNode->MARK );
fprintf( stdout, "BddNot->MARK %d\n", BddNot->MARK );
}
Polar = 1;
Element = searchauthelem( BoomAuxHashTable, (char *)BddNode );
if ( Element == (authelem *)0 )
{
Element = searchauthelem( BoomNotAuxHashTable, (char *)BddNode );
Polar = 0;
}
if ( Element == (authelem *)0 )
{
if ( ( (BddNode->MARK + BddNot->MARK ) < 2 ) ||
( ! BoomCheckIfGoodAuxAbl( Expr ) ) )
{
return( Expr );
}
sprintf( BoomAuxName, "aux%ld", BoomAuxNumber++ );
Name = namealloc( BoomAuxName );
if ( BddNot->MARK < BddNode->MARK )
{
addauthelem( BoomAuxHashTable , (char *)BddNode, (long)Name );
addauthelem( BoomNotAuxHashTable, (char *)BddNot , (long)Name );
}
else
{
addauthelem( BoomAuxHashTable , (char *)BddNot , (long)Name );
addauthelem( BoomNotAuxHashTable, (char *)BddNode, (long)Name );
BoomUnmarkBddNode( Expr );
Expr = createablnotexpr( Expr );
}
BoomBehFigure->BEAUX = beh_addbeaux( BoomBehFigure->BEAUX, Name, Expr, (void *)0 );
BoomAddBehAuxInfo( BoomBehFigure->BEAUX );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Add auxiliary signal %s P %d N %d\n",
Name, BddNode->MARK, BddNot->MARK );
viewablexprln( Expr, ABL_VIEW_VHDL );
}
if ( BddNot->MARK < BddNode->MARK )
{
Expr = createablatom( Name );
}
else
{
Expr = createablnotexpr( createablatom( Name ) );
}
}
else
{
Name = (char *)Element->VALUE;
if ( Name != BoomCurrentName )
{
/* BIG BUG !! */
Element = searchauthelem( BoomAuxNameHashTable, Name );
if ( Element == (authelem *)0 )
{
BoomUnmarkBddNode( Expr );
freeablexpr( Expr );
Expr = createablatom( Name );
if ( ! Polar ) Expr = createablnotexpr( Expr );
}
}
return( Expr );
}
}
return( Expr );
}
/*------------------------------------------------------------\
| |
| BoomCreateAuxAblWithName |
| |
\------------------------------------------------------------*/
static ablexpr *BoomCreateAuxAblWithName( Name, Expr )
char *Name;
ablexpr *Expr;
{
BoomCurrentName = Name;
Expr = BoomCreateAuxAbl( Expr );
return ( Expr );
}
/*------------------------------------------------------------\
| |
| BoomBehInitializeAux |
| |
\------------------------------------------------------------*/
void BoomBehInitializeAux( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
bddnode *BddNode;
bddnode *BddNot;
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
if ( IsBoomBehAuxDontTouch( BehAux ) ) continue;
BddNode = BehAux->NODE;
BddNot = decbddrefext( loc_applybddnot( BddNode ) );
addauthelem( BoomAuxHashTable , (char *)BddNode, (long)BehAux->NAME );
addauthelem( BoomNotAuxHashTable , (char *)BddNot , (long)BehAux->NAME );
addauthelem( BoomAuxNameHashTable, BehAux->NAME , 0 );
}
}
/*------------------------------------------------------------\
| |
| BoomCountAuxOccurAbl |
| |
\------------------------------------------------------------*/
static void BoomCountAuxOccurAbl( Expr )
ablexpr *Expr;
{
ablexpr *ScanExpr;
authelem *Element;
char *Value;
if ( ABL_ATOM( Expr ) )
{
Value = ABL_ATOM_VALUE( Expr );
Element = searchauthelem( BoomUselessAuxHashTable, Value );
if ( Element != (authelem *)0 )
{
Element->VALUE++;
}
}
else
{
ScanExpr = Expr;
while ( ( ScanExpr = ABL_CDR( ScanExpr ) ) != (chain_list *)0 )
{
BoomCountAuxOccurAbl( ABL_CAR( ScanExpr ) );
}
}
}
/*------------------------------------------------------------\
| |
| BoomReplaceUselessAuxAbl |
| |
\------------------------------------------------------------*/
static ablexpr *BoomReplaceUselessAuxAbl( Expr )
ablexpr *Expr;
{
ablexpr *ScanExpr;
authelem *Element;
char *Value;
if ( ABL_ATOM( Expr ) )
{
Value = ABL_ATOM_VALUE( Expr );
Element = searchauthelem( BoomUselessAuxHashTable, Value );
if ( Element != (authelem *)0 )
{
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Replace %s by ", Value );
viewablexprln( (ablexpr *)Element->VALUE, ABL_VIEW_VHDL );
}
freeablexpr( Expr );
Expr = BoomReplaceUselessAuxAbl( dupablexpr( (ablexpr *)Element->VALUE ) );
if ( IsBoomDebugLevel1() )
{
viewablexprln( Expr, ABL_VIEW_VHDL );
}
}
}
else
{
ScanExpr = Expr;
while ( ( ScanExpr = ABL_CDR( ScanExpr ) ) != (chain_list *)0 )
{
ABL_CAR( ScanExpr ) = BoomReplaceUselessAuxAbl( ABL_CAR( ScanExpr ) );
}
}
return( Expr );
}
/*------------------------------------------------------------\
| |
| BoomBehDeleteUselessAux |
| |
\------------------------------------------------------------*/
void BoomBehDeleteUselessAux( BehFigure, InitialAux, RemoveBerin )
befig_list *BehFigure;
beaux_list *InitialAux;
{
boombeauxinfo *AuxInfo;
beaux_list *BehAux;
beaux_list *DelBehAux;
beaux_list *HeadBehAux;
beaux_list **PrevBehAux;
authelem *Element;
if ( BoomUselessAuxHashTable == (authtable *)0 )
{
BoomUselessAuxHashTable = createauthtable( 10000 );
}
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
if ( BehAux == InitialAux ) break;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Add '%s'\n", BehAux->NAME );
}
addauthelem( BoomUselessAuxHashTable, BehAux->NAME, 0 );
}
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Count Occurences\n" );
}
BoomBehScanAbl( BehFigure, BoomCountAuxOccurAbl, 0 );
BoomBehGiveCost( BehFigure );
HeadBehAux = (beaux_list *)0;
PrevBehAux = &BehFigure->BEAUX;
BehAux = BehFigure->BEAUX;
while ( BehAux != (beaux_list *)0 )
{
if ( BehAux == InitialAux ) break;
AuxInfo = GetBoomBehAuxInfo( BehAux );
Element = searchauthelem( BoomUselessAuxHashTable, BehAux->NAME );
if ( ( ! IsBoomBehAuxKeep( BehAux ) ) &&
( ( Element->VALUE <= 1 ) ||
( AuxInfo->LITERAL_COST <= 1 ) ||
( ( AuxInfo->LITERAL_COST < BOOM_AUX_MIN_LITERAL_COST ) &&
( Element->VALUE < BOOM_AUX_MIN_OCCUR ) ) ) )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Should delete %s %ld %ld\n",
BehAux->NAME, Element->VALUE, AuxInfo->LITERAL_COST );
}
Element->VALUE = (long)BehAux->ABL;
DelBehAux = BehAux;
BehAux = BehAux->NEXT;
*PrevBehAux = BehAux;
DelBehAux->NEXT = HeadBehAux;
HeadBehAux = DelBehAux;
if ( RemoveBerin )
{
BehFigure->BERIN = beh_rmvberin( BehFigure->BERIN, DelBehAux->NAME );
}
}
else
{
delauthelem( BoomUselessAuxHashTable, BehAux->NAME );
PrevBehAux = &BehAux->NEXT;
BehAux = BehAux->NEXT;
}
}
BoomBehMapAbl( BehFigure, BoomReplaceUselessAuxAbl, 1 );
BoomBehFreeBehAux( HeadBehAux );
resetauthtable( BoomUselessAuxHashTable );
}
/*------------------------------------------------------------\
| |
| BoomBehCreateAux |
| |
\------------------------------------------------------------*/
void BoomBehCreateAux( BehFigure )
befig_list *BehFigure;
{
beaux_list *InitialAux;
bddcircuit *BddCircuit;
bddsystem *BddSystem;
long Reverse;
BddCircuit = BehFigure->CIRCUI;
BddSystem = BddCircuit->BDD_SYSTEM;
setbddlocalcircuit( BddCircuit );
setbddlocalsystem( BddSystem );
BoomBehFigure = BehFigure;
# ifdef DEBUG
fprintf( stdout, "Before BoomBehMakeBddNode\n" );
testbddcircuit( (bddcircuit *)0 );
# endif
InitialAux = BehFigure->BEAUX;
BoomAuxNumber = 0;
if ( BoomAuxHashTable == (authtable *)0 )
{
BoomAuxHashTable = createauthtable( 1000 );
BoomNotAuxHashTable = createauthtable( 1000 );
BoomAuxNameHashTable = createauthtable( 1000 );
}
for ( Reverse = 0; Reverse < 4; Reverse++ )
{
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "BoomBehCreateAux Reverse %ld\n", Reverse );
}
if ( Reverse != 0 )
{
BoomBehReverseAbl( BehFigure );
}
/*
garbagebddsystem( (bddsystem *)0 );
fprintf( stdout, "Before %ld ", BddLocalSystem->NUMBER_NODE );
*/
BoomBehUnflatAbl( BehFigure );
BoomBehMakeBddNode( BehFigure, 1 );
BoomBehInitializeAux( BehFigure );
BoomBehMapAblWithName( BehFigure, BoomCreateAuxAblWithName );
BoomBehUnmarkBddNode( BehFigure );
/*
garbagebddsystem( (bddsystem *)0 );
fprintf( stdout, "After %ld\n", BddLocalSystem->NUMBER_NODE );
*/
resetauthtable( BoomAuxHashTable );
resetauthtable( BoomNotAuxHashTable );
resetauthtable( BoomAuxNameHashTable );
BoomBehFlatAbl( BehFigure );
BoomBehSimplifyAbl( BehFigure );
/*
BoomBehDeleteUselessAux( BehFigure, InitialAux, 0 );
*/
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Reverse %ld Aux %ld\n", Reverse, BoomAuxNumber );
}
}
/*
for ( BoomAuxMinDepth = 15; BoomAuxMinDepth >= 2; BoomAuxMinDepth-- )
BoomAuxMinDepth = 2;
{
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Check Depth %ld\n", BoomAuxMinDepth );
}
}
*/
# ifdef DEBUG
fprintf( stdout, "After BoomCreateAuxAbl\n" );
testbddcircuit( (bddcircuit *)0 );
# endif
# ifdef DEBUG
fprintf( stdout, "After UnmarkAbl\n" );
testbddcircuit( (bddcircuit *)0 );
BoomBehResetBddNode( BehFigure );
# endif
}
/*------------------------------------------------------------\
| |
| BoomBehComputeAux |
| |
\------------------------------------------------------------*/
beaux_list *BoomBehComputeAux( BehFigure, BehAux )
befig_list *BehFigure;
beaux_list *BehAux;
{
beaux_list *ScanAux;
beaux_list **PrevAux;
PrevAux = &BehFigure->BEAUX;
for ( ScanAux = BehFigure->BEAUX;
ScanAux != (beaux_list *)0;
ScanAux = ScanAux->NEXT )
{
if ( ScanAux == BehAux )
{
*PrevAux = (beaux_list *)0; break;
}
PrevAux = &ScanAux->NEXT;
}
BoomBehFreeBehAux( BehFigure->BEAUX );
BehFigure->BEAUX = ScanAux;
BehAux = ScanAux;
BoomBehBddNode2Abl( BehFigure );
if ( IsBoomDebugLevel2() )
{
BoomDebugSaveBehFigure( BehFigure, NULL );
}
BoomBehCreateAux( BehFigure );
if ( IsBoomDebugLevel2() )
{
BoomDebugSaveBehFigure( BehFigure, NULL );
}
return( BehAux );
}

View File

@ -0,0 +1,78 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_aux.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_AUX_H
# define BOOM_AUX_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_AUX_MIN_DEPTH 2
# define BOOM_AUX_MIN_OCCUR 2
# define BOOM_AUX_MIN_LITERAL_COST 2
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehCreateAux();
extern beaux_list *BoomBehComputeAux();
extern void BoomBehDeleteUselessAux();
# endif

View File

@ -0,0 +1,352 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_auxinit.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_abl.h"
# include "boom_cost.h"
# include "boom_aux.h"
# include "boom_auxinit.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static befig_list *BoomBehFigure = (befig_list *)0;
static boombefiginfo *BoomFigInfo = (boombefiginfo *)0;
static authtable *BoomHashAux = (authtable *)0;
static long BoomAuxNumber = 0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomGetNumberAtomicXorAbl |
| |
\------------------------------------------------------------*/
static long BoomGetNumberAtomicXorAbl( Expr )
ablexpr *Expr;
{
ablexpr *ScanExpr;
long Oper;
long Count;
if ( ABL_ATOM( Expr ) )
{
return( 0 );
}
else
{
Oper = ABL_OPER( Expr );
Count = 0;
if ( ( Oper == ABL_XOR ) ||
( Oper == ABL_NXOR ) )
{
Count = 1;
ScanExpr = Expr;
while ( ( ScanExpr = ABL_CDR( ScanExpr ) ) != (ablexpr *)0 )
{
if ( ! ABL_ATOM( ABL_CAR( ScanExpr ) ) )
{
Count = 0; break;
}
}
}
while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 )
{
Count += BoomGetNumberAtomicXorAbl( ABL_CAR( Expr ) );
}
}
return( Count );
}
/*------------------------------------------------------------\
| |
| BoomGetNewAuxInitName |
| |
\------------------------------------------------------------*/
static char *BoomGetNewAuxInitName()
{
authelem *Element;
char *Name;
char Buffer[ 32 ];
do
{
sprintf( Buffer, "boom_init_%ld", BoomAuxNumber++ );
Name = namealloc( Buffer );
Element = searchauthelem( BoomHashAux, Name );
}
while ( Element != (authelem *)0 );
return( Name );
}
/*------------------------------------------------------------\
| |
| BoomCreateAuxInitComparatorAbl |
| |
\------------------------------------------------------------*/
static ablexpr *BoomCreateAuxInitComparatorAbl( Expr )
ablexpr *Expr;
{
ablexpr *ScanExpr;
long Oper;
ablexpr *Operand1;
ablexpr *Operand2;
ablexpr *AuxExpr;
char *AuxName;
if ( ! ABL_ATOM( Expr ) )
{
Oper = ABL_OPER( Expr );
if ( ( Oper == ABL_XOR ) ||
( Oper == ABL_NXOR ) )
{
ScanExpr = Expr;
while ( ( ScanExpr = ABL_CDR( ScanExpr ) ) != (ablexpr *)0 )
{
if ( ! ABL_ATOM( ABL_CAR( ScanExpr ) ) ) break;
}
if ( ScanExpr == (ablexpr *)0 )
{
/*
** Create auxiliary variables for each xor couple
*/
ScanExpr = Expr;
Operand1 = (ablexpr *)0;
while ( ( ScanExpr = ABL_CDR( ScanExpr ) ) != (ablexpr *)0 )
{
if ( Operand1 == (ablexpr *)0 )
{
Operand1 = ABL_CAR( ScanExpr );
ABL_CAR( ScanExpr ) = (ablexpr *)0;
continue;
}
Operand2 = ABL_CAR( ScanExpr );
ABL_CAR( ScanExpr ) = (ablexpr *)0;
AuxExpr = createablbinexpr( ABL_XOR, Operand1, Operand2 );
AuxName = BoomGetNewAuxInitName();
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Found a comparator, add aux init %s\n", AuxName );
}
BoomBehFigure->BEAUX = beh_addbeaux( BoomBehFigure->BEAUX, AuxName, AuxExpr, (void *)0 );
BoomBehFigure->BERIN = beh_addberin( BoomBehFigure->BERIN, AuxName );
BoomAddBehAuxInfo( BoomBehFigure->BEAUX );
SetBoomBehAuxKeep( BoomBehFigure->BEAUX );
Operand1 = createablatom( AuxName );
}
freeablexpr( Expr );
Expr = Operand1;
if ( Oper == ABL_NXOR ) Expr = optimablnotexpr( Expr );
return( Expr );
}
}
ScanExpr = Expr;
while ( ( ScanExpr = ABL_CDR( ScanExpr ) ) != (ablexpr *)0 )
{
ABL_CAR( ScanExpr ) = BoomCreateAuxInitComparatorAbl( ABL_CAR( ScanExpr ) );
}
}
return( Expr );
}
/*------------------------------------------------------------\
| |
| BoomIdentifiyComparatorAbl |
| |
\------------------------------------------------------------*/
static ablexpr *BoomIdentifiyComparatorAbl( Expr )
ablexpr *Expr;
{
long Number;
Number = BoomGetNumberAtomicXorAbl( Expr );
if ( Number > BOOM_AUX_INIT_MAX_XOR )
{
Expr = BoomCreateAuxInitComparatorAbl( Expr );
}
return( Expr );
}
/*------------------------------------------------------------\
| |
| BoomKeepStableAuxAbl |
| |
\------------------------------------------------------------*/
static void BoomKeepStableAuxAbl( Expr )
ablexpr *Expr;
{
authelem *Element;
char *Value;
beaux_list *BehAux;
long Oper;
if ( ABL_ATOM( Expr ) ) return;
Oper = ABL_OPER( Expr );
if ( Oper == ABL_STABLE )
{
Expr = ABL_CADR( Expr );
if ( ABL_ATOM( Expr ) )
{
Value = ABL_ATOM_VALUE( Expr );
Element = searchauthelem( BoomHashAux, Value );
if ( Element != (authelem *)0 )
{
BehAux = (beaux_list *)Element->VALUE;
SetBoomBehAuxKeep( BehAux );
}
}
}
else
{
while ( ( Expr = ABL_CDR( Expr ) ) != (chain_list *)0 )
{
BoomKeepStableAuxAbl( ABL_CAR( Expr ) );
}
}
}
/*------------------------------------------------------------\
| |
| BoomBehCreateAuxInit |
| |
\------------------------------------------------------------*/
void BoomBehCreateAuxInit( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
BoomBehFigure = BehFigure;
BoomFigInfo = GetBoomBehFigInfo( BehFigure );
BoomHashAux = createauthtable( 100 );
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
addauthelem( BoomHashAux, BehAux->NAME, (long)BehAux );
if ( BoomFigInfo->KEEP_AUX )
{
SetBoomBehAuxKeep( BehAux );
}
}
BoomBehScanAbl( BehFigure, BoomKeepStableAuxAbl, 1 );
BoomBehDeleteUselessAux( BehFigure, (beaux_list *)0, 1 );
BoomBehMapAbl( BehFigure, simpablexpr, 1 );
BoomBehMapAbl( BehFigure, BoomIdentifiyComparatorAbl, 0 );
destroyauthtable( BoomHashAux );
}

View File

@ -0,0 +1,74 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_auxinit.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_AUX_INIT_H
# define BOOM_AUX_INIT_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_AUX_INIT_MAX_XOR 5
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehCreateAuxInit();
# endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,109 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_bdd.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_BDD_H
# define BOOM_BDD_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_BDD_NODE_BIG_SIZE 8
# define BOOM_BDD_EXPLOSION_LIMIT 200000
# define BOOM_BDD_SWAP_LIMIT 10000
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*
# define BoomSetBddMarkAbl( E, N ) \
\
do { ABL_CDR( ABL_CAR( E ) ) = (chain_list *)(N); \
if ( (N)->MARK == 0 ) (N)->MARK = 1; \
else (N)->MARK = 2; \
incbddrefext( (N) ); \
} while (0)
*/
# define BoomSetBddMarkAbl( E, N ) \
\
do { ABL_CDR( ABL_CAR( E ) ) = (chain_list *)(N); \
if ( (N)->MARK == 0 ) incbddrefext( (N) ); \
(N)->MARK++; \
} while (0)
# define BoomGetBddMarkAbl( E ) \
\
( (bddnode *)( ABL_CDR( ABL_CAR( E ) ) ) )
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varibddes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehAbl2BddNode();
extern void BoomBehMakeBddNode();
extern void BoomBehResetBddNode();
extern void BoomBehUnmarkBddNode();
extern void BoomBehScanBdd();
extern void BoomBehMapBdd();
extern long BoomBehGetNumberBigBddNode();
extern chain_list *BoomUnmarkBddNode();
extern chain_list *BoomBehGetBddOrder();
extern void BoomBehRandomBddOrder();
extern void BoomBehRebuildBddNode();
# endif

View File

@ -0,0 +1,442 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_burgun.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 08.08.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_burgun.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static bddnode *BoomBddTopVarNode = (bddnode *)0;
static long BoomCurrentVar = (long )0;
static long BoomBurgunVar = (long )0;
static long BoomCurrentCost = 0;
static int BoomExplosionFlag = 0;
static char *BoomIndexArray = (char *)0;
static long BoomIndexArraySize = 0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBurgunTopBurgunVar |
| |
\------------------------------------------------------------*/
static bddnode *BoomBurgunTopBurgunVar( BddNode )
bddnode *BddNode;
{
bddnode *NewBddNode;
NewBddNode = composebddnode( BddLocalSystem, BddNode,
BoomBurgunVar , BoomBddTopVarNode );
return( NewBddNode );
}
/*------------------------------------------------------------\
| |
| BoomBurgunTopBddNode |
| |
\------------------------------------------------------------*/
static void BoomBurgunTopBddNode( BddNode )
bddnode *BddNode;
{
bddnode *NewBddNode;
long Number;
if ( ! BoomExplosionFlag )
{
Number = getbddnodenum( (bddsystem *)0, BddNode );
if ( Number < BOOM_BDD_NODE_BIG_SIZE ) return;
NewBddNode = composebddnode( BddLocalSystem, BddNode,
BoomCurrentVar, BoomBddTopVarNode );
if ( IsBddSystemExplosion( BddLocalSystem ) )
{
BoomPrintf( stdout, "Explosion !!! %ld\n", BddLocalSystem->NUMBER_NODE );
garbagebddsystem( BddLocalSystem );
explosionbddsystemrestart( BddLocalSystem );
BoomExplosionFlag = 1;
}
else
{
BoomCurrentCost += getbddnodenum( (bddsystem *)0, NewBddNode );
/*
Number = getbddnodenum( (bddsystem *)0, NewBddNode );
if ( Number >= BOOM_BDD_NODE_BIG_SIZE ) BoomCurrentCost += Number;
*/
decbddrefext( NewBddNode );
}
}
}
/*------------------------------------------------------------\
| |
| BoomBehBurgunBddOrder |
| |
\------------------------------------------------------------*/
chain_list *BoomBehBurgunBddOrder( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
chain_list *OrderList;
long NumberIndex;
long NumberVar;
long VarIndex;
long TopVar;
long FirstVar;
long LastVar;
long ExplosionLimit;
long MaxNode;
long BurgunCost;
char *Name;
char Buffer[ 32 ];
FigInfo = GetBoomBehFigInfo( BehFigure );
NumberIndex = BddLocalSystem->NUMBER_INDEX;
NumberVar = BddLocalSystem->NUMBER_VAR;
if ( BoomIndexArray == (char *)0 )
{
BoomIndexArray = (char *)autallocblock( sizeof( char ) * NumberIndex );
BoomIndexArraySize = NumberIndex;
}
else
if ( NumberIndex > BoomIndexArraySize )
{
BoomIndexArray = (char *)autresizeblock( (char *)BoomIndexArray,
sizeof( long ) * BoomIndexArraySize,
sizeof( long ) * NumberIndex );
BoomIndexArraySize = NumberIndex;
}
memset( BoomIndexArray, 0, BoomIndexArraySize );
OrderList = (chain_list *)0;
for ( TopVar = 0; TopVar < NumberVar; TopVar++ )
{
VarIndex = getbddvarindex( BddLocalSystem, TopVar );
sprintf( Buffer, "_top_%ld", TopVar );
BoomBddTopVarNode = addbddcircuitin( BddLocalCircuit, Buffer,
VarIndex, BDD_IN_MODE_BEFORE );
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "TopVar %ld %s\n", TopVar, Buffer );
}
MaxNode = BddLocalSystem->NUMBER_NODE * 2;
FirstVar = TopVar + 1;
LastVar = TopVar + NumberVar;
BoomBurgunVar = -1;
BurgunCost = 0;
for ( BoomCurrentVar = FirstVar; BoomCurrentVar <= LastVar; BoomCurrentVar++ )
{
VarIndex = getbddvarindex( (bddsystem *)0, BoomCurrentVar );
if ( BoomIndexArray[ VarIndex ] != 0 ) continue;
if ( BddLocalSystem->NUMBER_NODE >= MaxNode )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Sweep !\n" );
}
sweepbddvar( BddLocalSystem, TopVar, 1 );
if ( BddLocalSystem->NUMBER_NODE >= MaxNode )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Garbage !\n" );
}
garbagebddsystem( BddLocalSystem );
MaxNode = BddLocalSystem->NUMBER_NODE * 4;
}
}
ExplosionLimit = BddLocalSystem->NUMBER_NODE * 2;
if ( ExplosionLimit < BOOM_BURGUN_EXPLOSION_LIMIT )
{
ExplosionLimit = BOOM_BURGUN_EXPLOSION_LIMIT;
}
BoomExplosionFlag = 0;
explosionbddsystemdynamic( (bddsystem *)0, NULL, ExplosionLimit );
BoomCurrentCost = 0;
BoomBehScanBdd( BehFigure, BoomBurgunTopBddNode );
if ( ! BoomExplosionFlag )
{
if ( ( BoomBurgunVar == -1 ) ||
( BoomCurrentCost < BurgunCost ) )
{
BoomBurgunVar = BoomCurrentVar;
BurgunCost = BoomCurrentCost;
}
}
else
{
BoomExplosionFlag = 0;
}
if ( IsBoomDebugLevel1() )
{
Name = getbddcircuitinname( (bddcircuit *)0, VarIndex );
BoomPrintf( stdout, "%ld %ld %s\n", BoomCurrentVar, BoomCurrentCost, Name );
}
}
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "BurgunCost %ld BoomBurgunVar %ld\n", BurgunCost, BoomBurgunVar );
}
explosionbddsystemdynamic( (bddsystem *)0, NULL, 0 );
VarIndex = getbddvarindex( (bddsystem *)0, BoomBurgunVar );
Name = getbddcircuitinname( (bddcircuit *)0, VarIndex );
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Var %s\n", Name );
}
OrderList = addchain( OrderList, (void *)Name );
BoomIndexArray[ VarIndex ] = 1;
BoomBehMapBdd( BehFigure, BoomBurgunTopBurgunVar );
}
OrderList = reverse( OrderList );
BoomBehRebuildBddNode( BehFigure, OrderList );
return( OrderList );
}
/*------------------------------------------------------------\
| |
| BoomBehOptimizeBurgun |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeBurgun( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
boombefiginfo *FigInfo;
long Cost;
long NewCost;
long Iteration;
long Amplitude;
long MaxIteration;
long MaxAmplitude;
chain_list *BurgunOrder;
chain_list *NewOrder;
int Level;
FigInfo = GetBoomBehFigInfo( BehFigure );
MaxIteration = FigInfo->ITERATION;
MaxAmplitude = FigInfo->AMPLITUDE;
Level = FigInfo->OPTIM_LEVEL;
if ( MaxIteration <= 0 ) MaxIteration = 2;
if ( MaxAmplitude <= 0 ) MaxAmplitude = 5;
MaxIteration = MaxIteration * (Level + 1);
MaxAmplitude = MaxAmplitude + Level;
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
BurgunOrder = BoomBehGetBddOrder( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld\n", Cost );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
for ( Iteration = 0; Iteration < MaxIteration; Iteration++ )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Iteration %ld\n", Iteration );
}
Amplitude = MaxAmplitude + 1;
do
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Amplitude %ld\n", Amplitude );
}
if ( Amplitude <= MaxAmplitude )
{
BoomBehRandomBddOrder( BehFigure, Amplitude );
}
NewOrder = BoomBehBurgunBddOrder( BehFigure );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
freechain( BurgunOrder );
BurgunOrder = NewOrder;
}
else
{
freechain( NewOrder );
}
Amplitude--;
}
while ( Amplitude >= 0 );
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3ld\b\b\b", ( ( Iteration + 1 ) * 100 ) / MaxIteration );
fflush( stdout );
}
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Burgun cost : %ld\n", Cost );
}
BoomBehRebuildBddNode( BehFigure, BurgunOrder );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -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 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 : BOOM |
| |
| File : boom_burgun.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_BURGUN_H
# define BOOM_BURGUN_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_BURGUN_EXPLOSION_LIMIT 10000
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeBurgun();
extern chain_list *BoomBehBurgunBddOrder();
# endif

View File

@ -0,0 +1,132 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_check.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_check.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_abl.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static int BoomFoundDontCare = 0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomCheckBehAblDontCare |
| |
\------------------------------------------------------------*/
static void BoomCheckBehAblDontCare( Expr )
ablexpr *Expr;
{
if ( Expr != (ablexpr *)0 )
{
if ( ! BoomFoundDontCare )
{
BoomFoundDontCare = isablnameinexpr( Expr, ABL_ATOM_NAME_DC );
}
}
}
/*------------------------------------------------------------\
| |
| BoomCheckBehFigure |
| |
\------------------------------------------------------------*/
void BoomCheckBehFigure( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
FigInfo = GetBoomBehFigInfo( BehFigure );
BoomFoundDontCare = 0;
BoomBehScanAbl( BehFigure, BoomCheckBehAblDontCare, 1 ) ;
FigInfo->DONT_CARE = BoomFoundDontCare;
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Dont care %d\n", BoomFoundDontCare );
}
/* Check combinatory loop etc ... */
/* TO BE DONE */
}

View File

@ -0,0 +1,71 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_check.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_CHECK_H
# define BOOM_CHECK_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomCheckBehFigure();
# endif

View File

@ -0,0 +1,848 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_cost.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_cost.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static long BoomOperSurfaceCost[ ABL_MAX_OPERATOR ][ 3 ] =
{
{ 1250, 1500, 1750 }, /* ABL_OR */
{ 1250, 1500, 1750 }, /* ABL_AND */
{ 2250, 4500, 6750 }, /* ABL_XOR */
{ 750, 0, 0 }, /* ABL_NOT */
{ 1000, 1250, 1500 }, /* ABL_NOR */
{ 1000, 1250, 1500 }, /* ABL_NAND */
{ 2250, 4500, 6750 }, /* ABL_NXOR */
{ 0, 0, 0 } /* ABL_STABLE */
};
static int BoomFlagDepth = 0;
static int BoomFlagSurface = 0;
static authtable *BoomHashAux = (authtable *)0;
static authtable *BoomHashBux = (authtable *)0;
static authtable *BoomHashBus = (authtable *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomGiveAblSurfaceCost |
| |
\------------------------------------------------------------*/
static long LocalBoomGiveAblSurfaceCost( Expr )
ablexpr *Expr;
{
long Oper;
long Cost;
long NumOper;
long NextStep;
if ( ABL_ATOM( Expr ) )
{
return( 0 );
}
Oper = ABL_OPER( Expr );
Cost = 0;
NumOper = 0;
while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 )
{
Cost += LocalBoomGiveAblSurfaceCost( ABL_CAR( Expr ) );
NumOper++;
}
while ( NumOper )
{
NextStep = NumOper / 4;
if ( NextStep )
{
Cost += NextStep * BoomOperSurfaceCost[ Oper ][ BOOM_OPER_ARITY_4 ];
}
NumOper %= 4;
if ( NumOper == 3 )
{
if ( NextStep >= 1 ) NextStep += 3;
else Cost += BoomOperSurfaceCost[ Oper ][ BOOM_OPER_ARITY_3 ];
}
else
if ( NumOper == 2 )
{
if ( ( NextStep <= 2 ) &&
( NextStep != 0 ) )
{
NextStep += 2;
}
else
{
Cost += BoomOperSurfaceCost[ Oper ][ BOOM_OPER_ARITY_2 ];
}
}
else
if ( NumOper == 1 )
{
if ( Oper == ABL_NOT )
{
Cost += BoomOperSurfaceCost[ Oper ][ BOOM_OPER_ARITY_1 ];
}
else
if ( NextStep != 0 ) NextStep++;
}
NumOper = NextStep;
NextStep = 0;
}
return( Cost );
}
static long BoomGiveAblSurfaceCost( Expr )
ablexpr *Expr;
{
long Cost;
if ( ! BoomFlagSurface )
{
return( 0 );
}
Cost = LocalBoomGiveAblSurfaceCost( Expr );
if ( IsBoomDebugLevel2() )
{
fprintf( stdout, "BoomGiveAblSurfaceCost\n" );
viewablexprln( Expr, ABL_VIEW_VHDL );
fprintf( stdout, "%ld\n", Cost );
}
return( Cost );
}
/*------------------------------------------------------------\
| |
| BoomGiveAblLiteralCost |
| |
\------------------------------------------------------------*/
static long LocalBoomGiveAblLiteralCost( Expr )
ablexpr *Expr;
{
long Oper;
long Cost;
if ( ABL_ATOM( Expr ) )
{
return( 1 );
}
Cost = 0;
Oper = ABL_OPER( Expr );
if ( Oper != ABL_STABLE )
{
while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 )
{
Cost += LocalBoomGiveAblLiteralCost( ABL_CAR( Expr ) );
}
}
return( Cost );
}
long BoomGiveAblLiteralCost( Expr )
ablexpr *Expr;
{
long Cost;
if ( ABL_ATOM( Expr ) )
{
Cost = 0;
}
else
{
Cost = LocalBoomGiveAblLiteralCost( Expr );
}
if ( IsBoomDebugLevel2() )
{
fprintf( stdout, "BoomGiveAblLiteralCost\n" );
viewablexprln( Expr, ABL_VIEW_VHDL );
fprintf( stdout, "%ld\n", Cost );
}
return( Cost );
}
/*------------------------------------------------------------\
| |
| BoomGiveAblDepthCost |
| |
\------------------------------------------------------------*/
static long BoomGiveAblDepthCost();
static long LocalBoomGiveAblDepthCost( Expr )
ablexpr *Expr;
{
boombeauxinfo *AuxInfo;
boombebuxinfo *BuxInfo;
boombebusinfo *BusInfo;
bebus_list *BehBus;
bebux_list *BehBux;
beaux_list *BehAux;
char *Value;
authelem *Element;
biabl_list *BiAbl;
long Oper;
long Cost;
long Arity;
long NewCost;
Cost = 0;
if ( ABL_ATOM( Expr ) )
{
Value = ABL_ATOM_VALUE( Expr );
if ( ( Value != ABL_ATOM_NAME_ONE ) &&
( Value != ABL_ATOM_NAME_ZERO ) &&
( Value != ABL_ATOM_NAME_DC ) &&
( Value != ABL_ATOM_NAME_TRISTATE ) )
{
Element = searchauthelem( BoomHashAux, Value );
if ( Element != (authelem *)0 )
{
BehAux = (beaux_list *)Element->VALUE;
AuxInfo = GetBoomBehAuxInfo( BehAux );
if ( ! IsBoomBehAuxTag( BehAux ) )
{
SetBoomBehAuxTag( BehAux );
AuxInfo->DEPTH_COST = BoomGiveAblDepthCost( BehAux->ABL );
}
return( AuxInfo->DEPTH_COST );
}
Element = searchauthelem( BoomHashBus, Value );
if ( Element != (authelem *)0 )
{
BehBus = (bebus_list *)Element->VALUE;
BusInfo = GetBoomBehBusInfo( BehBus );
if ( ! IsBoomBehAuxTag( BehBus ) )
{
SetBoomBehAuxTag( BehBus );
BusInfo->DEPTH_COST = 0;
for ( BiAbl = BehBus->BIABL;
BiAbl != (biabl_list *)0;
BiAbl = BiAbl->NEXT )
{
if ( BiAbl->VALABL != (chain_list *)0 )
{
NewCost = BoomGiveAblDepthCost( BiAbl->VALABL );
if ( NewCost > BusInfo->DEPTH_COST )
{
BusInfo->DEPTH_COST = NewCost;
}
}
if ( BiAbl->CNDABL != (chain_list *)0 )
{
NewCost = BoomGiveAblDepthCost( BiAbl->CNDABL );
if ( NewCost > BusInfo->DEPTH_COST )
{
BusInfo->DEPTH_COST = NewCost;
}
}
}
}
return( BusInfo->DEPTH_COST );
}
Element = searchauthelem( BoomHashBux, Value );
if ( Element != (authelem *)0 )
{
BehBux = (bebux_list *)Element->VALUE;
BuxInfo = GetBoomBehBuxInfo( BehBux );
if ( ! IsBoomBehAuxTag( BehBux ) )
{
BuxInfo->DEPTH_COST = 0;
for ( BiAbl = BehBux->BIABL;
BiAbl != (biabl_list *)0;
BiAbl = BiAbl->NEXT )
{
if ( BiAbl->VALABL != (chain_list *)0 )
{
NewCost = BoomGiveAblDepthCost( BiAbl->VALABL );
if ( NewCost > BuxInfo->DEPTH_COST )
{
BuxInfo->DEPTH_COST = NewCost;
}
}
if ( BiAbl->CNDABL != (chain_list *)0 )
{
NewCost = BoomGiveAblDepthCost( BiAbl->CNDABL );
if ( NewCost > BuxInfo->DEPTH_COST )
{
BuxInfo->DEPTH_COST = NewCost;
}
}
}
SetBoomBehAuxTag( BehBux );
}
return( BuxInfo->DEPTH_COST );
}
}
}
else
{
Oper = ABL_OPER( Expr );
if ( Oper != ABL_STABLE )
{
Arity = 0;
while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 )
{
Arity++;
NewCost = LocalBoomGiveAblDepthCost( ABL_CAR( Expr ) );
if ( NewCost > Cost ) Cost = NewCost;
}
if ( Oper != ABL_NOT )
{
Cost += BoomComputeLog2( Arity );
}
}
}
return( Cost );
}
static long BoomGiveAblDepthCost( Expr )
ablexpr *Expr;
{
long Cost;
if ( ! BoomFlagDepth )
{
return( 0 );
}
Cost = LocalBoomGiveAblDepthCost( Expr );
if ( IsBoomDebugLevel2() )
{
fprintf( stdout, "BoomGiveAblDepthCost\n" );
viewablexprln( Expr, ABL_VIEW_VHDL );
fprintf( stdout, "%ld\n", Cost );
}
return( Cost );
}
/*------------------------------------------------------------\
| |
| BoomBehPrintCost |
| |
\------------------------------------------------------------*/
void BoomBehPrintCost( Text, BehFigure )
char *Text;
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
FigInfo = GetBoomBehFigInfo( BehFigure );
fprintf( stdout, "\t--> %s cost\n", Text );
fprintf( stdout, "\t Surface : %ld\n" , FigInfo->SURFACE_COST );
fprintf( stdout, "\t Depth : %ld\n" , FigInfo->DEPTH_COST );
fprintf( stdout, "\t Literals : %ld\n" , FigInfo->LITERAL_COST );
/*
fprintf( stdout, "\t Delay : %.3f ns\n", FigInfo->DEPTH_COST * 0.200 );
*/
}
/*------------------------------------------------------------\
| |
| BoomBehGiveFullCost |
| |
\------------------------------------------------------------*/
long BoomBehGiveFullCost( BehFigure, Quick )
befig_list *BehFigure;
int Quick;
{
boombefiginfo *FigInfo;
beout_list *BehOut;
beaux_list *BehAux;
bereg_list *BehReg;
bebus_list *BehBus;
bebux_list *BehBux;
biabl_list *BiAbl;
boombeauxinfo *AuxInfo;
boombeoutinfo *OutInfo;
boombereginfo *RegInfo;
boombebusinfo *BusInfo;
boombebuxinfo *BuxInfo;
long LiteralCost;
long SurfaceCost;
long DepthCost;
long GlobalCost;
long NewCost;
long PerCent;
char Buffer[ 32 ];
FigInfo = GetBoomBehFigInfo( BehFigure );
if ( BoomHashAux == (authtable *)0 )
{
BoomHashAux = createauthtable( 100 );
BoomHashBux = createauthtable( 100 );
BoomHashBus = createauthtable( 100 );
}
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
addauthelem( BoomHashAux, BehAux->NAME, (long)BehAux );
}
for ( BehBux = BehFigure->BEBUX;
BehBux != (bebux_list *)0;
BehBux = BehBux->NEXT )
{
addauthelem( BoomHashBux, BehBux->NAME, (long)BehBux );
}
for ( BehBus = BehFigure->BEBUS;
BehBus != (bebus_list *)0;
BehBus = BehBus->NEXT )
{
addauthelem( BoomHashBus, BehBus->NAME, (long)BehBus );
}
LiteralCost = 0;
SurfaceCost = 0;
DepthCost = 0;
BoomFlagDepth = 1;
BoomFlagSurface = 1;
if ( Quick )
{
if ( FigInfo->OPTIM_DELAY_PERCENT == 0 ) BoomFlagDepth = 0;
if ( FigInfo->USE_LITERAL ) BoomFlagSurface = 0;
if ( FigInfo->OPTIM_DELAY_PERCENT == 100 ) BoomFlagSurface = 0;
}
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
AuxInfo = GetBoomBehAuxInfo( BehAux );
AuxInfo->LITERAL_COST = BoomGiveAblLiteralCost( BehAux->ABL );
LiteralCost += AuxInfo->LITERAL_COST;
AuxInfo->SURFACE_COST = BoomGiveAblSurfaceCost( BehAux->ABL );
SurfaceCost += AuxInfo->SURFACE_COST;
if ( ! IsBoomBehAuxTag( BehAux ) )
{
AuxInfo->DEPTH_COST = BoomGiveAblDepthCost( BehAux->ABL );
SetBoomBehAuxTag( BehAux );
}
}
for ( BehOut = BehFigure->BEOUT;
BehOut != (beout_list *)0;
BehOut = BehOut->NEXT )
{
OutInfo = GetBoomBehOutInfo( BehOut );
OutInfo->LITERAL_COST = BoomGiveAblLiteralCost( BehOut->ABL );
LiteralCost += OutInfo->LITERAL_COST;
OutInfo->SURFACE_COST = BoomGiveAblSurfaceCost( BehOut->ABL );
SurfaceCost += OutInfo->SURFACE_COST;
OutInfo->DEPTH_COST = BoomGiveAblDepthCost( BehOut->ABL );
if ( OutInfo->DEPTH_COST > DepthCost )
{
DepthCost = OutInfo->DEPTH_COST;
}
}
for ( BehBus = BehFigure->BEBUS;
BehBus != (bebus_list *)0;
BehBus = BehBus->NEXT )
{
BusInfo = GetBoomBehBusInfo( BehBus );
BusInfo->LITERAL_COST = 0;
BusInfo->SURFACE_COST = 0;
if ( ! IsBoomBehAuxTag( BehBus ) )
{
BusInfo->DEPTH_COST = 0;
}
for ( BiAbl = BehBus->BIABL;
BiAbl != (biabl_list *)0;
BiAbl = BiAbl->NEXT )
{
if ( BiAbl->VALABL != (chain_list *)0 )
{
BusInfo->LITERAL_COST += BoomGiveAblLiteralCost( BiAbl->VALABL );
BusInfo->SURFACE_COST += BoomGiveAblSurfaceCost( BiAbl->VALABL );
if ( ! IsBoomBehAuxTag( BehBus ) )
{
NewCost = BoomGiveAblDepthCost( BiAbl->VALABL );
if ( NewCost > BusInfo->DEPTH_COST )
{
BusInfo->DEPTH_COST = NewCost;
}
}
}
if ( BiAbl->CNDABL != (chain_list *)0 )
{
BusInfo->LITERAL_COST += BoomGiveAblLiteralCost( BiAbl->CNDABL );
BusInfo->SURFACE_COST += BoomGiveAblSurfaceCost( BiAbl->CNDABL );
if ( ! IsBoomBehAuxTag( BehBus ) )
{
NewCost = BoomGiveAblDepthCost( BiAbl->CNDABL );
if ( NewCost > BusInfo->DEPTH_COST )
{
BusInfo->DEPTH_COST = NewCost;
}
}
}
}
SetBoomBehAuxTag( BehBus );
LiteralCost += BusInfo->LITERAL_COST;
SurfaceCost += BusInfo->SURFACE_COST;
if ( BusInfo->DEPTH_COST > DepthCost )
{
DepthCost = BusInfo->DEPTH_COST;
}
}
for ( BehBux = BehFigure->BEBUX;
BehBux != (bebux_list *)0;
BehBux = BehBux->NEXT )
{
BuxInfo = GetBoomBehBuxInfo( BehBux );
BuxInfo->LITERAL_COST = 0;
BuxInfo->SURFACE_COST = 0;
if ( ! IsBoomBehAuxTag( BehBux ) )
{
BuxInfo->DEPTH_COST = 0;
}
for ( BiAbl = BehBux->BIABL;
BiAbl != (biabl_list *)0;
BiAbl = BiAbl->NEXT )
{
if ( BiAbl->VALABL != (chain_list *)0 )
{
BuxInfo->LITERAL_COST += BoomGiveAblLiteralCost( BiAbl->VALABL );
BuxInfo->SURFACE_COST += BoomGiveAblSurfaceCost( BiAbl->VALABL );
if ( ! IsBoomBehAuxTag( BehBux ) )
{
NewCost = BoomGiveAblDepthCost( BiAbl->VALABL );
if ( NewCost > BuxInfo->DEPTH_COST )
{
BuxInfo->DEPTH_COST = NewCost;
}
}
}
if ( BiAbl->CNDABL != (chain_list *)0 )
{
BuxInfo->LITERAL_COST += BoomGiveAblLiteralCost( BiAbl->CNDABL );
BuxInfo->SURFACE_COST += BoomGiveAblSurfaceCost( BiAbl->CNDABL );
if ( ! IsBoomBehAuxTag( BehBux ) )
{
NewCost = BoomGiveAblDepthCost( BiAbl->CNDABL );
if ( NewCost > BuxInfo->DEPTH_COST )
{
BuxInfo->DEPTH_COST = NewCost;
}
}
}
}
SetBoomBehAuxTag( BehBux );
LiteralCost += BuxInfo->LITERAL_COST;
SurfaceCost += BuxInfo->SURFACE_COST;
if ( BuxInfo->DEPTH_COST > DepthCost )
{
DepthCost = BuxInfo->DEPTH_COST;
}
}
for ( BehReg = BehFigure->BEREG;
BehReg != (bereg_list *)0;
BehReg = BehReg->NEXT )
{
RegInfo = GetBoomBehRegInfo( BehReg );
RegInfo->LITERAL_COST = 0;
RegInfo->SURFACE_COST = 0;
RegInfo->DEPTH_COST = 0;
for ( BiAbl = BehReg->BIABL;
BiAbl != (biabl_list *)0;
BiAbl = BiAbl->NEXT )
{
if ( BiAbl->VALABL != (chain_list *)0 )
{
RegInfo->LITERAL_COST += BoomGiveAblLiteralCost( BiAbl->VALABL );
RegInfo->SURFACE_COST += BoomGiveAblSurfaceCost( BiAbl->VALABL );
NewCost = BoomGiveAblDepthCost( BiAbl->VALABL );
if ( NewCost > RegInfo->DEPTH_COST )
{
RegInfo->DEPTH_COST = NewCost;
}
}
if ( BiAbl->CNDABL != (chain_list *)0 )
{
RegInfo->LITERAL_COST += BoomGiveAblLiteralCost( BiAbl->CNDABL );
RegInfo->SURFACE_COST += BoomGiveAblSurfaceCost( BiAbl->CNDABL );
NewCost = BoomGiveAblDepthCost( BiAbl->CNDABL );
if ( NewCost > RegInfo->DEPTH_COST )
{
RegInfo->DEPTH_COST = NewCost;
}
}
}
LiteralCost += RegInfo->LITERAL_COST;
SurfaceCost += RegInfo->SURFACE_COST;
if ( RegInfo->DEPTH_COST > DepthCost )
{
DepthCost = RegInfo->DEPTH_COST;
}
}
resetauthtable( BoomHashAux );
resetauthtable( BoomHashBus );
resetauthtable( BoomHashBux );
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
ClearBoomBehAuxTag( BehAux );
}
for ( BehBux = BehFigure->BEBUX;
BehBux != (bebux_list *)0;
BehBux = BehBux->NEXT )
{
ClearBoomBehAuxTag( BehBux );
}
for ( BehBus = BehFigure->BEBUS;
BehBus != (bebus_list *)0;
BehBus = BehBus->NEXT )
{
ClearBoomBehAuxTag( BehBus );
}
if ( IsBoomDebugLevel1() )
{
if ( FigInfo->USE_LITERAL )
{
sprintf( Buffer, "%ld", LiteralCost );
}
else
{
sprintf( Buffer, "%ld", SurfaceCost );
}
BoomDebugSaveBehFigure( BehFigure, Buffer );
}
FigInfo->LITERAL_COST = LiteralCost;
FigInfo->SURFACE_COST = SurfaceCost;
FigInfo->DEPTH_COST = DepthCost;
if ( FigInfo->INITIAL_DEPTH_COST == 0 )
{
FigInfo->INITIAL_DEPTH_COST = DepthCost + 1;
}
if ( FigInfo->INITIAL_LITERAL_COST == 0 )
{
FigInfo->INITIAL_LITERAL_COST = LiteralCost + 1;
}
if ( FigInfo->INITIAL_SURFACE_COST == 0 )
{
FigInfo->INITIAL_SURFACE_COST = SurfaceCost + 1;
}
SurfaceCost = ( (double) SurfaceCost * 1000.0 / (double) FigInfo->INITIAL_SURFACE_COST );
LiteralCost = ( (double) LiteralCost * 1000.0 / (double) FigInfo->INITIAL_LITERAL_COST );
DepthCost = ( (double) DepthCost * 1000.0 / (double) FigInfo->INITIAL_DEPTH_COST );
PerCent = FigInfo->OPTIM_DELAY_PERCENT;
if ( FigInfo->USE_LITERAL )
{
GlobalCost = ( ( LiteralCost * ( 100 - PerCent ) ) +
( DepthCost * PerCent ) ) / 100;
}
else
{
GlobalCost = ( ( SurfaceCost * ( 100 - PerCent ) ) +
( DepthCost * PerCent ) ) / 100;
}
FigInfo->GLOBAL_COST = GlobalCost;
return( GlobalCost );
}
/*------------------------------------------------------------\
| |
| BoomBehGiveCost |
| |
\------------------------------------------------------------*/
long BoomBehGiveCost( BehFigure )
befig_list *BehFigure;
{
return ( BoomBehGiveFullCost( BehFigure, 1 ) );
}

View File

@ -0,0 +1,83 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_cost.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_COST_H
# define BOOM_COST_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_OPER_ARITY_1 0
# define BOOM_OPER_ARITY_2 0
# define BOOM_OPER_ARITY_3 1
# define BOOM_OPER_ARITY_4 2
# define BOOM_OPER_MAX_ARITY 3
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern long BoomBehGiveCost();
extern long BoomBehGiveFullCost();
extern void BoomBehPrintCost();
extern long BoomGiveAblLiteralCost();
# endif

View File

@ -0,0 +1,235 @@
/*-----------------------------------------------------------\
| 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 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 : BOOM |
| |
| File : boom_dc.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 02.11.01 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
#include MUT_H
#include AUT_H
#include ABL_H
#include BDD_H
#include ABE_H
#include ABV_H
#include ABT_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "boom_error.h"
#include "boom_debug.h"
#include "boom_shared.h"
#include "boom_aux.h"
#include "boom_abl.h"
#include "boom_bdd.h"
#include "boom_cost.h"
#include "boom_optim.h"
#include "boom_auxinit.h"
#include "boom_dc.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static bddnode *BoomBddDontCare = (bddnode *)0;
static int BoomFoundAblDc = 0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomReplaceDontCareAbl |
| |
\------------------------------------------------------------*/
static void BoomReplaceDontCareAbl( Expr )
ablexpr *Expr;
{
if ( ABL_ATOM( Expr ) )
{
if ( ABL_ATOM_VALUE( Expr ) == ABL_ATOM_NAME_DC )
{
BoomFoundAblDc = 1;
ABL_ATOM_VALUE( Expr ) = ABL_ATOM_NAME_ZERO;
}
}
while ( ( Expr = ABL_CDR( Expr ) ) )
{
BoomReplaceDontCareAbl( ABL_CAR( Expr ) );
}
}
/*------------------------------------------------------------\
| |
| BoomOptimDontCareAbl |
| |
\------------------------------------------------------------*/
static ablexpr *BoomOptimDontCareAbl( Expr )
ablexpr *Expr;
{
BoomFoundAblDc = 0;
BoomReplaceDontCareAbl( Expr );
if ( BoomFoundAblDc )
{
Expr = simpablexpr( Expr );
}
return( Expr );
}
/*------------------------------------------------------------\
| |
| BoomOptimDontCareBdd |
| |
\------------------------------------------------------------*/
static bddnode *BoomOptimDontCareBdd( BddNode )
bddnode *BddNode;
{
bddnode *BddOnSet;
bddnode *BddOffSet;
bddnode *BddDcSet;
bddnode *BddOptim;
bddnode *BddOptimOn;
bddnode *BddOptimOff;
bddvar VarDontCare;
int OnSize;
int OptimSize;
int OptimSizeOn;
int OptimSizeOff;
VarDontCare = getbddvarbyindex( (bddsystem *)0, BoomBddDontCare->INDEX );
BddOnSet = restrictbddnode( (bddsystem *)0, BddNode, VarDontCare,
BddLocalSystem->ZERO );
if ( BddOnSet == BddNode )
{
decbddrefext( BddOnSet );
return ( BddNode );
}
BddOffSet = applybddnodenot( (bddsystem *)0, BddOnSet );
BddDcSet = restrictbddnode( (bddsystem *)0, BddNode, VarDontCare,
BddLocalSystem->ONE );
BddDcSet = applybddnode( (bddsystem *)0, ABL_AND, decbddrefext( BddDcSet ), BddOffSet );
BddOptimOn = simpbddnodedcon( (bddsystem *)0, BddOnSet, BddDcSet );
BddOptimOff = simpbddnodedcoff( (bddsystem *)0, BddOnSet, BddDcSet );
decbddrefext( BddOnSet );
decbddrefext( BddOffSet );
decbddrefext( BddDcSet );
decbddrefext( BddOptimOn );
decbddrefext( BddOptimOff );
decbddrefext( BddNode );
OnSize = getbddnodenum( (bddsystem *)0, BddOnSet );
OptimSizeOn = getbddnodenum( (bddsystem *)0, BddOptimOn );
OptimSizeOff = getbddnodenum( (bddsystem *)0, BddOptimOff );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "OnSize %d, OptimSizeOn %d, OptimSizeOff %d\n",
OnSize, OptimSizeOn, OptimSizeOff );
}
if ( OptimSizeOn > OptimSizeOff )
{
BddOptim = BddOptimOff;
OptimSize = OptimSizeOff;
}
else
{
BddOptim = BddOptimOn;
OptimSize = OptimSizeOn;
}
if ( OptimSize < OnSize ) BddNode = incbddrefext( BddOptim );
else BddNode = incbddrefext( BddOnSet );
return( BddNode );
}
/*------------------------------------------------------------\
| |
| BoomOptimDontCare |
| |
\------------------------------------------------------------*/
void BoomOptimDontCare( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
FigInfo = GetBoomBehFigInfo( BehFigure );
BoomBddDontCare = FigInfo->BDD_DONT_CARE;
BoomBehMapBdd( BehFigure, BoomOptimDontCareBdd );
garbagebddsystem( (bddsystem *)0 );
BoomBehMapAbl( BehFigure, BoomOptimDontCareAbl, 1 );
}

View File

@ -0,0 +1,70 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_dc.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 02.11.01 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef BOOM_DC_H
# define BOOM_DC_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomOptimDontCare();
# endif

View File

@ -0,0 +1,396 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_debug.c |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <string.h>
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
int BoomDebugFlag = 0;
int BoomDebugOption = 0;
time_t BoomDebugChrono[ BOOM_DEBUG_MAX_CHRONO ];
/*------------------------------------------------------------\
| |
| Private variables |
| |
\------------------------------------------------------------*/
static char *BoomDebugItemName[ ] =
{
"boom_abl.c",
"boom_anneal.c",
"boom_aux.c",
"boom_auxinit.c",
"boom_bdd.c",
"boom_burgun.c",
"boom_check.c",
"boom_cost.c",
"boom_dc.c",
"boom_debug.c",
"boom_drive.c",
"boom_error.c",
"boom_gradient.c",
"boom_hash.c",
"boom_main.c",
"boom_one.c",
"boom_optim.c",
"boom_order.c",
"boom_param.c",
"boom_parse.c",
"boom_procrast.c",
"boom_random.c",
"boom_shared.c",
"boom_simple.c",
"boom_simul.c",
"boom_top.c",
"boom_window.c",
(char *)0
};
static char *BoomDebugItemFlag = (char *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomDebugSetOption |
| |
\------------------------------------------------------------*/
int BoomDebugSetOption( Name )
char *Name;
{
/*
if ( ! strcmp( Name, "no_redinst" ) )
{
SetBoomDebugNoRedInst(); return( 1 );
}
else
if ( ! strcmp( Name, "stat" ) )
{
SetBoomDebugStatistics(); return( 1 );
}
else
if ( ! strcmp( Name, "stdout" ) )
{
SetBoomDebugDriveStdout(); return( 1 );
}
*/
return( 0 );
}
/*------------------------------------------------------------\
| |
| BoomDebugAddItem |
| |
\------------------------------------------------------------*/
int BoomDebugAddItem( Name, Mode )
char *Name;
int Mode;
{
char Buffer[ 64 ];
char *Item;
int Index;
if ( BoomDebugItemFlag == (char *)0 )
{
Index = 0;
while ( BoomDebugItemName[ Index ] != (char *)0 )
{
BoomDebugItemName[ Index ] = namealloc( BoomDebugItemName[ Index ] );
Index++;
}
BoomDebugItemFlag = autallocblock( Index );
}
if ( ! strcmp( Name, "all" ) )
{
BoomDebugFlag |= Mode;
Index = 0;
while ( BoomDebugItemName[ Index ] != (char *)0 )
{
BoomDebugItemFlag[ Index ] |= Mode;
Index++;
}
return( 1 );
}
else
{
sprintf( Buffer, "boom_%s.c", Name );
Item = namealloc( Buffer );
Index = 0;
while ( BoomDebugItemName[ Index ] != (char *)0 )
{
if ( Item == BoomDebugItemName[ Index ] )
{
BoomDebugItemFlag[ Index ] |= Mode;
BoomDebugFlag |= Mode;
return( 1 );
}
Index++;
}
}
return( 0 );
}
/*------------------------------------------------------------\
| |
| BoomDebugSearchItem |
| |
\------------------------------------------------------------*/
int BoomDebugSearchItem( Item, Mode )
char *Item;
int Mode;
{
int Index;
if ( ( Mode & BoomDebugFlag ) == Mode )
{
Item = namealloc( Item );
Index = 0;
while ( BoomDebugItemName[ Index ] != (char *)0 )
{
if ( Item == BoomDebugItemName[ Index ] )
{
return( ( BoomDebugItemFlag[ Index ] & Mode ) == Mode );
}
Index++;
}
}
return( 0 );
}
/*------------------------------------------------------------\
| |
| BoomDebugLocSaveBehCost |
| |
\------------------------------------------------------------*/
static void BoomDebugLocSaveBehCost( BehFigure, FileName )
befig_list *BehFigure;
char *FileName;
{
FILE *XscFile;
beaux_list *BehAux;
beout_list *BehOut;
bereg_list *BehReg;
boombeauxinfo *AuxInfo;
boombeoutinfo *OutInfo;
boombereginfo *RegInfo;
long Layer;
XscFile = mbkfopen( BehFigure->NAME, "xsc", "w" );
if ( XscFile != (FILE *)0 )
{
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
AuxInfo = GetBoomBehAuxInfo( BehAux );
if ( AuxInfo != (boombeauxinfo *)0 )
{
Layer = AuxInfo->LITERAL_COST;
if ( Layer > 31 ) Layer = 32;
fprintf( XscFile, "B:beaux_%s:%ld:LITERAL %ld DELAY %ld\n",
BehAux->NAME, Layer, AuxInfo->LITERAL_COST, AuxInfo->DELAY_COST );
}
}
for ( BehOut = BehFigure->BEOUT;
BehOut != (beout_list *)0;
BehOut = BehOut->NEXT )
{
OutInfo = GetBoomBehOutInfo( BehOut );
if ( OutInfo != (boombeoutinfo *)0 )
{
Layer = OutInfo->LITERAL_COST;
if ( Layer > 31 ) Layer = 32;
fprintf( XscFile, "B:beout_%s:%ld:LITERAL %ld DELAY %ld\n",
BehOut->NAME, Layer, OutInfo->LITERAL_COST, OutInfo->DELAY_COST );
}
}
for ( BehReg = BehFigure->BEREG;
BehReg != (bereg_list *)0;
BehReg = BehReg->NEXT )
{
RegInfo = GetBoomBehRegInfo( BehReg );
if ( RegInfo != (boombereginfo *)0 )
{
Layer = RegInfo->LITERAL_COST;
if ( Layer > 31 ) Layer = 32;
fprintf( XscFile, "B:bereg_%s:%ld:LITERAL %ld DELAY %ld\n",
BehReg->NAME, Layer, RegInfo->LITERAL_COST, RegInfo->DELAY_COST );
}
}
fclose( XscFile );
}
}
/*------------------------------------------------------------\
| |
| BoomDebugLocSaveBehFigure |
| |
\------------------------------------------------------------*/
void BoomDebugLocSaveBehFigure( BehFigure, Text, FileName, Line )
befig_list *BehFigure;
char *Text;
char *FileName;
int Line;
{
static char Buffer[ 128 ];
static int Number = 0;
char *Name;
int Length;
Name = BehFigure->NAME;
sprintf( Buffer, "beh%03d_%04d", Number++, Line );
Length = strlen( Buffer );
FileName = FileName + 4;
strcpy( Buffer + Length, FileName );
Length += strlen( FileName );
if ( Text != (char *)0 )
{
strcpy( &Buffer[ Length - 2 ], Text );
}
else
{
Buffer[ Length - 2 ] = '\0';
}
BehFigure->NAME = namealloc( Buffer );
fprintf( stdout, " +++ BoomDebugSaveBehFigure %s.vbe\n", BehFigure->NAME );
vhdlsavebefig( BehFigure, 0 );
BoomDebugLocSaveBehCost( BehFigure, BehFigure->NAME );
BehFigure->NAME = Name;
}
/*------------------------------------------------------------\
| |
| BoomDebugPrint |
| |
\------------------------------------------------------------*/
void BoomDebugPrint( FileName, Line )
char *FileName;
int Line;
{
char Buffer[ 32 ];
int Length;
FileName = FileName + 5;
Length = strlen( FileName );
strcpy( Buffer, FileName );
Buffer[ Length - 2 ] = '\0';
fprintf( stdout, "%-8s%4d ", Buffer, Line );
}

View File

@ -0,0 +1,167 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_debug.h |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef BOOM_DEBUG_H
# define BOOM_DEBUG_H
# include <time.h>
/*------------------------------------------------------------\
| |
| Debug Mode |
| |
\------------------------------------------------------------*/
# define BOOM_DEBUG_LEVEL0 0x01
# define BOOM_DEBUG_LEVEL1 0x03
# define BOOM_DEBUG_LEVEL2 0x07
/*------------------------------------------------------------\
| |
| Debug Option |
| |
\------------------------------------------------------------*/
/*
# define BOOM_DEBUG_NO_RED_INST 0x01
# define BOOM_DEBUG_STATISTICS 0x02
# define BOOM_DEBUG_DRIVE_STDOUT 0x04
*/
/*------------------------------------------------------------\
| |
| Chrono |
| |
\------------------------------------------------------------*/
# define BOOM_DEBUG_MAX_CHRONO 10
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Save Macro |
| |
\------------------------------------------------------------*/
# define BoomDebugSaveBehFigure( F, T ) \
\
(BoomDebugLocSaveBehFigure( (F), (T), __FILE__, __LINE__ ))
/*------------------------------------------------------------\
| |
| Debug Macro |
| |
\------------------------------------------------------------*/
# define IsBoomDebugLevel0() (BoomDebugSearchItem( __FILE__, BOOM_DEBUG_LEVEL0))
# define IsBoomDebugLevel1() (BoomDebugSearchItem( __FILE__, BOOM_DEBUG_LEVEL1))
# define IsBoomDebugLevel2() (BoomDebugSearchItem( __FILE__, BOOM_DEBUG_LEVEL2))
/*------------------------------------------------------------\
| |
| Print Macro |
| |
\------------------------------------------------------------*/
# define BoomPrintf BoomDebugPrint( __FILE__, __LINE__ ); fprintf
/*------------------------------------------------------------\
| |
| Debug Option Macro |
| |
\------------------------------------------------------------*/
/*
# define IsBoomDebugNoRedInst() (BoomDebugOption & BOOM_DEBUG_NO_RED_INST)
# define SetBoomDebugNoRedInst() (BoomDebugOption |= BOOM_DEBUG_NO_RED_INST)
# define IsBoomDebugStatistics() (BoomDebugOption & BOOM_DEBUG_STATISTICS)
# define SetBoomDebugStatistics() (BoomDebugOption |= BOOM_DEBUG_STATISTICS)
# define IsBoomDebugDriveStdout() (BoomDebugOption & BOOM_DEBUG_DRIVE_STDOUT)
# define SetBoomDebugDriveStdout() (BoomDebugOption |= BOOM_DEBUG_DRIVE_STDOUT)
*/
/*------------------------------------------------------------\
| |
| Time Macro |
| |
\------------------------------------------------------------*/
# define BoomDebugStartChrono(N) (void)time(&BoomDebugChrono[(N)])
# define BoomDebugReadChrono(N) (time((void *)0) - BoomDebugChrono[(N)])
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
extern int BoomDebugFlag;
extern int BoomDebugOption;
extern time_t BoomDebugChrono[ BOOM_DEBUG_MAX_CHRONO ];
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern int BoomDebugSearchItem();
extern int BoomDebugAddItem();
extern int BoomDebugSetOption();
extern void BoomDebugLocSaveBehFigure();
extern void BoomDebugPrint();
# endif

View File

@ -0,0 +1,98 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_parse.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_abl.h"
# include "boom_parse.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomDriveBehFigure |
| |
\------------------------------------------------------------*/
void BoomDriveBehFigure( BehFigure, FileName )
befig_list *BehFigure;
char *FileName;
{
char *SaveName;
SaveName = BehFigure->NAME;
BehFigure->NAME = FileName;
vhdlsavebefig( BehFigure, 0 );
BehFigure->NAME = SaveName;
}

View File

@ -0,0 +1,71 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_drive.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_DRIVE_H
# define BOOM_DRIVE_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomDriveBehFigure();
# endif

View File

@ -0,0 +1,164 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_error.c |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <string.h>
# include MUT_H
# include AUT_H
# include "boom_error.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Private variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomDisplayError |
| |
\------------------------------------------------------------*/
void BoomDisplayError( File, Line, Error, Text )
char *File;
int Line;
int Error;
char *Text;
{
char *Name;
Name = mbkstrdup( File );
Name[ strlen( File ) - 1 ] = '\0';
fprintf( stderr, "%s%d ", Name, Line );
switch( Error )
{
case BOOM_EXPR_NULL_ERROR :
fprintf( stderr, "null expression !\n" );
break;
case BOOM_EXPR_LOOP_ERROR :
fprintf( stderr, "combinatory loop on %s !\n", Text );
break;
case BOOM_UNKNOWN_ATOM_ERROR :
fprintf( stderr, "unknown atom %s !\n", Text );
break;
case BOOM_SIMPLIFY_ERROR :
fprintf( stderr, "cannot simplify internal signals\n" );
break;
case BOOM_ILLEGAL_STABLE_ERROR :
fprintf( stderr, "illegal use of STABLE operator\n" );
break;
case BOOM_OPERATOR_ERROR :
fprintf( stderr, "illegal use of operator %ld\n", (long)Text );
break;
default : fprintf( stderr, "Internal error number %d\n", Error );
}
autexit( 1 );
}
/*------------------------------------------------------------\
| |
| BoomDisplayWarning |
| |
\------------------------------------------------------------*/
void BoomDisplayWarning( File, Line, Warning, Text )
char *File;
int Line;
int Warning;
char *Text;
{
char *Name;
Name = mbkstrdup( File );
Name[ strlen( File ) - 1 ] = '\0';
fprintf( stderr, "%s%d ", Name, Line );
switch ( Warning )
{
default : fprintf( stderr, "Internal warning number %d\n", Warning );
}
}

View File

@ -0,0 +1,99 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_error.h |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_ERROR_H
# define BOOM_ERROR_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_EXPR_NULL_ERROR 0
# define BOOM_EXPR_LOOP_ERROR 1
# define BOOM_UNKNOWN_ATOM_ERROR 2
# define BOOM_SIMPLIFY_ERROR 3
# define BOOM_ILLEGAL_STABLE_ERROR 4
# define BOOM_OPERATOR_ERROR 5
/*------------------------------------------------------------\
| |
| Errors |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Warnings |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
# define BoomError( ERROR, TEXT ) \
\
BoomDisplayError( __FILE__, __LINE__, (ERROR), (TEXT) )
# define BoomWarning( WARNING, TEXT ) \
\
BoomDisplayWarning( __FILE__, __LINE__, (WARNING), (TEXT) )
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomDisplayError();
extern void BoomDisplayWarning();
# endif

View File

@ -0,0 +1,415 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_gradient.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_gradient.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static bddnode *BoomBddTopVarNode = (bddnode *)0;
static long BoomCurrentVar = (long )0;
static long BoomCurrentCost = 0;
static int BoomExplosionFlag = 0;
static long *BoomVarCostArray = (long *)0;
static long *BoomVarSortArray = (long *)0;
static long BoomVarArraySize = 0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomGradientTopBddNode |
| |
\------------------------------------------------------------*/
static void BoomGradientTopBddNode( BddNode )
bddnode *BddNode;
{
bddnode *NewBddNode;
long Number;
if ( ! BoomExplosionFlag )
{
Number = getbddnodenum( (bddsystem *)0, BddNode );
if ( Number < BOOM_BDD_NODE_BIG_SIZE ) return;
NewBddNode = composebddnode( BddLocalSystem, BddNode,
BoomCurrentVar, BoomBddTopVarNode );
if ( IsBddSystemExplosion( BddLocalSystem ) )
{
BoomPrintf( stdout, "Explosion !!! %ld\n", BddLocalSystem->NUMBER_NODE );
garbagebddsystem( BddLocalSystem );
explosionbddsystemrestart( BddLocalSystem );
BoomExplosionFlag = 1;
}
else
{
BoomCurrentCost += getbddnodenum( (bddsystem *)0, NewBddNode );
/*
Number = getbddnodenum( (bddsystem *)0, NewBddNode );
if ( Number >= BOOM_BDD_NODE_BIG_SIZE ) BoomCurrentCost += Number;
*/
decbddrefext( NewBddNode );
}
}
}
/*------------------------------------------------------------\
| |
| BoomGradientCompareCost |
| |
\------------------------------------------------------------*/
static long BoomGradientCompareCost( CostArray, Index1, Index2 )
long *CostArray;
long Index1;
long Index2;
{
return( CostArray[ Index2 ] - CostArray[ Index1 ] );
}
/*------------------------------------------------------------\
| |
| BoomBehGradientBddOrder |
| |
\------------------------------------------------------------*/
chain_list *BoomBehGradientBddOrder( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
chain_list *OrderList;
long NumberVar;
long VarIndex;
long Index;
long ExplosionLimit;
long MaxNode;
char *Name;
FigInfo = GetBoomBehFigInfo( BehFigure );
VarIndex = getbddvarindex( BddLocalSystem, 0 );
BoomBddTopVarNode = addbddcircuitin( BddLocalCircuit, "_top_", VarIndex,
BDD_IN_MODE_BEFORE );
NumberVar = BddLocalSystem->NUMBER_VAR;
if ( BoomVarCostArray == (long *)0 )
{
BoomVarCostArray = (long *)autallocblock( sizeof( long ) * NumberVar );
BoomVarSortArray = (long *)autallocblock( sizeof( long ) * NumberVar );
BoomVarArraySize = NumberVar;
}
else
if ( NumberVar > BoomVarArraySize )
{
BoomVarCostArray = (long *)autresizeblock( (char *)BoomVarCostArray,
sizeof( long ) * BoomVarArraySize,
sizeof( long ) * NumberVar );
BoomVarSortArray = (long *)autresizeblock( (char *)BoomVarSortArray,
sizeof( long ) * BoomVarArraySize,
sizeof( long ) * NumberVar );
BoomVarArraySize = NumberVar;
}
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Compute Cost for each variables\n" );
}
MaxNode = BddLocalSystem->NUMBER_NODE * 2;
for ( BoomCurrentVar = 1; BoomCurrentVar < NumberVar; BoomCurrentVar++ )
{
if ( BddLocalSystem->NUMBER_NODE >= MaxNode )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Sweep !\n" );
}
sweepbddvar( BddLocalSystem, 0, 1 );
if ( BddLocalSystem->NUMBER_NODE >= MaxNode )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Garbage !\n" );
}
garbagebddsystem( BddLocalSystem );
MaxNode = BddLocalSystem->NUMBER_NODE * 4;
}
}
ExplosionLimit = BddLocalSystem->NUMBER_NODE * 2;
if ( ExplosionLimit < BOOM_GRADIENT_EXPLOSION_LIMIT )
{
ExplosionLimit = BOOM_GRADIENT_EXPLOSION_LIMIT;
}
explosionbddsystemdynamic( (bddsystem *)0, NULL, ExplosionLimit );
BoomCurrentCost = 0;
BoomBehScanBdd( BehFigure, BoomGradientTopBddNode );
if ( BoomExplosionFlag )
{
BoomExplosionFlag = 0;
BoomVarCostArray[ BoomCurrentVar - 1 ] = - BoomCurrentVar;
}
else
{
BoomVarCostArray[ BoomCurrentVar - 1 ] = BoomCurrentCost;
}
if ( IsBoomDebugLevel1() )
{
VarIndex = getbddvarindex( (bddsystem *)0, BoomCurrentVar );
Name = getbddcircuitinname( (bddcircuit *)0, VarIndex );
BoomPrintf( stdout, "%ld %ld %s\n", BoomCurrentVar, BoomCurrentCost, Name );
}
}
explosionbddsystemdynamic( (bddsystem *)0, NULL, 0 );
sortautarray( BoomVarCostArray, BoomVarSortArray, NumberVar - 1, BoomGradientCompareCost );
OrderList = (chain_list *)0;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "New variable order (reverse)\n" );
}
for ( Index = NumberVar - 2; Index >= 0; Index-- )
{
VarIndex = getbddvarindex( (bddsystem *)0, BoomVarSortArray[ Index ] + 1 );
Name = getbddcircuitinname( (bddcircuit *)0, VarIndex );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "%ld %ld %s\n", BoomVarSortArray[ Index ] + 1, VarIndex, Name );
}
OrderList = addchain( OrderList, (void *)Name );
}
BoomBehRebuildBddNode( BehFigure, OrderList );
return( OrderList );
}
/*------------------------------------------------------------\
| |
| BoomBehOptimizeGradient |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeGradient( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
boombefiginfo *FigInfo;
long Cost;
long NewCost;
long Iteration;
long Amplitude;
long MaxIteration;
long MaxAmplitude;
chain_list *BestOrder;
chain_list *NewOrder;
int Level;
FigInfo = GetBoomBehFigInfo( BehFigure );
MaxIteration = FigInfo->ITERATION;
MaxAmplitude = FigInfo->AMPLITUDE;
Level = FigInfo->OPTIM_LEVEL;
if ( MaxIteration <= 0 ) MaxIteration = 2;
if ( MaxAmplitude <= 0 ) MaxAmplitude = 5;
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
BestOrder = BoomBehGetBddOrder( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld\n", Cost );
}
MaxIteration = MaxIteration * (Level + 1);
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
for ( Iteration = 0; Iteration < MaxIteration; Iteration++ )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Iteration %ld\n", Iteration );
}
Amplitude = MaxAmplitude;
do
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Amplitude %ld\n", Amplitude );
}
BoomBehRandomBddOrder( BehFigure, Amplitude );
NewOrder = BoomBehGradientBddOrder( BehFigure );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
freechain( BestOrder );
BestOrder = NewOrder;
}
else
{
freechain( NewOrder );
}
Amplitude--;
}
while ( Amplitude > 0 );
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3ld\b\b\b", ( ( Iteration + 1 ) * 100 ) / MaxIteration );
fflush( stdout );
}
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Best cost : %ld\n", Cost );
}
BoomBehRebuildBddNode( BehFigure, BestOrder );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -0,0 +1,74 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_gradient.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_GRADIENT_H
# define BOOM_GRADIENT_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_GRADIENT_EXPLOSION_LIMIT 10000
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeGradient();
extern chain_list *BoomBehGradientBddOrder();
# endif

View File

@ -0,0 +1,313 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_hash.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_hash.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Get Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Get Hash Size |
| |
\------------------------------------------------------------*/
static long BoomGetHashAblSize( Size )
long Size;
{
int Index;
for ( Index = 0; Index < AUT_MAX_PRIME_NUMBER; Index++ )
{
if ( AUT_HASH_PRIME_NUMBER[ Index ] > Size )
{
return( AUT_HASH_PRIME_NUMBER[ Index ] );
}
}
if ( ( Size & 1 ) == 0 ) Size++;
return( Size );
}
/*------------------------------------------------------------\
| |
| Boom Get Hash Key |
| |
\------------------------------------------------------------*/
static long BoomGetHashAblKey( Table, BddNode )
boomhabltable *Table;
bddnode *BddNode;
{
return( ((unsigned long)BddNode >> 2 ) % Table->TABLE_SIZE );
}
/*------------------------------------------------------------\
| |
| Create Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Create Hash Abl Table |
| |
\------------------------------------------------------------*/
boomhabltable *BoomCreateHashAblTable( Length )
long Length;
{
boomhabltable *HashTable;
boomhabl *Table;
Length = BoomGetHashAblSize( Length );
HashTable = (boomhabltable *)autallocblock( sizeof( boomhabltable ) );
Table = (boomhabl *)autallocblock( sizeof( boomhabl ) * Length );
HashTable->TABLE = Table;
HashTable->TABLE_SIZE = Length;
return( HashTable );
}
/*------------------------------------------------------------\
| |
| Reset Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Reset Hash Abl Table |
| |
\------------------------------------------------------------*/
void BoomResetHashAblTable( HashTable )
boomhabltable *HashTable;
{
boomhabl *HashAbl;
long HashIndex;
if ( HashTable->NUMBER_ABL > 0 )
{
for ( HashIndex = 0; HashIndex < HashTable->TABLE_SIZE; HashIndex++ )
{
HashAbl = &HashTable->TABLE[ HashIndex ];
if ( HashAbl->NODE != (bddnode *)0 )
{
freeablexpr( HashAbl->ABL );
HashAbl->ABL = (chain_list *)0;
HashAbl->NODE = (bddnode *)0;
}
}
HashTable->NUMBER_ABL = 0;
HashTable->NUMBER_RESET++;
}
HashTable->NUMBER_ADD = 0;
HashTable->NUMBER_HIT = 0;
HashTable->NUMBER_MISS = 0;
}
/*------------------------------------------------------------\
| |
| Destroy Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Destroy Hash Abl Table |
| |
\------------------------------------------------------------*/
void BoomDestroyHashAblTable( HashTable )
boomhabltable *HashTable;
{
BoomResetHashAblTable( HashTable );
autfreeblock( HashTable->TABLE );
autfreeblock( HashTable );
}
/*------------------------------------------------------------\
| |
| Add Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Add Hash Element |
| |
\------------------------------------------------------------*/
boomhabl *BoomAddHashAbl( HashTable, BddNode, Equation )
boomhabltable *HashTable;
bddnode *BddNode;
chain_list *Equation;
{
boomhabl *HashAbl;
long HashIndex;
HashIndex = BoomGetHashAblKey( HashTable, BddNode, Equation );
HashAbl = &HashTable->TABLE[ HashIndex ];
HashTable->NUMBER_ADD++;
if ( HashAbl->NODE == (bddnode *)0 )
{
HashTable->NUMBER_ABL++;
}
else
{
freeablexpr( HashAbl->ABL );
}
HashAbl->NODE = BddNode;
HashAbl->ABL = dupablexpr( Equation );
return( HashAbl );
}
/*------------------------------------------------------------\
| |
| Search Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Search Hash Abl |
| |
\------------------------------------------------------------*/
boomhabl *BoomSearchHashAbl( HashTable, BddNode )
boomhabltable *HashTable;
bddnode *BddNode;
{
boomhabl *HashAbl;
long HashIndex;
HashIndex = BoomGetHashAblKey( HashTable, BddNode );
HashAbl = &HashTable->TABLE[ HashIndex ];
if ( HashAbl->NODE == BddNode )
{
HashTable->NUMBER_HIT++;
return( HashAbl );
}
HashTable->NUMBER_MISS++;
return( (boomhabl *)0 );
}
/*------------------------------------------------------------\
| |
| Boom View Hash Abl Table |
| |
\------------------------------------------------------------*/
void BoomViewHashAblTable( HashTable )
boomhabltable *HashTable;
{
fprintf( stdout, "--> HashAblTable\n" );
fprintf( stdout, " SIZE : %ld\n", HashTable->TABLE_SIZE );
fprintf( stdout, " ABL : %ld\n", HashTable->NUMBER_ABL );
fprintf( stdout, " ADD : %ld\n", HashTable->NUMBER_ADD );
fprintf( stdout, " HIT : %ld\n", HashTable->NUMBER_HIT );
fprintf( stdout, " MISS : %ld\n", HashTable->NUMBER_MISS );
fprintf( stdout, " RESET : %ld\n", HashTable->NUMBER_RESET );
fprintf( stdout, "<-- HashAblTable\n" );
}

View File

@ -0,0 +1,107 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_hash.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_HASH_H
# define BOOM_HASH_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Hash Abl |
| |
\------------------------------------------------------------*/
typedef struct boomhabl
{
bddnode *NODE;
chain_list *ABL;
} boomhabl;
/*-----------------------------------------------------------\
| |
| Boom Hash Abl Table |
| |
\-----------------------------------------------------------*/
typedef struct boomhabltable
{
boomhabl *TABLE;
long TABLE_SIZE;
long NUMBER_ABL;
long NUMBER_ADD;
long NUMBER_HIT;
long NUMBER_MISS;
long NUMBER_RESET;
} boomhabltable;
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern boomhabltable *BoomCreateHashAblTable();
extern void BoomDestroyHashAblTable();
extern void BoomResetHashAblTable();
extern boomhabl *BoomAddHashAbl();
extern boomhabl *BoomSearchHashAbl();
# endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,79 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_logic.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_LOGIC_H
# define BOOM_LOGIC_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_LOGIC_REORDER_123 0
# define BOOM_LOGIC_REORDER_213 1
# define BOOM_LOGIC_REORDER_231 2
# define BOOM_LOGIC_REORDER_321 3
# define BOOM_LOGIC_REORDER_312 4
# define BOOM_LOGIC_REORDER_132 5
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomLogicOptimization();
# endif

View File

@ -0,0 +1,383 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_main.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_shared.h"
# include "boom_parse.h"
# include "boom_check.h"
# include "boom_optim.h"
# include "boom_cost.h"
# include "boom_drive.h"
# include "boom_post.h"
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_param.h"
# include "boom_main.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Usage |
| |
\------------------------------------------------------------*/
void BoomUsage()
{
fprintf( stderr, " boom [Options] [Algorithm] Input_file_name [Output_file_name]\n\n" );
fprintf( stdout, " Options : -V Sets verbose mode on\n" );
fprintf( stdout, " -T Sets trace and verbose modes on\n" );
fprintf( stdout, " -O Reverses initial Bdd variables order\n" );
fprintf( stdout, " -A Keeps all auxiliary variables\n" );
fprintf( stdout, " -P Uses a parameter file (Input_file_name.boom)\n" );
fprintf( stdout, " -L Uses literal's number for surface estimation\n" );
fprintf( stdout, " -l num Optimization level [0-3] (default 0, low level)\n" );
fprintf( stdout, " -d num Delay optimization percent (default 0 %%)\n" );
fprintf( stdout, " -i num Iteration count\n" );
fprintf( stdout, " -a num Amplitude\n" );
fprintf( stdout, "\n" );
fprintf( stdout, " Algorithms : -s Simulated annealing (default)\n" );
fprintf( stdout, " -j Just do it algorithm\n" );
fprintf( stdout, " -b Burgun algorithm\n" );
fprintf( stdout, " -g Gradient algorithm\n" );
fprintf( stdout, " -p Procrastination algorithm\n" );
fprintf( stdout, " -w Window bdd reorder\n" );
fprintf( stdout, " -t Top bdd reorder\n" );
fprintf( stdout, " -m Simple bdd reorder\n" );
fprintf( stdout, " -o One pass (faster algorithm)\n" );
fprintf( stdout, " -r Random bdd reorder\n" );
fprintf( stdout, " -n No optimization algorithm\n" );
fprintf( stdout, "\n" );
exit( 1 );
}
/*------------------------------------------------------------\
| |
| Main |
| |
\------------------------------------------------------------*/
int main( argc, argv )
int argc;
char *argv[];
{
befig_list *BehFigure;
boombefiginfo *FigInfo;
char *InputFileName;
char *OutputFileName;
int Number;
int Index;
char Option;
int FlagParamFile = 0;
int FlagVerbose = 0;
int FlagTrace = 0;
int FlagInitBddOrder = 0;
int FlagKeepAux = 0;
int FlagUseLiteral = 0;
int OptimAlgorithm = BOOM_OPTIM_ALGORITHM_ANNEAL;
int OptimLevel = 0;
int OptimDelayPerCent = 0;
int Iteration = 0;
int Amplitude = 0;
alliancebanner_with_authors( "BooM", BOOM_VERSION, "BOOlean Minimization",
"2000", ALLIANCE_VERSION, "Ludovic Jacomme" );
mbkenv();
autenv();
ablenv();
bddenv();
if ( argc < 2 ) BoomUsage();
InputFileName = (char *)0;
OutputFileName = (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 ( BoomFlagDebug )
{
if ( BoomDebugAddItem( &argv[ Number ][ Index ], BoomFlagDebug ) ) break;
}
if ( BoomFlagOption )
{
if ( BoomDebugSetOption( &argv[ Number ][ Index ] ) ) break;
}
if ( Option == 'i' )
{
Number = Number + 1;
if ( Number >= argc ) BoomUsage();
Iteration = atoi( argv[ Number ] );
break;
}
else
if ( Option == 'a' )
{
Number = Number + 1;
if ( Number >= argc ) BoomUsage();
Amplitude = atoi( argv[ Number ] );
break;
}
else
if ( Option == 'l' )
{
Number = Number + 1;
if ( Number >= argc ) BoomUsage();
OptimLevel = atoi( argv[ Number ] );
if ( ( OptimLevel < 0 ) ||
( OptimLevel > 3 ) ) BoomUsage();
break;
}
else
if ( Option == 'd' )
{
Number = Number + 1;
if ( Number >= argc ) BoomUsage();
OptimDelayPerCent = atoi( argv[ Number ] );
if ( ( OptimDelayPerCent < 0 ) ||
( OptimDelayPerCent > 100 ) ) BoomUsage();
break;
}
switch ( Option )
{
case 'V' : FlagVerbose = 1;
break;
case 'T' : FlagTrace = 1;
break;
case 'O' : FlagInitBddOrder = 1;
break;
case 'P' : FlagParamFile = 1;
break;
case 'L' : FlagUseLiteral = 1;
break;
case 'A' : FlagKeepAux = 1;
break;
case 'j' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_SIMUL;
break;
case 'm' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_SIMPLE;
break;
case 't' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_TOP;
break;
case 'w' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_WINDOW;
break;
case 'o' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_ONE;
break;
case 'r' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_RANDOM;
break;
case 'p' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_PROCRAST;
break;
case 'b' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_BURGUN;
break;
case 'g' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_GRADIENT;
break;
case 'n' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_NOTHING;
break;
case 's' : OptimAlgorithm = BOOM_OPTIM_ALGORITHM_ANNEAL;
break;
case 'D' :
Index = Index + 1;
Option = argv[ Number ][ Index ];
if ( Option == '0' ) BoomFlagDebug = BOOM_DEBUG_LEVEL0;
else
if ( Option == '1' ) BoomFlagDebug = BOOM_DEBUG_LEVEL1;
else
if ( Option == '2' ) BoomFlagDebug = BOOM_DEBUG_LEVEL2;
else
BoomUsage();
break;
default : BoomUsage();
}
if ( Option == 'r' ) break;
}
}
else
if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ];
else
if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ];
else
BoomUsage();
}
if ( InputFileName == (char *)0 ) BoomUsage();
InputFileName = autbasename( InputFileName, "vbe" );
if ( OutputFileName == (char *)0 )
{
OutputFileName = autallocblock( strlen( InputFileName ) + 5 );
sprintf( OutputFileName, "%s_o", InputFileName );
}
else
{
OutputFileName = autbasename( OutputFileName, "vbe" );
}
fprintf( stdout, "\t--> Parse BEH file %s.vbe\n", InputFileName );
BehFigure = BoomParseBehFigure( InputFileName );
if ( FlagVerbose )
{
fprintf( stdout, "\n\t--> Check figure %s\n", BehFigure->NAME );
}
BoomCheckBehFigure( BehFigure );
if ( FlagParamFile )
{
fprintf( stdout, "\n\t--> Parse parameter file %s.boom\n", InputFileName );
BoomParseParamFile( BehFigure, InputFileName );
}
FigInfo = GetBoomBehFigInfo( BehFigure );
if ( FlagKeepAux ) FigInfo->KEEP_AUX = 1;
if ( FlagInitBddOrder ) FigInfo->INIT_BDD_ORDER = 1;
if ( FlagTrace ) FlagVerbose = 1;
FigInfo->OPTIM_ALGORITHM = OptimAlgorithm;
FigInfo->OPTIM_LEVEL = OptimLevel;
FigInfo->OPTIM_DELAY_PERCENT = OptimDelayPerCent;
FigInfo->ITERATION = Iteration;
FigInfo->AMPLITUDE = Amplitude;
FigInfo->VERBOSE = FlagVerbose;
FigInfo->TRACE = FlagTrace;
FigInfo->USE_LITERAL = FlagUseLiteral;
if ( FlagVerbose )
{
fprintf( stdout, "\n\t--> Optimization parameters\n" );
fprintf( stdout, "\t Algorithm : %s\n", BoomOptimAlgorithmName[ OptimAlgorithm ] );
fprintf( stdout, "\t Keep aux : %s\n", FlagKeepAux ? "yes" : "no" );
fprintf( stdout, "\t Area : %3d %%\n", 100 - OptimDelayPerCent );
fprintf( stdout, "\t Delay : %3d %%\n", OptimDelayPerCent );
fprintf( stdout, "\t Level : %3d\n", OptimLevel );
fprintf( stdout, "\n" );
}
if ( FlagVerbose )
{
BoomBehGiveFullCost( BehFigure, 0 );
BoomBehPrintCost( "Initial", BehFigure );
fprintf( stdout, "\n" );
}
BoomBehOptimize( BehFigure );
if ( FlagVerbose )
{
BoomBehGiveFullCost( BehFigure, 0 );
BoomBehPrintCost( "Final", BehFigure );
fprintf( stdout, "\n" );
}
if ( FlagVerbose )
{
fprintf( stdout, "\t--> Post treat figure %s\n\n", BehFigure->NAME );
BoomPostTreatBehFigure( BehFigure, OutputFileName );
}
fprintf( stdout, "\t--> Drive BEH file %s\n\n", OutputFileName );
BoomDriveBehFigure( BehFigure, OutputFileName );
BoomBehFreeBehFig( BehFigure );
return( 0 );
}

View File

@ -0,0 +1,70 @@
/*------------------------------------------------------------\
| |
| 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 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 : BFP |
| |
| File : bfp_main.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef BFP_MAIN_H
# define BFP_MAIN_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,113 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_one.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_one.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBehOptimizeOne |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeOne( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
bddvar NumberVar;
long Cost;
reorderbddsystemwindow( BddLocalSystem );
NumberVar = BddLocalSystem->NUMBER_VAR;
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -0,0 +1,70 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_one.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_ONE_H
# define BOOM_ONE_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeOne();
# endif

View File

@ -0,0 +1,226 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_optim.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_dc.h"
# include "boom_auxinit.h"
# include "boom_window.h"
# include "boom_top.h"
# include "boom_simple.h"
# include "boom_one.h"
# include "boom_random.h"
# include "boom_procrast.h"
# include "boom_burgun.h"
# include "boom_gradient.h"
# include "boom_simul.h"
# include "boom_anneal.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBehOptimize |
| |
\------------------------------------------------------------*/
void BoomBehOptimize( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
bddsystem *BddSystem;
bddcircuit *BddCircuit;
beaux_list *BehAux;
FigInfo = GetBoomBehFigInfo( BehFigure );
BoomBehCreateAuxInit( BehFigure );
if ( FigInfo->OPTIM_ALGORITHM == BOOM_OPTIM_ALGORITHM_NOTHING )
{
return;
}
BddSystem = createbddsystem( 1000, 20000, 100, 10000000 );
if ( ! BoomDebugFlag )
{
SetBddSystemNoWarning( BddSystem );
}
reorderbddsystemdynamic( BddSystem, reorderbddsystemwindow, 100000, 50 );
/*
explosionbddsystemdynamic( BddSystem, NULL, 50 );
*/
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\t--> Translate Abl to Bdd\n" );
}
BoomBehAbl2BddNode( BehFigure, FigInfo->INIT_BDD_ORDER, FigInfo->DONT_CARE );
reorderbddsystemdynamic( BddSystem, garbagebddsystem, 100000, 50 );
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\t Total Bdd nodes %ld\n\n", BddSystem->NUMBER_NODE );
}
if ( FigInfo->DONT_CARE )
{
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\t Optimize don't care\n" );
}
BoomOptimDontCare( BehFigure );
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\t Total Bdd nodes %ld\n\n", BddSystem->NUMBER_NODE );
}
}
BehAux = BehFigure->BEAUX;
/*\
while ( testbddcircuit( (bddcircuit *)0 ) )
{
BehAux = BoomOptimComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
fprintf( stdout, "New cost %d\n", Cost );
}
\*/
switch ( FigInfo->OPTIM_ALGORITHM )
{
case BOOM_OPTIM_ALGORITHM_SIMPLE : BoomBehOptimizeSimple( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_WINDOW : BoomBehOptimizeWindow( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_TOP : BoomBehOptimizeTop( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_ONE : BoomBehOptimizeOne( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_PROCRAST : BoomBehOptimizeProcrast( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_BURGUN : BoomBehOptimizeBurgun( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_RANDOM : BoomBehOptimizeRandom( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_GRADIENT : BoomBehOptimizeGradient( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_SIMUL : BoomBehOptimizeSimul( BehFigure );
break;
case BOOM_OPTIM_ALGORITHM_ANNEAL : BoomBehOptimizeAnneal( BehFigure );
break;
}
BoomBehResetBddNode( BehFigure );
BddCircuit = BehFigure->CIRCUI;
BehFigure->CIRCUI = (bddcircuit *)0;
destroybddcircuit( BddCircuit );
destroybddsystem( BddSystem );
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
ClearBoomBehAuxKeep( BehAux );
ClearBoomBehAuxDontTouch( BehAux );
}
BoomBehDeleteUselessAux( BehFigure, (beaux_list *)0, 1 );
BoomBehMapAbl( BehFigure, simpablexpr, 1 );
}

View File

@ -0,0 +1,79 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_optim.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_OPTIM_H
# define BOOM_OPTIM_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_OPTIM_REORDER_123 0
# define BOOM_OPTIM_REORDER_213 1
# define BOOM_OPTIM_REORDER_231 2
# define BOOM_OPTIM_REORDER_321 3
# define BOOM_OPTIM_REORDER_312 4
# define BOOM_OPTIM_REORDER_132 5
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimize();
# endif

View File

@ -0,0 +1,155 @@
/*------------------------------------------------------------\
| |
| 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 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 : Boom |
| |
| File : boom_order.c |
| |
| Date : 06.06.00 |
| |
| 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 "boom_error.h"
# include "boom_shared.h"
# include "boom_order.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Beh Make Bdd Order |
| |
\------------------------------------------------------------*/
void BoomBehMakeBddOrder( BehFigure, OrderFlag, DontCareFlag )
befig_list *BehFigure;
int OrderFlag;
int DontCareFlag;
{
berin_list *BehRin;
boombefiginfo *FigInfo;
chain_list *ScanOrder;
bddindex BddIndex;
authtable *HahsRin;
authelem *Element;
/*
beaux_list *BehAux;
beout_list *BehOut;
bebus_list *BehBus;
bebux_list *BehBux;
bereg_list *BehReg;
biabl_list *BiAbl;
*/
FigInfo = GetBoomBehFigInfo( BehFigure );
HahsRin = createauthtable( 100 );
for ( BehRin = BehFigure->BERIN;
BehRin != (berin_list *)0;
BehRin = BehRin->NEXT )
{
addauthelem( HahsRin, BehRin->NAME, (long)BehRin );
}
for ( ScanOrder = FigInfo->BDD_ORDER_LIST;
ScanOrder != (chain_list *)0;
ScanOrder = ScanOrder->NEXT )
{
Element = searchauthelem( HahsRin, (char *)ScanOrder->DATA );
if ( Element != (authelem *)0 )
{
BehRin = (berin_list *)Element->VALUE;
SetBoomBehRinOrder( BehRin );
BddIndex = BddLocalCircuit->NUMBER_NAME_IN + BDD_INDEX_MIN;
addbddcircuitin( (bddcircuit *)0, BehRin->NAME, BddIndex,
BDD_IN_MODE_IMPOSE | BDD_IN_MODE_LAST );
}
}
destroyauthtable( HahsRin );
if ( OrderFlag )
{
BehFigure->BERIN = (berin_list *)reverse( (chain_list *)BehFigure->BERIN );
}
for ( BehRin = BehFigure->BERIN;
BehRin != (berin_list *)0;
BehRin = BehRin->NEXT )
{
if ( IsBoomBehRinOrder( BehRin ) ) continue;
BddIndex = BddLocalCircuit->NUMBER_NAME_IN + BDD_INDEX_MIN;
addbddcircuitin( (bddcircuit *)0, BehRin->NAME, BddIndex,
BDD_IN_MODE_IMPOSE | BDD_IN_MODE_LAST );
}
if ( OrderFlag )
{
BehFigure->BERIN = (berin_list *)reverse( (chain_list *)BehFigure->BERIN );
}
if ( DontCareFlag )
{
FigInfo->BDD_DONT_CARE = addbddcircuitin( (bddcircuit *)0,
ABL_ATOM_NAME_DC, 0, BDD_IN_MODE_LAST );
}
}

View File

@ -0,0 +1,71 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_order.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_ORDER_H
# define BOOM_ORDER_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehMakeBddOrder();
# endif

View File

@ -0,0 +1,592 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_param.c |
| |
| Author : Ludovic Jacomme |
| |
| Date : 03/07/2000 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_shared.h"
# include "boom_debug.h"
# include "boom_param.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static authtable *BoomHashAux = (authtable *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomParseSetExprKeepAux |
| |
\------------------------------------------------------------*/
static void BoomParseSetExprKeepAux( Expr )
ablexpr *Expr;
{
char *Value;
beaux_list *BehAux;
authelem *Element;
if ( ABL_ATOM( Expr ) )
{
Value = ABL_ATOM_VALUE( Expr );
if ( ( Value != ABL_ATOM_NAME_ONE ) &&
( Value != ABL_ATOM_NAME_ZERO ) &&
( Value != ABL_ATOM_NAME_DC ) &&
( Value != ABL_ATOM_NAME_TRISTATE ) )
{
Element = searchauthelem( BoomHashAux, Value );
if ( Element != (authelem *)0 )
{
BehAux = (beaux_list *)Element->VALUE;
SetBoomBehAuxKeep( BehAux );
}
}
}
while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 )
{
BoomParseSetExprKeepAux( ABL_CAR( Expr ) );
}
}
/*------------------------------------------------------------\
| |
| BoomParseSetBiAblKeepAux |
| |
\------------------------------------------------------------*/
static void BoomParseSetBiAblKeepAux( BiAbl )
biabl_list *BiAbl;
{
while ( BiAbl != (biabl_list *)0 )
{
if ( BiAbl->CNDABL != (ablexpr *)0 )
{
BoomParseSetExprKeepAux( BiAbl->CNDABL );
}
if ( BiAbl->VALABL != (ablexpr *)0 )
{
BoomParseSetExprKeepAux( BiAbl->VALABL );
}
BiAbl = BiAbl->NEXT;
}
}
/*------------------------------------------------------------\
| |
| BoomParseCheckParam |
| |
\------------------------------------------------------------*/
void BoomParseCheckParam( BehFigure, FileName )
befig_list *BehFigure;
char *FileName;
{
boombefiginfo *FigInfo;
beaux_list *BehAux;
bereg_list *BehReg;
beout_list *BehOut;
bebux_list *BehBux;
bebus_list *BehBus;
berin_list *BehRin;
chain_list **PrevChain;
chain_list *ScanChain;
chain_list *DelChain;
authtable *HashOut;
authtable *HashReg;
authtable *HashBux;
authtable *HashBus;
authtable *HashRin;
authelem *Element;
FigInfo = GetBoomBehFigInfo( BehFigure );
BoomHashAux = createauthtable( 100 );
HashOut = createauthtable( 100 );
HashReg = createauthtable( 100 );
HashBux = createauthtable( 100 );
HashBus = createauthtable( 100 );
HashRin = createauthtable( 100 );
for ( BehRin = BehFigure->BERIN;
BehRin != (berin_list *)0;
BehRin = BehRin->NEXT )
{
addauthelem( HashRin, BehRin->NAME, (long)BehRin );
}
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
addauthelem( BoomHashAux, BehAux->NAME, (long)BehAux );
}
for ( BehOut = BehFigure->BEOUT;
BehOut != (beout_list *)0;
BehOut = BehOut->NEXT )
{
addauthelem( HashOut, BehOut->NAME, (long)BehOut );
}
for ( BehReg = BehFigure->BEREG;
BehReg != (bereg_list *)0;
BehReg = BehReg->NEXT )
{
addauthelem( HashReg, BehReg->NAME, (long)BehReg );
}
for ( BehBux = BehFigure->BEBUX;
BehBux != (bebux_list *)0;
BehBux = BehBux->NEXT )
{
addauthelem( HashBux, BehBux->NAME, (long)BehBux );
}
for ( BehBus = BehFigure->BEBUS;
BehBus != (bebus_list *)0;
BehBus = BehBus->NEXT )
{
addauthelem( HashBus, BehBus->NAME, (long)BehBus );
}
PrevChain = &FigInfo->KEEP_LIST;
ScanChain = FigInfo->KEEP_LIST;
while ( ScanChain != (chain_list *)0 )
{
Element = searchauthelem( BoomHashAux, (char *)ScanChain->DATA );
if ( Element != (authelem *)0 )
{
PrevChain = &ScanChain->NEXT;
ScanChain = ScanChain->NEXT;
BehAux = (beaux_list *)Element->VALUE;
SetBoomBehAuxKeep( BehAux );
fprintf( stderr, "\t keep signal '%s'\n", BehAux->NAME );
}
else
{
fprintf( stderr, "\t### unknown signal '%s' in parameter file %s.boom\n",
(char *)ScanChain->DATA, FileName );
*PrevChain = ScanChain->NEXT;
DelChain = ScanChain;
ScanChain = ScanChain->NEXT;
DelChain->NEXT = (chain_list *)0;
freechain( DelChain );
}
}
PrevChain = &FigInfo->DONT_TOUCH_LIST;
ScanChain = FigInfo->DONT_TOUCH_LIST;
while ( ScanChain != (chain_list *)0 )
{
Element = searchauthelem( BoomHashAux, (char *)ScanChain->DATA );
if ( Element != (authelem *)0 )
{
PrevChain = &ScanChain->NEXT;
ScanChain = ScanChain->NEXT;
BehAux = (beaux_list *)Element->VALUE;
SetBoomBehAuxDontTouch( BehAux );
SetBoomBehAuxKeep( BehAux );
BoomParseSetExprKeepAux( BehAux->ABL );
continue;
}
Element = searchauthelem( HashOut, (char *)ScanChain->DATA );
if ( Element != (authelem *)0 )
{
PrevChain = &ScanChain->NEXT;
ScanChain = ScanChain->NEXT;
BehOut = (beout_list *)Element->VALUE;
SetBoomBehAuxDontTouch( BehOut );
BoomParseSetExprKeepAux( BehOut->ABL );
continue;
}
Element = searchauthelem( HashReg, (char *)ScanChain->DATA );
if ( Element != (authelem *)0 )
{
PrevChain = &ScanChain->NEXT;
ScanChain = ScanChain->NEXT;
BehReg = (bereg_list *)Element->VALUE;
SetBoomBehAuxDontTouch( BehReg );
BoomParseSetBiAblKeepAux( BehReg->BIABL );
continue;
}
Element = searchauthelem( HashBus, (char *)ScanChain->DATA );
if ( Element != (authelem *)0 )
{
PrevChain = &ScanChain->NEXT;
ScanChain = ScanChain->NEXT;
BehBus = (bebus_list *)Element->VALUE;
SetBoomBehAuxDontTouch( BehBus );
BoomParseSetBiAblKeepAux( BehBus->BIABL );
continue;
}
Element = searchauthelem( HashBux, (char *)ScanChain->DATA );
if ( Element != (authelem *)0 )
{
PrevChain = &ScanChain->NEXT;
ScanChain = ScanChain->NEXT;
BehBux = (bebux_list *)Element->VALUE;
SetBoomBehAuxDontTouch( BehBux );
BoomParseSetBiAblKeepAux( BehBux->BIABL );
continue;
}
if ( Element == (authelem *)0 )
{
fprintf( stderr, "\t### unknown signal '%s' in parameter file %s.boom\n",
(char *)ScanChain->DATA, FileName );
*PrevChain = ScanChain->NEXT;
DelChain = ScanChain;
ScanChain = ScanChain->NEXT;
DelChain->NEXT = (chain_list *)0;
freechain( DelChain );
}
}
FigInfo->BDD_ORDER_LIST = reverse( FigInfo->BDD_ORDER_LIST );
PrevChain = &FigInfo->BDD_ORDER_LIST;
ScanChain = FigInfo->BDD_ORDER_LIST;
while ( ScanChain != (chain_list *)0 )
{
Element = searchauthelem( HashRin, (char *)ScanChain->DATA );
if ( Element != (authelem *)0 )
{
PrevChain = &ScanChain->NEXT;
ScanChain = ScanChain->NEXT;
BehRin = (berin_list *)Element->VALUE;
SetBoomBehRinOrder( BehRin );
fprintf( stderr, "\t order input/signal/register '%s'\n", BehRin->NAME );
}
else
{
fprintf( stderr, "\t### unknown signal '%s' in parameter file %s.boom\n",
(char *)ScanChain->DATA, FileName );
*PrevChain = ScanChain->NEXT;
DelChain = ScanChain;
ScanChain = ScanChain->NEXT;
DelChain->NEXT = (chain_list *)0;
freechain( DelChain );
}
}
destroyauthtable( HashReg );
destroyauthtable( HashOut );
destroyauthtable( HashBus );
destroyauthtable( HashBux );
destroyauthtable( HashRin );
destroyauthtable( BoomHashAux );
BoomHashAux = (authtable *)0;
}
/*------------------------------------------------------------\
| |
| BoomParseParamFile |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomParseGetWord |
| |
\------------------------------------------------------------*/
static char *BoomParseGetWord( Buffer )
char *Buffer;
{
char *String;
if ( ( String = (char *)strtok( Buffer, " =,\t\n" ) ) != (char *)0 )
{
String = namealloc( String );
}
return( String );
}
/*------------------------------------------------------------\
| |
| BoomParseParamFile |
| |
\------------------------------------------------------------*/
void BoomParseParamFile( BehFigure, FileName )
befig_list *BehFigure;
char *FileName;
{
boombefiginfo *FigInfo;
chain_list **PrevChain;
char *FirstWord;
char *Scan;
char *Pointer;
char *RegisterName;
int Left;
int Right;
int Step;
int Index;
int CurrentDef;
long LineNumber;
FILE *ParamFile;
char ParamBuffer[ 512 ];
char Buffer[ 128 ];
FigInfo = GetBoomBehFigInfo( BehFigure );
FileName = autbasename( FileName, "boom" );
ParamFile = mbkfopen( FileName, "boom", "r" );
if ( ParamFile == (FILE *)0 )
{
fprintf( stderr, "\t### Unable to parse parameter file %s.boom\n", FileName );
autexit( 1 );
}
LineNumber = 0;
CurrentDef = BOOM_PARAM_NONE;
while ( fgets( ParamBuffer, 512, ParamFile ) != (char *)0 )
{
LineNumber++;
if ( ParamBuffer[ 0 ] == '#' ) continue;
FirstWord = BoomParseGetWord( ParamBuffer );
if ( FirstWord == (char *)0 ) continue;
if ( ! strncmp( FirstWord, "end", 3 ) ) CurrentDef = BOOM_PARAM_NONE;
else
if ( CurrentDef != BOOM_PARAM_NONE )
{
/*
if ( CurrentDef == BOOM_PARAM_CLOCK )
{
SecondWord = BoomParseGetWord( (char *)0 );
if ( SecondWord == (char *)0 )
{
fprintf( stderr, "Syntax error line %ld in parameter file %s.boom\n",
LineNumber, FileName );
autexit( 1 );
}
}
else
*/
if ( ( CurrentDef == BOOM_PARAM_KEEP_AUX ) ||
( CurrentDef == BOOM_PARAM_DONT_TOUCH_AUX ) ||
( CurrentDef == BOOM_PARAM_BDD_ORDER ) )
{
if ( CurrentDef == BOOM_PARAM_KEEP_AUX ) PrevChain = &FigInfo->KEEP_LIST;
else
if ( CurrentDef == BOOM_PARAM_BDD_ORDER ) PrevChain = &FigInfo->BDD_ORDER_LIST;
else
PrevChain = &FigInfo->DONT_TOUCH_LIST;
do
{
Scan = strchr( FirstWord, '[' );
if ( Scan == NULL ) Scan = strchr( FirstWord, '(' );
if ( Scan != NULL )
{
strcpy( Buffer, FirstWord );
Scan = Buffer;
Pointer = strchr( Scan, '[' );
if ( Pointer == NULL ) Pointer = strchr( Scan, '(' );
*Pointer = '\0';
RegisterName = namealloc( Buffer );
Scan = Pointer + 1;
Pointer = strchr( Scan, ':' );
if ( Pointer != (char *)0 )
{
*Pointer = '\0';
Left = atoi( Scan );
Scan = Pointer + 1;
Pointer = strchr( Scan, ']' );
if ( Pointer == (char *)0 ) Pointer = strchr( Scan, ')' );
if ( Pointer == (char *)0 )
{
fprintf( stderr, "\t### Syntax error line %ld in parameter file %s.boom\n",
LineNumber, FileName );
autexit(1);
}
*Pointer = '\0';
Right = atoi( Scan );
}
else
{
Left = atoi( Scan );
Right = Left;
}
if ( Left < Right ) Step = -1;
else Step = 1;
for ( Index = Right; Index != (Left + Step) ; Index += Step )
{
sprintf( Buffer, "%s %d", RegisterName, Index );
*PrevChain = addchain( *PrevChain, namealloc( Buffer ) );
}
}
else
{
*PrevChain = addchain( *PrevChain, FirstWord );
}
} while ( ( FirstWord = BoomParseGetWord( NULL ) ) != NULL );
}
else
{
fprintf( stderr, "Syntax error line %ld in parameter file %s.boom\n",
LineNumber, FileName );
autexit( 1 );
}
}
else
if ( ! strcmp( FirstWord, "begin_keep" ) )
{
CurrentDef = BOOM_PARAM_KEEP_AUX;
}
else
if ( ! strcmp( FirstWord, "begin_dont_touch" ) )
{
CurrentDef = BOOM_PARAM_DONT_TOUCH_AUX;
}
else
if ( ! strcmp( FirstWord, "begin_bdd_order" ) )
{
CurrentDef = BOOM_PARAM_BDD_ORDER;
}
else
{
fprintf( stderr, "Syntax error line %ld in parameter file %s.boom\n",
LineNumber, FileName );
autexit( 1 );
}
}
fclose( ParamFile );
BoomParseCheckParam( BehFigure, FileName );
}

View File

@ -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 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 : BOOM |
| |
| File : boom_param.h |
| |
| Author : Ludovic Jacomme |
| |
| Date : 03/07/2000 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_PARAM_H
# define BOOM_PARAM_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_PARAM_NONE 0
# define BOOM_PARAM_KEEP_AUX 1
# define BOOM_PARAM_DONT_TOUCH_AUX 2
# define BOOM_PARAM_BDD_ORDER 3
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomParseParamFile();
# endif

View File

@ -0,0 +1,150 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_parse.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_parse.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_abl.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomParseBehFigure |
| |
\------------------------------------------------------------*/
befig_list *BoomParseBehFigure( FileName )
char *FileName;
{
befig_list *BehFigure;
beaux_list *BehAux;
beout_list *BehOut;
bereg_list *BehReg;
bebux_list *BehBux;
bebus_list *BehBus;
BehFigure = vhdlloadbefig( (befig_list *)0, FileName, 2 );
if ( BehFigure->ERRFLG )
{
fprintf( stderr, "\t### Unable to compile file %s.vbe\n", FileName );
autexit( 1 );
}
BoomAddBehFigInfo( BehFigure );
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
BoomAddBehAuxInfo( BehAux );
}
for ( BehBux = BehFigure->BEBUX;
BehBux != (bebux_list *)0;
BehBux = BehBux->NEXT )
{
BoomAddBehBuxInfo( BehBux );
}
for ( BehBus = BehFigure->BEBUS;
BehBus != (bebus_list *)0;
BehBus = BehBus->NEXT )
{
BoomAddBehBusInfo( BehBus );
}
for ( BehOut = BehFigure->BEOUT;
BehOut != (beout_list *)0;
BehOut = BehOut->NEXT )
{
BoomAddBehOutInfo( BehOut );
}
for ( BehReg = BehFigure->BEREG;
BehReg != (bereg_list *)0;
BehReg = BehReg->NEXT )
{
BoomAddBehRegInfo( BehReg );
}
beh_frebeaux( BehFigure->BEDLY );
BehFigure->BEDLY = (beaux_list *)0;
BoomBehMapAbl( BehFigure, simpablexpr, 1 );
return( BehFigure );
}

View File

@ -0,0 +1,71 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_parse.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_PARSE_H
# define BOOM_PARSE_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern befig_list *BoomParseBehFigure();
# endif

View File

@ -0,0 +1,160 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_post.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_abl.h"
# include "boom_post.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static authtable *BoomHashRename = (authtable *)0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomRenameAuxVectorAbl |
| |
\------------------------------------------------------------*/
static void BoomRenameAuxVectorAbl( Expr )
ablexpr *Expr;
{
authelem *Element;
char *Value;
if ( ABL_ATOM( Expr ) )
{
Value = ABL_ATOM_VALUE( Expr );
if ( ( Value != ABL_ATOM_NAME_ONE ) &&
( Value != ABL_ATOM_NAME_ZERO ) &&
( Value != ABL_ATOM_NAME_DC ) &&
( Value != ABL_ATOM_NAME_TRISTATE ) )
{
Element = searchauthelem( BoomHashRename, Value );
if ( Element != (authelem *)0 )
{
ABL_ATOM_VALUE( Expr ) = (char *)Element->VALUE;
}
}
return;
}
while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 )
{
BoomRenameAuxVectorAbl( ABL_CAR( Expr ) );
}
}
/*------------------------------------------------------------\
| |
| BoomPostTreatBehFigure |
| |
\------------------------------------------------------------*/
void BoomPostTreatBehFigure( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
char Buffer[ 512 ];
char *Scan;
if ( BoomHashRename == (authtable *)0 )
{
BoomHashRename = createauthtable( 100 );
}
for ( BehAux = BehFigure->BEAUX;
BehAux != (beaux_list *)0;
BehAux = BehAux->NEXT )
{
if ( strchr( BehAux->NAME, ' ' ) != (char *)0 )
{
strcpy( Buffer, BehAux->NAME );
Scan = strchr( Buffer, ' ' );
*Scan = '_';
Scan = namealloc( Buffer );
addauthelem( BoomHashRename, BehAux->NAME, (long)Scan );
BehAux->NAME = Scan;
}
}
BoomBehScanAbl( BehFigure, BoomRenameAuxVectorAbl, 1 );
resetauthtable( BoomHashRename );
}

View File

@ -0,0 +1,71 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_post.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_POST_H
# define BOOM_POST_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomPostTreatBehFigure();
# endif

View File

@ -0,0 +1,258 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_procrast.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_window.h"
# include "boom_procrast.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBehOptimizeProcrast |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeProcrast( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
boombefiginfo *FigInfo;
bddvar NumberChild;
bddvar ChildTo;
bddvar ChildFrom;
long Cost;
long NewCost;
long NumberNode;
long NewNumberNode;
long LastNewNumberNode;
long Iteration;
long MaxIteration;
int Level;
long MaxNode;
FigInfo = GetBoomBehFigInfo( BehFigure );
MaxIteration = FigInfo->ITERATION;
Level = FigInfo->OPTIM_LEVEL;
if ( MaxIteration <= 0 ) MaxIteration = 2;
MaxIteration = MaxIteration * (Level + 1);
NumberChild = BddLocalSystem->NUMBER_VAR;
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
NumberNode = BoomBehGetNumberBigBddNode( BehFigure );
MaxNode = ( BddLocalSystem->NUMBER_NODE * 120 ) / 100;
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld %ld\n", Cost, NumberNode );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
for ( Iteration = 0; Iteration < MaxIteration; Iteration++ )
{
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Iteration %ld\n", Iteration );
}
ChildFrom = 0;
for ( ChildFrom = 0; ChildFrom < (NumberChild - 1); ChildFrom++ )
{
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "-> ChildFrom %d\n", ChildFrom );
}
for ( ChildTo = ChildFrom; ChildTo < ( NumberChild - 1 ); ChildTo++ )
{
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "-> Swap %d and %d\n", ChildTo, ChildTo + 1 );
}
swapbddvar( (bddsystem *)0, ChildTo );
/*
NewNumberNode = BoomBehGetNumberBigBddNode( BehFigure );
BoomPrintf( stdout, "NewNumberNode: %ld\n", NewNumberNode );
*/
if ( BddLocalSystem->NUMBER_NODE >= MaxNode )
{
garbagebddsystem( BddLocalSystem );
}
if ( BddLocalSystem->NUMBER_NODE >= MaxNode )
{
BoomPrintf( stdout, "@@@@ Max nodes %ld reached %ld\n",
MaxNode, BddLocalSystem->NUMBER_NODE );
break;
}
}
NewNumberNode = BoomBehGetNumberBigBddNode( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewNumberNode: %ld\n", NewNumberNode );
}
/*
if ( NewNumberNode <= NumberNode )
*/
if ( ( NewNumberNode != NumberNode ) &&
( NewNumberNode != LastNewNumberNode ) &&
( NewNumberNode <= ( NumberNode * 105 ) / 100 ) )
{
if ( NewNumberNode < NumberNode ) NumberNode = NewNumberNode;
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld %ld\n", NewCost, NumberNode );
}
}
else
{
NewCost = Cost + 1;
}
LastNewNumberNode = NewNumberNode;
if ( NewCost > Cost )
{
while ( ChildTo > ChildFrom )
{
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "-> UnSwap %d and %d\n", ChildTo, ChildTo - 1 );
}
swapbddvar( (bddsystem *)0, ChildTo - 1 );
ChildTo = ChildTo - 1;
}
}
else
{
Cost = NewCost;
}
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3ld\b\b\b", ( ( Iteration + 1 ) * 100 ) / MaxIteration );
fflush( stdout );
}
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
BehAux = BoomBehComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -0,0 +1,71 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_procrast.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_PROCRAST_H
# define BOOM_PROCRAST_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeProcrast();
# endif

View File

@ -0,0 +1,249 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_random.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_window.h"
# include "boom_random.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBehOptimizeRandom |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeRandom( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
beaux_list *BehAux;
long MaxIteration;
bddvar NumberVar;
bddvar BddVar;
int Iteration;
long Cost;
static unsigned char InitOptimizeRandom = 1;
FigInfo = GetBoomBehFigInfo( BehFigure );
MaxIteration = FigInfo->ITERATION;
if ( InitOptimizeRandom )
{
srand( getpid() );
InitOptimizeRandom = 0;
}
NumberVar = BddLocalSystem->NUMBER_VAR;
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld, NumberVar %d\n", Cost, NumberVar );
}
if ( MaxIteration <= 0 ) MaxIteration = NumberVar;
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
for ( Iteration = 0; Iteration < MaxIteration; Iteration++ )
{
BddVar = (rand() >> 8) % (NumberVar - 1);
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Swap %d\n", BddVar );
}
BoomBehReorderWindow2( BehFigure, BehAux, BddVar, &Cost );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "New cost %ld\n", Cost );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3ld\b\b\b", ( ( Iteration + 1 ) * 100 ) / MaxIteration );
fflush( stdout );
}
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}
# if 0
void BoomBehOptimizeRandom( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
beaux_list *BehAux;
long MaxIteration;
bddvar NumberVar;
bddvar BddVar;
int Iteration;
int Amplitude;
int Swap;
long Cost;
static unsigned char InitOptimizeRandom = 1;
FigInfo = GetBoomBehFigInfo( BehFigure );
MaxIteration = FigInfo->ITERATION;
if ( InitOptimizeRandom )
{
srand( getpid() );
InitOptimizeRandom = 0;
}
NumberVar = BddLocalSystem->NUMBER_VAR;
/*
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
*/
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld, NumberVar %d\n", Cost, NumberVar );
}
/*
if ( MaxIteration <= 0 ) MaxIteration = NumberVar;
*/
MaxIteration = 1 + ( ( NumberVar + 2 ) / 2 );
for ( Iteration = 0; Iteration < MaxIteration; Iteration++ )
{
if ( Iteration != 0 )
{
BoomBehMakeBddNode( BehFigure, 0 );
}
for ( BddVar = 0; BddVar < ( NumberVar - 1 ); BddVar++ )
{
Amplitude = (rand() >> 8) % 8;
for ( Swap = 0; Swap < Amplitude; Swap++ )
{
if ( ( BddVar + Swap ) >= ( NumberVar - 1 ) ) break;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "-> Swap %d and %d\n", BddVar + Swap, BddVar + Swap + 1 );
}
swapbddvar( (bddsystem *)0, BddVar + Swap );
}
}
BoomOptimizeProcrast( BehFigure );
}
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}
# endif

View File

@ -0,0 +1,70 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_random.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_RANDOM_H
# define BOOM_RANDOM_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeRandom();
# endif

View File

@ -0,0 +1,509 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_shared.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include "boom_error.h"
# include "boom_shared.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
int BoomFlagDebug = 0;
int BoomFlagOption = 0;
char *BoomOptimAlgorithmName[ BOOM_MAX_OPTIM_ALGORITHM ] =
{
"top bdd reorder",
"window bdd reorder",
"simple bdd reorder",
"one pass",
"random bdd reorder",
"procrastination",
"Luc Burgun",
"no optimization algorithm",
"gradient",
"just do it",
"simulated annealing"
};
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomAddBehAuxInfo |
| |
\------------------------------------------------------------*/
boombeauxinfo *BoomAddBehAuxInfo( BehAux )
beaux_list *BehAux;
{
boombeauxinfo *AuxInfo;
AuxInfo = (boombeauxinfo *)autallocheap( sizeof( boombeauxinfo ) );
SetBoomBehAuxInfo( BehAux, AuxInfo );
return( AuxInfo );
}
/*------------------------------------------------------------\
| |
| BoomDelBehAuxInfo |
| |
\------------------------------------------------------------*/
void BoomDelBehAuxInfo( BehAux )
beaux_list *BehAux;
{
boombeauxinfo *AuxInfo;
AuxInfo = GetBoomBehAuxInfo( BehAux );
if ( AuxInfo != (boombeauxinfo *)0 )
{
autfreeheap( AuxInfo, sizeof( boombeauxinfo ) );
SetBoomBehAuxInfo( BehAux, NULL );
}
}
/*------------------------------------------------------------\
| |
| BoomBehFreeBehAux |
| |
\------------------------------------------------------------*/
void BoomBehFreeBehAux( BehAux )
beaux_list *BehAux;
{
beaux_list *ScanBehAux;
for ( ScanBehAux = BehAux;
ScanBehAux != (beaux_list *)0;
ScanBehAux = ScanBehAux->NEXT )
{
BoomDelBehAuxInfo( ScanBehAux );
}
beh_frebeaux( BehAux );
}
/*------------------------------------------------------------\
| |
| BoomAddBehOutInfo |
| |
\------------------------------------------------------------*/
boombeoutinfo *BoomAddBehOutInfo( BehOut )
beout_list *BehOut;
{
boombeoutinfo *OutInfo;
OutInfo = (boombeoutinfo *)autallocheap( sizeof( boombeoutinfo ) );
SetBoomBehOutInfo( BehOut, OutInfo );
return( OutInfo );
}
/*------------------------------------------------------------\
| |
| BoomDelBehOutInfo |
| |
\------------------------------------------------------------*/
void BoomDelBehOutInfo( BehOut )
beout_list *BehOut;
{
boombeoutinfo *OutInfo;
OutInfo = GetBoomBehOutInfo( BehOut );
if ( OutInfo != (boombeoutinfo *)0 )
{
autfreeheap( OutInfo, sizeof( boombeoutinfo ) );
SetBoomBehOutInfo( BehOut, NULL );
}
}
/*------------------------------------------------------------\
| |
| BoomBehFreeBehOut |
| |
\------------------------------------------------------------*/
void BoomBehFreeBehOut( BehOut )
beout_list *BehOut;
{
beout_list *ScanBehOut;
for ( ScanBehOut = BehOut;
ScanBehOut != (beout_list *)0;
ScanBehOut = ScanBehOut->NEXT )
{
BoomDelBehOutInfo( ScanBehOut );
}
beh_frebeout( BehOut );
}
/*------------------------------------------------------------\
| |
| BoomAddBehRegInfo |
| |
\------------------------------------------------------------*/
boombereginfo *BoomAddBehRegInfo( BehReg )
bereg_list *BehReg;
{
boombereginfo *RegInfo;
RegInfo = (boombereginfo *)autallocheap( sizeof( boombereginfo ) );
SetBoomBehRegInfo( BehReg, RegInfo );
return( RegInfo );
}
/*------------------------------------------------------------\
| |
| BoomDelBehRegInfo |
| |
\------------------------------------------------------------*/
void BoomDelBehRegInfo( BehReg )
bereg_list *BehReg;
{
boombereginfo *RegInfo;
RegInfo = GetBoomBehRegInfo( BehReg );
if ( RegInfo != (boombereginfo *)0 )
{
autfreeheap( RegInfo, sizeof( boombereginfo ) );
SetBoomBehRegInfo( BehReg, NULL );
}
}
/*------------------------------------------------------------\
| |
| BoomBehFreeBehReg |
| |
\------------------------------------------------------------*/
void BoomBehFreeBehReg( BehReg )
bereg_list *BehReg;
{
bereg_list *ScanBehReg;
for ( ScanBehReg = BehReg;
ScanBehReg != (bereg_list *)0;
ScanBehReg = ScanBehReg->NEXT )
{
BoomDelBehRegInfo( ScanBehReg );
}
beh_frebereg( BehReg );
}
/*------------------------------------------------------------\
| |
| BoomAddBehBusInfo |
| |
\------------------------------------------------------------*/
boombebusinfo *BoomAddBehBusInfo( BehBus )
bebus_list *BehBus;
{
boombebusinfo *BusInfo;
BusInfo = (boombebusinfo *)autallocheap( sizeof( boombebusinfo ) );
SetBoomBehBusInfo( BehBus, BusInfo );
return( BusInfo );
}
/*------------------------------------------------------------\
| |
| BoomDelBehBusInfo |
| |
\------------------------------------------------------------*/
void BoomDelBehBusInfo( BehBus )
bebus_list *BehBus;
{
boombebusinfo *BusInfo;
BusInfo = GetBoomBehBusInfo( BehBus );
if ( BusInfo != (boombebusinfo *)0 )
{
autfreeheap( BusInfo, sizeof( boombebusinfo ) );
SetBoomBehBusInfo( BehBus, NULL );
}
}
/*------------------------------------------------------------\
| |
| BoomBehFreeBehBus |
| |
\------------------------------------------------------------*/
void BoomBehFreeBehBus( BehBus )
bebus_list *BehBus;
{
bebus_list *ScanBehBus;
for ( ScanBehBus = BehBus;
ScanBehBus != (bebus_list *)0;
ScanBehBus = ScanBehBus->NEXT )
{
BoomDelBehBusInfo( ScanBehBus );
}
beh_frebebus( BehBus );
}
/*------------------------------------------------------------\
| |
| BoomAddBehBuxInfo |
| |
\------------------------------------------------------------*/
boombebuxinfo *BoomAddBehBuxInfo( BehBux )
bebux_list *BehBux;
{
boombebuxinfo *BuxInfo;
BuxInfo = (boombebuxinfo *)autallocheap( sizeof( boombebuxinfo ) );
SetBoomBehBuxInfo( BehBux, BuxInfo );
return( BuxInfo );
}
/*------------------------------------------------------------\
| |
| BoomDelBehBuxInfo |
| |
\------------------------------------------------------------*/
void BoomDelBehBuxInfo( BehBux )
bebux_list *BehBux;
{
boombebuxinfo *BuxInfo;
BuxInfo = GetBoomBehBuxInfo( BehBux );
if ( BuxInfo != (boombebuxinfo *)0 )
{
autfreeheap( BuxInfo, sizeof( boombebuxinfo ) );
SetBoomBehBuxInfo( BehBux, NULL );
}
}
/*------------------------------------------------------------\
| |
| BoomBehFreeBehBux |
| |
\------------------------------------------------------------*/
void BoomBehFreeBehBux( BehBux )
bebux_list *BehBux;
{
bebux_list *ScanBehBux;
for ( ScanBehBux = BehBux;
ScanBehBux != (bebux_list *)0;
ScanBehBux = ScanBehBux->NEXT )
{
BoomDelBehBuxInfo( ScanBehBux );
}
beh_frebebux( BehBux );
}
/*------------------------------------------------------------\
| |
| BoomAddBehFigInfo |
| |
\------------------------------------------------------------*/
boombefiginfo *BoomAddBehFigInfo( BehFig )
befig_list *BehFig;
{
boombefiginfo *FigInfo;
FigInfo = (boombefiginfo *)autallocheap( sizeof( boombefiginfo ) );
SetBoomBehFigInfo( BehFig, FigInfo );
return( FigInfo );
}
/*------------------------------------------------------------\
| |
| BoomDelBehFigInfo |
| |
\------------------------------------------------------------*/
void BoomDelBehFigInfo( BehFig )
befig_list *BehFig;
{
boombefiginfo *FigInfo;
FigInfo = GetBoomBehFigInfo( BehFig );
if ( FigInfo != (boombefiginfo *)0 )
{
freechain( FigInfo->KEEP_LIST );
freechain( FigInfo->DONT_TOUCH_LIST );
freechain( FigInfo->BDD_ORDER_LIST );
autfreeheap( FigInfo, sizeof( boombefiginfo ) );
SetBoomBehFigInfo( BehFig, NULL );
}
}
/*------------------------------------------------------------\
| |
| BoomBehFreeBehFig |
| |
\------------------------------------------------------------*/
void BoomBehFreeBehFig( BehFig )
befig_list *BehFig;
{
BoomBehFreeBehReg( BehFig->BEREG );
BoomBehFreeBehOut( BehFig->BEOUT );
BoomBehFreeBehAux( BehFig->BEAUX );
BoomBehFreeBehBus( BehFig->BEBUS );
BoomBehFreeBehBux( BehFig->BEBUX );
BehFig->BEOUT = (beout_list *)0;
BehFig->BEREG = (bereg_list *)0;
BehFig->BEAUX = (beaux_list *)0;
BehFig->BEBUS = (bebus_list *)0;
BehFig->BEBUX = (bebux_list *)0;
BoomDelBehFigInfo( BehFig );
BehFig->NEXT = (befig_list *)0;
beh_frebefig( BehFig );
}
/*------------------------------------------------------------\
| |
| BoomComputeLog2 |
| |
\------------------------------------------------------------*/
long BoomComputeLog2( Value )
unsigned long Value;
{
unsigned long Mask;
unsigned long Log2;
Mask = 1;
Log2 = 0;
while ( Value != 0 )
{
Value = Value >> 1;
Log2++;
}
if ( Log2 > 0 ) Log2--;
return( Log2 );
}

View File

@ -0,0 +1,293 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : vasy_shared.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_SHARED_H
# define BOOM_SHARED_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Aux Flags |
| |
\------------------------------------------------------------*/
# define BOOM_AUX_KEEP_MASK 0x01
# define BOOM_AUX_DONT_TOUCH_MASK 0x02
# define BOOM_AUX_TAG_MASK 0x04
/*------------------------------------------------------------\
| |
| Rin Flags |
| |
\------------------------------------------------------------*/
# define BOOM_RIN_ORDER_MASK 0x01
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Aux Flags |
| |
\------------------------------------------------------------*/
# define IsBoomBehAuxTag( A ) ((A)->FLAGS & BOOM_AUX_TAG_MASK)
# define SetBoomBehAuxTag( A ) ((A)->FLAGS |= BOOM_AUX_TAG_MASK)
# define ClearBoomBehAuxTag( A ) ((A)->FLAGS &= ~BOOM_AUX_TAG_MASK)
# define IsBoomBehAuxKeep( A ) ((A)->FLAGS & BOOM_AUX_KEEP_MASK)
# define SetBoomBehAuxKeep( A ) ((A)->FLAGS |= BOOM_AUX_KEEP_MASK)
# define ClearBoomBehAuxKeep( A ) ((A)->FLAGS &= ~BOOM_AUX_KEEP_MASK)
# define IsBoomBehAuxDontTouch( A ) ((A)->FLAGS & BOOM_AUX_DONT_TOUCH_MASK)
# define SetBoomBehAuxDontTouch( A ) ((A)->FLAGS |= BOOM_AUX_DONT_TOUCH_MASK)
# define ClearBoomBehAuxDontTouch( A ) ((A)->FLAGS &= ~BOOM_AUX_DONT_TOUCH_MASK)
/*------------------------------------------------------------\
| |
| Rin Flags |
| |
\------------------------------------------------------------*/
# define IsBoomBehRinOrder( R ) ((R)->FLAGS & BOOM_RIN_ORDER_MASK)
# define SetBoomBehRinOrder( R ) ((R)->FLAGS |= BOOM_RIN_ORDER_MASK)
# define ClearBoomBehRinOrder( R ) ((R)->FLAGS &= ~BOOM_RIN_ORDER_MASK)
/*------------------------------------------------------------\
| |
| Optimization Algorithm |
| |
\------------------------------------------------------------*/
# define BOOM_OPTIM_ALGORITHM_TOP 0
# define BOOM_OPTIM_ALGORITHM_WINDOW 1
# define BOOM_OPTIM_ALGORITHM_SIMPLE 2
# define BOOM_OPTIM_ALGORITHM_ONE 3
# define BOOM_OPTIM_ALGORITHM_RANDOM 4
# define BOOM_OPTIM_ALGORITHM_PROCRAST 5
# define BOOM_OPTIM_ALGORITHM_BURGUN 6
# define BOOM_OPTIM_ALGORITHM_NOTHING 7
# define BOOM_OPTIM_ALGORITHM_GRADIENT 8
# define BOOM_OPTIM_ALGORITHM_SIMUL 9
# define BOOM_OPTIM_ALGORITHM_ANNEAL 10
# define BOOM_MAX_OPTIM_ALGORITHM 11
/*------------------------------------------------------------\
| |
| Beh Fig Info |
| |
\------------------------------------------------------------*/
# define SetBoomBehFigInfo( F, I ) ((F)->USER = (void *)(I))
# define GetBoomBehFigInfo( F ) ((boombefiginfo *)(F)->USER)
/*------------------------------------------------------------\
| |
| Beh Aux Info |
| |
\------------------------------------------------------------*/
# define SetBoomBehAuxInfo( A, I ) ((A)->USER = (void *)(I))
# define GetBoomBehAuxInfo( A ) ((boombeauxinfo *)(A)->USER)
/*------------------------------------------------------------\
| |
| Beh Out Info |
| |
\------------------------------------------------------------*/
# define SetBoomBehOutInfo( A, I ) ((A)->USER = (void *)(I))
# define GetBoomBehOutInfo( A ) ((boombeoutinfo *)(A)->USER)
/*------------------------------------------------------------\
| |
| Beh Reg Info |
| |
\------------------------------------------------------------*/
# define SetBoomBehRegInfo( A, I ) ((A)->USER = (void *)(I))
# define GetBoomBehRegInfo( A ) ((boombereginfo *)(A)->USER)
/*------------------------------------------------------------\
| |
| Beh Bus Info |
| |
\------------------------------------------------------------*/
# define SetBoomBehBusInfo( A, I ) ((A)->USER = (void *)(I))
# define GetBoomBehBusInfo( A ) ((boombebusinfo *)(A)->USER)
/*------------------------------------------------------------\
| |
| Beh Bux Info |
| |
\------------------------------------------------------------*/
# define SetBoomBehBuxInfo( A, I ) ((A)->USER = (void *)(I))
# define GetBoomBehBuxInfo( A ) ((boombebuxinfo *)(A)->USER)
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
typedef struct boombeauxinfo
{
long DELAY_COST;
long DEPTH_COST;
long SURFACE_COST;
long LITERAL_COST;
} boombeauxinfo;
typedef struct boombeoutinfo
{
long DELAY_COST;
long DEPTH_COST;
long SURFACE_COST;
long LITERAL_COST;
} boombeoutinfo;
typedef struct boombereginfo
{
long DELAY_COST;
long DEPTH_COST;
long SURFACE_COST;
long LITERAL_COST;
} boombereginfo;
typedef struct boombebusinfo
{
long DELAY_COST;
long DEPTH_COST;
long SURFACE_COST;
long LITERAL_COST;
} boombebusinfo;
typedef struct boombebuxinfo
{
long DELAY_COST;
long DEPTH_COST;
long SURFACE_COST;
long LITERAL_COST;
} boombebuxinfo;
typedef struct boombefiginfo
{
chain_list *KEEP_LIST;
chain_list *DONT_TOUCH_LIST;
chain_list *BDD_ORDER_LIST;
long SURFACE_COST;
long DEPTH_COST;
long LITERAL_COST;
long GLOBAL_COST;
long INITIAL_SURFACE_COST;
long INITIAL_LITERAL_COST;
long INITIAL_DEPTH_COST;
unsigned char OPTIM_ALGORITHM;
unsigned char OPTIM_LEVEL;
unsigned char OPTIM_DELAY_PERCENT;
unsigned char KEEP_AUX;
unsigned char INIT_BDD_ORDER;
unsigned char VERBOSE;
unsigned char TRACE;
unsigned char USE_LITERAL;
unsigned char DONT_CARE;
bddnode *BDD_DONT_CARE;
int ITERATION;
int AMPLITUDE;
} boombefiginfo;
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
extern int BoomFlagOption;
extern int BoomFlagDebug;
extern char *BoomOptimAlgorithmName[ BOOM_MAX_OPTIM_ALGORITHM ];
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern boombeauxinfo *BoomAddBehAuxInfo();
extern void BoomDelBehAuxInfo();
extern void BoomBehFreeBehAux();
extern boombebuxinfo *BoomAddBehBuxInfo();
extern void BoomDelBehBuxInfo();
extern void BoomBehFreeBehBux();
extern boombebusinfo *BoomAddBehBusInfo();
extern void BoomDelBehBusInfo();
extern void BoomBehFreeBehBus();
extern boombeoutinfo *BoomAddBehOutInfo();
extern void BoomDelBehOutInfo();
extern void BoomBehFreeBehOut();
extern boombereginfo *BoomAddBehRegInfo();
extern void BoomDelBehRegInfo();
extern void BoomBehFreeBehReg();
extern boombefiginfo *BoomAddBehFigInfo();
extern void BoomDelBehFigInfo();
extern void BoomBehFreeBehFig();
extern long BoomComputeLog2();
# endif

View File

@ -0,0 +1,156 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_simple.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_window.h"
# include "boom_simple.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBehOptimizeSimple |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeSimple( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
beaux_list *BehAux;
bddvar NumberVar;
bddvar BddVar;
long Cost;
FigInfo = GetBoomBehFigInfo( BehFigure );
NumberVar = BddLocalSystem->NUMBER_VAR;
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld\n", Cost );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
for ( BddVar = 0; BddVar < NumberVar - 1; BddVar++ )
{
if ( BddVar < NumberVar - 2 )
{
BoomBehReorderWindow3( BehFigure, BehAux, BddVar, &Cost );
}
else
{
BoomBehReorderWindow2( BehFigure, BehAux, BddVar, &Cost );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "New cost %ld\n", Cost );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3d\b\b\b", ( ( BddVar + 1 ) * 100 ) / ( NumberVar - 1 ) );
fflush( stdout );
}
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -0,0 +1,70 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_simple.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_SIMPLE_H
# define BOOM_SIMPLE_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeSimple();
# endif

View File

@ -0,0 +1,224 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_simul.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 08.08.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <math.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_optim.h"
# include "boom_gradient.h"
# include "boom_simul.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBehOptimizeSimul |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeSimul( BehFigure )
befig_list *BehFigure;
{
beaux_list *BehAux;
boombefiginfo *FigInfo;
long Cost;
long NewCost;
long Iteration;
long Amplitude;
long MaxIteration;
long MaxAmplitude;
chain_list *SimulOrder;
chain_list *NewOrder;
int Level;
FigInfo = GetBoomBehFigInfo( BehFigure );
MaxIteration = FigInfo->ITERATION;
MaxAmplitude = FigInfo->AMPLITUDE;
Level = FigInfo->OPTIM_LEVEL;
if ( MaxIteration <= 0 ) MaxIteration = 50;
if ( MaxAmplitude <= 0 ) MaxAmplitude = 1 + (BddLocalSystem->NUMBER_VAR / 4);
MaxIteration = MaxIteration * (Level + 1);
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Compute initial cost !\n" );
}
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
/*
SimulOrder = BoomBehGetBddOrder( BehFigure );
*/
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld\n", Cost );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Compute initial order\n" );
}
if ( Level >= 1 )
{
SimulOrder = BoomBehGradientBddOrder( BehFigure );
}
else
{
SimulOrder = BoomBehGetBddOrder( BehFigure );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "done\n" );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
for ( Iteration = 0; Iteration < MaxIteration; Iteration++ )
{
Amplitude = 1 + (long)( (double)MaxAmplitude * exp( - (double)Iteration / 5.0 ) );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Iteration %ld, Amplitude %ld\n", Iteration, Amplitude );
}
BoomBehRandomBddOrder( BehFigure, Amplitude );
NewOrder = BoomBehGetBddOrder( BehFigure );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
freechain( SimulOrder );
SimulOrder = NewOrder;
}
else
{
BoomBehRebuildBddNode( BehFigure, SimulOrder );
freechain( NewOrder );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3ld\b\b\b", ( ( Iteration + 1 ) * 100 ) / MaxIteration );
fflush( stdout );
}
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Simul cost : %ld\n", Cost );
}
BoomBehRebuildBddNode( BehFigure, SimulOrder );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -0,0 +1,74 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_simul.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_SIMUL_H
# define BOOM_SIMUL_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_SIMUL_EXPLOSION_LIMIT 10000
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeSimul();
# endif

View File

@ -0,0 +1,226 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_top.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_top.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| BoomBehOptimizeTop |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeTop( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
beaux_list *BehAux;
char *ReorderLevel;
bddvar NumberChild;
bddvar BestChild;
bddvar ChildCount;
bddvar ChildTo;
bddvar ChildFrom;
char SwapReorder;
long Cost;
long NewCost;
FigInfo = GetBoomBehFigInfo( BehFigure );
NumberChild = BddLocalSystem->NUMBER_VAR;
ReorderLevel = (char *)autallocblock( sizeof( char ) * NumberChild );
for ( ChildFrom = 0; ChildFrom < ( NumberChild - 1 ); ChildFrom++ )
{
ReorderLevel[ ChildFrom ] = 1;
}
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Initial cost %ld\n", Cost );
}
ChildCount = ( NumberChild - 1 );
ChildFrom = 0;
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
while ( ChildCount > 0 )
{
if ( IsBoomDebugLevel2() )
{
BoomPrintf( stdout, "-> ChildFrom %d\n", ChildFrom );
}
ReorderLevel[ ChildFrom ] = 0;
BestChild = ChildFrom;
for ( ChildTo = ChildFrom; ChildTo < ( NumberChild - 1 ); ChildTo++ )
{
if ( IsBoomDebugLevel2() )
{
BoomPrintf( stdout, "-> Swap %d and %d\n", ChildTo, ChildTo + 1 );
}
swapbddvar( (bddsystem *)0, ChildTo );
SwapReorder = ReorderLevel[ ChildTo ];
ReorderLevel[ ChildTo ] = ReorderLevel[ ChildTo + 1 ];
ReorderLevel[ ChildTo + 1 ] = SwapReorder;
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
BestChild = ChildTo + 1; Cost = NewCost;
}
}
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "--> Best child %d\n", BestChild );
BoomPrintf( stdout, "--> Best cost %ld\n", Cost );
}
for ( ChildTo = ( NumberChild - 1 ); ChildTo > BestChild; ChildTo-- )
{
# ifdef BDD_DEBUG
if ( IsBoomDebugLevel1() )
{
fprintf( stdout, "-> UnSwap %d and %d\n", ChildTo - 1, ChildTo );
}
# endif
SwapReorder = ReorderLevel[ ChildTo - 1 ];
ReorderLevel[ ChildTo - 1 ] = ReorderLevel[ ChildTo ];
ReorderLevel[ ChildTo ] = SwapReorder;
swapbddvar( (bddsystem *)0, ChildTo - 1 );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-4d\b\b\b\b",
( ( NumberChild - ChildCount ) * 100 ) / ( NumberChild - 1 ) );
fflush( stdout );
}
while ( ! ReorderLevel[ ChildFrom ] )
{
ChildFrom = ChildFrom + 1;
}
ChildCount = ChildCount - 1;
}
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
autfreeblock( ReorderLevel );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

View File

@ -0,0 +1,70 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_top.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_TOP_H
# define BOOM_TOP_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeTop();
# endif

View File

@ -0,0 +1,385 @@
/*------------------------------------------------------------\
| |
| 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 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 : BOOM |
| |
| File : boom_window.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include ABE_H
# include ABV_H
# include ABT_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "boom_error.h"
# include "boom_debug.h"
# include "boom_shared.h"
# include "boom_aux.h"
# include "boom_abl.h"
# include "boom_bdd.h"
# include "boom_cost.h"
# include "boom_window.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Boom Beh Reorder Window 2 |
| |
\------------------------------------------------------------*/
int BoomBehReorderWindow2( BehFigure, BehAux, BddVar, PCost )
befig_list *BehFigure;
beaux_list *BehAux;
bddvar BddVar;
long *PCost;
{
long NewCost;
swapbddvar( (bddsystem *)0, BddVar );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( NewCost < *PCost )
{
*PCost = NewCost;
return( 1 );
}
else
if ( NewCost == *PCost )
{
return( 0 );
}
swapbddvar( BddLocalSystem, BddVar );
return( 0 );
}
/*------------------------------------------------------------\
| |
| Boom Beh Reorder Window 3 |
| |
\------------------------------------------------------------*/
int BoomBehReorderWindow3( BehFigure, BehAux, BddVar, PCost )
befig_list *BehFigure;
beaux_list *BehAux;
bddvar BddVar;
long *PCost;
{
long Cost;
long NewCost;
int BestOrder;
BestOrder = BOOM_WINDOW_REORDER_123;
Cost = *PCost;
NewCost = Cost;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Window3: Initial cost %ld\n", Cost );
}
swapbddvar( (bddsystem *)0, BddVar );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
BestOrder = BOOM_WINDOW_REORDER_213;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Window3: 213 new cost %ld\n", Cost );
}
}
swapbddvar( (bddsystem *)0, BddVar );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
BestOrder = BOOM_WINDOW_REORDER_231;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Window3: 231 new cost %ld\n", Cost );
}
}
swapbddvar( (bddsystem *)0, BddVar );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
BestOrder = BOOM_WINDOW_REORDER_321;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Window3: 321 new cost %ld\n", Cost );
}
}
swapbddvar( (bddsystem *)0, BddVar );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
BestOrder = BOOM_WINDOW_REORDER_312;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Window3: 312 new cost %ld\n", Cost );
}
}
swapbddvar( (bddsystem *)0, BddVar );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
NewCost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel0() )
{
BoomPrintf( stdout, "NewCost: %ld\n", NewCost );
}
if ( NewCost < Cost )
{
Cost = NewCost;
BestOrder = BOOM_WINDOW_REORDER_132;
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Window3: 132 new cost %ld\n", Cost );
}
}
switch ( BestOrder )
{
case BOOM_WINDOW_REORDER_123 : swapbddvar( (bddsystem *)0, BddVar );
break;
case BOOM_WINDOW_REORDER_213 : swapbddvar( (bddsystem *)0, BddVar );
swapbddvar( (bddsystem *)0, BddVar );
break;
case BOOM_WINDOW_REORDER_231 : swapbddvar( (bddsystem *)0, BddVar );
swapbddvar( (bddsystem *)0, BddVar );
swapbddvar( (bddsystem *)0, BddVar );
break;
case BOOM_WINDOW_REORDER_321 : swapbddvar( (bddsystem *)0, BddVar );
swapbddvar( (bddsystem *)0, BddVar );
break;
case BOOM_WINDOW_REORDER_312 : swapbddvar( (bddsystem *)0, BddVar );
break;
}
*PCost = Cost;
return( BestOrder != BOOM_WINDOW_REORDER_123 );
}
/*------------------------------------------------------------\
| |
| BoomBehOptimizeWindow |
| |
\------------------------------------------------------------*/
void BoomBehOptimizeWindow( BehFigure )
befig_list *BehFigure;
{
boombefiginfo *FigInfo;
beaux_list *BehAux;
short *ReorderLevel;
bddvar NumberChild;
bddvar ChildCount;
bddvar ChildFrom;
int AnySwap;
int Moved;
long Cost;
FigInfo = GetBoomBehFigInfo( BehFigure );
NumberChild = BddLocalSystem->NUMBER_VAR;
ReorderLevel = (short *)autallocblock( sizeof( short ) * NumberChild );
for ( ChildFrom = 0; ChildFrom < ( NumberChild - 1 ); ChildFrom++ )
{
ReorderLevel[ ChildFrom ] = 1;
}
BehAux = BoomBehComputeAux( BehFigure, BehFigure->BEAUX );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Initial cost %ld\n", Cost );
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "\t--> Optimization %% 0\b" );
fflush( stdout );
}
do
{
AnySwap = 0;
for ( ChildCount = 0; ChildCount < NumberChild - 1; ChildCount++ )
{
if ( ReorderLevel[ ChildCount ] )
{
if ( ChildCount < NumberChild - 2 )
{
Moved = BoomBehReorderWindow3( BehFigure, BehAux, ChildCount, &Cost );
}
else
{
Moved = BoomBehReorderWindow2( BehFigure, BehAux, ChildCount, &Cost );
}
if ( Moved )
{
AnySwap = 1;
if ( ChildCount > 0 ) ReorderLevel[ ChildCount - 1 ] = 1;
if ( ChildCount > 1 ) ReorderLevel[ ChildCount - 2 ] = 1;
ReorderLevel[ ChildCount + 1 ] = 1;
if ( ChildCount < NumberChild - 2 ) ReorderLevel[ ChildCount + 2 ] = 1;
if ( ChildCount < NumberChild - 3 ) ReorderLevel[ ChildCount + 3 ] = 1;
if ( ChildCount < NumberChild - 4 ) ReorderLevel[ ChildCount + 4 ] = 1;
}
else
{
ReorderLevel[ ChildCount ] = 0;
}
}
if ( ( FigInfo->VERBOSE ) &&
( ! BoomDebugFlag ) )
{
fprintf( stdout, "%-3d\b\b\b", ( ( ChildCount + 1 ) * 100 ) / ( NumberChild - 1 ) );
fflush( stdout );
}
}
}
while ( AnySwap );
if ( FigInfo->VERBOSE )
{
fprintf( stdout, "\n\n" );
}
autfreeblock( ReorderLevel );
BehAux = BoomBehComputeAux( BehFigure, BehAux );
Cost = BoomBehGiveCost( BehFigure );
if ( IsBoomDebugLevel1() )
{
BoomPrintf( stdout, "Final cost %ld\n", Cost );
}
}

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 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 : BOOM |
| |
| File : boom_window.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 06.06.00 |
| |
\------------------------------------------------------------*/
# ifndef BOOM_WINDOW_H
# define BOOM_WINDOW_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define BOOM_WINDOW_REORDER_123 0
# define BOOM_WINDOW_REORDER_213 1
# define BOOM_WINDOW_REORDER_231 2
# define BOOM_WINDOW_REORDER_321 3
# define BOOM_WINDOW_REORDER_312 4
# define BOOM_WINDOW_REORDER_132 5
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void BoomBehOptimizeWindow();
extern int BoomBehReorderWindow3();
extern int BoomBehReorderWindow2();
# endif

View File

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

View File

@ -0,0 +1,2 @@
man_MANS = fmi.1
EXTRA_DIST = $(man_MANS)

View File

@ -0,0 +1,49 @@
.TH FSP 1 "October 1, 1997" "ASIM/LIP6" "CAO\-VLSI Reference Manual"
.SH NAME
.TP
fmi
\- FSM state miminization
.so man1/alc_origin.1
.SH SYNOPSIS
.TP
\fBfmi\fP [\fI-V\fP] \fIinput_file\fP \fIoutput_file\fP
.br
.SH DESCRIPTION
.br
Made to run on FSM descriptions, \fBfmi\fP supports the same subset of VHDL as syf
(for further informations about this subset see SYF(1) and FSM(5)).
\fBfmi\fP uses a Reduced Ordered Binary Decision Diagrams representation and
identifies equivalent states.
After this step, it drives a new FSM where all equivalent states are replaced
by a single state.
.br
As a restriction \fBfmi\fP doesn't handle don't cares (as this much more
difficult).
.SH ENVIRONMENT VARIABLES
.br
.HP
.ti 7
\fIMBK_WORK_LIB\fP gives the path of the FSM description.
The default value is the current directory.
.br
.HP
.ti 7
\fIMBK_CATA_LIB\fP gives some auxiliary pathes for the FSM descriptions.
The default value is the current directory.
.SH OPTIONS
.ti 7
\-V
Sets verbose mode on. Each step of the minimization is displayed on the
standard output.
.br
.SH EXAMPLE
.br
fmi digi digi_min
.SH SEE ALSO
.br
\fBsyf\fP (1), \fBfsp\fP (1), \fBfsm\fP (5), \fBxfsm\fP (1).
.so man1/alc_bug_report.1

View File

@ -0,0 +1,12 @@
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = fmi
fmi_LDADD = @LIBS@ \
-lFtl -lFks -lFvh -lFsm \
-lBdd -lAbl -lAut -lMut
fmi_SOURCES = \
fmi_bdd.c fmi_main.c fmi_optim.c fmi_parse.c fsa_bdd.c \
fmi_bdd.h fmi_main.h fmi_optim.h fmi_parse.h

View File

@ -0,0 +1,190 @@
/*------------------------------------------------------------\
| |
| Tool : FSA |
| |
| File : fmi_bdd.c |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 04.12.96 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <string.h>
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include FSM_H
# include FTL_H
# include "fmi_bdd.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Private variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Fmi Fsm Make Bdd Node |
| |
\------------------------------------------------------------*/
void FmiMakeFsmBddNode( FsmFigure )
fsmfig_list *FsmFigure;
{
fsmstate_list *ScanState;
fsmlocout_list *ScanLocout;
fsmtrans_list *ScanTrans;
bddnode *BddNode;
bddnode *BddNodeOut;
bddnode *BddNodeLocout;
setbddlocalcircuit( FsmFigure->CIRCUIT );
setbddlocalsystem( BddLocalCircuit->BDD_SYSTEM );
for ( ScanTrans = FsmFigure->TRANS;
ScanTrans != (fsmtrans_list *)0;
ScanTrans = ScanTrans->NEXT )
{
ScanTrans->BDD = addbddcircuitabl( (bddcircuit *)0, ScanTrans->ABL );
}
for ( ScanState = FsmFigure->STATE;
ScanState != (fsmstate_list *)0;
ScanState = ScanState->NEXT )
{
BddNode = BddLocalSystem->ONE;
for ( ScanLocout = ScanState->LOCOUT;
ScanLocout != (fsmlocout_list *)0;
ScanLocout = ScanLocout->NEXT )
{
BddNodeOut = searchbddcircuitin( (bddcircuit *)0, ScanLocout->OUT->NAME );
if ( ScanLocout->ABL != (chain_list *)0 )
{
BddNodeLocout = addbddcircuitabl( (bddcircuit *)0, ScanLocout->ABL );
}
else
{
BddNodeLocout = BddLocalSystem->ZERO;
}
BddNodeLocout = applybddnode( (bddsystem *)0, ABL_NXOR,
decbddrefext( BddNodeLocout ),
decbddrefext( BddNodeOut ) );
BddNode = applybddnode( (bddsystem *)0, ABL_AND,
decbddrefext( BddNode ),
decbddrefext( BddNodeLocout ) );
}
BddNode = addbddcircuitout( (bddcircuit *)0, ScanState->NAME, BddNode );
ScanState->USER = (void *)BddNode;
}
#if 0
testbddcircuit( (bddcircuit *)0 );
#endif
}
/*------------------------------------------------------------\
| |
| Fmi Fsm Make Bdd Circuit |
| |
\------------------------------------------------------------*/
bddcircuit *FmiMakeFsmBddCircuit( FsmFigure )
fsmfig_list *FsmFigure;
{
fsmin_list *ScanIn;
fsmout_list *ScanOut;
bddsystem *BddSystem;
bddcircuit *BddCircuit;
BddSystem = createbddsystem( 50, 10000, 1000, 900000 );
reorderbddsystemdynamic( BddSystem, reorderbddsystemsimple, 100000, 50 );
SetBddSystemNoWarning( BddSystem );
BddCircuit = createbddcircuit( FsmFigure->NAME,
FsmFigure->NUMBER_IN + FsmFigure->NUMBER_OUT,
FsmFigure->NUMBER_STATE, BddSystem );
for ( ScanIn = FsmFigure->IN;
ScanIn != (fsmin_list *)0;
ScanIn = ScanIn->NEXT )
{
addbddcircuitin( (bddcircuit *)0, ScanIn->NAME,
(bddindex )0, BDD_IN_MODE_LAST );
}
for ( ScanOut = FsmFigure->OUT;
ScanOut != (fsmout_list *)0;
ScanOut = ScanOut->NEXT )
{
addbddcircuitin( (bddcircuit *)0, ScanOut->NAME,
(bddindex )0, BDD_IN_MODE_LAST );
}
FsmFigure->CIRCUIT = BddCircuit;
FmiMakeFsmBddNode( FsmFigure );
return( FsmFigure->CIRCUIT );
}
/*------------------------------------------------------------\
| |
| Fmi Fsm Convert Bdd Circuit |
| |
\------------------------------------------------------------*/
void FmiConvertFsmBddCircuit( FsmFigure )
fsmfig_list *FsmFigure;
{
bddcircuit *BddCircuit;
bddsystem *BddSystem;
BddCircuit = FsmFigure->CIRCUIT;
BddSystem = BddCircuit->BDD_SYSTEM;
reorderbddsystemwindow( BddSystem );
convertfsmbddnodeabl( FsmFigure );
destroybddcircuit( BddCircuit );
destroybddsystem( BddSystem );
FsmFigure->CIRCUIT = (bddcircuit *)0;
}

View File

@ -0,0 +1,46 @@
/*------------------------------------------------------------\
| |
| Tool : FMI |
| |
| File : fmi_bdd.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 04.12.96 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef FMI_BDD_H
# define FMI_BDD_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern bddcircuit *FmiMakeFsmBddCircuit();
extern void FmiConvertFsmBddCircuit();
# endif

View File

@ -0,0 +1,187 @@
/*------------------------------------------------------------\
| |
| 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 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 : FMI |
| |
| File : fmi_main.c |
| |
| Author : Jacomme Ludovic |
| |
| Date : 01.11.94 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include FSM_H
# include FTL_H
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "fmi_parse.h"
# include "fmi_bdd.h"
# include "fmi_optim.h"
# include "fmi_main.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Fmi Usage |
| |
\------------------------------------------------------------*/
void FmiUsage()
{
fprintf( stderr, "\t\tfmi [Options] filename1 filename2\n\n" );
fprintf( stdout, "\t\tOptions : -V Sets Verbose mode on\n" );
fprintf( stdout, "\n" );
exit( 1 );
}
/*------------------------------------------------------------\
| |
| Main |
| |
\------------------------------------------------------------*/
int main( argc, argv )
int argc;
char *argv[];
{
char *InputFileName;
char *OutputFileName;
int Number;
fsmfig_list *FsmFigure;
int FlagVerbose = 0;
alliancebanner_with_contrib( "FMI", FMI_VERSION, "FSM Minimization", "2000",
ALLIANCE_VERSION, "Frédéric Pétrot, Ludovic Jacomme", "Jean-Marie Alexandre" );
mbkenv();
autenv();
ablenv();
bddenv();
fsmenv();
if ( argc < 1 ) FmiUsage();
InputFileName = (char *)0;
OutputFileName = (char *)0;
for ( Number = 1; Number < argc; Number++ )
{
if ( ! strcmp( argv[ Number ], "-V" ) ) FlagVerbose = 1;
else
if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ];
else
if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ];
else
FmiUsage();
}
if ( InputFileName == (char *)0 ) FmiUsage();
InputFileName = autbasename( InputFileName, FSM_IN );
if ( OutputFileName == (char *)0 )
{
OutputFileName = autallocblock( strlen( InputFileName ) + 3 );
sprintf( OutputFileName, "%sfmi", InputFileName );
}
else
{
OutputFileName = autbasename( OutputFileName, FSM_IN );
}
if ( FlagVerbose )
{
fprintf( stdout, "\t--> Run FSM Compiler\n" );
fprintf( stdout, "\t--> Compile file %s\n", InputFileName );
}
FsmFigure = FmiParseFsm( InputFileName );
if ( FlagVerbose )
{
fprintf( stdout, "\t--> Build Binay Decision Diagrams\n" );
}
FmiMakeFsmBddCircuit( FsmFigure );
if ( FlagVerbose )
{
fprintf( stdout, "\t--> Identify equivalent states\n" );
}
FsmFigure = FmiOptimizeFsm( FsmFigure );
FsmFigure->NAME = namealloc( OutputFileName );
if ( FlagVerbose )
{
fprintf( stdout, "\t--> Save file %s\n", OutputFileName );
}
savefsmfig( FsmFigure );
return( 0 );
}

View File

@ -0,0 +1,70 @@
/*------------------------------------------------------------\
| |
| 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 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 : FSP |
| |
| File : fsp_main.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 01.11.94 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef FSP_MAIN_H
# define FSP_MAIN_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,608 @@
/*------------------------------------------------------------\
| |
| Tool : FMI |
| |
| File : fmi_optim.c |
| |
| Author : Jean Marie Alexandre |
| |
| Date : 20.09.00 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
# include MUT_H
# include LOG_H
# include AUT_H
# include ABL_H
# include BDD_H
# include FSM_H
# include FTL_H
# include "fmi_optim.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Private variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Parse Fsm File |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Fmi Del Elm |
| |
\------------------------------------------------------------*/
void
delfmielm (elm)
fmicelm_list *elm;
{
fmicelm_list *DelElem;
fmicelm_list *ScanElem;
ScanElem = elm;
while ( ScanElem != (fmicelm_list *) 0)
{
DelElem = ScanElem;
ScanElem = ScanElem->NEXT;
autfreeheap ((char *) DelElem, sizeof (fmicelm_list));
}
}
/*------------------------------------------------------------\
| |
| Fmi Del Classe |
| |
\------------------------------------------------------------*/
void
delfmiclasse (classe)
fmiclass_list *classe;
{
fmiclass_list *DelClass;
fmiclass_list *ScanClass;
ScanClass = classe;
while (ScanClass != (fmiclass_list *) 0)
{
DelClass = ScanClass;
ScanClass = ScanClass->NEXT;
autfreeheap((char *)DelClass, sizeof(fmiclass_list));
}
}
/*------------------------------------------------------------\
| |
| Fmi Alloc Elm |
| |
\------------------------------------------------------------*/
fmicelm_list *
allocfmielm ()
{
return (fmicelm_list *) (autallocheap(sizeof (fmicelm_list)));
}
/*------------------------------------------------------------\
| |
| Fmi Alloc Classe |
| |
\------------------------------------------------------------*/
fmiclass_list *
allocfmiclasse ()
{
return (fmiclass_list *) (autallocheap(sizeof (fmiclass_list)));
}
/*------------------------------------------------------------\
| |
| AddCLassElm |
| |
\------------------------------------------------------------*/
fmicelm_list *
AddClassElm (elm, state)
fmicelm_list *elm;
fsmstate_list *state;
{
fmicelm_list *new;
new = allocfmielm ();
new->STATE = state;
new->NEXT = elm;
return new;
}
/*------------------------------------------------------------\
| |
| AddCLass |
| |
\------------------------------------------------------------*/
fmiclass_list *
AddClass (classe)
fmiclass_list *classe;
{
fmiclass_list *new;
new = allocfmiclasse ();
new->NEXT = classe;
return new;
}
/*------------------------------------------------------------\
| |
| FmiRazUser |
| |
\------------------------------------------------------------*/
fsmstate_list *
FmiRazUser (state)
fsmstate_list *state;
{
fsmstate_list *ScanState;
fsmstate_list *head;
head = state;
for (ScanState = state;
ScanState != (fsmstate_list *) 0; ScanState = ScanState->NEXT)
{
ScanState->USER = NULL;
}
return (head);
}
/*------------------------------------------------------------\
| |
| FmiRazFlag |
| |
\------------------------------------------------------------*/
void
FmiRazFlag (classe)
fmiclass_list *classe;
{
fmiclass_list *ScanClasse;
fmicelm_list *Scanelm;
fmiclass_list *head;
head = classe;
for (ScanClasse = classe;
ScanClasse != (fmiclass_list *) 0; ScanClasse = ScanClasse->NEXT)
{
for (Scanelm = ScanClasse->ELM;
Scanelm != (fmicelm_list *) 0; Scanelm = Scanelm->NEXT)
{
ClearFmiClass (Scanelm->STATE);
}
}
}
/*------------------------------------------------------------\
| |
| FmiClassedansUser |
| |
\------------------------------------------------------------*/
fmiclass_list *
FmiClassedansUser (classe)
fmiclass_list *classe;
{
fmicelm_list *Scanelm;
fmiclass_list *Scanclasse;
for (Scanclasse = classe;
Scanclasse != (fmiclass_list *) 0; Scanclasse = Scanclasse->NEXT)
{
for (Scanelm = Scanclasse->ELM;
Scanelm != (fmicelm_list *) 0; Scanelm = Scanelm->NEXT)
{
Scanelm->STATE->USER = (void *) Scanclasse;
}
}
return (classe);
}
/*------------------------------------------------------------\
| |
| Fmitestin |
| |
\------------------------------------------------------------*/
int
Fmitestin (State1, State2)
fsmstate_list *State1;
fsmstate_list *State2;
{
chain_list *ScanChain1;
chain_list *ScanChain2;
fsmtrans_list *Trans1;
fsmtrans_list *Trans2;
fsmstate_list *SuccState1;
fsmstate_list *SuccState2;
bddnode *BddNode1;
bddnode *BddNode2;
bddnode *BddNode;
for (ScanChain1 = State1->FROM;
ScanChain1 != (chain_list *) 0; ScanChain1 = ScanChain1->NEXT)
{
Trans1 = (fsmtrans_list *) ScanChain1->DATA;
SuccState1 = Trans1->TO;
BddNode1 = Trans1->BDD;
for (ScanChain2 = State2->FROM;
ScanChain2 != (chain_list *) 0; ScanChain2 = ScanChain2->NEXT)
{
Trans2 = (fsmtrans_list *) ScanChain2->DATA;
BddNode2 = Trans2->BDD;
BddNode =
applybddnode ((bddsystem *) 0, ABL_AND, BddNode1, BddNode2);
decbddrefext (BddNode);
if (BddNode != BddLocalSystem->ZERO)
{
SuccState2 = Trans2->TO;
if (SuccState2->USER != SuccState1->USER)
{
return 0;
}
}
}
}
return 1;
}
/*------------------------------------------------------------\
| |
| Fmisucc |
| |
\------------------------------------------------------------*/
int
Fmisucc (State1, State2)
fsmstate_list *State1;
fsmstate_list *State2;
{
return (State1->USER == State2->USER) && Fmitestin (State1, State2);
}
/*------------------------------------------------------------\
| |
| FmiRec |
| |
\------------------------------------------------------------*/
fsmfig_list *
FmiRec (fsm, classe)
fsmfig_list *fsm;
fmiclass_list *classe;
{
fmiclass_list *ScanClasse;
fsmtrans_list *ScanTrans;
chain_list *ScanChain1;
fsmstate_list *State, *FromState, *ToState;
fsmtrans_list *trans;
fsmfig_list *NewFsm;
fsmin_list *ScanIn;
fsmout_list *ScanOut;
fsmport_list *ScanPort;
fsmlocout_list *ScanLocout;
for (ScanTrans = fsm->TRANS; ScanTrans; ScanTrans = ScanTrans->NEXT)
{
ClearFmiClass (ScanTrans);
}
/* Duplication of the old FSM entity */
NewFsm = addfsmfig ("$$");
NewFsm->CLOCK = fsm->CLOCK;
NewFsm->CLOCK_ABL = dupablexpr (fsm->CLOCK_ABL);
for (ScanIn = fsm->IN; ScanIn; ScanIn = ScanIn->NEXT)
{
addfsmin (NewFsm, ScanIn->NAME);
}
for (ScanOut = fsm->OUT; ScanOut; ScanOut = ScanOut->NEXT)
{
addfsmout (NewFsm, ScanOut->NAME);
}
for (ScanPort = fsm->PORT; ScanPort; ScanPort = ScanPort->NEXT)
{
addfsmport (NewFsm, ScanPort->NAME, ScanPort->DIR, ScanPort->TYPE);
}
for (ScanClasse = classe;
ScanClasse != (fmiclass_list *) 0; ScanClasse = ScanClasse->NEXT)
{
State = addfsmstate (NewFsm, ScanClasse->ELM->STATE->NAME);
for (ScanLocout = ScanClasse->ELM->STATE->LOCOUT;
ScanLocout; ScanLocout = ScanLocout->NEXT)
{
addfsmlocout (State, searchfsmout (NewFsm, ScanLocout->OUT->NAME),
dupablexpr (ScanLocout->ABL), NULL);
}
}
if (fsm->FIRST_STATE) {
NewFsm->FIRST_STATE =
searchfsmstate (NewFsm,
((fmiclass_list *) fsm->FIRST_STATE->USER)->ELM->STATE->
NAME);
SetFsmFirstState (NewFsm->FIRST_STATE);
} else
{
NewFsm->FIRST_STATE = NULL;
}
for (ScanClasse = classe;
ScanClasse != (fmiclass_list *) 0; ScanClasse = ScanClasse->NEXT)
{
State = ScanClasse->ELM->STATE;
for (ScanChain1 = State->FROM;
ScanChain1 != (chain_list *) 0; ScanChain1 = ScanChain1->NEXT)
{
FromState = searchfsmstate (NewFsm, ScanClasse->ELM->STATE->NAME);
ToState = searchfsmstate (NewFsm,
((fmiclass_list
*) ((fsmtrans_list *)
ScanChain1->DATA)->TO->USER)->
ELM->STATE->NAME);
trans =
addfsmtrans (NewFsm, FromState, ToState,
dupablexpr (((fsmtrans_list *) ScanChain1->DATA)->
ABL));
}
}
if ( IsFsmFigMixedRtl( fsm ) )
{
NewFsm->FIGURE = fsm->FIGURE;
SetFsmFigMixedRtl( NewFsm );
ClearFsmFigMixedRtl( fsm );
fsm->FIGURE = (void *)0;
}
delfsmfig( fsm->NAME );
return NewFsm;
}
/*------------------------------------------------------------\
| |
| FmiOptimizeFsm |
| |
\------------------------------------------------------------*/
fsmfig_list *
FmiOptimizeFsm (FsmFigure)
fsmfig_list *FsmFigure;
{
fsmstate_list *ScanState1;
fsmstate_list *ScanState2;
fmiclass_list *ScanClasse;
fmiclass_list *classetete = NULL;
fmicelm_list *ScanElm, *Elm;
fmiclass_list *new;
fmiclass_list *act;
int modif = 0;
long int nombre;
long int n;
/***************** premier passage ******************/
for (ScanState1 = FsmFigure->STATE;
ScanState1 != (fsmstate_list *) 0; ScanState1 = ScanState1->NEXT)
{
if (ScanState1->USER != (bddnode *) 0 && (!IsFmiClass (ScanState1)))
{
classetete = AddClass (classetete);
classetete->ELM = AddClassElm (NULL, ScanState1);
SetFmiClass (ScanState1);
/* on considère maintenant que ScanState1 est dans une classe */
for (ScanState2 = ScanState1->NEXT;
ScanState2 != (fsmstate_list *) 0;
ScanState2 = ScanState2->NEXT)
{
if (ScanState2->USER != (bddnode *) 0
&& (!IsFmiClass (ScanState2)))
{
if ((bddnode *) ScanState2->USER ==
(bddnode *) ScanState1->USER)
{
classetete->ELM =
AddClassElm (classetete->ELM, ScanState2);
SetFmiClass (ScanState2);
}
}
}
}
}
# ifdef DEBUG
for (new = classetete; new; new = new->NEXT)
{
printf ("{");
for (ScanElm = new->ELM; ScanElm; ScanElm = ScanElm->NEXT)
printf ("%s%s", ScanElm->STATE->NAME, ScanElm->NEXT ? "," : "");
printf ("}\n");
}
printf ("\n");
# endif
/* remise a jour des champs USER et FLAG de STATE */
FmiRazUser (FsmFigure->STATE);
FmiRazFlag (classetete);
/* on met la classe dans le champ USER de des states pour
* que chaque état sache dans quelle classe il se trouve */
FmiClassedansUser (classetete);
/******************* deuxième passage ************/
act = classetete;
do
{
modif = 0;
new = NULL;
for (ScanClasse = act;
ScanClasse != (fmiclass_list *) 0; ScanClasse = ScanClasse->NEXT)
{
for (ScanElm = ScanClasse->ELM;
ScanElm != (fmicelm_list *) 0; ScanElm = ScanElm->NEXT)
{
if (!IsFmiClass (ScanElm->STATE))
{
new = AddClass (new);
new->ELM = AddClassElm (NULL, ScanElm->STATE);
SetFmiClass (ScanElm->STATE);
for (Elm = ScanElm->NEXT;
Elm != (fmicelm_list *) 0; Elm = Elm->NEXT)
{
if (!IsFmiClass (Elm->STATE))
{
if (Fmisucc (ScanElm->STATE, Elm->STATE))
{
new->ELM = AddClassElm (new->ELM, Elm->STATE);
SetFmiClass (Elm->STATE);
}
else
{
modif = 1;
}
}
}
}
}
}
FmiRazFlag (new);
if (modif == 1)
{
FmiClassedansUser (new);
act = new;
}
}
while (modif != 0);
classetete = act;
# ifdef DEBUG
for (new = classetete; new; new = new->NEXT)
{
printf ("{");
for (ScanElm = new->ELM; ScanElm; ScanElm = ScanElm->NEXT)
printf ("%s%s", ScanElm->STATE->NAME, ScanElm->NEXT ? "," : "");
printf ("}\n");
}
# endif
/* à partir de la classe, on reconstruit la nouvelle classe */
nombre = FsmFigure->NUMBER_STATE;
FsmFigure = FmiRec (FsmFigure, classetete);
/*delfmielm(classetete->ELM);
delfmiclasse(classetete);
delfmielm(act->ELM);
delfmiclasse(act);
*/
n = nombre;
nombre = nombre - FsmFigure->NUMBER_STATE;
fprintf( stdout, "\t--> Initial number states : %ld\n", n);
fprintf( stdout, "\t--> Number of deleted states : %ld\n", nombre);
return (FsmFigure);
}

View File

@ -0,0 +1,90 @@
/*------------------------------------------------------------\
| |
| Tool : FMI |
| |
| File : fmi_optim.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 04.12.96 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef FMI_OPTIM_H
# define FMI_OPTIM_H
/*------------------------------------------------------\
| |
| Fsm Flag |
| |
\------------------------------------------------------*/
# define FMI_CLASS (long)( 0x0004 )
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
# define IsFmiClass( T ) ( (T)->FLAGS & FMI_CLASS )
# define SetFmiClass( T ) ( (T)->FLAGS |= FMI_CLASS )
# define ClearFmiClass( T ) ( (T)->FLAGS &= ~FMI_CLASS )
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| fmiclass |
| |
\------------------------------------------------------------*/
typedef struct fmicelm_list
{
struct fmicelm_list *NEXT;
struct fsmstate_list *STATE;
} fmicelm_list;
/*------------------------------------------------------------\
| |
| fmiclass_list |
| |
\------------------------------------------------------------*/
typedef struct fmiclass_list
{
struct fmiclass_list *NEXT;
struct fmicelm_list *ELM;
} fmiclass_list;
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
extern fmiclass_list *classetete;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern fsmfig_list *FmiOptimizeFsm();
# endif

View File

@ -0,0 +1,94 @@
/*------------------------------------------------------------\
| |
| tool : fmi |
| |
| file : fmi_parse.c |
| |
| authors : jacomme ludovic |
| |
| date : 04.12.96 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| include files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include FSM_H
# include FTL_H
# include "fmi_parse.h"
/*------------------------------------------------------------\
| |
| constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| private variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| parse fsm file |
| |
\------------------------------------------------------------*/
fsmfig_list *FmiParseFsm( FsmFilename )
char *FsmFilename;
{
fsmfig_list *FsmFigure;
fsmstate_list *ScanState;
FsmFigure = getfsmfig( FsmFilename );
/* on detache l'état star */
ScanState = FsmFigure->STAR_STATE;
if ( ScanState != (fsmstate_list *)0 )
{
*ScanState->PREV = ScanState->NEXT;
if ( ScanState->NEXT != (fsmstate_list *)0 )
{
ScanState->NEXT->PREV = ScanState->PREV;
}
FsmFigure->NUMBER_STATE--;
}
ScanState = FsmFigure->STATE;
simpfsmablexpr( FsmFigure );
return( FsmFigure );
}

View File

@ -0,0 +1,44 @@
/*------------------------------------------------------------\
| |
| Tool : FMI |
| |
| File : fmi_parse.h |
| |
| Author : Jacomme Ludovic |
| |
| Date : 04.12.96 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef FMI_PARSE_H
# define FMI_PARSE_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern fsmfig_list *FmiParseFsm();
# endif

View File

@ -0,0 +1,128 @@
/*------------------------------------------------------------\
| |
| Tool : FSA |
| |
| File : fsa_bdd.c |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 04.12.96 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <string.h>
# include MUT_H
# include AUT_H
# include ABL_H
# include BDD_H
# include FSM_H
# include FTL_H
# include PAT_H
# include PPT_H
# include "fsa_error.h"
# include "fsa_bdd.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Private variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Fsa Fsm Make Bdd Circuit |
| |
\------------------------------------------------------------*/
bddcircuit *FsaFsmMakeBddCircuit( FsmFigure )
fsmfig_list *FsmFigure;
{
fsmin_list *ScanIn;
fsmout_list *ScanOut;
bddsystem *BddSystem;
bddcircuit *BddCircuit;
BddSystem = createbddsystem( 50, 10000, 1000, 900000 );
reorderbddsystemdynamic( BddSystem, reorderbddsystemsimple, 100000, 50 );
BddCircuit = createbddcircuit( FsmFigure->NAME,
FsmFigure->NUMBER_IN + FsmFigure->NUMBER_OUT,
FsmFigure->NUMBER_STATE, BddSystem );
for ( ScanIn = FsmFigure->IN;
ScanIn != (fsmin_list *)0;
ScanIn = ScanIn->NEXT )
{
addbddcircuitin( (bddcircuit *)0, ScanIn->NAME,
(bddindex )0, BDD_IN_MODE_LAST );
}
for ( ScanOut = FsmFigure->OUT;
ScanOut != (fsmout_list *)0;
ScanOut = ScanOut->NEXT )
{
addbddcircuitin( (bddcircuit *)0, ScanOut->NAME,
(bddindex )0, BDD_IN_MODE_LAST );
}
FsmFigure->CIRCUIT = BddCircuit;
makefsmbddnode( FsmFigure );
reorderbddsystemwindow( BddSystem );
return( BddCircuit );
}
/*------------------------------------------------------------\
| |
| Fsa Fsm Convert Bdd Circuit |
| |
\------------------------------------------------------------*/
void FsaFsmConvertBddCircuit( FsmFigure )
fsmfig_list *FsmFigure;
{
bddcircuit *BddCircuit;
bddsystem *BddSystem;
BddCircuit = FsmFigure->CIRCUIT;
BddSystem = BddCircuit->BDD_SYSTEM;
reorderbddsystemwindow( BddSystem );
convertfsmbddnodeabl( FsmFigure );
destroybddcircuit( BddCircuit );
destroybddsystem( BddSystem );
FsmFigure->CIRCUIT = (bddcircuit *)0;
}