HGi
This commit is contained in:
parent
e430f9bc6e
commit
607d3677bd
|
@ -0,0 +1 @@
|
|||
SUBDIRS = src man1
|
|
@ -0,0 +1,2 @@
|
|||
man_MANS = syf.1
|
||||
EXTRA_DIST = $(man_MANS)
|
|
@ -0,0 +1,119 @@
|
|||
.\" $Id: syf.1,v 1.1 2002/03/26 12:53:41 ludo Exp $
|
||||
.\" @(#)Labo.l 2.2 95/09/24 UPMC; Author: Jacomme L.
|
||||
.pl -.4
|
||||
.TH SYF 1 "October 1, 1997" "ASIM/LIP6" "CAO\-VLSI Reference Manual"
|
||||
.SH NAME
|
||||
.TP
|
||||
SYF \- Finite State Machine synthesizer.
|
||||
.so man1/alc_origin.1
|
||||
.SH SYNOPSIS
|
||||
.TP
|
||||
\f4syf \-a|j|m|u|o|r [\-CDEOPRSTV] input_name [output_name]
|
||||
.br
|
||||
.SH DESCRIPTION
|
||||
.br
|
||||
\fBsyf\fp is a Finite State Machine synthesizer.
|
||||
\fBsyf\fp allows a fast generation of VHDL Data Flow description (see \fBvbe\fP(5))
|
||||
from a VHDL Finite State Machine description (see \fBfsm\fP(5)).
|
||||
The input FSM specification can use an internal STACK.
|
||||
Both MOORE and MEALEY FSMs can be synthesized, with output registers if desired.
|
||||
For a MOORE FSM, a timing\-optimized implementation that emulates a ROM with microsequencer
|
||||
is possible.
|
||||
A scan-path for the state registers can also be implemented.
|
||||
.br
|
||||
|
||||
.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\-a\fP
|
||||
Uses "Asp" as encoding algorithm.
|
||||
.TP 10
|
||||
\f4\-j\fP
|
||||
Uses "Jedi" as encoding algorithm.
|
||||
.TP 10
|
||||
\f4\-m\fP
|
||||
Uses "Mustang" as encoding algorithm.
|
||||
.TP 10
|
||||
\f4\-u\fP
|
||||
Uses an encoding given by user through <input_name>.enc file.
|
||||
In this file, a line started by a # character is a comment.
|
||||
A valid line contains one state name followed by its hexadecimal code.
|
||||
.TP 10
|
||||
\f4\-o\fP
|
||||
Uses the one hot encoding algorithm.
|
||||
.TP 10
|
||||
\f4\-r\fP
|
||||
Uses distinct random numbers for state encoding.
|
||||
.TP 10
|
||||
\f4\-C\fP
|
||||
Checks the transition's consistency.
|
||||
.TP 10
|
||||
\f4\-D\fP
|
||||
With this option \fBsyf\fP doesn't optimize unused, i.e Don't Care, codes.
|
||||
.TP 10
|
||||
\f4\-E\fP
|
||||
Saves the encoding result in the <output_name>.enc.
|
||||
This file has the same syntax as <input_name>.enc file which is used by \-u option.
|
||||
.TP 10
|
||||
\f4\-O\fP
|
||||
With this option \fBsyf\fp places registers on the outputs.
|
||||
.TP 10
|
||||
\f4\-P\fP
|
||||
Implements a scan-path for the state registers, stack registers and possibly output registers. Scan-path mechanism is directely included in states decoder. Users should use \fBscapin\fP(5) for a correct insertion of a scan-path in a netlist.
|
||||
Please check \fBfsm\fP(5) for information about scan-path descriptions.
|
||||
.TP 10
|
||||
\f4\-R\fP
|
||||
This option is only available for MOORE FSM. With this option, \fBsyf\fP emulate
|
||||
s a ROM with micro\-sequencer implementation : there is no combinatorial logic between
|
||||
the state registers and the FSM outputs.
|
||||
This can be mandatory for external timing constraints.
|
||||
See \fBfsm\fP(5) and \fBgrog\fP(1) for more on ROM descriptions.
|
||||
.TP 10
|
||||
\f4\-S\fP
|
||||
With this option \fBsyf\fp doesn't take into account the cost of the transitions to compute
|
||||
an encoding.
|
||||
.TP 10
|
||||
\f4\-V\fP
|
||||
Verbose mode on.
|
||||
Each step of the FSM synthesis is displayed on the standard output, along with some statistics.
|
||||
.ti 7
|
||||
.SH EXAMPLE
|
||||
.br
|
||||
Environment variables:
|
||||
.br
|
||||
.ti 7
|
||||
setenv MBK_WORK_LIB /alliance/tutorials/dlxm
|
||||
.br
|
||||
.ti 7
|
||||
|
||||
\fBsyf\fP is called as follow (the dlx_ctrl.fsm is already created in /alliance/tutorials/dlxm) :
|
||||
|
||||
.ti 7
|
||||
\fBsyf\fP -sE dlx_ctrl
|
||||
|
||||
Two files will be generated, a states encoding file dlx_ctrls.enc and a VHDL data flow file /alliance/tutorials/dlxm/dlx_ctrls.vbe
|
||||
.SH SEE ALSO
|
||||
.BR fsm (5),
|
||||
.BR vbe (5),
|
||||
.BR vhdl (5),
|
||||
.BR boom (1),
|
||||
.BR boog (1),
|
||||
.BR loon (1),
|
||||
.BR scapin (1),
|
||||
.BR bop (1),
|
||||
.BR glop (1),
|
||||
.BR scmap (1),
|
||||
.BR c4map (1),
|
||||
.BR asimut (1),
|
||||
.BR proof (1),
|
||||
.BR MBK_WORK_LIB (1).
|
||||
|
||||
|
||||
.so man1/alc_bug_report.1
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
bin_PROGRAMS = syf
|
||||
|
||||
syf_LDADD = @LIBS@ \
|
||||
-lFtl -lFks -lFvh -lFsm \
|
||||
-lBdd -lAbl -lAut -lMut
|
||||
|
||||
|
||||
syf_SOURCES = \
|
||||
fbh_parse.c syf_comp.h syf_error.c syf_main.h syf_synth.c \
|
||||
fbh_parse.h syf_cost.c syf_error.h syf_must.c syf_synth.h \
|
||||
kis_parse.c syf_cost.h syf_fsm.c syf_must.h syf_tools.c \
|
||||
kis_parse.h syf_dc.c syf_fsm.h syf_onehot.c syf_tools.h \
|
||||
syf_asp.c syf_dc.h syf_fsm2fbh.c syf_onehot.h syf_user.c \
|
||||
syf_asp.h syf_encod.c syf_fsm2fbh.h syf_random.c syf_user.h \
|
||||
syf_bdd.c syf_encod.h syf_jedi.c syf_random.h syf_verify.c \
|
||||
syf_bdd.h syf_env.c syf_jedi.h syf_simp.c syf_verify.h \
|
||||
syf_comp.c syf_env.h syf_main.c syf_simp.h
|
|
@ -0,0 +1,331 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : fbh_parse.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by 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 "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "fbh_parse.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static char *SyfClockKeyword = (char *)0;
|
||||
static char *SyfCurrentStateKeyword = (char *)0;
|
||||
static char *SyfNextStateKeyword = (char *)0;
|
||||
static char *SyfReturnStateKeyword = (char *)0;
|
||||
static char *SyfControlKeyword = (char *)0;
|
||||
static char *SyfToolsKeyword = (char *)0;
|
||||
static char *SyfScanInKeyword = (char *)0;
|
||||
static char *SyfScanOutKeyword = (char *)0;
|
||||
static char *SyfScanTestKeyword = (char *)0;
|
||||
|
||||
static char *SyfStackControlKeyword[ FSM_MAX_CTRL ];
|
||||
|
||||
static char *SyfClockName;
|
||||
static char *SyfCurrentStateName;
|
||||
static char *SyfNextStateName;
|
||||
static char *SyfReturnStateName;
|
||||
static char *SyfControlName;
|
||||
static char *SyfScanInName;
|
||||
static char *SyfScanOutName;
|
||||
static char *SyfScanTestName;
|
||||
static char *SyfStackControlName[ FSM_MAX_CTRL ];
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Privates |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfInitializeKeyword()
|
||||
{
|
||||
if ( SyfClockKeyword == (char *)0 )
|
||||
{
|
||||
SyfClockKeyword = namealloc( "clock" );
|
||||
SyfCurrentStateKeyword = namealloc( "current_state" );
|
||||
SyfReturnStateKeyword = namealloc( "return_state" );
|
||||
SyfNextStateKeyword = namealloc( "next_state" );
|
||||
SyfControlKeyword = namealloc( "control" );
|
||||
SyfScanInKeyword = namealloc( "scan_in" );
|
||||
SyfScanOutKeyword = namealloc( "scan_out" );
|
||||
SyfScanTestKeyword = namealloc( "scan_test" );
|
||||
SyfToolsKeyword = namealloc( "syf" );
|
||||
|
||||
SyfStackControlKeyword[ FSM_CTRL_NOP ] = namealloc( "nop" );
|
||||
SyfStackControlKeyword[ FSM_CTRL_PUSH ] = namealloc( "push" );
|
||||
SyfStackControlKeyword[ FSM_CTRL_POP ] = namealloc( "pop" );
|
||||
}
|
||||
|
||||
SyfClockName = SyfClockKeyword;
|
||||
SyfCurrentStateName = SyfCurrentStateKeyword;
|
||||
SyfReturnStateName = SyfReturnStateKeyword;
|
||||
SyfNextStateName = SyfNextStateKeyword;
|
||||
SyfControlName = SyfControlKeyword;
|
||||
SyfScanInName = SyfScanInKeyword;
|
||||
SyfScanOutName = SyfScanOutKeyword;
|
||||
SyfScanTestName = SyfScanTestKeyword;
|
||||
|
||||
SyfStackControlName[ FSM_CTRL_NOP ] = SyfStackControlKeyword[ FSM_CTRL_NOP ];
|
||||
SyfStackControlName[ FSM_CTRL_PUSH ] = SyfStackControlKeyword[ FSM_CTRL_PUSH ];
|
||||
SyfStackControlName[ FSM_CTRL_POP ] = SyfStackControlKeyword[ FSM_CTRL_POP ];
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFbhTreatPort |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFbhTreatPort( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
fsmin_list *ScanIn;
|
||||
fsmout_list *ScanOut;
|
||||
syfinfo *SyfInfo;
|
||||
char ScanOk;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
|
||||
ScanOk = ( SyfInfo->SCAN_PATH ) ? 0x00 : 0x07;
|
||||
|
||||
for ( ScanIn = FsmFigure->IN;
|
||||
ScanIn != (fsmin_list *)0;
|
||||
ScanIn = ScanIn->NEXT )
|
||||
{
|
||||
if ( ScanIn->NAME == SyfScanInName )
|
||||
{
|
||||
ScanOk |= 0x01;
|
||||
}
|
||||
else
|
||||
if ( ScanIn->NAME == SyfScanTestName )
|
||||
{
|
||||
ScanOk |= 0x02;
|
||||
}
|
||||
}
|
||||
|
||||
for ( ScanOut = FsmFigure->OUT;
|
||||
ScanOut != (fsmout_list *)0;
|
||||
ScanOut = ScanOut->NEXT )
|
||||
{
|
||||
if ( ScanOut->NAME == SyfScanOutName )
|
||||
{
|
||||
ScanOk |= 0x04;
|
||||
}
|
||||
|
||||
Syfaddfsmsyfout( ScanOut );
|
||||
}
|
||||
|
||||
if ( ScanOk != 0x07 )
|
||||
{
|
||||
SyfError( SYF_ERROR_MISSING_SCAN_PORT, FsmFigure->NAME );
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFbhTreatPragma |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFbhTreatPragma( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
ptype_list *ScanPragma;
|
||||
syfinfo *SyfInfo;
|
||||
char *PragmaType;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
|
||||
for ( ScanPragma = FsmFigure->PRAGMA;
|
||||
ScanPragma != (ptype_list *)0;
|
||||
ScanPragma = ScanPragma->NEXT )
|
||||
{
|
||||
PragmaType = (char *)ScanPragma->TYPE;
|
||||
|
||||
if ( PragmaType == SyfCurrentStateKeyword )
|
||||
{
|
||||
SyfCurrentStateName = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfNextStateKeyword )
|
||||
{
|
||||
SyfNextStateName = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfReturnStateKeyword )
|
||||
{
|
||||
SyfReturnStateName = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfControlKeyword )
|
||||
{
|
||||
SyfControlName = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfClockKeyword )
|
||||
{
|
||||
SyfClockName = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfStackControlKeyword[ FSM_CTRL_NOP ] )
|
||||
{
|
||||
SyfStackControlName[ FSM_CTRL_NOP ] = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfStackControlKeyword[ FSM_CTRL_PUSH ] )
|
||||
{
|
||||
SyfStackControlName[ FSM_CTRL_PUSH ] = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfStackControlKeyword[ FSM_CTRL_POP ] )
|
||||
{
|
||||
SyfStackControlName[ FSM_CTRL_POP ] = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfScanInKeyword )
|
||||
{
|
||||
SyfScanInName = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfScanOutKeyword )
|
||||
{
|
||||
SyfScanOutName = ScanPragma->DATA;
|
||||
}
|
||||
else
|
||||
if ( PragmaType == SyfScanTestKeyword )
|
||||
{
|
||||
SyfScanTestName = ScanPragma->DATA;
|
||||
}
|
||||
}
|
||||
|
||||
SyfInfo->SCAN_IN = SyfScanInName;
|
||||
SyfInfo->SCAN_OUT = SyfScanOutName;
|
||||
SyfInfo->SCAN_TEST = SyfScanTestName;
|
||||
SyfInfo->CURRENT_STATE = SyfCurrentStateName;
|
||||
SyfInfo->NEXT_STATE = SyfNextStateName;
|
||||
SyfInfo->RETURN_STATE = SyfReturnStateName;
|
||||
SyfInfo->NUMBER_CTRL = FSM_MAX_CTRL;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFbhParse |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
fsmfig_list *SyfFbhParse( Name, FlagScan )
|
||||
|
||||
char *Name;
|
||||
char FlagScan;
|
||||
{
|
||||
fsmfig_list *FsmFigure;
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
|
||||
SyfInitializeKeyword();
|
||||
|
||||
FsmFigure = Syfaddfsmfig( Name );
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
|
||||
SyfInfo->SCAN_PATH = FlagScan;
|
||||
|
||||
loadfsmfig( FsmFigure, Name );
|
||||
|
||||
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--;
|
||||
}
|
||||
|
||||
SyfInfo->STACK = ( FsmFigure->STACK_SIZE != 0 );
|
||||
|
||||
SyfFbhTreatPragma( FsmFigure );
|
||||
SyfFbhTreatPort( FsmFigure );
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
Syfaddfsmsyfstate( FsmFigure, ScanState );
|
||||
}
|
||||
|
||||
return( FsmFigure );
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : fbh_parse.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef FBH_PARSE_H
|
||||
# define FBH_PARSE_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Keywords |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern fsmfig_list *SyfFbhParse();
|
||||
|
||||
# endif
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : kis_parse.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by 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 "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "kis_parse.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Privates |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfKissParse |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
fsmfig_list *SyfKissParse( Name, FlagScan )
|
||||
|
||||
char *Name;
|
||||
char FlagScan;
|
||||
{
|
||||
fsmfig_list *FsmFigure;
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
fsmout_list *ScanOut;
|
||||
|
||||
FsmFigure = Syfaddfsmfig( Name );
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
|
||||
SyfInfo->SCAN_PATH = FlagScan;
|
||||
|
||||
SyfInfo->CURRENT_STATE = namealloc( "current_state" );
|
||||
SyfInfo->RETURN_STATE = namealloc( "return_state" );
|
||||
SyfInfo->NEXT_STATE = namealloc( "next_state" );
|
||||
SyfInfo->NUMBER_CTRL = FSM_MAX_CTRL;
|
||||
|
||||
loadfsmfig( FsmFigure, Name );
|
||||
|
||||
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--;
|
||||
}
|
||||
|
||||
if ( FlagScan )
|
||||
{
|
||||
SyfInfo->SCAN_IN = namealloc( "scan_in" );
|
||||
SyfInfo->SCAN_OUT = namealloc( "scan_out" );
|
||||
SyfInfo->SCAN_TEST = namealloc( "scan_test" );
|
||||
|
||||
addfsmport( FsmFigure, SyfInfo->SCAN_IN , FSM_DIR_IN , FSM_TYPE_BIT );
|
||||
addfsmport( FsmFigure, SyfInfo->SCAN_TEST, FSM_DIR_IN , FSM_TYPE_BIT );
|
||||
addfsmport( FsmFigure, SyfInfo->SCAN_OUT , FSM_DIR_OUT, FSM_TYPE_BIT );
|
||||
|
||||
addfsmin( FsmFigure , SyfInfo->SCAN_TEST );
|
||||
addfsmin( FsmFigure , SyfInfo->SCAN_IN );
|
||||
addfsmout( FsmFigure, SyfInfo->SCAN_OUT );
|
||||
}
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
Syfaddfsmsyfstate( FsmFigure, ScanState );
|
||||
}
|
||||
|
||||
for ( ScanOut = FsmFigure->OUT;
|
||||
ScanOut != (fsmout_list *)0;
|
||||
ScanOut = ScanOut->NEXT )
|
||||
{
|
||||
Syfaddfsmsyfout( ScanOut );
|
||||
}
|
||||
|
||||
return( FsmFigure );
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : kis_parse.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef KIS_PARSE_H
|
||||
# define KIS_PARSE_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Keywords |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern fsmfig_list *SyfKissParse();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,447 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : Syf_asp.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <memory.h>
|
||||
# include <string.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_must.h"
|
||||
# include "syf_asp.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmGetAspState |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmGetAspState( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
long *StateWeightArray;
|
||||
fsmstate_list *ScanState;
|
||||
syfstate *ScanSyfState;
|
||||
long NumberState;
|
||||
long IndexState;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
|
||||
if ( SyfInfo->ASP_STATE == (long *)0 )
|
||||
{
|
||||
StateWeightArray =
|
||||
|
||||
(long *)autallocblock( sizeof( long ) * NumberState );
|
||||
|
||||
SyfInfo->ASP_STATE = StateWeightArray;
|
||||
|
||||
IndexState = 0;
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
|
||||
ScanSyfState->INDEX = IndexState;
|
||||
|
||||
StateWeightArray[ IndexState++ ] += getablexprnumatom( ScanSyfState->ABL_TRANS );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StateWeightArray = SyfInfo->ASP_STATE;
|
||||
|
||||
memset( StateWeightArray, 0, sizeof(long) * NumberState );
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
|
||||
StateWeightArray[ ScanSyfState->INDEX ] += getablexprnumatom( ScanSyfState->ABL_TRANS );
|
||||
}
|
||||
}
|
||||
|
||||
# ifdef SYF_DEBUG
|
||||
|
||||
SyfFsmViewAspState( FsmFigure );
|
||||
|
||||
# endif
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmAspEncode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmAspEncode( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
syfstate *ScanSyfState;
|
||||
|
||||
syfcode *CodeArray;
|
||||
long *TransWeightArray;
|
||||
long *OutWeightArray;
|
||||
long *CtrlWeightArray;
|
||||
long *StateWeightArray;
|
||||
|
||||
long *WeightArray;
|
||||
long *SumWeightArray;
|
||||
long *SortGroupArray;
|
||||
long *SortStateArray;
|
||||
short *SelectArray;
|
||||
long *ValueArray;
|
||||
|
||||
long NumberState;
|
||||
long NumberOut;
|
||||
long NumberBit;
|
||||
long NumberGroup;
|
||||
long NumberCtrl;
|
||||
|
||||
long CodeMax;
|
||||
long CodeValue;
|
||||
long CodeIndex;
|
||||
|
||||
long BitSetMax;
|
||||
long BitSetMask;
|
||||
long BitSetCounter;
|
||||
long RemainBit;
|
||||
long RemainBitMax;
|
||||
|
||||
long GroupIndex;
|
||||
long GroupIndexCtrl;
|
||||
long SortGroupIndex;
|
||||
long LineGroup;
|
||||
|
||||
long StateIndex;
|
||||
long SortStateIndex;
|
||||
long SumWeight;
|
||||
long TransExist;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
CodeMax = SyfInfo->NUMBER_CODE;
|
||||
CodeArray = SyfInfo->CODE_ARRAY;
|
||||
NumberBit = SyfInfo->NUMBER_BIT;
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
NumberOut = FsmFigure->NUMBER_OUT;
|
||||
NumberGroup = NumberState + NumberOut;
|
||||
NumberCtrl = FSM_MAX_CTRL - 1;
|
||||
|
||||
SyfFsmGetAspState( FsmFigure );
|
||||
SyfFsmGetMustangTrans( FsmFigure );
|
||||
SyfFsmGetMustangOut( FsmFigure );
|
||||
SyfFsmGetMustangCtrl( FsmFigure );
|
||||
|
||||
TransWeightArray = SyfInfo->MUSTANG_TRANS;
|
||||
OutWeightArray = SyfInfo->MUSTANG_OUT;
|
||||
CtrlWeightArray = SyfInfo->MUSTANG_CTRL;
|
||||
StateWeightArray = SyfInfo->ASP_STATE;
|
||||
|
||||
if ( CtrlWeightArray != (long *)0 )
|
||||
{
|
||||
NumberGroup = NumberGroup + NumberCtrl;
|
||||
}
|
||||
|
||||
SumWeightArray = (long *)autallocblock( sizeof(long) * NumberGroup );
|
||||
SortGroupArray = (long *)autallocblock( sizeof(long) * NumberGroup );
|
||||
SortStateArray = (long *)autallocblock( sizeof(long) * NumberState );
|
||||
SelectArray = (short *)autallocblock( sizeof(short) * CodeMax );
|
||||
ValueArray = (long *)autallocblock( sizeof(long) * CodeMax );
|
||||
|
||||
/*
|
||||
** Initialize possible code values
|
||||
*/
|
||||
|
||||
for ( CodeIndex = 0; CodeIndex < CodeMax; CodeIndex++ )
|
||||
{
|
||||
CodeArray[ CodeIndex ].VALUE = CodeIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
** Compute weight sum for all groups
|
||||
*/
|
||||
|
||||
# ifdef SYF_DEBUG
|
||||
|
||||
fprintf( stdout, "\nCompute weight sum for groups\n" );
|
||||
|
||||
# endif
|
||||
|
||||
WeightArray = TransWeightArray;
|
||||
LineGroup = 0;
|
||||
GroupIndexCtrl = ( NumberState + NumberOut );
|
||||
|
||||
for ( GroupIndex = 0; GroupIndex < NumberGroup; GroupIndex++ )
|
||||
{
|
||||
SumWeight = 0;
|
||||
|
||||
if ( GroupIndex == NumberState )
|
||||
{
|
||||
LineGroup = 0;
|
||||
WeightArray = OutWeightArray;
|
||||
}
|
||||
else
|
||||
if ( GroupIndex == GroupIndexCtrl )
|
||||
{
|
||||
LineGroup = 0;
|
||||
WeightArray = CtrlWeightArray;
|
||||
}
|
||||
|
||||
for ( StateIndex = 0; StateIndex < NumberState; StateIndex++ )
|
||||
{
|
||||
TransExist = WeightArray[ StateIndex + LineGroup ];
|
||||
|
||||
if ( TransExist )
|
||||
{
|
||||
SumWeight += StateWeightArray[ StateIndex ];
|
||||
}
|
||||
}
|
||||
|
||||
SumWeightArray[ GroupIndex ] = SumWeight;
|
||||
|
||||
# ifdef SYF_DEBUG
|
||||
|
||||
fprintf( stdout, "Sum %c%-3d: %d\n",
|
||||
( GroupIndex < NumberState ) ? 'E' :
|
||||
( GroupIndex < GroupIndexCtrl ) ? 'O' : 'C',
|
||||
GroupIndex, SumWeight );
|
||||
# endif
|
||||
|
||||
LineGroup += NumberState;
|
||||
}
|
||||
|
||||
/*
|
||||
** Sort sum weight array index
|
||||
*/
|
||||
|
||||
SyfFsmGetSortArray( SumWeightArray, SortGroupArray, NumberGroup );
|
||||
|
||||
/*
|
||||
** Sort state weight array index
|
||||
*/
|
||||
|
||||
SyfFsmGetSortArray( StateWeightArray, SortStateArray, NumberState );
|
||||
|
||||
/*
|
||||
** Encode states bit by bit
|
||||
*/
|
||||
|
||||
BitSetMax = 1 << ( NumberBit - 1 );
|
||||
|
||||
for ( RemainBit = NumberBit; RemainBit > 0; RemainBit-- )
|
||||
{
|
||||
RemainBitMax = 1 << ( RemainBit - 1 );
|
||||
BitSetMask = 1 << ( NumberBit - RemainBit );
|
||||
BitSetCounter = 0;
|
||||
|
||||
memset( SelectArray, 0, sizeof(short) * CodeMax );
|
||||
|
||||
for ( GroupIndex = 0; GroupIndex < NumberGroup; GroupIndex++ )
|
||||
{
|
||||
SortGroupIndex = SortGroupArray[ GroupIndex ];
|
||||
|
||||
if ( SortGroupIndex < NumberState )
|
||||
{
|
||||
WeightArray = TransWeightArray;
|
||||
LineGroup = SortGroupIndex * NumberState;
|
||||
}
|
||||
else
|
||||
if ( SortGroupIndex < GroupIndexCtrl )
|
||||
{
|
||||
WeightArray = OutWeightArray;
|
||||
LineGroup = ( SortGroupIndex - NumberState ) * NumberState;
|
||||
}
|
||||
else
|
||||
{
|
||||
WeightArray = CtrlWeightArray;
|
||||
LineGroup = ( SortGroupIndex - GroupIndexCtrl ) * NumberState;
|
||||
}
|
||||
|
||||
for ( StateIndex = 0; StateIndex < NumberState; StateIndex++ )
|
||||
{
|
||||
SortStateIndex = SortStateArray[ StateIndex ];
|
||||
|
||||
TransExist = WeightArray[ LineGroup + SortStateIndex ];
|
||||
|
||||
if ( TransExist )
|
||||
{
|
||||
CodeValue = ValueArray[ SortStateIndex ];
|
||||
/*
|
||||
** If the "BitSetMask" bit isn't currently set on this code and
|
||||
** if less than "RemainBitMax" same code have been already selected
|
||||
** then affect to this state code value the bit "BitSetMask"
|
||||
*/
|
||||
if ( ( ! ( CodeValue & BitSetMask ) ) &&
|
||||
( SelectArray[ CodeValue ] < RemainBitMax ) )
|
||||
{
|
||||
ValueArray[ SortStateIndex ] |= BitSetMask;
|
||||
SelectArray[ CodeValue ]++;
|
||||
|
||||
BitSetCounter = BitSetCounter + 1;
|
||||
|
||||
if ( BitSetCounter >= BitSetMax ) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( BitSetCounter >= BitSetMax ) break;
|
||||
}
|
||||
}
|
||||
|
||||
BitSetMask = ( 1 << NumberBit ) - 1;
|
||||
|
||||
/*
|
||||
** Assign code pointer's for states
|
||||
*/
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
StateIndex = ScanSyfState->INDEX;
|
||||
CodeValue = ValueArray[ StateIndex ] ^ BitSetMask;
|
||||
|
||||
CodeArray[ CodeValue ].USED = 1;
|
||||
ScanSyfState->CODE = &CodeArray[ CodeValue ];
|
||||
}
|
||||
|
||||
autfreeblock( SumWeightArray );
|
||||
autfreeblock( SortGroupArray );
|
||||
autfreeblock( SortStateArray );
|
||||
autfreeblock( ValueArray );
|
||||
autfreeblock( SelectArray );
|
||||
|
||||
autfreeblock( SyfInfo->MUSTANG_TRANS );
|
||||
autfreeblock( SyfInfo->MUSTANG_OUT );
|
||||
autfreeblock( SyfInfo->ASP_STATE );
|
||||
|
||||
if ( SyfInfo->MUSTANG_CTRL != (long *)0 )
|
||||
{
|
||||
autfreeblock( SyfInfo->MUSTANG_CTRL );
|
||||
}
|
||||
|
||||
SyfInfo->MUSTANG_TRANS = (long *)0;
|
||||
SyfInfo->MUSTANG_OUT = (long *)0;
|
||||
SyfInfo->MUSTANG_CTRL = (long *)0;
|
||||
SyfInfo->ASP_STATE = (long *)0;
|
||||
}
|
||||
|
||||
# ifdef SYF_DEBUG
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| View Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf View Asp State |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmViewAspState( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
long *StateWeightArray;
|
||||
long NumberState;
|
||||
long IndexLine;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
StateWeightArray = SyfInfo->ASP_STATE;
|
||||
|
||||
fprintf( stdout, "\n--> Asp state weight array" );
|
||||
|
||||
if ( StateWeightArray != (long *)0 )
|
||||
{
|
||||
fprintf( stdout, "\n " );
|
||||
|
||||
for ( IndexLine = 0; IndexLine < NumberState; IndexLine++ )
|
||||
{
|
||||
fprintf( stdout, "\nE%-3d %-3d", IndexLine, StateWeightArray[ IndexLine ] );
|
||||
}
|
||||
}
|
||||
|
||||
fprintf( stdout, "\n<-- Asp state weight array" );
|
||||
}
|
||||
|
||||
# endif
|
|
@ -0,0 +1,85 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_asp.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_ASP_H
|
||||
# define SYF_ASP_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmAspEncode();
|
||||
extern void SyfFsmGetAspState();
|
||||
|
||||
# ifdef SYF_DEBUG
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| View Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmViewAspState();
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
|
@ -0,0 +1,117 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_bdd.c |
|
||||
| |
|
||||
| Author : Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 06.03.95 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
# include FVH_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_bdd.h"
|
||||
# include "syf_error.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmMakeBddCircuit |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
bddcircuit *SyfFsmMakeBddCircuit( BddSystem, FsmFigure )
|
||||
|
||||
bddsystem *BddSystem;
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
fsmin_list *ScanIn;
|
||||
fsmout_list *ScanOut;
|
||||
bddcircuit *BddCircuit;
|
||||
|
||||
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 );
|
||||
|
||||
return( BddCircuit );
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_bdd.h |
|
||||
| |
|
||||
| Author : Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 06.03.95 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_BDD_H
|
||||
# define SYF_BDD_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern bddcircuit *SyfFsmMakeBddCircuit();
|
||||
|
||||
|
||||
# endif
|
|
@ -0,0 +1,146 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_comp.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
# include FVH_H
|
||||
# include FTL_H
|
||||
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_comp.h"
|
||||
# include "kis_parse.h"
|
||||
# include "fbh_parse.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfRemoveStable |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static void SyfRemoveStable( Expr )
|
||||
|
||||
ablexpr *Expr;
|
||||
{
|
||||
if ( ! ABL_ATOM( Expr ) )
|
||||
{
|
||||
if ( ABL_OPER( Expr ) == ABL_STABLE )
|
||||
{
|
||||
freechain( ABL_CADR( Expr ) );
|
||||
freechain( ABL_CDR( Expr ) );
|
||||
freechain( ABL_CAR( Expr ) );
|
||||
|
||||
ABL_CDR( Expr ) = (ablexpr *)0;
|
||||
ABL_ATOM_VALUE( Expr ) = getablatomzero();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
while ( ( Expr = ABL_CDR( Expr ) ) != (ablexpr *)0 )
|
||||
{
|
||||
SyfRemoveStable( ABL_CAR( Expr ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfCompile |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
fsmfig_list *SyfCompile( FileName, FlagScan, FlagSynopsys )
|
||||
|
||||
char *FileName;
|
||||
char FlagScan;
|
||||
char FlagSynopsys;
|
||||
{
|
||||
fsmfig_list *FsmFigure;
|
||||
syfinfo *SyfInfo;
|
||||
|
||||
if ( FSM_IN == FSM_VHDL_FORMAT )
|
||||
{
|
||||
FsmFigure = SyfFbhParse( FileName, FlagScan );
|
||||
}
|
||||
else
|
||||
{
|
||||
FsmFigure = SyfKissParse( FileName, FlagScan );
|
||||
}
|
||||
|
||||
if ( FlagSynopsys )
|
||||
{
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
SyfRemoveStable( FsmFigure->CLOCK_ABL );
|
||||
}
|
||||
|
||||
return( FsmFigure );
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| This file is part of the Alliance CAD System Copyright |
|
||||
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
|
||||
| |
|
||||
| Home page : http://www-asim.lip6.fr/alliance/ |
|
||||
| E-mail support : mailto:alliance-support@asim.lip6.fr |
|
||||
| |
|
||||
| This progam is free software; you can redistribute it |
|
||||
| and/or modify it under the terms of the GNU 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 : SYF |
|
||||
| |
|
||||
| File : syf_comp.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_COMP_H
|
||||
# define SYF_COMP_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern fsmfig_list *SyfCompileKiss();
|
||||
extern fsmfig_list *SyfCompile();
|
||||
|
||||
# endif
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_cost.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
# include FVH_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include <malloc.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_env.h"
|
||||
# include "syf_fsm2fbh.h"
|
||||
# include "syf_synth.h"
|
||||
# include "syf_bdd.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_cost.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFbhAblGiveCost |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
long SyfFbhAblGiveCost( FbhFigure )
|
||||
|
||||
fbfig_list *FbhFigure;
|
||||
{
|
||||
long Cost;
|
||||
fbout_list *FbhOut;
|
||||
fbaux_list *FbhAux;
|
||||
fbreg_list *FbhReg;
|
||||
biabl_list *FbhBiAbl;
|
||||
|
||||
Cost = 0;
|
||||
|
||||
for ( FbhOut = FbhFigure->BEOUT;
|
||||
FbhOut != (fbout_list *)0;
|
||||
FbhOut = FbhOut->NEXT )
|
||||
{
|
||||
if ( FbhOut->ABL != (chain_list *)0 )
|
||||
{
|
||||
Cost += getablexprnumatom( FbhOut->ABL );
|
||||
}
|
||||
}
|
||||
|
||||
for ( FbhAux = FbhFigure->BEAUX;
|
||||
FbhAux != (fbaux_list *)0;
|
||||
FbhAux = FbhAux->NEXT )
|
||||
{
|
||||
if ( FbhAux->ABL != (chain_list *)0 )
|
||||
{
|
||||
Cost += getablexprnumatom( FbhAux->ABL );
|
||||
}
|
||||
}
|
||||
|
||||
for ( FbhReg = FbhFigure->BEREG;
|
||||
FbhReg != (fbreg_list *)0;
|
||||
FbhReg = FbhReg->NEXT )
|
||||
{
|
||||
for ( FbhBiAbl = FbhReg->BIABL;
|
||||
FbhBiAbl != (biabl_list *)0;
|
||||
FbhBiAbl = FbhBiAbl->NEXT )
|
||||
{
|
||||
if ( FbhBiAbl->VALABL != (chain_list *)0 )
|
||||
{
|
||||
Cost += getablexprnumatom( FbhBiAbl->VALABL );
|
||||
}
|
||||
|
||||
if ( FbhBiAbl->CNDABL != (chain_list *)0 )
|
||||
{
|
||||
Cost += getablexprnumatom( FbhBiAbl->CNDABL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return( Cost );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfBddGiveCost |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static long SyfBddGiveCost( BddNode )
|
||||
|
||||
bddnode *BddNode;
|
||||
{
|
||||
bddnode *BddNot;
|
||||
|
||||
if ( BddNode->INDEX >= BDD_INDEX_MIN )
|
||||
{
|
||||
if ( ! ( BddNode->FLAG & SYF_BDD_COST_FLAG ) )
|
||||
{
|
||||
if ( ( BddNode->HIGH->INDEX >= BDD_INDEX_MIN ) ||
|
||||
( BddNode->LOW->INDEX >= BDD_INDEX_MIN ) )
|
||||
{
|
||||
if ( BddNode->REF_INT > 1 )
|
||||
{
|
||||
BddNode->FLAG |= SYF_BDD_COST_FLAG;
|
||||
|
||||
BddNot = applybddnodenot( (bddsystem *)0, BddNode );
|
||||
|
||||
if ( BddNot->REF_INT > 1 )
|
||||
{
|
||||
BddNot->FLAG |= SYF_BDD_COST_FLAG;
|
||||
}
|
||||
|
||||
delbddnode( (bddsystem *)0, decbddrefext( BddNot ) );
|
||||
}
|
||||
|
||||
return( SyfBddGiveCost( BddNode->LOW ) + 1 +
|
||||
SyfBddGiveCost( BddNode->HIGH ) );
|
||||
}
|
||||
}
|
||||
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_cost.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
|
||||
# ifndef SYF_COST_H
|
||||
# define SYF_COST_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define SYF_BDD_COST_FLAG (bddflag)(0x0004)
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern long SyfFsmGiveCost();
|
||||
extern long SyfFbhAblGiveCost();
|
||||
extern long SyfFbhBddGiveCost();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,243 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_synth.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_env.h"
|
||||
# include "syf_dc.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfSynthCodeDc2Abl |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfSynthCodeDc2Abl( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
syfcode *CodeArray;
|
||||
syfregstate *RegArray;
|
||||
bddsystem *BddSystem;
|
||||
bddcircuit *BddCircuit;
|
||||
bddnode *BddNode;
|
||||
bddnode *BddNodeDc;
|
||||
bddnode *BddNodeOut;
|
||||
bddnode *BddNodeOutDc;
|
||||
bddnode *BddSimp;
|
||||
bddnode *BddNot;
|
||||
long NodeSize;
|
||||
long SimpSize;
|
||||
long Index;
|
||||
long BitMask;
|
||||
long ScanBit;
|
||||
long NumberIn;
|
||||
char DecodeOut;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
CodeArray = SyfInfo->CODE_ARRAY;
|
||||
RegArray = SyfInfo->REG_ARRAY;
|
||||
DecodeOut = ( SyfInfo->REG_OUT ) && ( SyfInfo->STACK );
|
||||
NumberIn = SyfInfo->NUMBER_REG;
|
||||
|
||||
if ( DecodeOut )
|
||||
{
|
||||
NumberIn = NumberIn << 1;
|
||||
}
|
||||
|
||||
BddSystem = createbddsystem( SYF_BDD_VAR_NODE, SYF_BDD_OPER_NODE, NumberIn, SYF_BDD_MAX_NODE );
|
||||
BddCircuit = createbddcircuit( FsmFigure->NAME, NumberIn, 1, BddSystem );
|
||||
|
||||
for ( ScanBit = 0; ScanBit < SyfInfo->NUMBER_REG; ScanBit++ )
|
||||
{
|
||||
BddNode = addbddcircuitin( (bddcircuit *)0, RegArray[ ScanBit ].NAME_OUT,
|
||||
(bddindex )0, BDD_IN_MODE_LAST );
|
||||
|
||||
RegArray[ ScanBit ].NODE_OUT = BddNode;
|
||||
|
||||
if ( DecodeOut )
|
||||
{
|
||||
BddNode = addbddcircuitin( (bddcircuit *)0, RegArray[ ScanBit ].NAME_IN,
|
||||
(bddindex )0, BDD_IN_MODE_LAST );
|
||||
|
||||
RegArray[ ScanBit ].NODE_IN = BddNode;
|
||||
}
|
||||
}
|
||||
|
||||
BddNodeDc = BddSystem->ZERO;
|
||||
BddNodeOutDc = BddSystem->ZERO;
|
||||
|
||||
for ( Index = 0; Index < SyfInfo->NUMBER_CODE; Index++ )
|
||||
{
|
||||
BddNode = BddSystem->ONE;
|
||||
BddNodeOut = BddSystem->ONE;
|
||||
BitMask = 1;
|
||||
|
||||
for ( ScanBit = 0; ScanBit < SyfInfo->NUMBER_REG; ScanBit++ )
|
||||
{
|
||||
if ( CodeArray[ Index ].VALUE & BitMask )
|
||||
{
|
||||
BddNode = applybddnode( (bddsystem *)0, ABL_AND,
|
||||
decbddrefext( BddNode ),
|
||||
RegArray[ ScanBit ].NODE_OUT );
|
||||
|
||||
if ( DecodeOut )
|
||||
{
|
||||
BddNodeOut = applybddnode( (bddsystem *)0, ABL_AND,
|
||||
decbddrefext( BddNodeOut ),
|
||||
RegArray[ ScanBit ].NODE_IN );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BddNot = applybddnodenot( (bddsystem *)0, RegArray[ ScanBit ].NODE_OUT );
|
||||
BddNode = applybddnode( (bddsystem *)0, ABL_AND,
|
||||
decbddrefext( BddNode ),
|
||||
decbddrefext( BddNot ) );
|
||||
if ( DecodeOut )
|
||||
{
|
||||
BddNot = applybddnodenot( (bddsystem *)0, RegArray[ ScanBit ].NODE_IN );
|
||||
BddNodeOut = applybddnode( (bddsystem *)0, ABL_AND,
|
||||
decbddrefext( BddNodeOut ),
|
||||
decbddrefext( BddNot ) );
|
||||
}
|
||||
}
|
||||
|
||||
BitMask = BitMask << 1;
|
||||
}
|
||||
|
||||
if ( ! CodeArray[ Index ].USED )
|
||||
{
|
||||
BddNodeDc = applybddnode( (bddsystem *)0, ABL_OR,
|
||||
decbddrefext( BddNodeDc ), BddNode );
|
||||
|
||||
if ( DecodeOut )
|
||||
{
|
||||
BddNodeOutDc = applybddnode( (bddsystem *)0, ABL_OR,
|
||||
decbddrefext( BddNodeOutDc ), BddNodeOut );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CodeArray[ Index ].ABL = (chain_list *)BddNode;
|
||||
|
||||
if ( DecodeOut )
|
||||
{
|
||||
CodeArray[ Index ].ABL_OUT = (chain_list *)BddNodeOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( Index = 0; Index < SyfInfo->NUMBER_CODE; Index++ )
|
||||
{
|
||||
if ( CodeArray[ Index ].USED )
|
||||
{
|
||||
BddNode = (bddnode *)CodeArray[ Index ].ABL;
|
||||
BddSimp = simpbddnodedcoff( (bddsystem *)0, BddNode, BddNodeDc );
|
||||
|
||||
SimpSize = getbddnodesize( (bddsystem *)0, BddSimp );
|
||||
NodeSize = getbddnodesize( (bddsystem *)0, BddNode );
|
||||
|
||||
if ( SimpSize < NodeSize )
|
||||
{
|
||||
BddNode = BddSimp;
|
||||
}
|
||||
|
||||
CodeArray[ Index ].ABL =
|
||||
|
||||
convertbddcircuitabl( (bddcircuit *)0, BddNode );
|
||||
|
||||
if ( DecodeOut )
|
||||
{
|
||||
BddNodeOut = (bddnode *)CodeArray[ Index ].ABL_OUT;
|
||||
BddSimp = simpbddnodedcoff( (bddsystem *)0, BddNodeOut, BddNodeOutDc );
|
||||
|
||||
SimpSize = getbddnodesize( (bddsystem *)0, BddSimp );
|
||||
NodeSize = getbddnodesize( (bddsystem *)0, BddNodeOut );
|
||||
|
||||
if ( SimpSize < NodeSize )
|
||||
{
|
||||
BddNodeOut = BddSimp;
|
||||
}
|
||||
|
||||
CodeArray[ Index ].ABL_OUT =
|
||||
|
||||
convertbddcircuitabl( (bddcircuit *)0, BddNodeOut );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
destroybddcircuit( BddCircuit );
|
||||
destroybddsystem( BddSystem );
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_dc.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_DC_H
|
||||
# define SYF_DC_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfSynthCodeDc2Abl();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,189 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_encod.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
# include "syf_env.h"
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_tools.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_encod.h"
|
||||
# include "syf_asp.h"
|
||||
# include "syf_random.h"
|
||||
# include "syf_user.h"
|
||||
# include "syf_must.h"
|
||||
# include "syf_jedi.h"
|
||||
# include "syf_onehot.h"
|
||||
# include "syf_synth.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmEncode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmEncode( FsmFigure, Encode, Verbose,
|
||||
TreatDc, RegOut, MustCost, FileName )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
int Encode;
|
||||
int Verbose;
|
||||
int TreatDc;
|
||||
int RegOut;
|
||||
int MustCost;
|
||||
char *FileName;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
syfcode *CodeArray;
|
||||
long CodeMax;
|
||||
long NumberBit;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
|
||||
SyfInfo->REG_OUT = RegOut;
|
||||
|
||||
if ( Encode != SYF_ENCODE_ONE_HOT )
|
||||
{
|
||||
NumberBit = SyfGetNumberBit( FsmFigure->NUMBER_STATE - 1 );
|
||||
CodeMax = ( 1 << NumberBit );
|
||||
}
|
||||
else
|
||||
{
|
||||
CodeMax = NumberBit = FsmFigure->NUMBER_STATE;
|
||||
}
|
||||
|
||||
CodeArray = (syfcode *)autallocblock( sizeof( syfcode ) * CodeMax );
|
||||
|
||||
SyfInfo->CODE_ARRAY = CodeArray;
|
||||
SyfInfo->NUMBER_CODE = CodeMax;
|
||||
SyfInfo->NUMBER_BIT = NumberBit;
|
||||
SyfInfo->ENCODE = Encode;
|
||||
|
||||
switch( Encode )
|
||||
{
|
||||
case SYF_ENCODE_RANDOM :
|
||||
|
||||
if ( Verbose ) fprintf( stdout, "\t\t--> Random encoding\n" );
|
||||
SyfFsmRandomEncode( FsmFigure );
|
||||
|
||||
break;
|
||||
|
||||
case SYF_ENCODE_USER :
|
||||
|
||||
if ( Verbose ) fprintf( stdout, "\t\t--> User encoding\n" );
|
||||
SyfFsmUserEncode( FsmFigure, FileName );
|
||||
|
||||
break;
|
||||
|
||||
case SYF_ENCODE_MUSTANG :
|
||||
|
||||
if ( Verbose ) fprintf( stdout, "\t\t--> Mustang encoding\n" );
|
||||
SyfFsmMustangEncode( FsmFigure );
|
||||
|
||||
break;
|
||||
|
||||
case SYF_ENCODE_ASP :
|
||||
|
||||
if ( Verbose ) fprintf( stdout, "\t\t--> Asp encoding\n" );
|
||||
|
||||
SyfSynthTrans2Abl( FsmFigure );
|
||||
SyfFsmAspEncode( FsmFigure );
|
||||
SyfSynthFreeTransAbl( FsmFigure );
|
||||
|
||||
break;
|
||||
|
||||
case SYF_ENCODE_JEDI :
|
||||
|
||||
if ( Verbose ) fprintf( stdout, "\t\t--> Jedi encoding\n" );
|
||||
SyfFsmJediEncode( FsmFigure );
|
||||
|
||||
break;
|
||||
|
||||
case SYF_ENCODE_ONE_HOT :
|
||||
|
||||
if ( Verbose ) fprintf( stdout, "\t\t--> One hot encoding\n" );
|
||||
SyfFsmOneHotEncode( FsmFigure );
|
||||
|
||||
break;
|
||||
|
||||
default :
|
||||
|
||||
SyfError( SYF_ERROR_UNKNOWN_ENCODE_TYPE, Encode );
|
||||
}
|
||||
|
||||
if ( ( MustCost ) &&
|
||||
( Verbose ) )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Mustang cost %ld\n",
|
||||
SyfFsmGetMustangCost( FsmFigure ) );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_encod.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_ENCOD_H
|
||||
# define SYF_ENCOD_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmUserSaveCode();
|
||||
extern void SyfFsmEncode();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,170 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_env.c |
|
||||
| |
|
||||
| Author : Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 06.03.95 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
# include FVH_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_env.h"
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
long SYF_BDD_MAX_NODE = 900000;
|
||||
long SYF_BDD_VAR_NODE = 50;
|
||||
long SYF_BDD_OPER_NODE = 10000;
|
||||
long SYF_BDD_REORDER_NODE = 100000;
|
||||
long SYF_BDD_REORDER_RATIO = 50;
|
||||
void (*SYF_BDD_REORDER_FUNC)() = reorderbddsystemsimple;
|
||||
|
||||
int SYF_MUSTANG_JEDI_ATOM = 1;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfEnv( Trace )
|
||||
|
||||
int Trace;
|
||||
{
|
||||
char *Variable;
|
||||
char ReorderFunc;
|
||||
|
||||
Variable = mbkgetenv( "SYF_BDD_VAR_NODE" );
|
||||
if ( Variable != (char *)0 )
|
||||
{
|
||||
SYF_BDD_VAR_NODE = atoi( Variable );
|
||||
}
|
||||
|
||||
Variable = mbkgetenv( "SYF_BDD_MAX_NODE" );
|
||||
if ( Variable != (char *)0 )
|
||||
{
|
||||
SYF_BDD_MAX_NODE = atoi( Variable );
|
||||
}
|
||||
|
||||
Variable = mbkgetenv( "SYF_BDD_OPER_NODE" );
|
||||
if ( Variable != (char *)0 )
|
||||
{
|
||||
SYF_BDD_OPER_NODE = atoi( Variable );
|
||||
}
|
||||
|
||||
Variable = mbkgetenv( "SYF_BDD_REORDER_NODE" );
|
||||
if ( Variable != (char *)0 )
|
||||
{
|
||||
SYF_BDD_REORDER_NODE = atoi( Variable );
|
||||
}
|
||||
|
||||
Variable = mbkgetenv( "SYF_BDD_REORDER_RATIO" );
|
||||
if ( Variable != (char *)0 )
|
||||
{
|
||||
SYF_BDD_REORDER_RATIO = atoi( Variable );
|
||||
}
|
||||
|
||||
Variable = mbkgetenv( "SYF_BDD_REORDER_FUNC" );
|
||||
if ( Variable != (char *)0 )
|
||||
{
|
||||
ReorderFunc = Variable[ 0 ];
|
||||
|
||||
switch( ReorderFunc )
|
||||
{
|
||||
case 's' : SYF_BDD_REORDER_FUNC = reorderbddsystemsimple;
|
||||
break;
|
||||
|
||||
case 'w' : SYF_BDD_REORDER_FUNC = reorderbddsystemwindow;
|
||||
break;
|
||||
|
||||
case 'g' : SYF_BDD_REORDER_FUNC = garbagebddsystem;
|
||||
break;
|
||||
|
||||
default : SYF_BDD_REORDER_FUNC = (void *)0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ReorderFunc = 's';
|
||||
}
|
||||
|
||||
Variable = mbkgetenv( "SYF_MUSTANG_JEDI_ATOM" );
|
||||
if ( Variable != (char *)0 )
|
||||
{
|
||||
SYF_MUSTANG_JEDI_ATOM = atoi( Variable );
|
||||
}
|
||||
|
||||
if ( Trace )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Bdd environement\n\n" );
|
||||
fprintf( stdout, "\t\t\tSYF_BDD_VAR_NODE : %ld\n", SYF_BDD_VAR_NODE );
|
||||
fprintf( stdout, "\t\t\tSYF_BDD_MAX_NODE : %ld\n", SYF_BDD_MAX_NODE );
|
||||
fprintf( stdout, "\t\t\tSYF_BDD_OPER_NODE : %ld\n", SYF_BDD_OPER_NODE );
|
||||
fprintf( stdout, "\t\t\tSYF_BDD_REORDER_NODE : %ld\n", SYF_BDD_REORDER_NODE );
|
||||
fprintf( stdout, "\t\t\tSYF_BDD_REORDER_RATIO : %ld\n", SYF_BDD_REORDER_RATIO );
|
||||
fprintf( stdout, "\t\t\tSYF_BDD_REORDER_FUNC : %c\n", ReorderFunc );
|
||||
|
||||
fprintf( stdout, "\n\t\t--> Mustang and Jedi environement\n\n" );
|
||||
fprintf( stdout, "\t\t\tSYF_MUSTANG_JEDI_ATOM : %d\n", SYF_MUSTANG_JEDI_ATOM );
|
||||
fprintf( stdout, "\n" );
|
||||
}
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_env.h |
|
||||
| |
|
||||
| Author : Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 06.03.95 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_ENV_H
|
||||
# define SYF_ENV_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern long SYF_BDD_VAR_NODE;
|
||||
extern long SYF_BDD_MAX_NODE;
|
||||
extern long SYF_BDD_OPER_NODE;
|
||||
extern long SYF_BDD_REORDER_NODE;
|
||||
extern long SYF_BDD_REORDER_RATIO;
|
||||
extern void (*SYF_BDD_REORDER_FUNC)();
|
||||
|
||||
extern int SYF_MUSTANG_JEDI_ATOM;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfEnv();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,218 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_error.c |
|
||||
| |
|
||||
| Authors : Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
|
||||
# include "syf_error.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Private variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfDisplayError |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfDisplayError( 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 SYF_ERROR_OPEN_FILE :
|
||||
fprintf( stderr, "Unable to open file \"%s\"\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_MISSING_SCAN_PORT :
|
||||
fprintf( stderr, "Missing scan-port declaration in figure \"%s\"\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_UNKNOWN_ENCODE_TYPE :
|
||||
fprintf( stderr, "Unknown encode type \"%c\"\n", (int)Text );
|
||||
break;
|
||||
case SYF_ERROR_BAD_STACK_NO_PUSH :
|
||||
fprintf( stderr, "Bad stack, no \"push\" in figure \"%s\"\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_BAD_STACK_NO_POP :
|
||||
fprintf( stderr, "Bad stack, no \"pop\" in figure \"%s\"\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_SYNTAX :
|
||||
fprintf( stderr, "Syntax error %s\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_UNEXPECTED_EOF :
|
||||
fprintf( stderr, "Unexpected end of file error %s\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_UNKNOWN_STATE :
|
||||
fprintf( stderr, "Unknown state %s\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_DUPLICATE_CODE :
|
||||
fprintf( stderr, "Duplicate state code %s\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_WRONG_CODE :
|
||||
fprintf( stderr, "Bad state code %s\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_BDD_ATOM_UNKNOWN :
|
||||
fprintf( stderr, "Unknown atom %s, unable to make BDD\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_BDD_OPER :
|
||||
fprintf( stderr, "Illegal oper %ld, unable to make BDD\n", (long)Text );
|
||||
break;
|
||||
case SYF_ERROR_BDD_EXPR_NULL :
|
||||
fprintf( stderr, "Expression NULL, unable to make BDD\n" );
|
||||
break;
|
||||
case SYF_ERROR_BDD_LOOP :
|
||||
fprintf( stderr, "Loop on %s, unable to make BDD\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_ORDER_ATOM_UNKNOWN :
|
||||
fprintf( stderr, "Unknown atom %s, unable to order BDD\n", Text );
|
||||
break;
|
||||
case SYF_ERROR_ORDER_OPER :
|
||||
fprintf( stderr, "Illegal oper %ld, unable to order BDD\n", (long)Text );
|
||||
break;
|
||||
case SYF_ERROR_ORDER_EXPR_NULL :
|
||||
fprintf( stderr, "Expression NULL, unable to order BDD\n" );
|
||||
break;
|
||||
case SYF_ERROR_ORDER_LOOP :
|
||||
fprintf( stderr, "Loop on %s, unable to order BDD\n", Text );
|
||||
break;
|
||||
|
||||
default :
|
||||
fprintf( stderr, "Internal error number %d\n", Error );
|
||||
|
||||
}
|
||||
|
||||
autexit( 1 );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfDisplayWarning |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfDisplayWarning( File, Line, Warning, Text1, Text2 )
|
||||
|
||||
char *File;
|
||||
int Line;
|
||||
int Warning;
|
||||
char *Text1;
|
||||
char *Text2;
|
||||
{
|
||||
char *Name;
|
||||
|
||||
Name = mbkstrdup( File );
|
||||
Name[ strlen( File ) - 1 ] = '\0';
|
||||
|
||||
fprintf( stderr, "%s%d ", Name, Line );
|
||||
|
||||
switch ( Warning )
|
||||
{
|
||||
case SYF_WARNING_NO_TRANS_TO :
|
||||
fprintf( stderr, "No transition to \"%s\"\n", Text1 );
|
||||
break;
|
||||
case SYF_WARNING_NO_TRANS_FROM :
|
||||
fprintf( stderr, "No transition from \"%s\"\n", Text1 );
|
||||
break;
|
||||
case SYF_WARNING_REMOVE_UNUSED_STACK :
|
||||
fprintf( stderr, "Remove unused stack in figure \"%s\"\n", Text1 );
|
||||
break;
|
||||
case SYF_WARNING_REMOVE_STACK :
|
||||
fprintf( stderr, "Remove stack in state \"%s\"\n", Text1 );
|
||||
break;
|
||||
case SYF_WARNING_REMOVE_LOCOUT :
|
||||
fprintf( stderr, "Remove local output in state \"%s\"\n", Text1 );
|
||||
break;
|
||||
case SYF_WARNING_REMOVE_TRANS :
|
||||
fprintf( stderr, "Remove transition from \"%s\" to \"%s\"\n", Text1, Text2 );
|
||||
break;
|
||||
case SYF_WARNING_SUM_TRANS :
|
||||
fprintf( stderr, "All the possible combinations in \"%s\" are not evaluated\n", Text1 );
|
||||
break;
|
||||
case SYF_WARNING_INTER_TRANS :
|
||||
fprintf( stderr, "Intersection of all transitions leaving \"%s\" is non-empty\n", Text1 );
|
||||
break;
|
||||
case SYF_WARNING_OUTPUT_NOT_ASSIGNED :
|
||||
fprintf( stderr, "Output \"%s\" is assigned by only %ld states\n", Text1, (long)Text2 );
|
||||
break;
|
||||
case SYF_WARNING_MODIFY_POLARITY :
|
||||
fprintf( stderr, "Inverse the polarity of the output \"%s\"\n", Text1 );
|
||||
break;
|
||||
default :
|
||||
fprintf( stderr, "Internal warning number %d\n", Warning );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_error.h |
|
||||
| |
|
||||
| Authors : Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_ERROR_H
|
||||
# define SYF_ERROR_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Errors |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define SYF_ERROR_OPEN_FILE 1
|
||||
# define SYF_ERROR_MISSING_SCAN_PORT 2
|
||||
# define SYF_ERROR_UNKNOWN_ENCODE_TYPE 4
|
||||
# define SYF_ERROR_BAD_STACK_NO_PUSH 5
|
||||
# define SYF_ERROR_BAD_STACK_NO_POP 6
|
||||
# define SYF_ERROR_SYNTAX 7
|
||||
# define SYF_ERROR_UNEXPECTED_EOF 8
|
||||
# define SYF_ERROR_UNKNOWN_STATE 9
|
||||
# define SYF_ERROR_DUPLICATE_CODE 10
|
||||
# define SYF_ERROR_WRONG_CODE 11
|
||||
# define SYF_ERROR_ILLEGAL_FSM_TYPE 12
|
||||
# define SYF_ERROR_BDD_ATOM_UNKNOWN 13
|
||||
# define SYF_ERROR_BDD_OPER 14
|
||||
# define SYF_ERROR_BDD_EXPR_NULL 15
|
||||
# define SYF_ERROR_BDD_LOOP 16
|
||||
# define SYF_ERROR_ORDER_ATOM_UNKNOWN 17
|
||||
# define SYF_ERROR_ORDER_OPER 18
|
||||
# define SYF_ERROR_ORDER_EXPR_NULL 19
|
||||
# define SYF_ERROR_ORDER_LOOP 20
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Warnings |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define SYF_WARNING_NO_TRANS_TO 0
|
||||
# define SYF_WARNING_NO_TRANS_FROM 1
|
||||
# define SYF_WARNING_REMOVE_UNUSED_STACK 2
|
||||
# define SYF_WARNING_REMOVE_STACK 3
|
||||
# define SYF_WARNING_REMOVE_LOCOUT 4
|
||||
# define SYF_WARNING_REMOVE_TRANS 5
|
||||
# define SYF_WARNING_INTER_TRANS 6
|
||||
# define SYF_WARNING_SUM_TRANS 7
|
||||
# define SYF_WARNING_OUTPUT_NOT_ASSIGNED 8
|
||||
# define SYF_WARNING_MODIFY_POLARITY 9
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define SyfError( ERROR, TEXT ) \
|
||||
\
|
||||
SyfDisplayError( __FILE__, __LINE__, (ERROR), (TEXT) )
|
||||
|
||||
# define SyfWarning( WARNING, T1, T2 ) \
|
||||
\
|
||||
SyfDisplayWarning( __FILE__, __LINE__, (WARNING), (T1), (T2) )
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern char SyfDebugMode;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfDisplayError();
|
||||
extern void SyfDisplayWarning();
|
||||
|
||||
# endif
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_fsm.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_fsm.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
char *SYF_FSM_TYPE_NAME[ SYF_FSM_MAX_TYPE ] = { "MOORE", "MEALY" };
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Add Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syfaddfsmsyfinfo |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
syfinfo *Syfaddfsmsyfinfo( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
|
||||
SyfInfo = (void *)autallocblock( sizeof( syfinfo ) );
|
||||
FsmFigure->USER = (void *)SyfInfo;
|
||||
|
||||
return( SyfInfo );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syfaddfsmfig |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
fsmfig_list *Syfaddfsmfig( Name )
|
||||
|
||||
char *Name;
|
||||
{
|
||||
fsmfig_list *Figure;
|
||||
|
||||
Figure = addfsmfig( Name );
|
||||
Syfaddfsmsyfinfo( Figure );
|
||||
|
||||
return( Figure );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syfaddfsmsyfout |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
syfout *Syfaddfsmsyfout( Output )
|
||||
|
||||
fsmout_list *Output;
|
||||
{
|
||||
syfout *SyfOut;
|
||||
|
||||
SyfOut = (syfout *)autallocblock( sizeof( syfout ) );
|
||||
Output->USER = (void *)SyfOut;
|
||||
|
||||
return( SyfOut );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syfaddfsmsyfstate |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
syfstate *Syfaddfsmsyfstate( Figure, State )
|
||||
|
||||
fsmfig_list *Figure;
|
||||
fsmstate_list *State;
|
||||
{
|
||||
syfstate *SyfState;
|
||||
syfinfo *SyfInfo;
|
||||
char *Buffer;
|
||||
int Length;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( Figure );
|
||||
|
||||
SyfState = (void *)autallocblock( sizeof( syfstate ) );
|
||||
State->USER = (void *)SyfState;
|
||||
|
||||
Length = strlen( State->NAME ) + strlen( SyfInfo->CURRENT_STATE );
|
||||
Buffer = autallocblock( Length + 2 );
|
||||
|
||||
sprintf( Buffer, "%s_%s", SyfInfo->CURRENT_STATE, State->NAME );
|
||||
SyfState->CURRENT_NAME = namealloc( Buffer );
|
||||
|
||||
autfreeblock( Buffer );
|
||||
|
||||
Length = strlen( State->NAME ) + strlen( SyfInfo->RETURN_STATE );
|
||||
Buffer = autallocblock( Length + 2 );
|
||||
|
||||
sprintf( Buffer, "%s_%s", SyfInfo->RETURN_STATE, State->NAME );
|
||||
SyfState->RETURN_NAME = namealloc( Buffer );
|
||||
|
||||
autfreeblock( Buffer );
|
||||
|
||||
Length = strlen( State->NAME ) + strlen( SyfInfo->NEXT_STATE );
|
||||
Buffer = autallocblock( Length + 5 );
|
||||
|
||||
sprintf( Buffer, "%s_%s", SyfInfo->NEXT_STATE, State->NAME );
|
||||
SyfState->NEXT_NAME = namealloc( Buffer );
|
||||
|
||||
sprintf( Buffer, "%s_in_%s", SyfInfo->NEXT_STATE, State->NAME );
|
||||
SyfState->NEXT_IN_NAME = namealloc( Buffer );
|
||||
|
||||
autfreeblock( Buffer );
|
||||
|
||||
return( SyfState );
|
||||
}
|
|
@ -0,0 +1,260 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_fsm.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_FSM_H
|
||||
# define SYF_FSM_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define SYF_FSM_TYPE_MOORE 0
|
||||
# define SYF_FSM_TYPE_MEALY 1
|
||||
# define SYF_FSM_MAX_TYPE 2
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Encode Type |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define SYF_ENCODE_RANDOM 'r'
|
||||
# define SYF_ENCODE_CHAKER 'c'
|
||||
# define SYF_ENCODE_ANNEAL 's'
|
||||
# define SYF_ENCODE_USER 'u'
|
||||
# define SYF_ENCODE_MUSTANG 'm'
|
||||
# define SYF_ENCODE_ASP 'a'
|
||||
# define SYF_ENCODE_JEDI 'j'
|
||||
# define SYF_ENCODE_ONE_HOT 'o'
|
||||
# define SYF_ENCODE_FRANCK 'f'
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define FSM_SYF_INFO( Figure ) ( (syfinfo *)( ( Figure )->USER ) )
|
||||
# define FSM_SYF_STATE( State ) ( (syfstate *)( ( State )->USER ) )
|
||||
# define FSM_SYF_OUT( Out ) ( (syfout *)( ( Out )->USER ) )
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf Control Structure |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
typedef struct syfctrl
|
||||
{
|
||||
char *NAME;
|
||||
chain_list *ABL;
|
||||
|
||||
} syfctrl;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf Output Structure |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
typedef struct syfout
|
||||
{
|
||||
long INDEX;
|
||||
long NUMBER_ZERO;
|
||||
long NUMBER_ONE;
|
||||
long NUMBER_ASSIGN;
|
||||
long POLARITY;
|
||||
chain_list *ABL;
|
||||
|
||||
} syfout;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf Code Structure |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
typedef struct syfcode
|
||||
{
|
||||
long VALUE;
|
||||
long USED;
|
||||
chain_list *ABL;
|
||||
chain_list *ABL_OUT;
|
||||
|
||||
} syfcode;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf State Structure |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
typedef struct syfstate
|
||||
{
|
||||
char *CURRENT_NAME;
|
||||
char *RETURN_NAME;
|
||||
char *NEXT_NAME;
|
||||
char *NEXT_IN_NAME;
|
||||
long INDEX;
|
||||
syfcode *CODE;
|
||||
chain_list *ABL_TRANS;
|
||||
chain_list *ABL_RETURN;
|
||||
|
||||
} syfstate;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf Register Structure |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
typedef struct syfregout
|
||||
{
|
||||
char *NAME_MASTER;
|
||||
char *NAME_OUT;
|
||||
chain_list *ABL;
|
||||
|
||||
} syfregout;
|
||||
|
||||
typedef struct syfregstate
|
||||
{
|
||||
char *NAME_IN;
|
||||
bddnode *NODE_IN;
|
||||
char *NAME_MASTER;
|
||||
char *NAME_OUT;
|
||||
bddnode *NODE_OUT;
|
||||
chain_list *ABL_IN;
|
||||
chain_list *ABL_SET;
|
||||
chain_list *ABL_RESET;
|
||||
chain_list *ABL;
|
||||
|
||||
} syfregstate;
|
||||
|
||||
typedef struct syfregstack
|
||||
{
|
||||
char *NAME_MASTER;
|
||||
char *NAME_OUT;
|
||||
chain_list *ABL;
|
||||
long FLAGS;
|
||||
|
||||
} syfregstack;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf Info Structure |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
typedef struct syfinfo
|
||||
{
|
||||
char *CURRENT_STATE;
|
||||
char *NEXT_STATE;
|
||||
char *RETURN_STATE;
|
||||
char *SCAN_IN;
|
||||
char *SCAN_OUT;
|
||||
char *SCAN_TEST;
|
||||
char *SCAN_STACK;
|
||||
|
||||
char STACK;
|
||||
char SCAN_PATH;
|
||||
char REG_OUT;
|
||||
|
||||
long STACK_MASK;
|
||||
long STACK_CSTE;
|
||||
|
||||
char FSM_TYPE;
|
||||
char ENCODE;
|
||||
|
||||
long NUMBER_BIT;
|
||||
long NUMBER_REG;
|
||||
syfregstate *REG_ARRAY;
|
||||
|
||||
long NUMBER_OUT;
|
||||
syfregout *OUT_ARRAY;
|
||||
|
||||
long NUMBER_STACK;
|
||||
syfregstack *STACK_ARRAY;
|
||||
|
||||
long NUMBER_CTRL;
|
||||
syfctrl *CTRL_ARRAY;
|
||||
|
||||
long NUMBER_CODE;
|
||||
syfcode *CODE_ARRAY;
|
||||
|
||||
long *MUSTANG_OUT;
|
||||
long *MUSTANG_TRANS;
|
||||
long *MUSTANG_CTRL;
|
||||
long *MUSTANG_EDGE;
|
||||
|
||||
long *ASP_STATE;
|
||||
|
||||
} syfinfo;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern char *SYF_FSM_TYPE_NAME[ SYF_FSM_MAX_TYPE ];
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Add Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern fsmfig_list *Syfaddfsmfig();
|
||||
extern syfinfo *Syfaddfsmsyfinfo();
|
||||
extern syfout *Syfaddfsmsyfout();
|
||||
extern syfstate *Syfaddfsmsyfstate();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,401 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_fsm2fbh.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
# include FVH_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_fsm2fbh.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Private Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmTreatPort |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmTreatPort( FsmFigure, FbhFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
fbfig_list *FbhFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fbpor_list *FbhPort;
|
||||
fbrin_list *FbhRin;
|
||||
fsmport_list *ScanPort;
|
||||
|
||||
if ( IsFsmFigMixedRtl( FsmFigure ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
FbhPort = (fbpor_list *)0;
|
||||
FbhRin = FbhFigure->BERIN;
|
||||
|
||||
for ( ScanPort = FsmFigure->PORT;
|
||||
ScanPort != (fsmport_list *)0;
|
||||
ScanPort = ScanPort->NEXT )
|
||||
{
|
||||
FbhPort = fbh_addfbpor( FbhPort, ScanPort->NAME,
|
||||
ScanPort->DIR, ScanPort->TYPE );
|
||||
|
||||
if ( ScanPort->DIR != FSM_DIR_OUT )
|
||||
{
|
||||
FbhRin = fbh_addfbrin( FbhRin, ScanPort->NAME );
|
||||
}
|
||||
}
|
||||
|
||||
FbhFigure->BERIN = FbhRin;
|
||||
FbhFigure->BEPOR = FbhPort;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmTreatOutput |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmTreatOutput( FsmFigure, FbhFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
fbfig_list *FbhFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmout_list *ScanOut;
|
||||
syfout *ScanSyfOut;
|
||||
syfregout *OutArray;
|
||||
fbout_list *FbhOut;
|
||||
fbrin_list *FbhRin;
|
||||
fbreg_list *FbhReg;
|
||||
biabl_list *FbhBiAbl;
|
||||
binode_list *FbhBiNode;
|
||||
ablexpr *Equation;
|
||||
ablexpr *AblExpr;
|
||||
long Index;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
OutArray = SyfInfo->OUT_ARRAY;
|
||||
|
||||
FbhOut = FbhFigure->BEOUT;
|
||||
FbhRin = FbhFigure->BERIN;
|
||||
FbhReg = FbhFigure->BEREG;
|
||||
|
||||
|
||||
for ( ScanOut = FsmFigure->OUT;
|
||||
ScanOut != (fsmout_list *)0;
|
||||
ScanOut = ScanOut->NEXT )
|
||||
{
|
||||
ScanSyfOut = FSM_SYF_OUT( ScanOut );
|
||||
|
||||
if ( ScanSyfOut->ABL != (chain_list *)0 )
|
||||
{
|
||||
AblExpr = dupablexpr( ScanSyfOut->ABL );
|
||||
|
||||
if ( ScanSyfOut->POLARITY )
|
||||
{
|
||||
if ( ! SyfInfo->REG_OUT )
|
||||
{
|
||||
AblExpr = optimablnotexpr( AblExpr );
|
||||
}
|
||||
else
|
||||
{
|
||||
Equation = OutArray[ ScanSyfOut->INDEX ].ABL;
|
||||
Equation = optimablnotexpr( Equation );
|
||||
OutArray[ ScanSyfOut->INDEX ].ABL = Equation;
|
||||
}
|
||||
}
|
||||
|
||||
FbhOut = fbh_addfbout( FbhOut, ScanOut->NAME, AblExpr, (bddnode *)0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
if ( SyfInfo->REG_OUT )
|
||||
{
|
||||
for ( Index = 0; Index < SyfInfo->NUMBER_OUT; Index++ )
|
||||
{
|
||||
if ( OutArray[ Index ].ABL == (chain_list *)0 ) continue;
|
||||
|
||||
Equation = dupablexpr( FsmFigure->CLOCK_ABL );
|
||||
AblExpr = dupablexpr( OutArray[ Index ].ABL );
|
||||
|
||||
FbhBiAbl = fbh_addbiabl( (biabl_list *)0,
|
||||
OutArray[ Index ].NAME_MASTER, Equation, AblExpr );
|
||||
|
||||
FbhBiNode = fbh_addbinode( (binode_list *)0,
|
||||
(bddnode *)0,
|
||||
(bddnode *)0 );
|
||||
|
||||
FbhReg = fbh_addfbreg( FbhReg, OutArray[ Index ].NAME_MASTER,
|
||||
FbhBiAbl, FbhBiNode );
|
||||
|
||||
FbhRin = fbh_addfbrin( FbhRin, OutArray[ Index ].NAME_MASTER );
|
||||
}
|
||||
|
||||
FbhFigure->BEREG = FbhReg;
|
||||
}
|
||||
|
||||
FbhFigure->BERIN = FbhRin;
|
||||
FbhFigure->BEOUT = FbhOut;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmTreatRegister |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmTreatRegister( FsmFigure, FbhFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
fbfig_list *FbhFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
syfregstate *RegArray;
|
||||
syfregstack *StackArray;
|
||||
int Index;
|
||||
fbreg_list *FbhReg;
|
||||
fbrin_list *FbhRin;
|
||||
biabl_list *FbhBiAbl;
|
||||
binode_list *FbhBiNode;
|
||||
chain_list *Equation;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
RegArray = SyfInfo->REG_ARRAY;
|
||||
FbhReg = FbhFigure->BEREG;
|
||||
FbhRin = FbhFigure->BERIN;
|
||||
|
||||
for ( Index = SyfInfo->NUMBER_REG - 1; Index >= 0; Index-- )
|
||||
{
|
||||
Equation = dupablexpr( FsmFigure->CLOCK_ABL );
|
||||
FbhBiAbl = fbh_addbiabl( (biabl_list *)0,
|
||||
RegArray[ Index ].NAME_MASTER,
|
||||
Equation,
|
||||
dupablexpr( RegArray[ Index ].ABL_IN ) );
|
||||
|
||||
FbhBiNode = fbh_addbinode( (binode_list *)0, (bddnode *)0, (bddnode *)0 );
|
||||
|
||||
FbhReg = fbh_addfbreg( FbhReg, RegArray[ Index ].NAME_MASTER,
|
||||
FbhBiAbl, FbhBiNode );
|
||||
|
||||
FbhRin = fbh_addfbrin( FbhRin, RegArray[ Index ].NAME_MASTER );
|
||||
}
|
||||
|
||||
if ( SyfInfo->STACK )
|
||||
{
|
||||
StackArray = SyfInfo->STACK_ARRAY;
|
||||
|
||||
for ( Index = SyfInfo->NUMBER_STACK -1; Index >= 0; Index-- )
|
||||
{
|
||||
if ( ! StackArray[ Index ].FLAGS )
|
||||
{
|
||||
Equation = dupablexpr( FsmFigure->CLOCK_ABL );
|
||||
FbhBiAbl = fbh_addbiabl( (biabl_list *)0,
|
||||
StackArray[ Index ].NAME_MASTER,
|
||||
Equation,
|
||||
dupablexpr( StackArray[ Index ].ABL ) );
|
||||
|
||||
FbhBiNode = fbh_addbinode( (binode_list *)0,
|
||||
(bddnode *)0,
|
||||
(bddnode *)0 );
|
||||
|
||||
FbhReg = fbh_addfbreg( FbhReg, StackArray[ Index ].NAME_MASTER,
|
||||
FbhBiAbl, FbhBiNode );
|
||||
|
||||
FbhRin = fbh_addfbrin( FbhRin, StackArray[ Index ].NAME_MASTER );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FbhFigure->BERIN = FbhRin;
|
||||
FbhFigure->BEREG = FbhReg;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmTreatAux |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmTreatAux( FsmFigure, FbhFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
fbfig_list *FbhFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fbaux_list *FbhAux;
|
||||
fbrin_list *FbhRin;
|
||||
fsmstate_list *ScanState;
|
||||
syfstate *ScanSyfState;
|
||||
syfctrl *CtrlArray;
|
||||
syfregstack *StackArray;
|
||||
syfregstate *RegArray;
|
||||
int Index;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
FbhAux = FbhFigure->BEAUX;
|
||||
FbhRin = FbhFigure->BERIN;
|
||||
|
||||
if ( SyfInfo->STACK )
|
||||
{
|
||||
StackArray = SyfInfo->STACK_ARRAY;
|
||||
|
||||
for ( Index = SyfInfo->NUMBER_REG - 1; Index >= 0; Index-- )
|
||||
{
|
||||
if ( StackArray[ Index ].FLAGS )
|
||||
{
|
||||
FbhAux = fbh_addfbaux( FbhAux, StackArray[ Index ].NAME_OUT,
|
||||
dupablexpr( StackArray[ Index ].ABL ), (bddnode *)0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
CtrlArray = SyfInfo->CTRL_ARRAY;
|
||||
|
||||
for ( Index = 0; Index < SyfInfo->NUMBER_CTRL; Index++ )
|
||||
{
|
||||
FbhAux = fbh_addfbaux( FbhAux, CtrlArray[ Index ].NAME,
|
||||
dupablexpr( CtrlArray[ Index ].ABL ), (bddnode *)0, 0 );
|
||||
|
||||
FbhRin = fbh_addfbrin( FbhRin, CtrlArray[ Index ].NAME );
|
||||
}
|
||||
}
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
|
||||
if ( ( SyfInfo->STACK ) &&
|
||||
( SyfInfo->REG_OUT ) )
|
||||
{
|
||||
FbhAux = fbh_addfbaux( FbhAux, ScanSyfState->NEXT_IN_NAME,
|
||||
dupablexpr( ScanSyfState->CODE->ABL_OUT ), (bddnode *)0, 0 );
|
||||
FbhRin = fbh_addfbrin( FbhRin, ScanSyfState->NEXT_IN_NAME );
|
||||
}
|
||||
|
||||
FbhAux = fbh_addfbaux( FbhAux, ScanSyfState->CURRENT_NAME,
|
||||
dupablexpr( ScanSyfState->CODE->ABL ), (bddnode *)0, 0 );
|
||||
FbhRin = fbh_addfbrin( FbhRin, ScanSyfState->CURRENT_NAME );
|
||||
|
||||
FbhAux = fbh_addfbaux( FbhAux, ScanSyfState->NEXT_NAME,
|
||||
dupablexpr( ScanSyfState->ABL_TRANS ), (bddnode *)0, 0 );
|
||||
FbhRin = fbh_addfbrin( FbhRin, ScanSyfState->NEXT_NAME );
|
||||
|
||||
if ( ScanSyfState->ABL_RETURN != (chain_list *)0 )
|
||||
{
|
||||
FbhAux = fbh_addfbaux( FbhAux, ScanSyfState->RETURN_NAME,
|
||||
dupablexpr( ScanSyfState->ABL_RETURN ), (bddnode *)0, 0 );
|
||||
FbhRin = fbh_addfbrin( FbhRin, ScanSyfState->RETURN_NAME );
|
||||
}
|
||||
}
|
||||
|
||||
RegArray = SyfInfo->REG_ARRAY;
|
||||
|
||||
for ( Index = SyfInfo->NUMBER_REG - 1; Index >= 0; Index-- )
|
||||
{
|
||||
FbhAux = fbh_addfbaux( FbhAux, RegArray[ Index ].NAME_IN,
|
||||
dupablexpr( RegArray[ Index ].ABL ), (bddnode *)0, 0 );
|
||||
FbhRin = fbh_addfbrin( FbhRin, RegArray[ Index ].NAME_IN );
|
||||
}
|
||||
|
||||
FbhFigure->BERIN = FbhRin;
|
||||
FbhFigure->BEAUX = FbhAux;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsm2Fbh |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
fbfig_list *SyfFsm2Fbh( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
fbfig_list *FbhFigure;
|
||||
|
||||
if ( ! IsFsmFigMixedRtl( FsmFigure ) )
|
||||
{
|
||||
FbhFigure = fbh_addfbfig( (fbfig_list *)0, FsmFigure->NAME );
|
||||
}
|
||||
else
|
||||
{
|
||||
FbhFigure = (fbfig_list *)FsmFigure->FIGURE;
|
||||
}
|
||||
|
||||
SyfFsmTreatPort( FsmFigure, FbhFigure );
|
||||
SyfFsmTreatOutput( FsmFigure, FbhFigure );
|
||||
SyfFsmTreatRegister( FsmFigure, FbhFigure );
|
||||
SyfFsmTreatAux( FsmFigure, FbhFigure );
|
||||
|
||||
return( FbhFigure );
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_fsm2fbh.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_FSM2FBH_H
|
||||
# define SYF_FSM2FBH_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern fbfig_list *SyfFsm2Fbh();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,285 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : Syf_jedi.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_tools.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_must.h"
|
||||
# include "syf_jedi.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmJediEncode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmJediEncode( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
syfstate *ScanSyfState;
|
||||
syfcode *CodeArray;
|
||||
long *EdgeWeightArray;
|
||||
|
||||
short *DoneArray;
|
||||
long *SortArray;
|
||||
long *ValueArray;
|
||||
|
||||
long StateCounter;
|
||||
long BestState;
|
||||
long SortState;
|
||||
long DoneState;
|
||||
|
||||
long SumWeightMax;
|
||||
long SumWeight;
|
||||
long SumCostMin;
|
||||
long SumCost;
|
||||
|
||||
long LineState;
|
||||
long LineBest;
|
||||
|
||||
|
||||
long SortIndex;
|
||||
long StateIndex;
|
||||
long ValueIndex;
|
||||
|
||||
long EdgeWeight;
|
||||
long Distance;
|
||||
|
||||
long BestCode;
|
||||
long StateCode;
|
||||
long CodeValue;
|
||||
|
||||
long NumberState;
|
||||
long NumberBit;
|
||||
long CodeMax;
|
||||
long ValueMax;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
CodeMax = SyfInfo->NUMBER_CODE;
|
||||
ValueMax = CodeMax;
|
||||
CodeArray = SyfInfo->CODE_ARRAY;
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
NumberBit = SyfInfo->NUMBER_BIT;
|
||||
|
||||
SyfFsmGetMustangEdge( FsmFigure );
|
||||
|
||||
autfreeblock( SyfInfo->MUSTANG_TRANS );
|
||||
autfreeblock( SyfInfo->MUSTANG_OUT );
|
||||
|
||||
if ( SyfInfo->MUSTANG_CTRL != (long *)0 )
|
||||
{
|
||||
autfreeblock( SyfInfo->MUSTANG_CTRL );
|
||||
}
|
||||
|
||||
EdgeWeightArray = SyfInfo->MUSTANG_EDGE;
|
||||
|
||||
ValueArray = (long *)autallocblock( sizeof(long) * CodeMax );
|
||||
DoneArray = (short *)autallocblock( sizeof(short) * NumberState );
|
||||
SortArray = (long *)autallocblock( sizeof(long) * NumberState );
|
||||
|
||||
/*
|
||||
** Initialize possible code values
|
||||
*/
|
||||
for ( ValueIndex = 0; ValueIndex < ValueMax; ValueIndex++ )
|
||||
{
|
||||
ValueArray[ ValueIndex ] = ValueIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
** Assign code pointer for states
|
||||
*/
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
|
||||
ScanSyfState->CODE = &CodeArray[ ScanSyfState->INDEX ];
|
||||
}
|
||||
|
||||
for ( StateCounter = 0; StateCounter < NumberState; StateCounter++ )
|
||||
{
|
||||
/*
|
||||
** Look for a "best" state
|
||||
*/
|
||||
LineState = 0;
|
||||
SumWeightMax = -1;
|
||||
|
||||
for ( StateIndex = 0; StateIndex < NumberState; StateIndex++ )
|
||||
{
|
||||
if ( ! DoneArray[ StateIndex ] )
|
||||
{
|
||||
SumWeight = 0;
|
||||
|
||||
if ( StateCounter == 0 )
|
||||
{
|
||||
for ( SortState = 0; SortState < NumberState; SortState++ )
|
||||
{
|
||||
SumWeight += EdgeWeightArray[ LineState + SortState ];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( SortIndex = 0; SortIndex < StateCounter; SortIndex++ )
|
||||
{
|
||||
SortState = SortArray[ SortIndex ];
|
||||
SumWeight += EdgeWeightArray[ LineState + SortState ];
|
||||
}
|
||||
}
|
||||
|
||||
if ( SumWeight > SumWeightMax )
|
||||
{
|
||||
BestState = StateIndex;
|
||||
LineBest = LineState;
|
||||
SumWeightMax = SumWeight;
|
||||
}
|
||||
}
|
||||
|
||||
LineState = LineState + NumberState;
|
||||
}
|
||||
/*
|
||||
** Get unused code for the "best" state
|
||||
*/
|
||||
SortArray[ StateCounter ] = BestState;
|
||||
DoneArray[ BestState ] = 1;
|
||||
|
||||
if ( StateCounter == 0 )
|
||||
{
|
||||
BestCode = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
SumCostMin = -1;
|
||||
|
||||
for ( ValueIndex = 0; ValueIndex < ValueMax; ValueIndex++ )
|
||||
{
|
||||
SumCost = 0;
|
||||
CodeValue = ValueArray[ ValueIndex ];
|
||||
|
||||
for ( SortIndex = 0; SortIndex < StateCounter; SortIndex++ )
|
||||
{
|
||||
DoneState = SortArray[ SortIndex ];
|
||||
EdgeWeight = EdgeWeightArray[ LineBest + DoneState ];
|
||||
|
||||
if ( EdgeWeight != 0 )
|
||||
{
|
||||
Distance = SyfGetHamingDistance( CodeArray[ DoneState ].VALUE,
|
||||
CodeValue, NumberBit );
|
||||
|
||||
SumCost += Distance * EdgeWeight;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( SumCost < SumCostMin ) ||
|
||||
( SumCostMin == -1 ) )
|
||||
{
|
||||
SumCostMin = SumCost;
|
||||
BestCode = ValueIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ValueMax = ValueMax - 1;
|
||||
StateCode = ValueArray[ BestCode ];
|
||||
|
||||
if ( ValueMax != BestCode )
|
||||
{
|
||||
ValueArray[ BestCode ] = ValueArray[ ValueMax ];
|
||||
ValueArray[ ValueMax ] = StateCode;
|
||||
}
|
||||
|
||||
CodeArray[ BestState ].USED = 1;
|
||||
CodeArray[ BestState ].VALUE = StateCode;
|
||||
}
|
||||
|
||||
for ( ValueIndex = 0; ValueIndex < ValueMax; ValueIndex++ )
|
||||
{
|
||||
CodeArray[ NumberState + ValueIndex ].VALUE = ValueArray[ ValueIndex ];
|
||||
}
|
||||
|
||||
autfreeblock( SortArray );
|
||||
autfreeblock( DoneArray );
|
||||
autfreeblock( ValueArray );
|
||||
|
||||
autfreeblock( SyfInfo->MUSTANG_EDGE );
|
||||
|
||||
SyfInfo->MUSTANG_TRANS = (long *)0;
|
||||
SyfInfo->MUSTANG_OUT = (long *)0;
|
||||
SyfInfo->MUSTANG_CTRL = (long *)0;
|
||||
SyfInfo->MUSTANG_EDGE = (long *)0;
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_jedi.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_JEDI_H
|
||||
# define SYF_JEDI_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmJediEncode();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,355 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_main.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
# include FVH_H
|
||||
# include FTL_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_main.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_env.h"
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_comp.h"
|
||||
# include "syf_fsm2fbh.h"
|
||||
# include "syf_cost.h"
|
||||
# include "syf_verify.h"
|
||||
# include "syf_synth.h"
|
||||
# include "syf_dc.h"
|
||||
# include "syf_encod.h"
|
||||
# include "syf_simp.h"
|
||||
# include "syf_bdd.h"
|
||||
# include "syf_verify.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
fsmfig_list *SyfFsmFigure = (fsmfig_list *)0;
|
||||
fbfig_list *SyfFbhFigure = (fbfig_list *)0;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Syf Usage |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfUsage()
|
||||
{
|
||||
fprintf( stdout, "\t\tsyf Encoding [Options] Input_name [Output_name]\n\n" );
|
||||
|
||||
fprintf( stdout, "\t\tEncoding : -a Asp encoding\n" );
|
||||
fprintf( stdout, "\t\t -j Jedi encoding\n" );
|
||||
fprintf( stdout, "\t\t -m Mustang encoding\n" );
|
||||
fprintf( stdout, "\t\t -u User 'Input_name'.enc file\n" );
|
||||
fprintf( stdout, "\t\t -o One hot encoding\n" );
|
||||
fprintf( stdout, "\t\t -r Random encoding\n\n" );
|
||||
|
||||
fprintf( stdout, "\t\tOptions : -C Checks FSM transitions\n" );
|
||||
fprintf( stdout, "\t\t -D Doesn't treat unused codes as DC\n" );
|
||||
fprintf( stdout, "\t\t -E Saves 'Output_name'.enc file\n" );
|
||||
fprintf( stdout, "\t\t -O Uses registers for outputs\n" );
|
||||
fprintf( stdout, "\t\t -P Uses a scan-path for registers\n" );
|
||||
fprintf( stdout, "\t\t -I Doesn't inverse outputs polarity \n" );
|
||||
fprintf( stdout, "\t\t -S Doesn't simplify FSM equations\n" );
|
||||
fprintf( stdout, "\t\t -T Sets Trace mode on\n" );
|
||||
fprintf( stdout, "\t\t -V Sets Verbose mode on\n" );
|
||||
fprintf( stdout, "\t\t -F Sets synopsys output Format\n" );
|
||||
fprintf( stdout, "\n" );
|
||||
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Main |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
int main( argc, argv )
|
||||
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
char *InputFileName;
|
||||
char *OutputFileName;
|
||||
char *FileName;
|
||||
long Literals;
|
||||
int Number;
|
||||
int Index;
|
||||
char Option;
|
||||
|
||||
int FlagSave = 0;
|
||||
int FlagScan = 0;
|
||||
int FlagCode = -1;
|
||||
int FlagVerbose = 0;
|
||||
int FlagTrace = 0;
|
||||
int FlagRegOut = 0;
|
||||
int FlagDc = 1;
|
||||
int FlagCheck = 0;
|
||||
int FlagSimplify = 1;
|
||||
int FlagInvPolar = 1;
|
||||
int FlagMustCost = 0;
|
||||
int FlagFormat = 0;
|
||||
|
||||
alliancebanner_with_authors(
|
||||
"SYF", SYF_VERSION, "FSM Synthesizer", "1995",
|
||||
ALLIANCE_VERSION, "Ludovic Jacomme and Chaker Sarwary" );
|
||||
|
||||
mbkenv();
|
||||
autenv();
|
||||
ablenv();
|
||||
bddenv();
|
||||
fsmenv();
|
||||
|
||||
if ( argc < 3 ) SyfUsage();
|
||||
|
||||
OutputFileName = (char *)0;
|
||||
InputFileName = (char *)0;
|
||||
|
||||
for ( Number = 1; Number < argc; Number++ )
|
||||
{
|
||||
if ( argv[ Number ][ 0 ] == '-' )
|
||||
{
|
||||
for ( Index = 1; argv[ Number ][ Index ] != '\0'; Index++ )
|
||||
{
|
||||
Option = argv[ Number ][ Index ];
|
||||
|
||||
switch ( Option )
|
||||
{
|
||||
case 'C' : FlagCheck = 1;
|
||||
break;
|
||||
case 'D' : FlagDc = 0;
|
||||
break;
|
||||
case 'E' : FlagSave = 1;
|
||||
break;
|
||||
case 'F' : FlagFormat = 1;
|
||||
break;
|
||||
case 'O' : FlagRegOut = 1;
|
||||
break;
|
||||
case 'P' : FlagScan = 1;
|
||||
break;
|
||||
case 'S' : FlagSimplify = 0;
|
||||
break;
|
||||
case 'T' : FlagTrace = 1;
|
||||
break;
|
||||
case 'V' : FlagVerbose = 1;
|
||||
break;
|
||||
case 'M' : FlagMustCost = 1;
|
||||
break;
|
||||
case 'I' : FlagInvPolar = 0;
|
||||
break;
|
||||
case 'r' : FlagCode = SYF_ENCODE_RANDOM;
|
||||
break;
|
||||
case 'c' : FlagCode = SYF_ENCODE_CHAKER;
|
||||
break;
|
||||
case 'u' : FlagCode = SYF_ENCODE_USER;
|
||||
break;
|
||||
case 'm' : FlagCode = SYF_ENCODE_MUSTANG;
|
||||
break;
|
||||
case 'a' : FlagCode = SYF_ENCODE_ASP;
|
||||
break;
|
||||
case 'j' : FlagCode = SYF_ENCODE_JEDI;
|
||||
break;
|
||||
case 'o' : FlagCode = SYF_ENCODE_ONE_HOT;
|
||||
break;
|
||||
default : SyfUsage();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ];
|
||||
else
|
||||
if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ];
|
||||
else
|
||||
SyfUsage();
|
||||
}
|
||||
|
||||
if ( ( InputFileName == (char *)0 ) ||
|
||||
( FlagCode == -1 ) ) SyfUsage();
|
||||
|
||||
InputFileName = autbasename( InputFileName, FSM_IN );
|
||||
|
||||
FileName = autallocblock( strlen( InputFileName ) + 7 );
|
||||
strcpy( FileName, InputFileName );
|
||||
InputFileName = FileName;
|
||||
|
||||
if ( OutputFileName == (char *)0 )
|
||||
{
|
||||
OutputFileName = autallocblock( strlen( InputFileName ) + 2 );
|
||||
sprintf( OutputFileName, "%s%c", InputFileName, FlagCode );
|
||||
}
|
||||
else
|
||||
{
|
||||
OutputFileName = autbasename( OutputFileName, FSM_OUT );
|
||||
}
|
||||
|
||||
SyfEnv( FlagTrace );
|
||||
|
||||
fprintf( stdout, "\t\t--> Compile FSM file %s\n", InputFileName );
|
||||
|
||||
SyfFsmFigure = SyfCompile( InputFileName, FlagScan, FlagFormat );
|
||||
|
||||
SyfFsmFigure->NAME = namealloc( OutputFileName );
|
||||
|
||||
if ( FlagInvPolar )
|
||||
{
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Check FSM figure outputs\n" );
|
||||
}
|
||||
|
||||
SyfFsmOutputPolarity( SyfFsmFigure );
|
||||
}
|
||||
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
if ( FlagSimplify )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Simplify FSM figure\n" );
|
||||
}
|
||||
}
|
||||
|
||||
SyfFsmSimplify( SyfFsmFigure, FlagSimplify );
|
||||
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Verify FSM figure\n" );
|
||||
}
|
||||
|
||||
SyfFsmVerify( SyfFsmFigure, FlagCheck );
|
||||
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Identify reset conditions\n" );
|
||||
}
|
||||
|
||||
SyfFsmTreatReset( SyfFsmFigure );
|
||||
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
fprintf( stdout, "\n" );
|
||||
|
||||
if ( IsFsmFigMixedRtl( SyfFsmFigure ) )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Mixed DataFlow / Fsm\n\n" );
|
||||
}
|
||||
fprintf( stdout, "\t\t--> States : %ld\n", SyfFsmFigure->NUMBER_STATE );
|
||||
fprintf( stdout, "\t\t--> Inputs : %ld\n", SyfFsmFigure->NUMBER_IN );
|
||||
fprintf( stdout, "\t\t--> Outputs : %ld\n", SyfFsmFigure->NUMBER_OUT );
|
||||
fprintf( stdout, "\t\t--> Edges : %ld\n", SyfFsmFigure->NUMBER_TRANS );
|
||||
fprintf( stdout, "\t\t--> Stacks : %ld\n", SyfFsmFigure->NUMBER_STACK );
|
||||
fprintf( stdout, "\n" );
|
||||
fprintf( stdout, "\t\t--> Encode FSM figure\n" );
|
||||
}
|
||||
|
||||
SyfFsmEncode( SyfFsmFigure, FlagCode, FlagVerbose,
|
||||
FlagDc, FlagRegOut, FlagMustCost, InputFileName );
|
||||
|
||||
if ( FlagSave )
|
||||
{
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Save FSM codes\n" );
|
||||
}
|
||||
|
||||
SyfFsmUserSaveCode( SyfFsmFigure, OutputFileName );
|
||||
}
|
||||
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Translate FSM to BEH\n" );
|
||||
}
|
||||
|
||||
SyfSynthFsmInit( SyfFsmFigure );
|
||||
SyfSynthCode2Abl( SyfFsmFigure, FlagDc );
|
||||
SyfSynthFsm2Abl( SyfFsmFigure );
|
||||
|
||||
SyfFbhFigure = SyfFsm2Fbh( SyfFsmFigure );
|
||||
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
fprintf( stdout, "\t\t--> Simplify BEH figure\n" );
|
||||
}
|
||||
|
||||
SyfFbhSimplify( SyfFbhFigure );
|
||||
|
||||
if ( FlagVerbose )
|
||||
{
|
||||
Literals = SyfFbhAblGiveCost( SyfFbhFigure );
|
||||
|
||||
fprintf( stdout, "\n" );
|
||||
fprintf( stdout, "\t\t--> Literals : %ld\n", Literals );
|
||||
fprintf( stdout, "\n" );
|
||||
}
|
||||
|
||||
fprintf( stdout, "\t\t--> Save BEH file %s\n\n", OutputFileName );
|
||||
|
||||
vhdlsavefbfig( SyfFbhFigure, OutputFileName, FlagFormat );
|
||||
|
||||
return( 0 );
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_main.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_MAIN_H
|
||||
# define SYF_MAIN_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# endif
|
|
@ -0,0 +1,908 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : Syf_must.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include <stdio.h>
|
||||
# include <memory.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include "syf_env.h"
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_tools.h"
|
||||
# include "syf_must.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmGetMustangCtrl |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmGetMustangCtrl( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstack_list *ScanStack;
|
||||
long *CtrlWeightArray;
|
||||
long NumberCtrl;
|
||||
long NumberState;
|
||||
long StateIndex;
|
||||
long LineCtrl;
|
||||
long Control;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
NumberCtrl = FSM_MAX_CTRL - 1;
|
||||
|
||||
if ( ! SyfInfo->STACK ) return;
|
||||
|
||||
if ( SyfInfo->MUSTANG_CTRL == (long*)0 )
|
||||
{
|
||||
CtrlWeightArray =
|
||||
|
||||
(long*)autallocblock( sizeof(long) * NumberState * NumberCtrl );
|
||||
|
||||
SyfInfo->MUSTANG_CTRL = CtrlWeightArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
CtrlWeightArray = SyfInfo->MUSTANG_CTRL;
|
||||
|
||||
memset( CtrlWeightArray, 0, sizeof(long) * NumberState * NumberCtrl );
|
||||
}
|
||||
|
||||
for ( ScanStack = FsmFigure->STACK;
|
||||
ScanStack != (fsmstack_list *)0;
|
||||
ScanStack = ScanStack->NEXT )
|
||||
{
|
||||
if ( IsFsmStarStack( ScanStack ) ) continue;
|
||||
|
||||
Control = ScanStack->CTRL;
|
||||
|
||||
if ( Control != FSM_CTRL_NOP )
|
||||
{
|
||||
LineCtrl = ( Control - 1 ) * NumberState;
|
||||
StateIndex = FSM_SYF_STATE( ScanStack->CURRENT )->INDEX;
|
||||
|
||||
if ( SYF_MUSTANG_JEDI_ATOM )
|
||||
{
|
||||
CtrlWeightArray[ LineCtrl + StateIndex ] +=
|
||||
|
||||
getablexprnumatom( ScanStack->ABL );
|
||||
}
|
||||
else
|
||||
{
|
||||
CtrlWeightArray[ LineCtrl + StateIndex ]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmGetMustangOut |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmGetMustangOut( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
long *OutWeightArray;
|
||||
fsmout_list *ScanOut;
|
||||
fsmstate_list *ScanState;
|
||||
fsmlocout_list *ScanLocout;
|
||||
long NumberState;
|
||||
long NumberOut;
|
||||
long IndexState;
|
||||
long IndexOut;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
NumberOut = FsmFigure->NUMBER_OUT;
|
||||
OutWeightArray = SyfInfo->MUSTANG_OUT;
|
||||
|
||||
if ( OutWeightArray == (long *)0 )
|
||||
{
|
||||
OutWeightArray =
|
||||
|
||||
(long *)autallocblock( sizeof(long) * NumberState * NumberOut );
|
||||
|
||||
SyfInfo->MUSTANG_OUT = OutWeightArray;
|
||||
|
||||
IndexOut = 0;
|
||||
|
||||
for ( ScanOut = FsmFigure->OUT;
|
||||
ScanOut != (fsmout_list *)0;
|
||||
ScanOut = ScanOut->NEXT )
|
||||
{
|
||||
FSM_SYF_OUT( ScanOut )->INDEX = IndexOut++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( OutWeightArray, 0, sizeof(long) * NumberState * NumberOut );
|
||||
}
|
||||
|
||||
IndexState = 0;
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
for ( ScanLocout = ScanState->LOCOUT;
|
||||
ScanLocout != (fsmlocout_list *)0;
|
||||
ScanLocout = ScanLocout->NEXT )
|
||||
{
|
||||
IndexOut = FSM_SYF_OUT( ScanLocout->OUT )->INDEX;
|
||||
|
||||
if ( SYF_MUSTANG_JEDI_ATOM )
|
||||
{
|
||||
if ( ScanLocout->ABL != (chain_list *)0 )
|
||||
{
|
||||
OutWeightArray[ ( IndexOut * NumberState ) + IndexState ] +=
|
||||
|
||||
getablexprnumatom( ScanLocout->ABL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OutWeightArray[ ( IndexOut * NumberState ) + IndexState ]++;
|
||||
}
|
||||
}
|
||||
|
||||
FSM_SYF_STATE( ScanState )->INDEX = IndexState++;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmGetMustangTrans |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmGetMustangTrans( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
long *TransWeightArray;
|
||||
fsmstate_list *ScanState;
|
||||
fsmtrans_list *ScanTrans;
|
||||
long NumberState;
|
||||
long Index;
|
||||
long IndexTo;
|
||||
long IndexFrom;
|
||||
long IndexState;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
TransWeightArray = SyfInfo->MUSTANG_TRANS;
|
||||
|
||||
if ( TransWeightArray == (long *)0 )
|
||||
{
|
||||
TransWeightArray =
|
||||
|
||||
(long *)autallocblock( sizeof(long) * NumberState * NumberState );
|
||||
|
||||
SyfInfo->MUSTANG_TRANS = TransWeightArray;
|
||||
|
||||
IndexState = 0;
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
FSM_SYF_STATE( ScanState )->INDEX = IndexState++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( TransWeightArray, 0, sizeof(long) * NumberState * NumberState );
|
||||
}
|
||||
|
||||
for ( ScanTrans = FsmFigure->TRANS;
|
||||
ScanTrans != (fsmtrans_list *)0;
|
||||
ScanTrans = ScanTrans->NEXT )
|
||||
{
|
||||
if ( IsFsmStarTrans( ScanTrans ) ) continue;
|
||||
|
||||
IndexTo = FSM_SYF_STATE( ScanTrans->TO )->INDEX;
|
||||
IndexFrom = FSM_SYF_STATE( ScanTrans->FROM )->INDEX;
|
||||
Index = ( IndexTo * NumberState ) + IndexFrom;
|
||||
|
||||
if ( SYF_MUSTANG_JEDI_ATOM )
|
||||
{
|
||||
TransWeightArray[ Index ] += getablexprnumatom( ScanTrans->ABL );
|
||||
}
|
||||
else
|
||||
{
|
||||
TransWeightArray[ Index ]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmGetMustangEdge |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmGetMustangEdge( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
long NumberState;
|
||||
long NumberOut;
|
||||
long NumberBit;
|
||||
long NumberCtrl;
|
||||
long *EdgeWeightArray;
|
||||
long *OutWeightArray;
|
||||
long *TransWeightArray;
|
||||
long *CtrlWeightArray;
|
||||
long StateIKWeight;
|
||||
long StateJKWeight;
|
||||
long CtrlIKWeight;
|
||||
long CtrlJKWeight;
|
||||
long OutIKWeight;
|
||||
long OutJKWeight;
|
||||
long LineStateI;
|
||||
long LineStateJ;
|
||||
long LineCtrlK;
|
||||
long LineOutK;
|
||||
long StateIJ;
|
||||
long StateI;
|
||||
long StateJ;
|
||||
long StateK;
|
||||
long OutK;
|
||||
long CtrlK;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
NumberOut = FsmFigure->NUMBER_OUT;
|
||||
NumberBit = SyfInfo->NUMBER_BIT;
|
||||
NumberCtrl = FSM_MAX_CTRL - 1;
|
||||
EdgeWeightArray = SyfInfo->MUSTANG_EDGE;
|
||||
|
||||
if ( SyfInfo->MUSTANG_OUT == (long *)0 )
|
||||
{
|
||||
SyfFsmGetMustangOut( FsmFigure );
|
||||
}
|
||||
|
||||
if ( SyfInfo->MUSTANG_TRANS == (long *)0 )
|
||||
{
|
||||
SyfFsmGetMustangTrans( FsmFigure );
|
||||
}
|
||||
|
||||
if ( SyfInfo->MUSTANG_CTRL == (long *)0 )
|
||||
{
|
||||
SyfFsmGetMustangCtrl( FsmFigure );
|
||||
}
|
||||
|
||||
if ( EdgeWeightArray == (long *)0 )
|
||||
{
|
||||
EdgeWeightArray =
|
||||
|
||||
(long *)autallocblock( sizeof(long) * NumberState * NumberState );
|
||||
|
||||
SyfInfo->MUSTANG_EDGE = EdgeWeightArray;
|
||||
}
|
||||
else
|
||||
{
|
||||
memset( EdgeWeightArray, 0, sizeof(long) * NumberState * NumberState );
|
||||
}
|
||||
|
||||
EdgeWeightArray = SyfInfo->MUSTANG_EDGE;
|
||||
OutWeightArray = SyfInfo->MUSTANG_OUT;
|
||||
CtrlWeightArray = SyfInfo->MUSTANG_CTRL;
|
||||
TransWeightArray = SyfInfo->MUSTANG_TRANS;
|
||||
|
||||
LineStateI = 0;
|
||||
|
||||
for ( StateI = 0; StateI < NumberState; StateI++ )
|
||||
{
|
||||
LineStateJ = 0;
|
||||
|
||||
for ( StateJ = 0; StateJ < NumberState; StateJ++ )
|
||||
{
|
||||
StateIJ = LineStateI + StateJ;
|
||||
|
||||
if ( StateI != StateJ )
|
||||
{
|
||||
for ( StateK = 0; StateK < NumberState; StateK++ )
|
||||
{
|
||||
StateIKWeight = TransWeightArray[ LineStateI + StateK ];
|
||||
StateJKWeight = TransWeightArray[ LineStateJ + StateK ];
|
||||
|
||||
if ( ( StateIKWeight != 0 ) &&
|
||||
( StateJKWeight != 0 ) )
|
||||
{
|
||||
EdgeWeightArray[ StateIJ ] += StateIKWeight * StateJKWeight;
|
||||
}
|
||||
}
|
||||
|
||||
EdgeWeightArray[ StateIJ ] *= NumberBit;
|
||||
|
||||
if ( CtrlWeightArray != (long *)0 )
|
||||
{
|
||||
LineCtrlK = 0;
|
||||
|
||||
for ( CtrlK = 0; CtrlK < NumberCtrl; CtrlK++ )
|
||||
{
|
||||
CtrlIKWeight = CtrlWeightArray[ LineCtrlK + StateI ];
|
||||
CtrlJKWeight = CtrlWeightArray[ LineCtrlK + StateJ ];
|
||||
|
||||
if ( ( CtrlIKWeight != 0 ) &&
|
||||
( CtrlJKWeight != 0 ) )
|
||||
{
|
||||
EdgeWeightArray[ StateIJ ] += CtrlIKWeight * CtrlJKWeight;
|
||||
}
|
||||
|
||||
LineCtrlK = LineCtrlK + NumberState;
|
||||
}
|
||||
}
|
||||
|
||||
LineOutK = 0;
|
||||
|
||||
for ( OutK = 0; OutK < NumberOut; OutK++ )
|
||||
{
|
||||
OutIKWeight = OutWeightArray[ LineOutK + StateI ];
|
||||
OutJKWeight = OutWeightArray[ LineOutK + StateJ ];
|
||||
|
||||
if ( ( OutIKWeight != 0 ) &&
|
||||
( OutJKWeight != 0 ) )
|
||||
{
|
||||
EdgeWeightArray[ StateIJ ] += OutIKWeight * OutJKWeight;
|
||||
}
|
||||
|
||||
LineOutK = LineOutK + NumberState;
|
||||
}
|
||||
}
|
||||
|
||||
LineStateJ = LineStateJ + NumberState;
|
||||
}
|
||||
|
||||
LineStateI = LineStateI + NumberState;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmGetMustangCost |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
long SyfFsmGetMustangCost( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
syfstate *ScanSyfState;
|
||||
long NumberState;
|
||||
long NumberBit;
|
||||
long *EdgeWeightArray;
|
||||
long *CodeArray;
|
||||
long StateI;
|
||||
long StateJ;
|
||||
long LineStateI;
|
||||
long Distance;
|
||||
long Weight;
|
||||
char FreeEdge;
|
||||
long EdgeCost;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
NumberBit = SyfInfo->NUMBER_BIT;
|
||||
|
||||
if ( SyfInfo->CODE_ARRAY == (syfcode *)0 )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
if ( SyfInfo->MUSTANG_EDGE == (long *)0 )
|
||||
{
|
||||
SyfFsmGetMustangEdge( FsmFigure );
|
||||
|
||||
autfreeblock( SyfInfo->MUSTANG_TRANS );
|
||||
autfreeblock( SyfInfo->MUSTANG_OUT );
|
||||
|
||||
if ( SyfInfo->MUSTANG_CTRL != (long *)0 )
|
||||
{
|
||||
autfreeblock( SyfInfo->MUSTANG_CTRL );
|
||||
}
|
||||
|
||||
SyfInfo->MUSTANG_TRANS = (long *)0;
|
||||
SyfInfo->MUSTANG_OUT = (long *)0;
|
||||
SyfInfo->MUSTANG_CTRL = (long *)0;
|
||||
|
||||
FreeEdge = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeEdge = 0;
|
||||
}
|
||||
|
||||
EdgeWeightArray = SyfInfo->MUSTANG_EDGE;
|
||||
|
||||
CodeArray = (long *)autallocblock( sizeof(long) * NumberState );
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
|
||||
CodeArray[ ScanSyfState->INDEX ] = ScanSyfState->CODE->VALUE;
|
||||
}
|
||||
|
||||
EdgeCost = 0;
|
||||
LineStateI = 0;
|
||||
|
||||
for ( StateI = 0; StateI < NumberState; StateI++ )
|
||||
{
|
||||
for ( StateJ = 0; StateJ < NumberState; StateJ++ )
|
||||
{
|
||||
if ( StateJ != StateI )
|
||||
{
|
||||
Weight = EdgeWeightArray[ StateJ + LineStateI ];
|
||||
|
||||
if ( Weight != 0 )
|
||||
{
|
||||
Distance =
|
||||
|
||||
SyfGetHamingDistance( CodeArray[ StateI ], CodeArray[ StateJ ], NumberBit );
|
||||
|
||||
EdgeCost = EdgeCost + ( Distance * Weight );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LineStateI = LineStateI + NumberState;
|
||||
}
|
||||
|
||||
autfreeblock( CodeArray );
|
||||
|
||||
if ( FreeEdge )
|
||||
{
|
||||
autfreeblock( SyfInfo->MUSTANG_EDGE );
|
||||
|
||||
SyfInfo->MUSTANG_EDGE = (long *)0;
|
||||
}
|
||||
|
||||
return( EdgeCost );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmGetSortArray |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmGetSortArray( ValueArray, IndexArray, ArraySize )
|
||||
|
||||
long *ValueArray;
|
||||
long *IndexArray;
|
||||
long ArraySize;
|
||||
{
|
||||
long Node;
|
||||
long NodeIndex;
|
||||
long LastNode;
|
||||
long Father;
|
||||
long FatherIndex;
|
||||
long LeftChild;
|
||||
long LeftIndex;
|
||||
long RightChild;
|
||||
long RightIndex;
|
||||
long Child;
|
||||
long ChildIndex;
|
||||
|
||||
for ( LastNode = 0; LastNode < ArraySize; LastNode++ )
|
||||
{
|
||||
IndexArray[ LastNode ] = LastNode;
|
||||
|
||||
NodeIndex = LastNode;
|
||||
Node = LastNode;
|
||||
|
||||
do
|
||||
{
|
||||
Father = HEAP_FATHER( Node );
|
||||
|
||||
if ( Father != -1 )
|
||||
{
|
||||
FatherIndex = IndexArray[ Father ];
|
||||
|
||||
if ( ValueArray[ FatherIndex ] > ValueArray[ NodeIndex ] )
|
||||
{
|
||||
IndexArray[ Father ] = NodeIndex;
|
||||
IndexArray[ Node ] = FatherIndex;
|
||||
|
||||
Node = Father;
|
||||
}
|
||||
}
|
||||
}
|
||||
while ( Node == Father );
|
||||
}
|
||||
|
||||
for ( LastNode = ArraySize - 1; LastNode >= 0; LastNode-- )
|
||||
{
|
||||
Node = 0;
|
||||
|
||||
NodeIndex = IndexArray[ LastNode ];
|
||||
IndexArray[ LastNode ] = IndexArray[ 0 ];
|
||||
IndexArray[ 0 ] = NodeIndex;
|
||||
|
||||
do
|
||||
{
|
||||
LeftChild = HEAP_LEFT_CHILD( Node );
|
||||
RightChild = HEAP_RIGHT_CHILD( Node );
|
||||
|
||||
if ( LeftChild < LastNode )
|
||||
{
|
||||
LeftIndex = IndexArray[ LeftChild ];
|
||||
RightIndex = IndexArray[ RightChild ];
|
||||
|
||||
if ( ( RightChild < LastNode ) &&
|
||||
( ValueArray[ RightIndex ] < ValueArray[ LeftIndex ] ) )
|
||||
{
|
||||
Child = RightChild;
|
||||
ChildIndex = RightIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
Child = LeftChild;
|
||||
ChildIndex = LeftIndex;
|
||||
}
|
||||
|
||||
if ( ValueArray[ NodeIndex ] > ValueArray[ ChildIndex ] )
|
||||
{
|
||||
IndexArray[ Child ] = NodeIndex;
|
||||
IndexArray[ Node ] = ChildIndex;
|
||||
|
||||
Node = Child;
|
||||
}
|
||||
else
|
||||
{
|
||||
LeftChild = LastNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
while ( LeftChild < LastNode );
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmMustangEncode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmMustangEncode( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
syfstate *ScanSyfState;
|
||||
syfcode *CodeArray;
|
||||
long *EdgeArray;
|
||||
|
||||
short *DoneArray;
|
||||
long *SortArray;
|
||||
long *ValueArray;
|
||||
|
||||
long NearCounter;
|
||||
long NearCounterMax;
|
||||
long StateCounter;
|
||||
|
||||
long NearState;
|
||||
long BestState;
|
||||
long SortState;
|
||||
|
||||
long SumWeightMax;
|
||||
long SumWeight;
|
||||
long EdgeWeight;
|
||||
|
||||
long SortIndex;
|
||||
long StateIndex;
|
||||
long ValueIndex;
|
||||
long BestIndex;
|
||||
|
||||
long LineState;
|
||||
long LineSort;
|
||||
|
||||
long StateCode;
|
||||
long NearCode;
|
||||
|
||||
long BestDistance;
|
||||
long Distance;
|
||||
|
||||
long BitSet;
|
||||
long BestBitSet;
|
||||
|
||||
long NumberState;
|
||||
long NumberBit;
|
||||
long CodeMax;
|
||||
long ValueMax;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
CodeMax = SyfInfo->NUMBER_CODE;
|
||||
ValueMax = CodeMax;
|
||||
CodeArray = SyfInfo->CODE_ARRAY;
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
NumberBit = SyfInfo->NUMBER_BIT;
|
||||
|
||||
SyfFsmGetMustangEdge( FsmFigure);
|
||||
|
||||
autfreeblock( SyfInfo->MUSTANG_TRANS );
|
||||
autfreeblock( SyfInfo->MUSTANG_OUT );
|
||||
|
||||
if ( SyfInfo->MUSTANG_CTRL != (long *)0 )
|
||||
{
|
||||
autfreeblock( SyfInfo->MUSTANG_CTRL );
|
||||
}
|
||||
|
||||
EdgeArray = SyfInfo->MUSTANG_EDGE;
|
||||
|
||||
ValueArray = (long *)autallocblock( sizeof(long) * CodeMax );
|
||||
DoneArray = (short *)autallocblock( sizeof(short) * NumberState );
|
||||
SortArray = (long *)autallocblock( sizeof(long) * NumberState
|
||||
* NumberState );
|
||||
/*
|
||||
** Initialize possible code values
|
||||
*/
|
||||
for ( ValueIndex = 0; ValueIndex < ValueMax; ValueIndex++ )
|
||||
{
|
||||
ValueArray[ ValueIndex ] = ValueIndex;
|
||||
}
|
||||
|
||||
/*
|
||||
** Assign code pointer for states
|
||||
*/
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
|
||||
ScanSyfState->CODE = &CodeArray[ ScanSyfState->INDEX ];
|
||||
}
|
||||
|
||||
/*
|
||||
** Sort states index from edge weight values
|
||||
*/
|
||||
LineState = 0;
|
||||
|
||||
for ( StateIndex = 0; StateIndex < NumberState; StateIndex++ )
|
||||
{
|
||||
SyfFsmGetSortArray( EdgeArray + LineState,
|
||||
SortArray + LineState, NumberState );
|
||||
|
||||
LineState = LineState + NumberState;
|
||||
}
|
||||
|
||||
StateCounter = 0;
|
||||
|
||||
while ( StateCounter < NumberState )
|
||||
{
|
||||
/*
|
||||
** Look for a "best" state, and a maximum of NumberBit "near" states
|
||||
*/
|
||||
SumWeightMax = -1;
|
||||
BestState = -1;
|
||||
LineSort = 0;
|
||||
NearCounterMax = 0;
|
||||
|
||||
for ( StateIndex = 0; StateIndex < NumberState; StateIndex++ )
|
||||
{
|
||||
if ( ! DoneArray[ StateIndex ] )
|
||||
{
|
||||
SumWeight = 0;
|
||||
NearCounter = 0;
|
||||
|
||||
for ( SortIndex = 0; SortIndex < NumberState; SortIndex++ )
|
||||
{
|
||||
SortState = SortArray[ LineSort + SortIndex ];
|
||||
|
||||
if ( ! DoneArray[ SortState ] )
|
||||
{
|
||||
EdgeWeight = EdgeArray[ LineSort + SortState ];
|
||||
|
||||
if ( EdgeWeight == 0 ) break;
|
||||
|
||||
SumWeight = SumWeight + EdgeWeight;
|
||||
|
||||
NearCounter++;
|
||||
|
||||
if ( NearCounter >= NumberBit ) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( SumWeight > SumWeightMax )
|
||||
{
|
||||
BestState = StateIndex;
|
||||
LineState = LineSort;
|
||||
SumWeightMax = SumWeight;
|
||||
NearCounterMax = NearCounter;
|
||||
}
|
||||
}
|
||||
|
||||
LineSort = LineSort + NumberState;
|
||||
}
|
||||
/*
|
||||
** Get unused code for the "best" state
|
||||
*/
|
||||
DoneArray[ BestState ] = 1;
|
||||
|
||||
if ( ! CodeArray[ BestState ].USED )
|
||||
{
|
||||
ValueMax = ValueMax - 1;
|
||||
StateCode = ValueArray[ 0 ];
|
||||
|
||||
if ( ValueMax != 0 )
|
||||
{
|
||||
ValueArray[ 0 ] = ValueArray[ ValueMax ];
|
||||
ValueArray[ ValueMax ] = StateCode;
|
||||
}
|
||||
|
||||
CodeArray[ BestState ].USED = 1;
|
||||
CodeArray[ BestState ].VALUE = StateCode;
|
||||
|
||||
StateCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
StateCode = CodeArray[ BestState ].VALUE;
|
||||
}
|
||||
/*
|
||||
** Get nearest code for the "near" states
|
||||
*/
|
||||
NearCounter = 0;
|
||||
LineSort = LineState;
|
||||
|
||||
for ( SortIndex = 0; SortIndex < NumberState; SortIndex++ )
|
||||
{
|
||||
NearState = SortArray[ LineSort + SortIndex ];
|
||||
|
||||
if ( DoneArray[ NearState ] ) continue;
|
||||
|
||||
if ( ! CodeArray[ NearState ].USED )
|
||||
{
|
||||
BestIndex = 0;
|
||||
BestDistance = NumberBit;
|
||||
BestBitSet = NumberBit;
|
||||
/*
|
||||
** Search the nearest code in the possible code array
|
||||
*/
|
||||
for ( ValueIndex = 0; ValueIndex < ValueMax; ValueIndex++ )
|
||||
{
|
||||
Distance =
|
||||
|
||||
SyfGetHamingDistance( StateCode, ValueArray[ ValueIndex ], NumberBit );
|
||||
|
||||
BitSet =
|
||||
|
||||
SyfGetNumberBitSet( ValueArray[ ValueIndex ], NumberBit );
|
||||
|
||||
if ( BestDistance > Distance )
|
||||
{
|
||||
BestDistance = Distance;
|
||||
BestBitSet = BitSet;
|
||||
BestIndex = ValueIndex;
|
||||
}
|
||||
else
|
||||
if ( ( BestDistance == Distance ) &&
|
||||
( BitSet < BestBitSet ) )
|
||||
{
|
||||
BestBitSet = BitSet;
|
||||
BestIndex = ValueIndex;
|
||||
}
|
||||
}
|
||||
|
||||
ValueMax = ValueMax - 1;
|
||||
NearCode = ValueArray[ BestIndex ];
|
||||
|
||||
if ( BestIndex != ValueMax )
|
||||
{
|
||||
ValueArray[ BestIndex ] = ValueArray[ ValueMax ];
|
||||
ValueArray[ ValueMax ] = NearCode;
|
||||
}
|
||||
|
||||
CodeArray[ NearState ].USED = 1;
|
||||
CodeArray[ NearState ].VALUE = NearCode;
|
||||
|
||||
StateCounter++;
|
||||
}
|
||||
|
||||
NearCounter++;
|
||||
|
||||
if ( NearCounter >= NearCounterMax ) break;
|
||||
}
|
||||
}
|
||||
|
||||
for ( ValueIndex = 0; ValueIndex < ValueMax; ValueIndex++ )
|
||||
{
|
||||
CodeArray[ NumberState + ValueIndex ].VALUE = ValueArray[ ValueIndex ];
|
||||
}
|
||||
|
||||
autfreeblock( SortArray );
|
||||
autfreeblock( DoneArray );
|
||||
autfreeblock( ValueArray );
|
||||
|
||||
autfreeblock( SyfInfo->MUSTANG_EDGE );
|
||||
|
||||
SyfInfo->MUSTANG_TRANS = (long *)0;
|
||||
SyfInfo->MUSTANG_OUT = (long *)0;
|
||||
SyfInfo->MUSTANG_CTRL = (long *)0;
|
||||
SyfInfo->MUSTANG_EDGE = (long *)0;
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_must.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_MUSTANG_H
|
||||
# define SYF_MUSTANG_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define HEAP_FATHER( Node ) ( ( ( ( Node ) + 1 ) >> 1 ) - 1 )
|
||||
# define HEAP_LEFT_CHILD( Node ) ( ( ( ( Node ) + 1 ) << 1 ) - 1 )
|
||||
# define HEAP_RIGHT_CHILD( Node ) ( ( ( Node ) + 1 ) << 1 )
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmMustangEncode();
|
||||
extern void SyfFsmGetMustangTrans();
|
||||
extern void SyfFsmGetMustangOut();
|
||||
extern void SyfFsmGetMustangCtrl();
|
||||
extern void SyfFsmGetMustangEdge();
|
||||
extern long SyfFsmGetMustangCost();
|
||||
|
||||
extern void SyfFsmGetSortArray();
|
||||
|
||||
|
||||
# ifdef SYF_DEBUG
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| View Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmViewMustangOut();
|
||||
extern void SyfFsmViewMustangTrans();
|
||||
extern void SyfFsmViewMustangCtrl();
|
||||
extern void SyfFsmViewMustangEdge();
|
||||
|
||||
# endif
|
||||
|
||||
# endif
|
|
@ -0,0 +1,111 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : Syf_must.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <memory.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_onehot.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmOneHotEncode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmOneHotEncode( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
syfcode *CodeArray;
|
||||
long CodeMax;
|
||||
long Index;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
CodeMax = SyfInfo->NUMBER_CODE;
|
||||
CodeArray = SyfInfo->CODE_ARRAY;
|
||||
|
||||
ScanState = FsmFigure->STATE;
|
||||
|
||||
for ( Index = 0; Index < CodeMax; Index++ )
|
||||
{
|
||||
FSM_SYF_STATE( ScanState )->CODE = &CodeArray[ Index ];
|
||||
|
||||
CodeArray[ Index ].VALUE = Index;
|
||||
CodeArray[ Index ].USED = 1;
|
||||
|
||||
ScanState = ScanState->NEXT;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_onehot.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_ONEHOT_H
|
||||
# define SYF_ONEHOT_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmOneHotEncode();
|
||||
|
||||
# endif
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : random.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
# include <stdio.h>
|
||||
# include <sys/types.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# include <string.h>
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_random.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static char SyfInitializedRandom = 0;
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfInitializeRandom |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfInitializeRandom()
|
||||
{
|
||||
if ( ! SyfInitializedRandom )
|
||||
{
|
||||
SyfInitializedRandom = 1;
|
||||
|
||||
srand( getpid() );
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfRandomEncode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmRandomEncode( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
syfcode *CodeArray;
|
||||
long CodeMax;
|
||||
int Index;
|
||||
int Swap;
|
||||
int Scan;
|
||||
|
||||
SyfInitializeRandom();
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
CodeMax = SyfInfo->NUMBER_CODE;
|
||||
CodeArray = SyfInfo->CODE_ARRAY;
|
||||
|
||||
for ( Index = 0; Index < CodeMax; Index++ )
|
||||
{
|
||||
CodeArray[ Index ].VALUE = Index;
|
||||
}
|
||||
|
||||
ScanState = FsmFigure->STATE;
|
||||
|
||||
while ( ScanState != (fsmstate_list *)0 )
|
||||
{
|
||||
Scan = ( rand() >> 8 ) % CodeMax;
|
||||
|
||||
CodeMax = CodeMax - 1;
|
||||
|
||||
FSM_SYF_STATE( ScanState )->CODE = &CodeArray[ CodeMax ];
|
||||
|
||||
CodeArray[ CodeMax ].USED = 1;
|
||||
|
||||
if ( Scan != CodeMax )
|
||||
{
|
||||
Swap = CodeArray[ CodeMax ].VALUE;
|
||||
CodeArray[ CodeMax ].VALUE = CodeArray[ Scan ].VALUE;
|
||||
CodeArray[ Scan ].VALUE = Swap;
|
||||
}
|
||||
|
||||
ScanState = ScanState->NEXT;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : random.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_RANDOM_H
|
||||
# define SYF_RANDOM_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmRandomEncode();
|
||||
extern void SyfInitializeRandom();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,134 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_simp.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
# include FVH_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_tools.h"
|
||||
# include "syf_bdd.h"
|
||||
# include "syf_simp.h"
|
||||
# include "syf_error.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFbhSimplify |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
|
||||
void SyfFbhSimplify( FbhFigure )
|
||||
|
||||
fbfig_list *FbhFigure;
|
||||
{
|
||||
fbout_list *FbOut;
|
||||
fbreg_list *FbReg;
|
||||
biabl_list *FbBiabl;
|
||||
fbaux_list *FbAux;
|
||||
|
||||
for ( FbAux = FbhFigure->BEAUX;
|
||||
FbAux != (fbaux_list *)0;
|
||||
FbAux = FbAux->NEXT )
|
||||
{
|
||||
if ( FbAux->ABL != (chain_list *)0 )
|
||||
{
|
||||
FbAux->ABL = simpablexpr( FbAux->ABL );
|
||||
}
|
||||
}
|
||||
|
||||
for ( FbOut = FbhFigure->BEOUT;
|
||||
FbOut != (fbout_list *)0;
|
||||
FbOut = FbOut->NEXT )
|
||||
{
|
||||
if ( FbOut->ABL != (chain_list *)0 )
|
||||
{
|
||||
FbOut->ABL = simpablexpr( FbOut->ABL );
|
||||
}
|
||||
}
|
||||
|
||||
for ( FbReg = FbhFigure->BEREG;
|
||||
FbReg != (fbreg_list *)0;
|
||||
FbReg = FbReg->NEXT )
|
||||
{
|
||||
for ( FbBiabl = FbReg->BIABL;
|
||||
FbBiabl != (biabl_list *)0;
|
||||
FbBiabl = FbBiabl->NEXT )
|
||||
{
|
||||
if ( ( FbBiabl->CNDABL != (chain_list *)0 ) &&
|
||||
( FbBiabl->VALABL != (chain_list *)0 ) )
|
||||
{
|
||||
FbBiabl->CNDABL = simpablexpr( FbBiabl->CNDABL );
|
||||
FbBiabl->VALABL = simpablexpr( FbBiabl->VALABL );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_simp.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_SIMP_H
|
||||
# define SYF_SIMP_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFbhSimplify();
|
||||
|
||||
# endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,88 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_synth.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_SYNTH_H
|
||||
# define SYF_SYNTH_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfSynthStack2Abl();
|
||||
extern void SyfSynthCtrl2Abl();
|
||||
extern void SyfSynthOut2Abl();
|
||||
extern void SyfSynthReg2Abl();
|
||||
extern void SyfSynthCode2Abl();
|
||||
extern void SyfSynthTrans2Abl();
|
||||
extern void SyfSynthFsm2Abl();
|
||||
|
||||
extern void SyfSynthFreeStackAbl();
|
||||
extern void SyfSynthFreeCtrlAbl();
|
||||
extern void SyfSynthFreeOutAbl();
|
||||
extern void SyfSynthFreeRegAbl();
|
||||
extern void SyfSynthFreeCodeAbl();
|
||||
extern void SyfSynthFreeTransAbl();
|
||||
extern void SyfSynthFreeFsmAbl();
|
||||
|
||||
extern void SyfSynthFsmInit();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,159 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_tools.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_tools.h"
|
||||
# include "syf_error.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfGetNumberBit |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
int SyfGetNumberBit( Value )
|
||||
|
||||
long Value;
|
||||
{
|
||||
long Mask;
|
||||
int NumberBit;
|
||||
|
||||
Mask = 1 << 31;
|
||||
|
||||
for ( NumberBit = 32; NumberBit > 0; NumberBit-- )
|
||||
{
|
||||
if ( Mask & Value ) return( NumberBit );
|
||||
|
||||
Mask = Mask >> 1;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfGetHamingDistance |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
int SyfGetHamingDistance( First, Second, Bits )
|
||||
|
||||
int First;
|
||||
int Second;
|
||||
int Bits;
|
||||
{
|
||||
register int Mask;
|
||||
register int Counter;
|
||||
register int Distance;
|
||||
|
||||
First = First ^ Second;
|
||||
Distance = 0;
|
||||
Mask = 1;
|
||||
|
||||
for( Counter = 0; Counter < Bits; Counter++ )
|
||||
{
|
||||
if( Mask & First ) Distance++;
|
||||
|
||||
Mask = Mask << 1;
|
||||
}
|
||||
|
||||
return( Distance );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfGetNumberBitSet |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
int SyfGetNumberBitSet( Number, Bits )
|
||||
|
||||
int Number;
|
||||
int Bits;
|
||||
{
|
||||
int Mask;
|
||||
int Counter;
|
||||
int BitSet;
|
||||
|
||||
Mask = 1;
|
||||
BitSet = 0;
|
||||
|
||||
for( Counter = 0; Counter < Bits; Counter++ )
|
||||
{
|
||||
if( Mask & Number ) BitSet++;
|
||||
|
||||
Mask = Mask << 1;
|
||||
}
|
||||
|
||||
return( BitSet );
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_tools.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_TOOLS_H
|
||||
# define SYF_TOOLS_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern int SyfGetHamingDistance();
|
||||
extern int SyfGetNumberBit();
|
||||
extern int SyfGetNumberBitSet();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,339 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_user.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 "syf_fsm.h"
|
||||
# include "syf_error.h"
|
||||
# include "syf_user.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static char SyfUserBuffer[ SYF_USER_BUFFER_SIZE ];
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmUserSaveCode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmUserSaveCode( FsmFigure, FileName )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
char *FileName;
|
||||
{
|
||||
FILE *UserFile;
|
||||
fsmstate_list *ScanState;
|
||||
syfinfo *SyfInfo;
|
||||
long Value;
|
||||
long Bit;
|
||||
char OneHot;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
UserFile = mbkfopen( FileName, "enc", "w" );
|
||||
|
||||
if ( UserFile == (FILE *)0 )
|
||||
{
|
||||
SyfError( SYF_ERROR_OPEN_FILE, FileName );
|
||||
}
|
||||
|
||||
fprintf( UserFile, "# Encoding figure \"%s\"\n", FsmFigure->NAME );
|
||||
fprintf( UserFile, "-%c %ld\n" , SyfInfo->ENCODE, SyfInfo->NUMBER_BIT );
|
||||
|
||||
OneHot = ( SyfInfo->ENCODE == SYF_ENCODE_ONE_HOT );
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
Value = FSM_SYF_STATE( ScanState )->CODE->VALUE;
|
||||
|
||||
fprintf( UserFile,"%s\t%lX", ScanState->NAME, Value );
|
||||
|
||||
if ( OneHot )
|
||||
{
|
||||
Bit = Value & 0x03;
|
||||
|
||||
fprintf( UserFile, "\t%lX", (long)( 1 << Bit ) );
|
||||
|
||||
Value = Value - Bit;
|
||||
|
||||
while ( Value > 0 )
|
||||
{
|
||||
Value = Value - 4;
|
||||
|
||||
fprintf( UserFile, "0" );
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsFsmFirstState( ScanState ) ) fprintf( UserFile, "\tFirst state" );
|
||||
|
||||
fprintf( UserFile, "\n" );
|
||||
}
|
||||
|
||||
fclose( UserFile );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmUserEncode |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmUserEncode( FsmFigure, FileName )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
char *FileName;
|
||||
{
|
||||
FILE *UserFile;
|
||||
syfinfo *SyfInfo;
|
||||
syfcode *CodeArray;
|
||||
fsmstate_list *ScanState;
|
||||
syfstate *ScanSyfState;
|
||||
char *ScanBuffer;
|
||||
authtable *HashTable;
|
||||
authelem *Element;
|
||||
char *StateName;
|
||||
unsigned long StateCode;
|
||||
long NumberState;
|
||||
long NumberBit;
|
||||
long CurrentLine;
|
||||
unsigned long CodeMax;
|
||||
long Index;
|
||||
long Error;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
CodeMax = SyfInfo->NUMBER_CODE;
|
||||
CodeArray = SyfInfo->CODE_ARRAY;
|
||||
NumberState = FsmFigure->NUMBER_STATE;
|
||||
|
||||
for ( Index = 0; Index < CodeMax; Index++ )
|
||||
{
|
||||
CodeArray[ Index ].VALUE = Index;
|
||||
}
|
||||
|
||||
HashTable = createauthtable( NumberState << 1 );
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
addauthelem( HashTable, ScanState->NAME, (long)ScanState );
|
||||
}
|
||||
|
||||
UserFile = mbkfopen( FileName, "enc", "r" );
|
||||
|
||||
if ( UserFile == (FILE *)0 )
|
||||
{
|
||||
SyfError( SYF_ERROR_OPEN_FILE, FileName );
|
||||
}
|
||||
|
||||
CurrentLine = 1;
|
||||
Error = 0;
|
||||
|
||||
while ( fgets( SyfUserBuffer,
|
||||
SYF_USER_BUFFER_SIZE,
|
||||
UserFile ) != (char *)0 )
|
||||
{
|
||||
for ( Index = 0; SyfUserBuffer[ Index ] != '\0'; Index++ )
|
||||
{
|
||||
if ( ! isspace( SyfUserBuffer[ Index ] ) ) break;
|
||||
}
|
||||
|
||||
ScanBuffer = SyfUserBuffer + Index;
|
||||
|
||||
if ( ScanBuffer[ 0 ] == '-' )
|
||||
{
|
||||
if ( ScanBuffer[ 1 ] == SYF_ENCODE_ONE_HOT )
|
||||
{
|
||||
CodeMax = NumberState;
|
||||
|
||||
autfreeblock( (char *)CodeArray );
|
||||
CodeArray = (syfcode *)autallocblock( sizeof( syfcode ) * CodeMax );
|
||||
|
||||
SyfInfo->CODE_ARRAY = CodeArray;
|
||||
SyfInfo->NUMBER_CODE = CodeMax;
|
||||
SyfInfo->NUMBER_BIT = CodeMax;
|
||||
SyfInfo->ENCODE = SYF_ENCODE_ONE_HOT;
|
||||
|
||||
for ( Index = 0; Index < CodeMax; Index++ )
|
||||
{
|
||||
CodeArray[ Index ].VALUE = Index;
|
||||
}
|
||||
}
|
||||
else
|
||||
if ( ScanBuffer[ 1 ] == SYF_ENCODE_FRANCK )
|
||||
{
|
||||
NumberBit = atoi( &ScanBuffer[ 2 ] );
|
||||
|
||||
if ( ( NumberBit > SyfInfo->NUMBER_BIT ) &&
|
||||
( NumberBit < 32 ) )
|
||||
{
|
||||
CodeMax = 1 << NumberBit;
|
||||
|
||||
autfreeblock( (char *)CodeArray );
|
||||
CodeArray = (syfcode *)autallocblock( sizeof( syfcode ) * NumberState );
|
||||
|
||||
SyfInfo->CODE_ARRAY = CodeArray;
|
||||
SyfInfo->NUMBER_CODE = NumberState;
|
||||
SyfInfo->NUMBER_BIT = NumberBit;
|
||||
SyfInfo->ENCODE = SYF_ENCODE_FRANCK;
|
||||
}
|
||||
else
|
||||
{
|
||||
Error = SYF_ERROR_SYNTAX; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
if ( ( ScanBuffer[ 0 ] != '#' ) &&
|
||||
( ScanBuffer[ 0 ] != '\0' ) )
|
||||
{
|
||||
StateCode = -1;
|
||||
StateName = (char *)0;
|
||||
|
||||
for ( Index = 0; ScanBuffer[ Index ] != '\0'; Index++ )
|
||||
{
|
||||
if ( ( isspace( ScanBuffer[ Index ] ) ) &&
|
||||
( ScanBuffer[ Index + 1 ] != '\0' ) )
|
||||
{
|
||||
StateName = ScanBuffer;
|
||||
ScanBuffer[ Index ] = '\0';
|
||||
sscanf( ScanBuffer + Index + 1, "%lx", &StateCode );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( StateName == (char *)0 )
|
||||
{
|
||||
Error = SYF_ERROR_SYNTAX; break;
|
||||
}
|
||||
|
||||
if ( ( (long)StateCode < 0 ) ||
|
||||
( StateCode >= CodeMax ) )
|
||||
{
|
||||
Error = SYF_ERROR_WRONG_CODE; break;
|
||||
}
|
||||
|
||||
StateName = namealloc( StateName );
|
||||
Element = searchauthelem( HashTable, StateName );
|
||||
|
||||
if ( Element == (authelem *)0 )
|
||||
{
|
||||
Error = SYF_ERROR_UNKNOWN_STATE; break;
|
||||
}
|
||||
|
||||
ScanState = (fsmstate_list *)Element->VALUE;
|
||||
ScanSyfState = FSM_SYF_STATE( ScanState );
|
||||
|
||||
if ( ScanSyfState->CODE != (syfcode *)0 )
|
||||
{
|
||||
Error = SYF_ERROR_DUPLICATE_CODE; break;
|
||||
}
|
||||
|
||||
if ( SyfInfo->ENCODE != SYF_ENCODE_FRANCK )
|
||||
{
|
||||
if ( CodeArray[ StateCode ].USED )
|
||||
{
|
||||
Error = SYF_ERROR_DUPLICATE_CODE; break;
|
||||
}
|
||||
|
||||
CodeArray[ StateCode ].USED = 1;
|
||||
ScanSyfState->CODE = &CodeArray[ StateCode ];
|
||||
}
|
||||
else
|
||||
{
|
||||
CodeArray[ NumberState - 1 ].USED = 1;
|
||||
CodeArray[ NumberState - 1 ].VALUE = StateCode;
|
||||
ScanSyfState->CODE = &CodeArray[ NumberState - 1 ];
|
||||
}
|
||||
|
||||
NumberState--;
|
||||
}
|
||||
|
||||
CurrentLine++;
|
||||
}
|
||||
|
||||
if ( ( ! Error ) &&
|
||||
( NumberState != 0 ) ) Error = SYF_ERROR_UNEXPECTED_EOF;
|
||||
|
||||
if ( Error )
|
||||
{
|
||||
sprintf( SyfUserBuffer, "line %ld in file \"%s.enc\"", CurrentLine, FileName );
|
||||
SyfError( Error, SyfUserBuffer );
|
||||
}
|
||||
|
||||
destroyauthtable( HashTable );
|
||||
|
||||
fclose( UserFile );
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_user.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_USER_H
|
||||
# define SYF_USER_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# define SYF_USER_BUFFER_SIZE 512
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmUserEncode();
|
||||
extern void SyfFsmUserSaveCode();
|
||||
|
||||
# endif
|
|
@ -0,0 +1,957 @@
|
|||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| 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 : SYF |
|
||||
| |
|
||||
| File : syf_verify.c |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Include Files |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# include MUT_H
|
||||
# include AUT_H
|
||||
# include ABL_H
|
||||
# include BDD_H
|
||||
# include FSM_H
|
||||
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
# include "syf_fsm.h"
|
||||
# include "syf_env.h"
|
||||
# include "syf_bdd.h"
|
||||
# include "syf_tools.h"
|
||||
# include "syf_verify.h"
|
||||
# include "syf_error.h"
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmVerifyMooreExpr |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
int SyfFsmVerifyMooreExpr( FsmFigure, Equation )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
chain_list *Equation;
|
||||
{
|
||||
char *Value;
|
||||
|
||||
if ( Equation == (chain_list *)0 )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
if ( ABL_ATOM( Equation ) )
|
||||
{
|
||||
Value = ABL_ATOM_VALUE( Equation );
|
||||
|
||||
if ( ( Value != ABL_ATOM_NAME_ZERO ) &&
|
||||
( Value != ABL_ATOM_NAME_ONE ) &&
|
||||
( Value != ABL_ATOM_NAME_DC ) )
|
||||
{
|
||||
if ( searchfsmin( FsmFigure, Value ) )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( ( Equation = ABL_CDR( Equation ) ) != (ablexpr *)0 )
|
||||
{
|
||||
if ( SyfFsmVerifyMooreExpr( FsmFigure, ABL_CAR( Equation ) ) )
|
||||
{
|
||||
return( 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfVerifyExclusivity |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static void SyfVerifyExclusivity( ScanState, StarState )
|
||||
|
||||
fsmstate_list *ScanState;
|
||||
fsmstate_list *StarState;
|
||||
{
|
||||
chain_list *ScanChain;
|
||||
chain_list *ScanNext;
|
||||
fsmtrans_list *ScanTrans;
|
||||
fsmtrans_list *NextTrans;
|
||||
fsmstack_list *ScanStack;
|
||||
fsmstack_list *NextStack;
|
||||
bddnode *TransCond;
|
||||
bddnode *NextCond;
|
||||
bddnode *ProductCond;
|
||||
char Counter;
|
||||
char NextCounter;
|
||||
|
||||
Counter = 0;
|
||||
ScanChain = ScanState->FROM;
|
||||
|
||||
while ( Counter < 4 )
|
||||
{
|
||||
while ( ScanChain != (chain_list *)0 )
|
||||
{
|
||||
if ( Counter & 0x1 )
|
||||
{
|
||||
ScanStack = (fsmstack_list *)ScanChain->DATA;
|
||||
TransCond = ScanStack->BDD;
|
||||
|
||||
if ( ScanStack->CTRL != FSM_CTRL_POP )
|
||||
{
|
||||
ScanChain = ScanChain->NEXT; continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanTrans = (fsmtrans_list *)ScanChain->DATA;
|
||||
TransCond = ScanTrans->BDD;
|
||||
}
|
||||
|
||||
NextCounter = Counter;
|
||||
ScanNext = ScanChain->NEXT;
|
||||
|
||||
while ( NextCounter < 4 )
|
||||
{
|
||||
while ( ScanNext != (chain_list *)0 )
|
||||
{
|
||||
if ( NextCounter & 0x1 )
|
||||
{
|
||||
NextStack = (fsmstack_list *)ScanNext->DATA;
|
||||
NextCond = NextStack->BDD;
|
||||
|
||||
if ( NextStack->CTRL != FSM_CTRL_POP )
|
||||
{
|
||||
ScanNext = ScanNext->NEXT; continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NextTrans = (fsmtrans_list *)ScanNext->DATA;
|
||||
NextCond = NextTrans->BDD;
|
||||
}
|
||||
|
||||
ProductCond = applybddnode( (bddsystem *)0, ABL_AND, NextCond, TransCond );
|
||||
|
||||
if ( ProductCond != BddLocalSystem->ZERO )
|
||||
{
|
||||
SyfWarning( SYF_WARNING_INTER_TRANS, ScanState->NAME, NULL );
|
||||
}
|
||||
|
||||
ScanNext = ScanNext->NEXT;
|
||||
}
|
||||
|
||||
NextCounter = NextCounter + 1;
|
||||
|
||||
if ( ( NextCounter > 1 ) &&
|
||||
( StarState == (fsmstate_list *)0 ) ) break;
|
||||
|
||||
if ( NextCounter == 1 ) ScanNext = ScanState->STACK;
|
||||
else
|
||||
if ( NextCounter == 2 ) ScanNext = StarState->FROM;
|
||||
else ScanNext = StarState->STACK;
|
||||
}
|
||||
|
||||
ScanChain = ScanChain->NEXT;
|
||||
}
|
||||
|
||||
Counter = Counter + 1;
|
||||
|
||||
|
||||
if ( ( Counter > 1 ) &&
|
||||
( StarState == (fsmstate_list *)0 ) ) break;
|
||||
|
||||
if ( Counter == 1 ) ScanChain = ScanState->STACK;
|
||||
else
|
||||
if ( Counter == 2 ) ScanChain = StarState->FROM;
|
||||
else ScanChain = StarState->STACK;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfVerifyCompletly |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static void SyfVerifyCompletly( ScanState, SumStar )
|
||||
|
||||
fsmstate_list *ScanState;
|
||||
bddnode *SumStar;
|
||||
{
|
||||
chain_list *ScanChain;
|
||||
fsmtrans_list *ScanTrans;
|
||||
fsmstack_list *ScanStack;
|
||||
bddnode *TransCond;
|
||||
bddnode *SumCond;
|
||||
char Stack;
|
||||
|
||||
SumCond = SumStar;
|
||||
Stack = 0;
|
||||
ScanChain = ScanState->FROM;
|
||||
|
||||
while ( Stack < 2 )
|
||||
{
|
||||
while ( ScanChain != (chain_list *)0 )
|
||||
{
|
||||
if ( ! Stack )
|
||||
{
|
||||
ScanTrans = (fsmtrans_list *)ScanChain->DATA;
|
||||
TransCond = ScanTrans->BDD;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanStack = (fsmstack_list *)ScanChain->DATA;
|
||||
TransCond = ScanStack->BDD;
|
||||
|
||||
if ( ScanStack->CTRL != FSM_CTRL_POP )
|
||||
{
|
||||
ScanChain = ScanChain->NEXT;
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
SumCond = applybddnode( (bddsystem *)0, ABL_OR, SumCond, TransCond );
|
||||
ScanChain = ScanChain->NEXT;
|
||||
}
|
||||
|
||||
ScanChain = ScanState->STACK;
|
||||
Stack = Stack + 1;
|
||||
}
|
||||
|
||||
if ( SumCond != BddLocalSystem->ONE )
|
||||
{
|
||||
SyfWarning( SYF_WARNING_SUM_TRANS, ScanState->NAME, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfVerifyTransistion |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
static void SyfVerifyTransition( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
bddsystem *BddSystem;
|
||||
bddcircuit *BddCircuit;
|
||||
fsmstate_list *ScanState;
|
||||
fsmstate_list *StarState;
|
||||
chain_list *ScanChain;
|
||||
fsmtrans_list *StarTrans;
|
||||
fsmstack_list *StarStack;
|
||||
bddnode *TransCond;
|
||||
bddnode *SumStar;
|
||||
char Stack;
|
||||
|
||||
if ( FsmFigure->CIRCUIT == (bddcircuit *)0 )
|
||||
{
|
||||
BddSystem = createbddsystem( SYF_BDD_VAR_NODE, SYF_BDD_OPER_NODE, 1000, SYF_BDD_MAX_NODE );
|
||||
reorderbddsystemdynamic( BddSystem, SYF_BDD_REORDER_FUNC,
|
||||
SYF_BDD_REORDER_NODE, SYF_BDD_REORDER_RATIO );
|
||||
BddCircuit = SyfFsmMakeBddCircuit( BddSystem, FsmFigure );
|
||||
reorderbddsystemsimple( BddSystem );
|
||||
}
|
||||
else
|
||||
{
|
||||
BddCircuit = FsmFigure->CIRCUIT;
|
||||
BddSystem = BddCircuit->BDD_SYSTEM;
|
||||
|
||||
setbddlocalcircuit( BddCircuit );
|
||||
setbddlocalsystem( BddSystem );
|
||||
}
|
||||
/*
|
||||
** Compute Sum Star Transitions
|
||||
*/
|
||||
SumStar = BddLocalSystem->ZERO;
|
||||
StarState = FsmFigure->STAR_STATE;
|
||||
|
||||
if ( StarState != (fsmstate_list *)0 )
|
||||
{
|
||||
Stack = 0;
|
||||
ScanChain = StarState->FROM;
|
||||
|
||||
while ( Stack < 2 )
|
||||
{
|
||||
while ( ScanChain != (chain_list *)0 )
|
||||
{
|
||||
if ( ! Stack )
|
||||
{
|
||||
StarTrans = (fsmtrans_list *)ScanChain->DATA;
|
||||
TransCond = StarTrans->BDD;
|
||||
}
|
||||
else
|
||||
{
|
||||
StarStack = (fsmstack_list *)ScanChain->DATA;
|
||||
TransCond = StarStack->BDD;
|
||||
|
||||
if ( StarStack->CTRL != FSM_CTRL_POP )
|
||||
{
|
||||
ScanChain = ScanChain->NEXT; continue;
|
||||
}
|
||||
}
|
||||
|
||||
decbddrefext( SumStar );
|
||||
SumStar = applybddnode( (bddsystem *)0, ABL_OR, SumStar, TransCond );
|
||||
ScanChain = ScanChain->NEXT;
|
||||
}
|
||||
|
||||
ScanChain = StarState->STACK;
|
||||
Stack = Stack + 1;
|
||||
}
|
||||
}
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
SyfVerifyCompletly( ScanState, SumStar );
|
||||
SyfVerifyExclusivity( ScanState, StarState );
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmVerify |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmVerify( FsmFigure, FlagVerify )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
int FlagVerify;
|
||||
{
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
fsmstack_list *ScanStack;
|
||||
fsmlocout_list *ScanLocout;
|
||||
chain_list *ScanChain;
|
||||
char TypeMoore;
|
||||
int NumberPush;
|
||||
int NumberPop;
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
|
||||
if ( SyfInfo->STACK )
|
||||
{
|
||||
NumberPush = 0;
|
||||
NumberPop = 0;
|
||||
|
||||
for ( ScanStack = FsmFigure->STACK;
|
||||
ScanStack != (fsmstack_list *)0;
|
||||
ScanStack = ScanStack->NEXT )
|
||||
{
|
||||
if ( ScanStack->CTRL == FSM_CTRL_PUSH ) NumberPush++;
|
||||
else
|
||||
if ( ScanStack->CTRL == FSM_CTRL_POP ) NumberPop++;
|
||||
}
|
||||
|
||||
if ( ( NumberPush == 0 ) &&
|
||||
( NumberPop == 0 ) )
|
||||
{
|
||||
FsmFigure->STACK_SIZE = 0;
|
||||
|
||||
while ( FsmFigure->STACK != (fsmstack_list *)0 )
|
||||
{
|
||||
delfsmstack( FsmFigure, FsmFigure->STACK );
|
||||
}
|
||||
|
||||
SyfWarning( SYF_WARNING_REMOVE_UNUSED_STACK, FsmFigure->NAME, NULL );
|
||||
}
|
||||
else
|
||||
if ( NumberPop == 0 )
|
||||
{
|
||||
SyfError( SYF_ERROR_BAD_STACK_NO_POP, FsmFigure->NAME );
|
||||
}
|
||||
else
|
||||
if ( NumberPush == 0 )
|
||||
{
|
||||
SyfError( SYF_ERROR_BAD_STACK_NO_PUSH, FsmFigure->NAME );
|
||||
}
|
||||
}
|
||||
|
||||
TypeMoore = 1;
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
if ( IsFsmStarState( ScanState ) ) continue;
|
||||
|
||||
if ( ScanState->TO == (chain_list *)0 )
|
||||
{
|
||||
/*
|
||||
** No transition to E(i)
|
||||
*/
|
||||
if ( SyfInfo->STACK )
|
||||
{
|
||||
for ( ScanStack = FsmFigure->STACK;
|
||||
ScanStack != (fsmstack_list *)0;
|
||||
ScanStack = ScanStack->NEXT )
|
||||
{
|
||||
if ( ( ScanStack->CTRL == FSM_CTRL_PUSH ) &&
|
||||
( ScanStack->RETURN == ScanState ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
** No stack transition to E(i)
|
||||
*/
|
||||
if ( ScanStack == (fsmstack_list *)0 )
|
||||
{
|
||||
SyfWarning( SYF_WARNING_NO_TRANS_TO, ScanState->NAME, NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SyfWarning( SYF_WARNING_NO_TRANS_TO, ScanState->NAME, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ScanState->FROM == (chain_list *)0 )
|
||||
{
|
||||
/*
|
||||
** No transition from E(i)
|
||||
*/
|
||||
if ( SyfInfo->STACK )
|
||||
{
|
||||
for ( ScanChain = ScanState->STACK;
|
||||
ScanChain != (chain_list *)0;
|
||||
ScanChain = ScanChain->NEXT )
|
||||
{
|
||||
ScanStack = (fsmstack_list *)(ScanChain->DATA);
|
||||
|
||||
if ( ScanStack->CTRL == FSM_CTRL_POP )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
** No stack transition from E(i)
|
||||
*/
|
||||
if ( ScanChain == (chain_list *)0 )
|
||||
{
|
||||
SyfWarning( SYF_WARNING_NO_TRANS_FROM, ScanState->NAME, NULL );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SyfWarning( SYF_WARNING_NO_TRANS_FROM, ScanState->NAME, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
if ( TypeMoore )
|
||||
{
|
||||
for ( ScanLocout = ScanState->LOCOUT;
|
||||
ScanLocout != (fsmlocout_list *)0;
|
||||
ScanLocout = ScanLocout->NEXT )
|
||||
{
|
||||
if ( SyfFsmVerifyMooreExpr( FsmFigure, ScanLocout->ABL ) )
|
||||
{
|
||||
TypeMoore = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( TypeMoore )
|
||||
{
|
||||
SyfInfo->FSM_TYPE = SYF_FSM_TYPE_MOORE;
|
||||
}
|
||||
else
|
||||
{
|
||||
SyfInfo->FSM_TYPE = SYF_FSM_TYPE_MEALY;
|
||||
}
|
||||
|
||||
if ( FlagVerify )
|
||||
{
|
||||
SyfVerifyTransition( FsmFigure );
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmOutputPolarity |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmOutputPolarity( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
fsmstate_list *ScanState;
|
||||
fsmstate_list *StarState;
|
||||
chain_list *ScanChain;
|
||||
fsmtrans_list *ScanTrans;
|
||||
fsmlocout_list *ScanLocout;
|
||||
fsmout_list *ScanOut;
|
||||
syfout *SyfOut;
|
||||
bddsystem *BddSystem;
|
||||
bddcircuit *BddCircuit;
|
||||
bddnode *BddOne;
|
||||
bddnode *BddZero;
|
||||
bddnode *BddNode;
|
||||
|
||||
if ( FsmFigure->CIRCUIT == (bddcircuit *)0 )
|
||||
{
|
||||
BddSystem = createbddsystem( SYF_BDD_VAR_NODE, SYF_BDD_OPER_NODE, 1000, SYF_BDD_MAX_NODE );
|
||||
reorderbddsystemdynamic( BddSystem, SYF_BDD_REORDER_FUNC,
|
||||
SYF_BDD_REORDER_NODE, SYF_BDD_REORDER_RATIO );
|
||||
BddCircuit = SyfFsmMakeBddCircuit( BddSystem, FsmFigure );
|
||||
reorderbddsystemsimple( BddSystem );
|
||||
}
|
||||
else
|
||||
{
|
||||
BddCircuit = FsmFigure->CIRCUIT;
|
||||
BddSystem = BddCircuit->BDD_SYSTEM;
|
||||
|
||||
setbddlocalcircuit( BddCircuit );
|
||||
setbddlocalsystem( BddSystem );
|
||||
}
|
||||
|
||||
StarState = FsmFigure->STAR_STATE;
|
||||
BddOne = BddSystem->ONE;
|
||||
BddZero = BddSystem->ZERO;
|
||||
|
||||
if ( StarState != (fsmstate_list *)0 )
|
||||
{
|
||||
BddOne = BddSystem->ZERO;
|
||||
|
||||
for ( ScanChain = StarState->FROM;
|
||||
ScanChain != (chain_list *)0;
|
||||
ScanChain = ScanChain->NEXT )
|
||||
{
|
||||
ScanTrans = (fsmtrans_list *)ScanChain->DATA;
|
||||
BddOne = applybddnode( (bddsystem *)0, ABL_OR,
|
||||
decbddrefext( BddOne ), ScanTrans->BDD );
|
||||
}
|
||||
|
||||
if ( StarState->FROM == (chain_list *)0 )
|
||||
{
|
||||
StarState = (fsmstate_list *)0;
|
||||
}
|
||||
|
||||
BddOne = applybddnodenot( (bddsystem *)0, decbddrefext( BddOne ) );
|
||||
}
|
||||
|
||||
if ( StarState != (fsmstate_list *)0 )
|
||||
{
|
||||
ScanState = StarState;
|
||||
ScanState->NEXT = FsmFigure->STATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanState = FsmFigure->STATE;
|
||||
}
|
||||
|
||||
while ( ScanState != (fsmstate_list *)0 )
|
||||
{
|
||||
for ( ScanLocout = ScanState->LOCOUT;
|
||||
ScanLocout != (fsmlocout_list *)0;
|
||||
ScanLocout = ScanLocout->NEXT )
|
||||
{
|
||||
if ( ScanLocout->ABL == (ablexpr *)0 ) continue;
|
||||
|
||||
if ( ScanLocout->BDD == (bddnode *)0 )
|
||||
{
|
||||
ScanLocout->BDD = addbddcircuitabl( BddCircuit, ScanLocout->ABL );
|
||||
}
|
||||
|
||||
ScanOut = ScanLocout->OUT;
|
||||
SyfOut = FSM_SYF_OUT( ScanOut );
|
||||
|
||||
SyfOut->NUMBER_ASSIGN++;
|
||||
|
||||
if ( ScanState != StarState )
|
||||
{
|
||||
if ( ScanLocout->BDD == BddOne ) SyfOut->NUMBER_ONE++;
|
||||
else
|
||||
if ( ScanLocout->BDD == BddZero ) SyfOut->NUMBER_ZERO++;
|
||||
}
|
||||
}
|
||||
|
||||
ScanState = ScanState->NEXT;
|
||||
}
|
||||
|
||||
for ( ScanOut = FsmFigure->OUT;
|
||||
ScanOut != (fsmout_list *)0;
|
||||
ScanOut = ScanOut->NEXT )
|
||||
{
|
||||
SyfOut = FSM_SYF_OUT( ScanOut );
|
||||
|
||||
if ( ( SyfOut->NUMBER_ASSIGN < FsmFigure->NUMBER_STATE ) &&
|
||||
( SyfOut->NUMBER_ASSIGN != 0 ) )
|
||||
{
|
||||
SyfWarning( SYF_WARNING_OUTPUT_NOT_ASSIGNED, ScanOut->NAME, SyfOut->NUMBER_ASSIGN );
|
||||
}
|
||||
|
||||
if ( SyfOut->NUMBER_ONE > SyfOut->NUMBER_ZERO )
|
||||
{
|
||||
SyfOut->POLARITY = 1;
|
||||
SyfWarning( SYF_WARNING_MODIFY_POLARITY, ScanOut->NAME, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
if ( StarState != (fsmstate_list *)0 ) ScanState = StarState;
|
||||
else ScanState = FsmFigure->STATE;
|
||||
|
||||
while ( ScanState != (fsmstate_list *)0 )
|
||||
{
|
||||
for ( ScanLocout = ScanState->LOCOUT;
|
||||
ScanLocout != (fsmlocout_list *)0;
|
||||
ScanLocout = ScanLocout->NEXT )
|
||||
{
|
||||
ScanOut = ScanLocout->OUT;
|
||||
SyfOut = FSM_SYF_OUT( ScanOut );
|
||||
|
||||
if ( SyfOut->POLARITY )
|
||||
{
|
||||
if ( ScanState == StarState )
|
||||
{
|
||||
BddNode = ScanLocout->BDD;
|
||||
BddNode = applybddnode( (bddsystem *)0, ABL_NOR, BddNode, BddOne );
|
||||
}
|
||||
else
|
||||
{
|
||||
BddNode = ScanLocout->BDD;
|
||||
BddNode = applybddnodenot( (bddsystem *)0, BddNode );
|
||||
BddNode = applybddnode( (bddsystem *)0, ABL_AND, decbddrefext( BddNode ), BddOne );
|
||||
}
|
||||
|
||||
freeablexpr( ScanLocout->ABL );
|
||||
ScanLocout->ABL = convertbddcircuitabl( (bddcircuit *)0, BddNode );
|
||||
|
||||
decbddrefext( ScanLocout->BDD );
|
||||
ScanLocout->BDD = BddNode;
|
||||
|
||||
freeablexpr( ScanLocout->ABL_DC );
|
||||
ScanLocout->ABL_DC = (ablexpr *)0;
|
||||
}
|
||||
}
|
||||
|
||||
ScanState = ScanState->NEXT;
|
||||
}
|
||||
|
||||
decbddrefext( BddOne );
|
||||
decbddrefext( BddZero );
|
||||
|
||||
if ( StarState != (fsmstate_list *)0 )
|
||||
{
|
||||
StarState->NEXT = (fsmstate_list *)0;
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmSimplify |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmSimplify( FsmFigure, FlagSimplify )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
int FlagSimplify;
|
||||
{
|
||||
bddsystem *BddSystem;
|
||||
bddcircuit *BddCircuit;
|
||||
syfinfo *SyfInfo;
|
||||
fsmstate_list *ScanState;
|
||||
fsmstack_list *ScanStack;
|
||||
fsmstack_list *DelStack;
|
||||
fsmlocout_list *ScanLocout;
|
||||
fsmlocout_list *DelLocout;
|
||||
fsmtrans_list *ScanTrans;
|
||||
fsmtrans_list *DelTrans;
|
||||
|
||||
if ( FlagSimplify )
|
||||
{
|
||||
if ( FsmFigure->CIRCUIT == (bddcircuit *)0 )
|
||||
{
|
||||
BddSystem = createbddsystem( SYF_BDD_VAR_NODE, SYF_BDD_OPER_NODE, 1000, SYF_BDD_MAX_NODE );
|
||||
reorderbddsystemdynamic( BddSystem, SYF_BDD_REORDER_FUNC,
|
||||
SYF_BDD_REORDER_NODE, SYF_BDD_REORDER_RATIO );
|
||||
BddCircuit = SyfFsmMakeBddCircuit( BddSystem, FsmFigure );
|
||||
reorderbddsystemsimple( BddSystem );
|
||||
}
|
||||
|
||||
convertfsmbddnodeabl( FsmFigure );
|
||||
}
|
||||
|
||||
SyfInfo = FSM_SYF_INFO( FsmFigure );
|
||||
|
||||
if ( SyfInfo->STACK )
|
||||
{
|
||||
ScanStack = FsmFigure->STACK;
|
||||
|
||||
while ( ScanStack != (fsmstack_list *)0 )
|
||||
{
|
||||
ScanStack->ABL = simpablexpr( ScanStack->ABL );
|
||||
|
||||
if ( ( ABL_ATOM( ScanStack->ABL ) ) &&
|
||||
( ABL_ATOM_VALUE( ScanStack->ABL ) == ABL_ATOM_NAME_ZERO ) )
|
||||
{
|
||||
DelStack = ScanStack;
|
||||
ScanStack = ScanStack->NEXT;
|
||||
|
||||
SyfWarning( SYF_WARNING_REMOVE_STACK, DelStack->CURRENT->NAME, NULL );
|
||||
|
||||
delfsmstack( FsmFigure, DelStack );
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanStack = ScanStack->NEXT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ( ScanState = FsmFigure->STATE;
|
||||
ScanState != (fsmstate_list *)0;
|
||||
ScanState = ScanState->NEXT )
|
||||
{
|
||||
ScanLocout = ScanState->LOCOUT;
|
||||
|
||||
while ( ScanLocout != (fsmlocout_list *)0 )
|
||||
{
|
||||
if ( ScanLocout->ABL != (chain_list *)0 )
|
||||
{
|
||||
ScanLocout->ABL = simpablexpr( ScanLocout->ABL );
|
||||
|
||||
if ( ( ABL_ATOM( ScanLocout->ABL ) ) &&
|
||||
( ABL_ATOM_VALUE( ScanLocout->ABL ) == ABL_ATOM_NAME_ZERO ) )
|
||||
{
|
||||
freeablexpr( ScanLocout->ABL );
|
||||
ScanLocout->ABL = (chain_list *)0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ScanLocout->ABL_DC != (chain_list *)0 )
|
||||
{
|
||||
ScanLocout->ABL_DC = simpablexpr( ScanLocout->ABL_DC );
|
||||
|
||||
if ( ( ABL_ATOM( ScanLocout->ABL_DC ) ) &&
|
||||
( ABL_ATOM_VALUE( ScanLocout->ABL_DC ) == ABL_ATOM_NAME_ZERO ) )
|
||||
{
|
||||
freeablexpr( ScanLocout->ABL_DC );
|
||||
ScanLocout->ABL_DC = (chain_list *)0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( ScanLocout->ABL == (chain_list *)0 ) &&
|
||||
( ScanLocout->ABL_DC == (chain_list *)0 ) )
|
||||
{
|
||||
DelLocout = ScanLocout;
|
||||
ScanLocout = ScanLocout->NEXT;
|
||||
|
||||
delfsmlocout( ScanState, DelLocout );
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanLocout = ScanLocout->NEXT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScanTrans = FsmFigure->TRANS;
|
||||
|
||||
while ( ScanTrans != (fsmtrans_list *)0 )
|
||||
{
|
||||
ScanTrans->ABL = simpablexpr( ScanTrans->ABL );
|
||||
|
||||
if ( ( ABL_ATOM( ScanTrans->ABL ) ) &&
|
||||
( ABL_ATOM_VALUE( ScanTrans->ABL ) == ABL_ATOM_NAME_ZERO ) )
|
||||
{
|
||||
DelTrans = ScanTrans;
|
||||
ScanTrans = ScanTrans->NEXT;
|
||||
|
||||
SyfWarning( SYF_WARNING_REMOVE_TRANS,
|
||||
DelTrans->FROM->NAME, DelTrans->TO->NAME );
|
||||
|
||||
delfsmtrans( FsmFigure, DelTrans );
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanTrans = ScanTrans->NEXT;
|
||||
}
|
||||
}
|
||||
|
||||
if ( FsmFigure->CLOCK_ABL != (chain_list *)0 )
|
||||
{
|
||||
FsmFigure->CLOCK_ABL = simpablexpr( FsmFigure->CLOCK_ABL );
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| SyfFsmTreatReset |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
void SyfFsmTreatReset( FsmFigure )
|
||||
|
||||
fsmfig_list *FsmFigure;
|
||||
{
|
||||
bddsystem *BddSystem;
|
||||
bddcircuit *BddCircuit;
|
||||
bddassoc *BddAssoc;
|
||||
bddnode *SumStar;
|
||||
bddnode *TransCond;
|
||||
bddnode *BddNode;
|
||||
bddvar BddVar;
|
||||
fsmstate_list *StarState;
|
||||
fsmtrans_list *ScanTrans;
|
||||
chain_list *ScanChain;
|
||||
chain_list *Support;
|
||||
|
||||
StarState = FsmFigure->STAR_STATE;
|
||||
|
||||
if ( ( StarState == (fsmstate_list *)0 ) ||
|
||||
( StarState->FROM == (chain_list *)0 ) ) return;
|
||||
|
||||
if ( FsmFigure->CIRCUIT == (bddcircuit *)0 )
|
||||
{
|
||||
BddSystem = createbddsystem( SYF_BDD_VAR_NODE, SYF_BDD_OPER_NODE, 1000, SYF_BDD_MAX_NODE );
|
||||
reorderbddsystemdynamic( BddSystem, SYF_BDD_REORDER_FUNC,
|
||||
SYF_BDD_REORDER_NODE, SYF_BDD_REORDER_RATIO );
|
||||
BddCircuit = SyfFsmMakeBddCircuit( BddSystem, FsmFigure );
|
||||
reorderbddsystemsimple( BddSystem );
|
||||
}
|
||||
|
||||
/*
|
||||
** Compute Sum Star Transitions
|
||||
*/
|
||||
SumStar = BddLocalSystem->ZERO;
|
||||
|
||||
for ( ScanChain = StarState->FROM;
|
||||
ScanChain != (chain_list *)0;
|
||||
ScanChain = ScanChain->NEXT )
|
||||
{
|
||||
ScanTrans = (fsmtrans_list *)ScanChain->DATA;
|
||||
TransCond = ScanTrans->BDD;
|
||||
|
||||
decbddrefext( SumStar );
|
||||
SumStar = applybddnode( (bddsystem *)0, ABL_OR, SumStar, TransCond );
|
||||
}
|
||||
|
||||
decbddrefext( SumStar );
|
||||
SumStar = applybddnodenot( (bddsystem *)0, SumStar );
|
||||
|
||||
BddAssoc = addbddassoc( (bddsystem *)0 );
|
||||
Support = getbddnodesupportchain( (bddsystem *)0, SumStar );
|
||||
|
||||
for ( ScanChain = Support;
|
||||
ScanChain != (chain_list *)0;
|
||||
ScanChain = ScanChain->NEXT )
|
||||
{
|
||||
BddNode = (bddnode *)ScanChain->DATA;
|
||||
BddVar = getbddvarbyindex( (bddsystem *)0, BddNode->INDEX );
|
||||
addbddnodeassoc( (bddsystem *)0, BddAssoc, BddVar, BddNode );
|
||||
}
|
||||
|
||||
freechain( Support);
|
||||
|
||||
for ( ScanTrans = FsmFigure->TRANS;
|
||||
ScanTrans != (fsmtrans_list *)0;
|
||||
ScanTrans = ScanTrans->NEXT )
|
||||
{
|
||||
if ( IsFsmStarTrans( ScanTrans ) ) continue;
|
||||
|
||||
TransCond = ScanTrans->BDD;
|
||||
TransCond = existbddnodeassoc( (bddsystem *)0, TransCond, BddAssoc );
|
||||
/*
|
||||
** Verify the correctness of the solution
|
||||
*/
|
||||
BddNode = applybddnode( (bddsystem *)0, ABL_AND, TransCond, SumStar );
|
||||
decbddrefext( BddNode );
|
||||
|
||||
if ( BddNode != ScanTrans->BDD )
|
||||
{
|
||||
decbddrefext( TransCond );
|
||||
TransCond = ScanTrans->BDD;
|
||||
TransCond = cofactorbddnode( (bddsystem *)0, TransCond, SumStar );
|
||||
}
|
||||
|
||||
decbddrefext( ScanTrans->BDD );
|
||||
ScanTrans->BDD = TransCond;
|
||||
}
|
||||
|
||||
delbddassoc( (bddsystem *)0, BddAssoc );
|
||||
|
||||
convertfsmbddnodeabl( FsmFigure );
|
||||
|
||||
if ( FsmFigure->CIRCUIT != (bddcircuit *)0 )
|
||||
{
|
||||
BddCircuit = FsmFigure->CIRCUIT;
|
||||
BddSystem = BddCircuit->BDD_SYSTEM;
|
||||
|
||||
destroybddsystem( BddSystem );
|
||||
destroybddcircuit( BddCircuit );
|
||||
|
||||
FsmFigure->CIRCUIT = (bddcircuit *)0;
|
||||
}
|
||||
}
|
|
@ -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 : SYF |
|
||||
| |
|
||||
| File : syf_verify.h |
|
||||
| |
|
||||
| Authors : C. Sarwary |
|
||||
| Modified by Jacomme Ludovic |
|
||||
| |
|
||||
| Date : 01.11.94 |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Constants |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
# ifndef SYF_VERIFY_H
|
||||
# define SYF_VERIFY_H
|
||||
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Macro |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Types |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Variables |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
/*------------------------------------------------------------\
|
||||
| |
|
||||
| Functions |
|
||||
| |
|
||||
\------------------------------------------------------------*/
|
||||
|
||||
extern void SyfFsmOutputPolarity();
|
||||
extern void SyfFsmVerify();
|
||||
extern void SyfFsmSimplify();
|
||||
extern void SyfFsmTreatReset();
|
||||
|
||||
# endif
|
Loading…
Reference in New Issue