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

branch.
This commit is contained in:
Ludovic Jacomme 2002-03-20 12:34:02 +00:00
commit f4bf3bb5ed
41 changed files with 8949 additions and 0 deletions

View File

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

View File

@ -0,0 +1,45 @@
dnl
/*
dnl This file is part of the Alliance CAD System
dnl Copyright (C) Laboratoire LIP6 - Département ASIM
dnl Universite Pierre et Marie Curie
dnl
dnl Home page : http://www-asim.lip6.fr/alliance/
dnl E-mail support : mailto:alliance-support@asim.lip6.fr
dnl
dnl This library is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU Library General Public License as published
dnl by the Free Software Foundation; either version 2 of the License, or (at
dnl your option) any later version.
dnl
dnl Alliance VLSI CAD System is distributed in the hope that it will be
dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
dnl Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with the GNU C Library; see the file COPYING. If not, write to the Free
dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
dnl
dnl Purpose : Auto stuffing Alliance
dnl Almost ten years since I wrote this stuff, I just can't
dnl believe it
dnl Date : 01/02/2002
dnl Author : Frederic Petrot <Frederic.Petrot@lip6.fr>
dnl $Id: configure.in,v 1.1 2002/03/20 12:34:01 ludo Exp $
dnl
dnl
AC_INIT(src/vex.h)
AM_INIT_AUTOMAKE(vex, 1.3)
AC_PROG_INSTALL
AC_PROG_CC
AC_HEADER_STDC
AC_C_CONST
AC_PROG_RANLIB
AM_ALLIANCE
AC_OUTPUT([
Makefile
src/Makefile
])

View File

@ -0,0 +1,12 @@
CFLAGS = @CFLAGS@ \
-DALLIANCE_TOP=\"${ALLIANCE_TOP}\"
lib_LIBRARIES = libVex.a
include_HEADERS = vex.h
libVex_a_SOURCES = \
vexcreate.h vexerror.c vexfree.h vexshift.c vexunflat.h \
vex.h vexdel.c vexerror.h vexget.c vexshift.h vexview.c \
vexadd.c vexdel.h vexeval.c vexget.h vexsimp.c vexview.h \
vexadd.h vexdup.c vexeval.h vexis.c vexsimp.h \
vexalloc.c vexdup.h vexextend.c vexis.h vexslice.c \
vexalloc.h vexenv.c vexextend.h vexoptim.c vexslice.h \
vexcreate.c vexenv.h vexfree.c vexoptim.h vexunflat.c

155
alliance/src/vex/src/main.c Normal file
View File

@ -0,0 +1,155 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <stdlib.h>
# include <malloc.h>
# include "mut.h"
# include "aut.h"
# include "vex.h"
int main( argc, argv )
int argc;
char **argv;
{
long Integer;
long Value;
vexexpr *Vex;
vexexpr *Atom;
int Width = 8;
mbkenv();
autenv();
vexenv();
if ( argc > 1 ) Width = atoi( argv[ 1 ] );
fprintf( stdout, "Width %d\n", Width );
fprintf( stdout, "width 0, signed 0\n" );
for ( Integer = -10; Integer < 10; Integer++ )
{
Vex = createvexatomlong( Integer, 0, 0 );
fprintf( stdout, "%ld -> ", Integer );
viewvexexprboundln( Vex );
if ( evalvexatomlong( Vex, &Value ) != -1 )
fprintf( stdout, "<- %ld\n", Value );
else
fprintf( stdout, "<- ERROR\n" );
Vex = extendvexatomsign( Vex, Width );
if ( Vex != (vexexpr *)0 )
{
viewvexexprboundln( Vex );
fprintf( stdout, "\n" );
}
else
fprintf( stdout, "<- ERROR\n" );
}
fprintf( stdout, "width 0, signed 1\n" );
for ( Integer = -10; Integer < 10; Integer++ )
{
Vex = createvexatomlong( Integer, 0, 1 );
fprintf( stdout, "%ld -> ", Integer );
viewvexexprboundln( Vex );
if ( evalvexatomlong( Vex, &Value ) != -1 )
fprintf( stdout, "<- %ld\n", Value );
else
fprintf( stdout, "<- ERROR\n" );
Vex = extendvexatomsign( Vex, Width );
if ( Vex != (vexexpr *)0 )
{
viewvexexprboundln( Vex );
fprintf( stdout, "\n" );
}
else
fprintf( stdout, "<- ERROR\n" );
}
fprintf( stdout, "width 6, signed 0\n" );
for ( Integer = -10; Integer < 10; Integer++ )
{
Vex = createvexatomlong( Integer, 6, 0 );
fprintf( stdout, "%ld -> ", Integer );
viewvexexprboundln( Vex );
if ( evalvexatomlong( Vex, &Value ) != -1 )
fprintf( stdout, "<- %ld\n", Value );
else
fprintf( stdout, "<- ERROR\n" );
Vex = extendvexatomsign( Vex, Width );
if ( Vex != (vexexpr *)0 )
{
viewvexexprboundln( Vex );
fprintf( stdout, "\n" );
}
else
fprintf( stdout, "<- ERROR\n" );
}
fprintf( stdout, "width 6, signed 1\n" );
for ( Integer = -10; Integer < 10; Integer++ )
{
Vex = createvexatomlong( Integer, 6, 1 );
fprintf( stdout, "%ld -> ", Integer );
viewvexexprboundln( Vex );
if ( evalvexatomlong( Vex, &Value ) != -1 )
fprintf( stdout, "<- %ld\n", Value );
else
fprintf( stdout, "<- ERROR\n" );
Vex = extendvexatomsign( Vex, Width );
if ( Vex != (vexexpr *)0 )
{
viewvexexprboundln( Vex );
fprintf( stdout, "\n" );
}
else
fprintf( stdout, "<- ERROR\n" );
}
Atom = createvexatomvec( "v", 3, 0 );
viewvexexprboundln( Atom );
fprintf( stdout, "\n ici " );
Vex = extendvexatomsign( Atom, 5 );
viewvexexprboundln( Vex );
fprintf( stdout, "\n" );
Atom = createvexatomvec( "v", 3, 0 );
SetVexNodeSigned( Atom );
viewvexexprboundln( Atom );
fprintf( stdout, "\n" );
Vex = extendvexatomsign( Atom, 5 );
viewvexexprboundln( Vex );
fprintf( stdout, "\n" );
return( 1 );
}

693
alliance/src/vex/src/vex.h Normal file
View File

@ -0,0 +1,693 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------\
| |
| Title : Structures and fonctions for VEX |
| |
| Date : 04.02.97 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------*/
# ifndef VEX_103_H
# define VEX_103_H
/*------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------*/
# ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
# endif
/*------------------------------------------------------\
| |
| View Mode |
| |
\------------------------------------------------------*/
# define VEX_VIEW_VHDL 0
# define VEX_VIEW_VERILOG 1
/*------------------------------------------------------\
| |
| Node Type |
| |
\------------------------------------------------------*/
# define VEX_NODE_ATOM_MASK (unsigned short)(0x1000)
# define VEX_NODE_OPER_MASK (unsigned short)(0x2000)
# define VEX_NODE_FUNC_MASK (unsigned short)(0x4000)
# define VEX_NODE_TYPE_MASK (unsigned short)(0x7000)
# define VEX_NODE_TAG_MASK (unsigned short)(0x8000)
# define VEX_ATOM_LITERAL_MASK (unsigned short)(0x0100) /*Literal Name */
# define VEX_NODE_SIGNED_MASK (unsigned short)(0x0200) /*Signed Unsigned */
# define VEX_NODE_BIT_MASK (unsigned short)(0x0400) /*Bit Vector */
# define VEX_NODE_DOWN_MASK (unsigned short)(0x0800) /*Down Up */
# define VEX_NODE_VAR_WIDTH_MASK (unsigned short)(0x0080) /*Variable Width */
# define VEX_NODE_USER1_MASK (unsigned short)(0x0020)
# define VEX_NODE_USER2_MASK (unsigned short)(0x0040)
# define VEX_NODE_VHDL_TYPE_MASK (unsigned short)(0x001f)
/*------------------------------------------------------\
| |
| Macro Node Type |
| |
\------------------------------------------------------*/
# define IsVexNodeAtom( N ) ( (N)->TYPE & VEX_NODE_ATOM_MASK )
# define SetVexNodeAtom( N ) ( (N)->TYPE = ((N)->TYPE & ~VEX_NODE_TYPE_MASK )\
| VEX_NODE_ATOM_MASK )
# define IsVexNodeOper( N ) ( (N)->TYPE & VEX_NODE_OPER_MASK )
# define SetVexNodeOper( N ) ( (N)->TYPE = ((N)->TYPE & ~VEX_NODE_TYPE_MASK )\
| VEX_NODE_OPER_MASK )
# define IsVexNodeFunc( N ) ( (N)->TYPE & VEX_NODE_FUNC_MASK )
# define SetVexNodeFunc( N ) ( (N)->TYPE = ((N)->TYPE & ~VEX_NODE_TYPE_MASK )\
| VEX_NODE_FUNC_MASK )
/*------------------------------------------------------\
| |
| Macro Node Width |
| |
\------------------------------------------------------*/
# define IsVexNodeVarWidth( N ) ( (N)->TYPE & VEX_NODE_VAR_WIDTH_MASK )
# define SetVexNodeVarWidth( N ) ( (N)->TYPE |= VEX_NODE_VAR_WIDTH_MASK )
# define ClearVexNodeVarWidth( N ) ( (N)->TYPE &= ~VEX_NODE_VAR_WIDTH_MASK )
/*------------------------------------------------------\
| |
| Macro Node Signed |
| |
\------------------------------------------------------*/
# define IsVexNodeSigned( N ) ( (N)->TYPE & VEX_NODE_SIGNED_MASK )
# define SetVexNodeSigned( N ) ( (N)->TYPE |= VEX_NODE_SIGNED_MASK )
# define ClearVexNodeSigned( N ) ( (N)->TYPE &= ~VEX_NODE_SIGNED_MASK )
/*------------------------------------------------------\
| |
| Macro Node Bit |
| |
\------------------------------------------------------*/
# define IsVexNodeBit( N ) ( (N)->TYPE & VEX_NODE_BIT_MASK )
# define SetVexNodeBit( N ) ( (N)->TYPE |= VEX_NODE_BIT_MASK )
# define ClearVexNodeBit( N ) ( (N)->TYPE &= ~VEX_NODE_BIT_MASK )
/*------------------------------------------------------\
| |
| Macro Node Direction |
| |
\------------------------------------------------------*/
# define IsVexNodeDown( N ) ( (N)->TYPE & VEX_NODE_DOWN_MASK )
# define SetVexNodeDown( N ) ( (N)->TYPE |= VEX_NODE_DOWN_MASK )
# define ClearVexNodeDown( N ) ( (N)->TYPE &= ~VEX_NODE_DOWN_MASK )
/*------------------------------------------------------\
| |
| Macro Node Tag |
| |
\------------------------------------------------------*/
# define IsVexNodeTag( N ) ( (N)->TYPE & VEX_NODE_TAG_MASK )
# define SetVexNodeTag( N ) ( (N)->TYPE |= VEX_NODE_TAG_MASK )
# define ClearVexNodeTag( N ) ( (N)->TYPE &= ~VEX_NODE_TAG_MASK )
/*------------------------------------------------------\
| |
| Macro Atom |
| |
\------------------------------------------------------*/
# define IsVexAtomLiteral( N ) ( (N)->TYPE & VEX_ATOM_LITERAL_MASK )
# define SetVexAtomLiteral( N ) ( (N)->TYPE |= VEX_ATOM_LITERAL_MASK )
# define ClearVexAtomLiteral( N ) ( (N)->TYPE &= ~VEX_ATOM_LITERAL_MASK )
# define IsVexAtomVarWidth( N ) ( IsVexNodeVarWidth( N ) )
# define SetVexAtomVarWidth( N ) ( SetVexNodeVarWidth( N ) )
# define IsVexAtomStaWidth( N ) ( ! IsVexNodeVarWidth( N ) )
# define SetVexAtomStaWidth( N ) ( ClearVexNodeVarWidth( N ) )
# define IsVexAtomBit( N ) ( IsVexNodeBit( N ) )
# define SetVexAtomBit( N ) ( SetVexNodeBit( N ) )
# define IsVexAtomVector( N ) ( ! IsVexNodeBit( N ) )
# define SetVexAtomVector( N ) ( ClearVexNodeBit( N ) )
# define IsVexAtomSigned( N ) ( IsVexNodeSigned( N ) )
# define SetVexAtomSigned( N ) ( SetVexNodeSigned( N ) )
# define IsVexAtomUnsigned( N ) ( ! IsVexNodeSigned( N ) )
# define SetVexAtomUnsigned( N ) ( ClearVexNodeSigned( N ) )
# define IsVexAtomDown( N ) ( IsVexNodeDown( N ) )
# define SetVexAtomDown( N ) ( SetVexNodeDown( N ) )
# define IsVexAtomUp( N ) ( ! IsVexNodeDown( N ) )
# define SetVexAtomUp( N ) ( ClearVexNodeDown( N ) )
/*------------------------------------------------------\
| |
| Macro Oper |
| |
\------------------------------------------------------*/
# define IsVexOperVarWidth( N ) ( IsVexNodeVarWidth( N ) )
# define SetVexOperVarWidth( N ) ( SetVexNodeVarWidth( N ) )
# define IsVexOperStaWidth( N ) ( ! IsVexNodeVarWidth( N ) )
# define SetVexOperStaWidth( N ) ( ClearVexNodeVarWidth( N ) )
# define IsVexOperBit( N ) ( IsVexNodeBit( N ) )
# define SetVexOperBit( N ) ( SetVexNodeBit( N ) )
# define IsVexOperVector( N ) ( ! IsVexNodeBit( N ) )
# define SetVexOperVector( N ) ( ClearVexNodeBit( N ) )
# define IsVexOperSigned( N ) ( IsVexNodeSigned( N ) )
# define SetVexOperSigned( N ) ( SetVexNodeSigned( N ) )
# define IsVexOperUnsigned( N ) ( ! IsVexNodeSigned( N ) )
# define SetVexOperUnsigned( N ) ( ClearVexNodeSigned( N ) )
# define IsVexOperDown( N ) ( IsVexNodeDown( N ) )
# define SetVexOperDown( N ) ( SetVexNodeDown( N ) )
# define IsVexOperUp( N ) ( ! IsVexNodeDown( N ) )
# define SetVexOperUp( N ) ( ClearVexNodeDown( N ) )
/*------------------------------------------------------\
| |
| Macro Func |
| |
\------------------------------------------------------*/
# define IsVexFuncVarWidth( N ) ( IsVexNodeVarWidth( N ) )
# define SetVexFuncVarWidth( N ) ( SetVexNodeVarWidth( N ) )
# define IsVexFuncStaWidth( N ) ( ! IsVexNodeVarWidth( N ) )
# define SetVexFuncStaWidth( N ) ( ClearVexNodeVarWidth( N ) )
# define IsVexFuncBit( N ) ( IsVexNodeBit( N ) )
# define SetVexFuncBit( N ) ( SetVexNodeBit( N ) )
# define IsVexFuncVector( N ) ( ! IsVexNodeBit( N ) )
# define SetVexFuncVector( N ) ( ClearVexNodeBit( N ) )
# define IsVexFuncSigned( N ) ( IsVexNodeSigned( N ) )
# define SetVexFuncSigned( N ) ( SetVexNodeSigned( N ) )
# define IsVexFuncUnsigned( N ) ( ! IsVexNodeSigned( N ) )
# define SetVexFuncUnsigned( N ) ( ClearVexNodeSigned( N ) )
# define IsVexFuncDown( N ) ( IsVexNodeDown( N ) )
# define SetVexFuncDown( N ) ( SetVexNodeDown( N ) )
# define IsVexFuncUp( N ) ( ! IsVexNodeDown( N ) )
# define SetVexFuncUp( N ) ( ClearVexNodeDown( N ) )
/*------------------------------------------------------\
| |
| Macro Type |
| |
\------------------------------------------------------*/
# define SetVexVhdlType( N, T ) ((N)->TYPE = ((N)->TYPE & ~VEX_NODE_VHDL_TYPE_MASK)|(T))
# define GetVexVhdlType( N ) ((N)->TYPE & VEX_NODE_VHDL_TYPE_MASK)
/*------------------------------------------------------\
| |
| Operators |
| |
\------------------------------------------------------*/
# define VEX_CONCAT 0
# define VEX_NOT 1
# define VEX_NEG 2
# define VEX_EVENT 3
# define VEX_OR 4
# define VEX_AND 5
# define VEX_XOR 6
# define VEX_NOR 7
# define VEX_NAND 8
# define VEX_NXOR 9
# define VEX_EQ 10
# define VEX_NE 11
# define VEX_LT 12
# define VEX_LE 13
# define VEX_GT 14
# define VEX_GE 15
# define VEX_ADD 16
# define VEX_SUB 17
# define VEX_MUL 18
# define VEX_DIV 19
# define VEX_EXP 20
# define VEX_MOD 21
# define VEX_REM 22
# define VEX_TO 23
# define VEX_DOWNTO 24
# define VEX_INDEX 25
# define VEX_LEFT 26
# define VEX_RIGHT 27
# define VEX_LOW 28
# define VEX_HIGH 29
# define VEX_LENGTH 30
# define VEX_RANGE 31
# define VEX_REV_RANGE 32
# define VEX_DRIVER 33
# define VEX_IFT 34
# define VEX_ARRAY 35
# define VEX_INDEX_N 36
# define VEX_OTHERS 37
# define VEX_NUM_BIT 38
# define VEX_ABS 39
# define VEX_MAX_OPERATOR 40
/*------------------------------------------------------\
| |
| Vhdl Type |
| |
\------------------------------------------------------*/
# define VEX_TYPE_SEVERITY 0
# define VEX_TYPE_BOOLEAN 1
# define VEX_TYPE_CHARACTER 2
# define VEX_TYPE_STRING 3
# define VEX_TYPE_BIT 4
# define VEX_TYPE_INTEGER 5
# define VEX_TYPE_NATURAL 6
# define VEX_TYPE_BIT_VECTOR 7
# define VEX_TYPE_STD_ULOGIC 8
# define VEX_TYPE_STD_LOGIC 9
# define VEX_TYPE_STD_ULOGIC_VECTOR 10
# define VEX_TYPE_STD_LOGIC_VECTOR 11
# define VEX_TYPE_X01 12
# define VEX_TYPE_X01Z 13
# define VEX_TYPE_UX01 14
# define VEX_TYPE_UX01Z 15
# define VEX_TYPE_UNSIGNED 16
# define VEX_TYPE_SIGNED 17
# define VEX_TYPE_SMALL_INT 18
# define VEX_TYPE_REG_BIT 19
# define VEX_TYPE_REG_VECTOR 20
# define VEX_TYPE_MUX_BIT 21
# define VEX_TYPE_MUX_VECTOR 22
# define VEX_TYPE_WOR_BIT 23
# define VEX_TYPE_WOR_VECTOR 24
# define VEX_TYPE_ENUMERATE 25
# define VEX_TYPE_ARRAY 26
# define VEX_MAX_TYPE 27
/*------------------------------------------------------\
| |
| Std Function |
| |
\------------------------------------------------------*/
# define VEX_STD_TO_BIT 0
# define VEX_STD_TO_BITVECTOR 1
# define VEX_STD_TO_STDULOGIC 2
# define VEX_STD_TO_STDLOGICVECTOR 3
# define VEX_STD_TO_STDULOGICVECTOR 4
# define VEX_STD_TO_X01 5
# define VEX_STD_TO_X01Z 6
# define VEX_STD_TO_UX01 7
# define VEX_STD_RISING_EDGE 8
# define VEX_STD_FALLING_EDGE 9
# define VEX_STD_IS_X 10
# define VEX_STD_ABS 11
# define VEX_STD_SHL 12
# define VEX_STD_SHR 13
# define VEX_STD_CONV_INTEGER 14
# define VEX_STD_CONV_UNSIGNED 15
# define VEX_STD_CONV_SIGNED 16
# define VEX_STD_CONV_STD_LOGIC_VECTOR 17
# define VEX_STD_EXT 18
# define VEX_STD_SXT 19
# define VEX_STD_SHIFT_LEFT 20
# define VEX_STD_SHIFT_RIGHT 21
# define VEX_STD_ROTATE_LEFT 22
# define VEX_STD_ROTATE_RIGHT 23
# define VEX_STD_RESIZE 24
# define VEX_STD_TO_INTEGER 25
# define VEX_STD_TO_UNSIGNED 26
# define VEX_STD_TO_SIGNED 27
# define VEX_STD_STD_LOGIC_VECTOR 28
# define VEX_STD_STD_ULOGIC_VECTOR 29
# define VEX_STD_SIGNED 30
# define VEX_STD_UNSIGNED 31
# define VEX_MAX_STD_FUNC 32
/*------------------------------------------------------\
| |
| Literals 9 |
| |
\------------------------------------------------------*/
# define VEX_UNINIT_ID 0 /* Uninitialized */
# define VEX_UNKNOWN_ID 1 /* Forcing Unknown */
# define VEX_ZERO_ID 2 /* Forcing 0 */
# define VEX_ONE_ID 3 /* Forcing 1 */
# define VEX_TRISTATE_ID 4 /* High Impedance */
# define VEX_WEAK_UNKNOWN_ID 5 /* Weak Unknown */
# define VEX_WEAK_ZERO_ID 6 /* Weak 0 */
# define VEX_WEAK_ONE_ID 7 /* Weak 1 */
# define VEX_DC_ID 8 /* Don't care */
# define VEX_MAX_ID 9
/*------------------------------------------------------\
| |
| Macro Literals 9 |
| |
\------------------------------------------------------*/
# define VEX_UNINIT VEX_LITERAL_BY_ID[ VEX_UNINIT_ID ]
# define VEX_UNKNOWN VEX_LITERAL_BY_ID[ VEX_UNKNOWN_ID ]
# define VEX_ZERO VEX_LITERAL_BY_ID[ VEX_ZERO_ID ]
# define VEX_ONE VEX_LITERAL_BY_ID[ VEX_ONE_ID ]
# define VEX_TRISTATE VEX_LITERAL_BY_ID[ VEX_TRISTATE_ID ]
# define VEX_WEAK_UNKNOWN VEX_LITERAL_BY_ID[ VEX_WEAK_UNKNOWN_ID ]
# define VEX_WEAK_ZERO VEX_LITERAL_BY_ID[ VEX_WEAK_ZERO_ID ]
# define VEX_WEAK_ONE VEX_LITERAL_BY_ID[ VEX_WEAK_ONE_ID ]
# define VEX_DC VEX_LITERAL_BY_ID[ VEX_DC_ID ]
/*------------------------------------------------------\
| |
| Macro Atom Literals 9 |
| |
\------------------------------------------------------*/
# define VEX_ATOM_UNINIT VEX_ATOM_BY_ID[ VEX_UNINIT_ID ]
# define VEX_ATOM_UNKNOWN VEX_ATOM_BY_ID[ VEX_UNKNOWN_ID ]
# define VEX_ATOM_ZERO VEX_ATOM_BY_ID[ VEX_ZERO_ID ]
# define VEX_ATOM_ONE VEX_ATOM_BY_ID[ VEX_ONE_ID ]
# define VEX_ATOM_TRISTATE VEX_ATOM_BY_ID[ VEX_TRISTATE_ID ]
# define VEX_ATOM_WEAK_UNKNOWN VEX_ATOM_BY_ID[ VEX_WEAK_UNKNOWN_ID ]
# define VEX_ATOM_WEAK_ZERO VEX_ATOM_BY_ID[ VEX_WEAK_ZERO_ID ]
# define VEX_ATOM_WEAK_ONE VEX_ATOM_BY_ID[ VEX_WEAK_ONE_ID ]
# define VEX_ATOM_DC VEX_ATOM_BY_ID[ VEX_DC_ID ]
/*------------------------------------------------------\
| |
| Macro Oper Types |
| |
\------------------------------------------------------*/
# define GetVexFuncValue( N ) ( (char *)(N)->VALUE )
# define SetVexFuncValue( N, F ) ( (N)->VALUE = (void *)(F) )
# define GetVexOperValue( N ) ( (long )(N)->VALUE )
# define SetVexOperValue( N, O ) ( (N)->VALUE = (void *)(O) )
# define GetVexAtomValue( N ) ( (char *)(N)->VALUE )
# define SetVexAtomValue( N, A ) ( (N)->VALUE = (void *)(A) )
# define GetVexOperand( C ) ( (vexexpr *)(C)->DATA )
# define SetVexOperand( C, O ) ( (C)->DATA = (void *)(O) )
/*------------------------------------------------------\
| |
| Type |
| |
\------------------------------------------------------*/
typedef struct vexexpr
{
chain_list *OPERAND;
void *VALUE;
short TYPE;
short LEFT;
short RIGHT;
short WIDTH;
} vexexpr;
/*------------------------------------------------------\
| |
| Global Variable |
| |
\------------------------------------------------------*/
extern char *VEX_OPER_NAME[ VEX_MAX_OPERATOR ];
extern char *VEX_OPER_UPPER_NAME[ VEX_MAX_OPERATOR ];
extern char *VEX_OPER_VERILOG_NAME[ VEX_MAX_OPERATOR ];
extern char *VEX_TYPE_NAME[ VEX_MAX_TYPE ];
extern long VEX_OPER_NOT[ VEX_MAX_OPERATOR ];
extern char VEX_LITERAL_BY_ID[ VEX_MAX_ID ];
extern char *VEX_ATOM_BY_ID[ VEX_MAX_ID ];
extern char *VEX_STD_FUNC_NAME[ VEX_MAX_STD_FUNC ];
extern char *VEX_STD_FUNC_UPPER_NAME[ VEX_MAX_STD_FUNC ];
/*------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------*/
/*------------------------------------------------------\
| |
| Initialize Functions |
| |
\------------------------------------------------------*/
extern void vexenv __P(());
/*------------------------------------------------------\
| |
| Node Functions |
| |
\------------------------------------------------------*/
extern vexexpr *allocvexnode __P(());
extern vexexpr *dupvexnode __P((vexexpr *Node));
extern vexexpr *copyvexnode __P((vexexpr *Target, vexexpr *Source));
extern void freevexnode __P((vexexpr *Node));
/*------------------------------------------------------\
| |
| Create Functions |
| |
\------------------------------------------------------*/
extern vexexpr *createvexatombit __P((char *Name));
extern vexexpr *createvexatomvec __P((char *Name, short Left, short Right));
extern vexexpr *createvexatomlit __P((char *Name));
extern vexexpr *createvexatomveclit __P((unsigned char Literal, short Width));
extern vexexpr *createvexatomlong __P((long Integer, short Width, short Signed));
extern vexexpr *createvexatomlongarray __P((long *Array, short Size, short Width, short Signed));
extern vexexpr *createvexoper __P((long Oper, short Width));
extern vexexpr *createvexbinexpr __P((long Oper, short Width, vexexpr *Expr1, vexexpr *Expr2));
extern vexexpr *createvexternaryexpr __P((long Oper, short Width, \
vexexpr *Expr1, vexexpr *Expr2, vexexpr *Expr3));
extern vexexpr *createvexunaryexpr __P((long Oper, short Width, vexexpr *Expr));
extern vexexpr *createvexfunc __P((char *Func, short Width));
/*------------------------------------------------------\
| |
| Simplify Functions |
| |
\------------------------------------------------------*/
extern vexexpr *simpvexexpr __P((vexexpr *Expr));
extern vexexpr *simpvexexpreq __P((vexexpr *Expr));
extern vexexpr *simpvexexprothers __P((vexexpr *Expr, short Width ));
/*------------------------------------------------------\
| |
| Optimize Functions |
| |
\------------------------------------------------------*/
extern vexexpr *optimvexnotexpr __P((vexexpr *Expr));
extern vexexpr *optimvexbinexpr __P((long Oper, short Width, vexexpr *Expr1, vexexpr *Expr2));
/*------------------------------------------------------\
| |
| Add Functions |
| |
\------------------------------------------------------*/
extern void addvexqexpr __P((vexexpr *Expr1, vexexpr *Expr2));
extern void addvexhexpr __P((vexexpr *Expr1, vexexpr *Expr2));
/*------------------------------------------------------\
| |
| Duplicate Functions |
| |
\------------------------------------------------------*/
extern vexexpr *dupvexexpr __P((vexexpr *Expr));
/*------------------------------------------------------\
| |
| Del Functions |
| |
\------------------------------------------------------*/
extern void delvexexpr __P((vexexpr *Expr));
extern void delvexexprnum __P((vexexpr *Expr, int Number));
/*------------------------------------------------------\
| |
| Free Functions |
| |
\------------------------------------------------------*/
extern void freevexexpr __P((vexexpr *Expr));
/*------------------------------------------------------\
| |
| Is Functions |
| |
\------------------------------------------------------*/
extern int isvexunaryoper __P((long Oper));
extern int isvexbinaryoper __P((long Oper));
extern int isvexternaryoper __P((long Oper));
extern int isvexoperinexpr __P((vexexpr *Expr, long Oper));
extern int isvexarithoperinexpr __P((vexexpr *Expr));
extern int isvexnameinexpr __P((vexexpr *Expr, char *Name));
extern int isvexpositiveoper __P((long Oper));
extern int isvexnegativeoper __P((long Oper));
extern int isvexequalexpr __P((vexexpr *Expr1, vexexpr *Expr2));
extern int isvextypedivisible __P((int Type));
extern int isvextypevector __P((int Type));
/*------------------------------------------------------\
| |
| Get Functions |
| |
\------------------------------------------------------*/
extern char *getvexvectorname __P((char *Vector, long *Index));
extern char *getvexopername __P((long Oper));
extern char *getvexatomname __P((vexexpr *Expr));
extern char *getvexoperuppername __P((long Oper));
extern char *getvexoperverilogname __P((long Oper));
extern long getvexoperbyname __P((char *Name));
extern long getvexnotoper __P((long Oper));
extern char *getvexarrayname __P((vexexpr *Atom));
extern vexexpr *getvexarrayatom __P((vexexpr *Expr));
extern chain_list *getvexatombitname __P((vexexpr *Expr));
extern chain_list *getvexexprsupport __P((vexexpr *Expr));
extern chain_list *unionvexexprsupport __P((chain_list *Support, vexexpr *Expr));
extern ptype_list *getvexatombitnameptype __P((vexexpr *Expr));
extern ptype_list *getvexexprsupportptype __P((vexexpr *Expr));
extern ptype_list *unionvexexprsupportptype __P((ptype_list *Support, vexexpr *Expr));
extern chain_list *getvexexprallname __P((vexexpr *Expr));
extern chain_list *unionvexexprallname __P((chain_list *AllName, vexexpr *Expr));
extern int getvextypescalar __P((int Type));
extern long getvexexprdepth __P((vexexpr *Expr));
extern long getvexexprnumnode __P((vexexpr *Expr));
extern int getvexliteralid __P((char Literal));
extern int getvexstdfuncid __P((char *FuncName));
extern int getvexvectorpos __P((vexexpr *Vector, short Index));
extern int getvexvectorindex __P((vexexpr *Atom, short Position));
extern int getvexvectormin __P((vexexpr *Expr));
extern int getvexvectormax __P((vexexpr *Expr));
extern int getvexintnumbit __P((long Size));
extern int getvexintervalnumbit __P((long Left, long Right));
/*------------------------------------------------------\
| |
| Eval Functions |
| |
\------------------------------------------------------*/
extern int evalvexatomlong __P((vexexpr *Expr, long *PLong));
extern int evalvexnotliteral __P((char Literal, char *PChar));
extern int evalvexandliteral __P((char Literal1, char Literal2, char *PChar));
extern int evalvexorliteral __P((char Literal1, char Literal2, char *PChar));
extern int evalvexxorliteral __P((char Literal1, char Literal2, char *PChar));
/*------------------------------------------------------\
| |
| Extend Sign Functions |
| |
\------------------------------------------------------*/
extern vexexpr *extendvexatomsign __P((vexexpr *Expr, short Width));
/*------------------------------------------------------\
| |
| Shift Functions |
| |
\------------------------------------------------------*/
extern vexexpr *shiftvexatomleft __P((vexexpr *Expr, short Count ));
extern vexexpr *shiftvexatomright __P((vexexpr *Expr, short Count ));
/*------------------------------------------------------\
| |
| Slice Functions |
| |
\------------------------------------------------------*/
extern vexexpr *slicevexatomvec __P((vexexpr *Expr, short Left, short Right));
/*------------------------------------------------------\
| |
| Unflat Functions |
| |
\------------------------------------------------------*/
extern vexexpr *unflatvexexpr __P((vexexpr *Expr));
/*------------------------------------------------------\
| |
| View Functions |
| |
\------------------------------------------------------*/
extern void viewvexexprfile __P((FILE *VexFile, vexexpr *Expr));
extern void viewvexexpr __P((vexexpr *Expr));
extern void viewvexexprln __P((vexexpr *Expr));
extern void viewvexexprbound __P((vexexpr *Expr));
extern void viewvexexprboundln __P((vexexpr *Expr));
extern char *viewvexexprstr __P((vexexpr *Expr));
extern char *viewvexexprstrbound __P((vexexpr *Expr));
extern int getvexviewmode __P(());
extern void setvexviewmode __P((int Mode));
# endif

View File

@ -0,0 +1,115 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexadd.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include "vexadd.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Add Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Add Vex Queue Expr |
| |
\------------------------------------------------------------*/
void addvexqexpr( Expr1, Expr2 )
vexexpr *Expr1;
vexexpr *Expr2;
{
chain_list *ScanOper;
chain_list **PrevOper;
PrevOper = &Expr1->OPERAND;
for ( ScanOper = Expr1->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
PrevOper = &ScanOper->NEXT;
}
*PrevOper = addchain( (chain_list *)0, (void *)Expr2 );
}
/*------------------------------------------------------------\
| |
| Add Vex Head Expr |
| |
\------------------------------------------------------------*/
void addvexhexpr( Expr1, Expr2 )
vexexpr *Expr1;
vexexpr *Expr2;
{
Expr1->OPERAND = addchain( Expr1->OPERAND, (void *)Expr2 );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexadd.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_ADD_H
# define VEX_ADD_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,123 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexalloc.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include <memory.h>
# include "vexalloc.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Vex Alloc Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Vex Alloc Node |
| |
\------------------------------------------------------------*/
vexexpr *allocvexnode()
{
return( (vexexpr *)autallocheap( sizeof( vexexpr ) ) );
}
/*------------------------------------------------------------\
| |
| Vex Copy Node |
| |
\------------------------------------------------------------*/
vexexpr *copyvexnode( Target, Source )
vexexpr *Target;
vexexpr *Source;
{
memcpy( (char *)Target, (char *)Source, sizeof( vexexpr ) );
return( Target );
}
/*------------------------------------------------------------\
| |
| Vex Duplicate Node |
| |
\------------------------------------------------------------*/
vexexpr *dupvexnode( Node )
vexexpr *Node;
{
vexexpr *DupNode;
DupNode = (vexexpr *)autallocheap( sizeof( vexexpr ) );
DupNode = copyvexnode( DupNode, Node );
return( DupNode );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexalloc.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_ALLOC_H
# define VEX_ALLOC_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,530 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexcreate.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include "vexcreate.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Create Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Create Vex Atom Vector |
| |
\------------------------------------------------------------*/
vexexpr *createvexatomvec( Name, Left, Right )
char *Name;
short Left;
short Right;
{
vexexpr *Node;
short Width;
Name = namealloc( Name );
Node = allocvexnode();
SetVexNodeAtom( Node );
SetVexAtomValue( Node, Name );
SetVexAtomVector( Node );
if ( ( Left < 0 ) ||
( Right < 0 ) )
{
Node->WIDTH = 1;
SetVexNodeVarWidth( Node );
}
else
{
if ( Left < Right )
{
Width = 1 + Right - Left;
}
else
{
Width = 1 + Left - Right;
SetVexAtomDown( Node );
}
Node->LEFT = Left;
Node->RIGHT = Right;
Node->WIDTH = Width;
}
if ( Name[ 0 ] == '"' )
{
SetVexAtomLiteral( Node );
}
return( Node );
}
/*------------------------------------------------------------\
| |
| Create Vex Atom Literal |
| |
\------------------------------------------------------------*/
vexexpr *createvexatomlit( Name )
char *Name;
{
vexexpr *Node;
short Width;
Name = namealloc( Name );
Node = allocvexnode();
SetVexNodeAtom( Node );
SetVexAtomValue( Node, Name );
SetVexAtomLiteral( Node );
Width = strlen( Name ) - 2;
Node->LEFT = Width - 1;
Node->RIGHT = 0;
Node->WIDTH = Width;
if ( Width > 1 ) SetVexAtomVector( Node );
else SetVexAtomBit( Node );
return( Node );
}
/*------------------------------------------------------------\
| |
| Create Vex Atom Literal Vector |
| |
\------------------------------------------------------------*/
vexexpr *createvexatomveclit( Literal, Width )
unsigned char Literal;
short Width;
{
vexexpr *Node;
char *Name;
char Buffer[ 512 ];
char Cote;
if ( Width > 1 ) Cote = '\"';
else Cote = '\'';
Buffer[ 0 ] = Cote;
Buffer[ Width + 1 ] = Cote;
Buffer[ Width + 2 ] = '\0';
memset( Buffer + 1, Literal, Width );
Name = namealloc( Buffer );
Node = allocvexnode();
SetVexNodeAtom( Node );
SetVexAtomValue( Node, Name );
SetVexAtomLiteral( Node );
Node->LEFT = Width - 1;
Node->RIGHT = 0;
Node->WIDTH = Width;
if ( Width > 1 ) SetVexAtomVector( Node );
else SetVexAtomBit( Node );
return( Node );
}
/*------------------------------------------------------------\
| |
| Create Vex Atom Bit |
| |
\------------------------------------------------------------*/
vexexpr *createvexatombit( Name )
char *Name;
{
vexexpr *Node;
Name = namealloc( Name );
Node = allocvexnode();
SetVexNodeAtom( Node );
SetVexAtomValue( Node, Name );
SetVexAtomBit( Node );
Node->WIDTH = 1;
if ( Name[ 0 ] == '\'' )
{
SetVexAtomLiteral( Node );
}
return( Node );
}
/*------------------------------------------------------------\
| |
| Create Vex Oper |
| |
\------------------------------------------------------------*/
vexexpr *createvexoper( Oper, Width )
long Oper;
short Width;
{
vexexpr *Node;
if ( ( Oper < 0 ) ||
( Oper >= VEX_MAX_OPERATOR ) )
{
vexerror( VEX_OPERATOR_ERROR, Oper );
}
Node = allocvexnode();
if ( Width <= 0 )
{
Width = 1;
SetVexNodeVarWidth( Node );
}
Node->WIDTH = Width;
Node->LEFT = Width - 1;
SetVexNodeOper( Node );
SetVexOperValue( Node, Oper );
return( Node );
}
/*------------------------------------------------------------\
| |
| Create Vex Bin Expr |
| |
\------------------------------------------------------------*/
vexexpr *createvexbinexpr( Oper, Width, Expr1, Expr2 )
long Oper;
short Width;
vexexpr *Expr1;
vexexpr *Expr2;
{
vexexpr *Expr;
if ( ! isvexbinaryoper( Oper ) )
{
vexerror( VEX_OPERATOR_ERROR, Oper );
}
Expr = createvexoper( Oper, Width );
addvexhexpr( Expr, Expr2 );
addvexhexpr( Expr, Expr1 );
return( Expr );
}
/*------------------------------------------------------------\
| |
| Create Vex Unary Expr |
| |
\------------------------------------------------------------*/
vexexpr *createvexunaryexpr( Oper, Width, Expr )
long Oper;
short Width;
vexexpr *Expr;
{
vexexpr *Expr1;
if ( ! isvexunaryoper( Oper ) )
{
vexerror( VEX_NOT_UNARY_ERROR, Oper );
}
Expr1 = createvexoper( Oper, Width );
addvexhexpr( Expr1, Expr );
return( Expr1 );
}
/*------------------------------------------------------------\
| |
| Create Vex Ternary Expr |
| |
\------------------------------------------------------------*/
vexexpr *createvexternaryexpr( Oper, Width, Expr1, Expr2, Expr3 )
long Oper;
short Width;
vexexpr *Expr1;
vexexpr *Expr2;
vexexpr *Expr3;
{
vexexpr *Expr;
if ( ! isvexternaryoper( Oper ) )
{
vexerror( VEX_OPERATOR_ERROR, Oper );
}
Expr = createvexoper( Oper, Width );
addvexhexpr( Expr, Expr3 );
addvexhexpr( Expr, Expr2 );
addvexhexpr( Expr, Expr1 );
return( Expr );
}
/*------------------------------------------------------------\
| |
| Create Vex Func |
| |
\------------------------------------------------------------*/
vexexpr *createvexfunc( Func, Width )
char *Func;
short Width;
{
vexexpr *Node;
Node = allocvexnode();
if ( Width <= 0 )
{
Width = 1;
SetVexNodeVarWidth( Node );
}
Node->WIDTH = Width;
Node->LEFT = Width - 1;
SetVexNodeFunc( Node );
SetVexFuncValue( Node, Func );
return( Node );
}
/*------------------------------------------------------------\
| |
| Create Vex Atom Long Array |
| |
\------------------------------------------------------------*/
vexexpr *createvexatomlongarray( Array, Size, Width, Signed )
long *Array;
short Size;
short Width;
short Signed;
{
vexexpr *Node;
char Buffer[ 512 ];
long Integer;
short Index;
short MaxWidth;
int Scan;
unsigned long Mask;
if ( Size == 0 ) return( (vexexpr *)0 );
Node = allocvexnode();
MaxWidth = Size * 32;
if ( Width == 0 )
{
Width = MaxWidth;
Index = 0;
Mask = 1L << 31;
Integer = Array[ 0 ];
if ( Integer & Mask )
{
if ( Signed )
{
while ( ( Integer & Mask ) != 0 )
{
Width--; Mask = Mask >> 1;
if ( Mask == 0 )
{
Index++;
if ( Index == Size ) break;
Integer = Array[ Index ];
Mask = 1L << 31;
}
}
Width++;
Signed = 1;
}
}
else
{
while ( ( Integer & Mask ) == 0 )
{
Width--; Mask = Mask >> 1;
if ( Mask == 0 )
{
Index++;
if ( Index == Size ) break;
Integer = Array[ Index ];
Mask = 1L << 31;
}
}
if ( ( Signed == 1 ) ||
( Width == 0 ) ) Width++;
}
}
if ( Width > MaxWidth ) return( (vexexpr *)0 );
Node->WIDTH = Width;
Node->LEFT = Width - 1;
Node->RIGHT = 0;
Scan = 1;
Index = Size - ((Width + 31) / 32);
Mask = 1L << ((Width - 1) % 32);
do
{
if ( Array[ Index ] & Mask ) Buffer[ Scan ] = '1';
else Buffer[ Scan ] = '0';
Scan = Scan + 1;
Mask = Mask >> 1;
if ( Mask == 0 )
{
Mask = 1L << 31; Index++;
}
}
while ( Index < Size );
if ( Width == 1 )
{
Buffer[ 0 ] = '\'';
Buffer[ Scan++ ] = '\'';
SetVexAtomBit( Node );
}
else
{
Buffer[ 0 ] = '"';
Buffer[ Scan++ ] = '"';
SetVexAtomVector( Node );
}
Buffer[ Scan ] = '\0';
if ( Signed == 1 ) SetVexNodeSigned( Node );
SetVexNodeAtom( Node );
SetVexAtomValue( Node, namealloc( Buffer ) );
SetVexAtomLiteral( Node );
return( Node );
}
/*------------------------------------------------------------\
| |
| Create Vex Atom Long |
| |
\------------------------------------------------------------*/
vexexpr *createvexatomlong( Integer, Width, Signed )
long Integer;
short Width;
short Signed;
{
return( createvexatomlongarray( &Integer, 1, Width, Signed ) );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexcreate.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_CREATE_H
# define VEX_CREATE_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,144 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexdel.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include "vexdel.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Del Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Del Vex Expr |
| |
\------------------------------------------------------------*/
void delvexexpr( Expr )
vexexpr *Expr;
{
chain_list *ScanOper;
if ( ! IsVexNodeAtom( Expr ) )
{
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
freevexexpr( GetVexOperand( ScanOper ) );
}
freechain( Expr->OPERAND );
}
freevexnode( Expr );
}
/*------------------------------------------------------------\
| |
| Del Vex Expr Number |
| |
\------------------------------------------------------------*/
void delvexexprnum( Expr, Number )
vexexpr *Expr;
int Number;
{
chain_list **PrevOper;
chain_list *ScanOper;
int Counter;
if ( ! IsVexNodeAtom( Expr ) )
{
PrevOper = &Expr->OPERAND;
Counter = 0;
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
if ( Counter == Number )
{
*PrevOper = ScanOper->NEXT;
ScanOper->NEXT = (chain_list *)0;
delvexexpr( GetVexOperand( ScanOper ) );
freechain( ScanOper );
return;
}
Counter = Counter + 1;
PrevOper = &ScanOper->NEXT;
ScanOper = ScanOper->NEXT;
}
}
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexdel.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_DEL_H
# define VEX_DEL_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,115 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexdup.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include "vexdup.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Dup Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Duplicate Vex Expr |
| |
\------------------------------------------------------------*/
vexexpr *dupvexexpr( Expr )
vexexpr *Expr;
{
vexexpr *ExprDup;
chain_list *ScanOper;
chain_list *DupOper;
chain_list **PrevOper;
if ( Expr == (vexexpr *) 0)
{
return( (vexexpr *)0 );
}
ExprDup = dupvexnode( Expr );
if ( ! IsVexNodeAtom( Expr ) )
{
PrevOper = &ExprDup->OPERAND;
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
DupOper = addchain( (chain_list *)0,
(void *)dupvexexpr( GetVexOperand( ScanOper ) ) );
*PrevOper = DupOper;
PrevOper = &DupOper->NEXT;
}
}
return( ExprDup );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexdup.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_DUP_H
# define VEX_DUP_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,270 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexenv.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include "vexenv.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
char *VEX_OPER_UPPER_NAME[ VEX_MAX_OPERATOR ] =
{
"&" ,
"NOT" ,
"NEG" ,
"EVENT" ,
"OR" ,
"AND" ,
"XOR" ,
"NOR" ,
"NAND" ,
"XNOR" ,
"=" ,
"/=" ,
"<" ,
"<=" ,
">" ,
">=" ,
"+" ,
"-" ,
"*" ,
"/" ,
"**" ,
"MOD" ,
"REM" ,
"TO" ,
"DOWNTO",
"INDEX" ,
"LEFT" ,
"RIGHT",
"LOW",
"HIGH",
"LENGTH",
"RANGE",
"REV_RANGE",
"DRIVER",
"IFT",
"ARRAY",
"INDEX_N",
"OTHERS =>",
"NUM_BIT",
"ABS"
};
/* A few declaration that should be in vexenv I believe, but I leave
* this kind of update to Mr Jacomme, master of these sources */
/* A sharp '#' is used where an operator exists but has to be
* treated specifically.
* Quite a few VHDL operators have no equivalent in verilog for my
* current knowledge: NULL indicates that! */
char *VEX_OPER_VERILOG_NAME[ VEX_MAX_OPERATOR ] =
{
"," , /* VEX_CONCAT */
"~" , /* VEX_NOT */
"-" , /* VEX_NEG */
NULL, /* VEX_EVENT */
"|" , /* VEX_OR */
"&" , /* VEX_AND */
"^" , /* VEX_XOR */
"#" , /* VEX_NOR */
"#" , /* VEX_NAND */
"#" , /* VEX_NXOR */
"==", /* VEX_EQ */
"!=", /* VEX_NE */
"<" , /* VEX_LT */
"<=", /* VEX_LE */
">" , /* VEX_GT */
">=", /* VEX_GE */
"+" , /* VEX_ADD */
"-" , /* VEX_SUB */
"*" , /* VEX_MUL */
"/" , /* VEX_DIV */
"**", /* VEX_EXP */
"%" , /* VEX_MOD */
"%" , /* VEX_REM */
NULL, /* VEX_TO */
NULL, /* VEX_DOWNTO */
NULL, /* VEX_INDEX */
NULL, /* VEX_LEFT */
NULL, /* VEX_RIGHT */
NULL, /* VEX_LOW */
NULL, /* VEX_HIGH */
NULL, /* VEX_LENGTH */
NULL, /* VEX_RANGE */
NULL, /* VEX_REV_RANGE */
NULL, /* VEX_DRIVER */
"IFT", /* VEX_IFT */
NULL , /* VEX_ARRAY */
NULL , /* VEX_INDEX_N */
NULL , /* VEX_OTHERS */
NULL , /* VEX_NUM_BIT */
NULL /* VEX_ABS */
};
char VEX_LITERAL_BY_ID[ VEX_MAX_ID ] =
{
'u', 'x', '0', '1', 'z', 'w', 'l', 'h', '-'
};
char *VEX_TYPE_NAME[ VEX_MAX_TYPE ] =
{
"SEVERITY",
"BOOLEAN",
"CHARACTER",
"STRING",
"BIT",
"INTEGER",
"NATURAL",
"BIT_VECTOR",
"STD_ULOGIC",
"STD_LOGIC",
"STD_ULOGIC_VECTOR",
"STD_LOGIC_VECTOR",
"X01",
"X01Z",
"UX01",
"UX01Z",
"UNSIGNED",
"SIGNED",
"SMALL_INT",
"REG_BIT",
"REG_VECTOR",
"MUX_BIT",
"MUX_VECTOR",
"WOR_BIT",
"WOR_VECTOR",
"ENUMERATE",
"ARRAY"
};
char *VEX_STD_FUNC_UPPER_NAME[ VEX_MAX_STD_FUNC ] =
{
"TO_BIT",
"TO_BITVECTOR",
"TO_STDULOGIC",
"TO_STDLOGICVECTOR",
"TO_STDULOGICVECTOR",
"TO_X01",
"TO_X01Z",
"TO_UX01",
"RISING_EDGE",
"FALLING_EDGE",
"IS_X",
"ABS",
"SHL",
"SHR",
"CONV_INTEGER",
"CONV_UNSIGNED",
"CONV_SIGNED",
"CONV_STD_LOGIC_VECTOR",
"EXT",
"SXT",
"SHIFT_LEFT",
"SHIFT_RIGHT",
"ROTATE_LEFT",
"ROTATE_RIGHT",
"RESIZE",
"TO_INTEGER",
"TO_UNSIGNED",
"TO_SIGNED",
"STD_LOGIC_VECTOR",
"STD_ULOGIC_VECTOR",
"SIGNED",
"UNSIGNED"
};
char *VEX_ATOM_BY_ID[ VEX_MAX_ID ];
char *VEX_OPER_NAME[ VEX_MAX_OPERATOR ];
char *VEX_STD_FUNC_NAME[ VEX_MAX_STD_FUNC ];
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Vex Env |
| |
\------------------------------------------------------------*/
void vexenv()
{
char Buffer[ 16 ];
int Index;
for ( Index = 0; Index < VEX_MAX_ID; Index++ )
{
sprintf( Buffer, "'%c'", VEX_LITERAL_BY_ID[ Index ] );
VEX_ATOM_BY_ID[ Index ] = namealloc( Buffer );
}
for ( Index = 0; Index < VEX_MAX_OPERATOR; Index++ )
{
VEX_OPER_NAME[ Index ] = namealloc( VEX_OPER_UPPER_NAME[ Index ] );
}
for ( Index = 0; Index < VEX_MAX_STD_FUNC; Index++ )
{
VEX_STD_FUNC_NAME[ Index ] = namealloc( VEX_STD_FUNC_UPPER_NAME[ Index ] );
}
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexenv.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_ENV_H
# define VEX_ENV_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,113 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : Vex Errors |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 03.12.96 |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include <stdio.h>
# include <string.h>
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
void vex_error( Error, Text, File, Line )
int Error;
char *Text;
char *File;
long Line;
{
char *Name;
Name = mbkstrdup( File );
Name[ strlen( File ) - 1 ] = '\0';
fprintf( stderr, "%s%ld ", Name, Line );
switch( Error )
{
case VEX_OPERATOR_ERROR :
fprintf( stderr, "bad operator %ld !\n", (long)Text );
break;
case VEX_NOT_UNARY_ERROR :
fprintf( stderr, "not unary operator %ld !\n", (long)Text );
break;
case VEX_NOT_LITERAL_ERROR :
fprintf( stderr, "not literal atom !\n" );
break;
default :
fprintf( stderr, "unknown internal error %d !\n", Error );
}
autexit( 1 );
}

View File

@ -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 Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : Vex Errors |
| |
| Authors : Jacomme Ludovic |
| |
| Date : 03.12.96 |
| |
\------------------------------------------------------------*/
# ifndef VEX_ERROR_H
# define VEX_ERROR_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define VEX_OPERATOR_ERROR 0
# define VEX_NOT_UNARY_ERROR 1
# define VEX_NOT_LITERAL_ERROR 2
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Macros |
| |
\------------------------------------------------------------*/
# define vexerror( E, V ) (vex_error( (int)(E), (char*)(long)(V), __FILE__, __LINE__ ))
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
extern void vex_error __P((int Error, char *Text, char *File, long Line));
# endif

View File

@ -0,0 +1,303 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexeval.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include "vexeval.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
char VexNotLiteral[ VEX_MAX_ID ] =
{
/* ------------------------------------------ */
/* U X 0 1 Z W L H - */
/* ------------------------------------------ */
'u', 'x', '1', '0', 'x', 'x', '1', '0', 'x'
};
char VexAndLiteral[ VEX_MAX_ID ][ VEX_MAX_ID ] =
{
/* ------------------------------------------ */
/* U X 0 1 Z W L H - */
/* ------------------------------------------ */
{ 'u', 'u', '0', 'u', 'u', 'u', '0', 'u', 'u' }, /* | u | */
{ 'u', 'x', '0', 'x', 'x', 'x', '0', 'x', 'x' }, /* | x | */
{ '0', '0', '0', '0', '0', '0', '0', '0', '0' }, /* | 0 | */
{ 'u', 'x', '0', '1', 'x', 'x', '0', '1', 'x' }, /* | 1 | */
{ 'u', 'x', '0', 'x', 'x', 'x', '0', 'x', 'x' }, /* | z | */
{ 'u', 'x', '0', 'x', 'x', 'x', '0', 'x', 'x' }, /* | w | */
{ '0', '0', '0', '0', '0', '0', '0', '0', '0' }, /* | l | */
{ 'u', 'x', '0', '1', 'x', 'x', '0', '1', 'x' }, /* | h | */
{ 'u', 'x', '0', 'x', 'x', 'x', '0', 'x', 'x' } /* | - | */
};
char VexOrLiteral[ VEX_MAX_ID ][ VEX_MAX_ID ] =
{
/* ------------------------------------------ */
/* U X 0 1 Z W L H - */
/* ------------------------------------------ */
{ 'u', 'u', 'u', '1', 'u', 'u', 'u', '1', 'u' }, /* | u | */
{ 'u', 'x', 'x', '1', 'x', 'x', 'x', '1', 'x' }, /* | x | */
{ 'u', 'x', '0', '1', 'x', 'x', '0', '1', 'x' }, /* | 0 | */
{ '1', '1', '1', '1', '1', '1', '1', '1', '1' }, /* | 1 | */
{ 'u', 'x', 'x', '1', 'x', 'x', 'x', '1', 'x' }, /* | z | */
{ 'u', 'x', 'x', '1', 'x', 'x', 'x', '1', 'x' }, /* | w | */
{ 'u', 'x', '0', '1', 'x', 'x', '0', '1', 'x' }, /* | l | */
{ '1', '1', '1', '1', '1', '1', '1', '1', '1' }, /* | h | */
{ 'u', 'x', 'x', '1', 'x', 'x', 'x', '1', 'x' } /* | - | */
};
char VexXorLiteral[ VEX_MAX_ID ][ VEX_MAX_ID ] =
{
/* ------------------------------------------ */
/* U X 0 1 Z W L H - */
/* ------------------------------------------ */
{ 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u', 'u' }, /* | u | */
{ 'u', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' }, /* | x | */
{ 'u', 'x', '0', '1', 'x', 'x', '0', '1', 'x' }, /* | 0 | */
{ 'u', 'x', '1', '0', 'x', 'x', '1', '0', 'x' }, /* | 1 | */
{ 'u', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' }, /* | z | */
{ 'u', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' }, /* | w | */
{ 'u', 'x', '0', '1', 'x', 'x', '0', '1', 'x' }, /* | l | */
{ 'u', 'x', '1', '0', 'x', 'x', '1', '0', 'x' }, /* | h | */
{ 'u', 'x', 'x', 'x', 'x', 'x', 'x', 'x', 'x' } /* | - | */
};
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Eval Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Eval Vex Atom Long |
| |
\------------------------------------------------------------*/
int evalvexatomlong( Expr, PLong )
vexexpr *Expr;
long *PLong;
{
char *Literal;
long Value;
int Index;
int IndexStep;
int IndexMax;
int Error;
if ( ( ! IsVexNodeAtom( Expr ) ) ||
( ! IsVexAtomLiteral( Expr ) ) )
{
return( -1 );
}
Literal = GetVexAtomValue( Expr );
Error = 0;
Index = 1;
IndexStep = 1;
IndexMax = Expr->WIDTH + 1;
if ( ( IsVexNodeSigned( Expr ) ) &&
( Literal[ Index ] == '1' ) ) Value = -1;
else Value = 0;
do
{
Value = Value << 1;
if ( Literal[ Index ] == '1' )
{
Value |= 1;
}
else
if ( Literal[ Index ] != '0' )
{
Error = -1;
}
Index += IndexStep;
}
while ( Index != IndexMax );
*PLong = Value;
return( Error );
}
/*------------------------------------------------------------\
| |
| Eval Vex Not Literal |
| |
\------------------------------------------------------------*/
int evalvexnotliteral( Literal, PChar )
char Literal;
char *PChar;
{
int Index;
Index = getvexliteralid( Literal );
if ( Index == -1 )
{
return( -1 );
}
*PChar = VexNotLiteral[ Index ];
return( 0 );
}
/*------------------------------------------------------------\
| |
| Eval Vex And Literal |
| |
\------------------------------------------------------------*/
int evalvexandliteral( Literal1, Literal2, PChar )
char Literal1;
char Literal2;
char *PChar;
{
int Index1;
int Index2;
Index1 = getvexliteralid( Literal1 );
Index2 = getvexliteralid( Literal2 );
if ( ( Index1 == -1 ) ||
( Index2 == -1 ) )
{
return( -1 );
}
*PChar = VexAndLiteral[ Index1 ][ Index2 ];
return( 0 );
}
/*------------------------------------------------------------\
| |
| Eval Vex Or Literal |
| |
\------------------------------------------------------------*/
int evalvexorliteral( Literal1, Literal2, PChar )
char Literal1;
char Literal2;
char *PChar;
{
int Index1;
int Index2;
Index1 = getvexliteralid( Literal1 );
Index2 = getvexliteralid( Literal2 );
if ( ( Index1 == -1 ) ||
( Index2 == -1 ) )
{
return( -1 );
}
*PChar = VexOrLiteral[ Index1 ][ Index2 ];
return( 0 );
}
/*------------------------------------------------------------\
| |
| Eval Vex Xor Literal |
| |
\------------------------------------------------------------*/
int evalvexxorliteral( Literal1, Literal2, PChar )
char Literal1;
char Literal2;
char *PChar;
{
int Index1;
int Index2;
Index1 = getvexliteralid( Literal1 );
Index2 = getvexliteralid( Literal2 );
if ( ( Index1 == -1 ) ||
( Index2 == -1 ) )
{
return( -1 );
}
*PChar = VexXorLiteral[ Index1 ][ Index2 ];
return( 0 );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexeval.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_EVAL_H
# define VEX_EVAL_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,261 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexextend.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include "vexextend.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Extend Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Extend Vex Atom Sign |
| |
\------------------------------------------------------------*/
vexexpr *extendvexatomsign( Expr, Width )
vexexpr *Expr;
short Width;
{
char *Value;
vexexpr *Atom;
vexexpr *Result;
char Buffer[ 128 ];
int Index;
int Target;
int Extend;
char Sign;
char Limit;
if ( IsVexNodeAtom( Expr ) )
{
Value = GetVexAtomValue( Expr );
if ( IsVexAtomLiteral( Expr ) )
{
if ( Expr->WIDTH < Width )
{
/*
** "1xxxx" -> "1111xxxx"
*/
Extend = Width - Expr->WIDTH;
if ( IsVexNodeSigned( Expr ) ) Sign = Value[ 1 ];
else Sign = '0';
Target = 0;
Buffer[ Target++ ] = '"';
for ( Index = 1; Index <= Extend; Index++ )
{
Buffer[ Target++ ] = Sign;
}
for ( Index = 1; Index <= Expr->WIDTH; Index++ )
{
Buffer[ Target++ ] = Value[ Index ];
}
Buffer[ Target++ ] = '"';
Buffer[ Target++ ] = '\0';
SetVexAtomValue( Expr, namealloc( Buffer ) );
Expr->WIDTH = Width;
Expr->LEFT = Width - 1;
Expr->RIGHT = 0;
}
else
if ( Expr->WIDTH > Width )
{
/*
** "1111xxxx" -> "1xxxx"
*/
Extend = (Expr->WIDTH + 1) - Width;
if ( IsVexNodeSigned( Expr ) ) Sign = Value[ 1 ];
else Sign = '0';
Target = 0;
if ( Width > 1 ) Limit = '"';
else Limit = '\'';
Buffer[ Target++ ] = Limit;
for ( Index = 1; Index <= Extend; Index++ )
{
if ( Value[ Index ] != Sign ) return( (vexexpr *)0 );
}
for ( Index = Extend; Index <= Expr->WIDTH; Index++ )
{
Buffer[ Target++ ] = Value[ Index ];
}
Buffer[ Target++ ] = Limit;
Buffer[ Target++ ] = '\0';
SetVexAtomValue( Expr, namealloc( Buffer ) );
Expr->WIDTH = Width;
Expr->LEFT = Width - 1;
Expr->RIGHT = 0;
}
return( Expr );
}
else
{
if ( Expr->WIDTH < Width )
{
/*
** "1xxxx" -> "1111xxxx"
*/
Extend = Width - Expr->WIDTH;
if ( IsVexNodeSigned( Expr ) )
{
Value = GetVexAtomValue( Expr );
Result = createvexoper( VEX_CONCAT, Width );
addvexhexpr( Result, Expr );
for ( Index = 1; Index <= Extend; Index++ )
{
if ( IsVexAtomVector( Expr ) )
{
Atom = createvexatomvec( Value, Expr->LEFT, Expr->LEFT );
}
else
{
Atom = createvexatombit( Value );
}
addvexhexpr( Result, Atom );
}
Expr = Result;
Expr->WIDTH = Width;
Expr->LEFT = Width - 1;
Expr->RIGHT = 0;
SetVexNodeSigned( Expr );
}
else
{
Target = 0;
if ( Extend > 1 ) Limit = '"';
else Limit = '\'';
Buffer[ Target++ ] = Limit;
for ( Index = 1; Index <= Extend; Index++ )
{
Buffer[ Target++ ] = '0';
}
Buffer[ Target++ ] = Limit;
Buffer[ Target++ ] = '\0';
Atom = createvexatomlit( Buffer );
Expr = createvexbinexpr( VEX_CONCAT, 0, Atom, Expr );
Expr->LEFT = Width - 1;
Expr->RIGHT = 0;
Expr->WIDTH = Width;
}
return( Expr );
}
else
{
Expr->WIDTH = Width;
if ( IsVexAtomDown( Expr ) )
{
Expr->LEFT = Expr->RIGHT + Width - 1;
}
else
{
Expr->LEFT = Expr->RIGHT - Width + 1;
}
return( Expr );
}
}
}
return( (vexexpr *)0 );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexextend.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_EXTEND_H
# define VEX_EXTEND_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,119 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexfree.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include "vexfree.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Vex Free Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Vex Free Node |
| |
\------------------------------------------------------------*/
void freevexnode( Node )
vexexpr *Node;
{
autfreeheap( Node, sizeof( vexexpr ) );
}
/*------------------------------------------------------------\
| |
| Vex Free Expr |
| |
\------------------------------------------------------------*/
void freevexexpr( Expr )
vexexpr *Expr;
{
chain_list *ScanOper;
if ( Expr != (vexexpr *)0 )
{
if ( ! IsVexNodeAtom( Expr ) )
{
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
freevexexpr( GetVexOperand( ScanOper ) );
}
freechain( Expr->OPERAND );
}
freevexnode( Expr );
}
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexfree.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_FREE_H
# define VEX_FREE_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexget.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_GET_H
# define VEX_GET_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,634 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexis.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include "vexis.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
short VexOperBinary[ VEX_MAX_OPERATOR ] =
{
3, /* VEX_CONCAT */
0, /* VEX_NOT */
0, /* VEX_NEG */
0, /* VEX_EVENT */
3, /* VEX_OR */
3, /* VEX_AND */
3, /* VEX_XOR */
3, /* VEX_NOR */
3, /* VEX_NAND */
3, /* VEX_NXOR */
2, /* VEX_EQ */
2, /* VEX_NE */
2, /* VEX_LT */
2, /* VEX_LE */
2, /* VEX_GT */
2, /* VEX_GE */
3, /* VEX_ADD */
2, /* VEX_SUB */
3, /* VEX_MUL */
2, /* VEX_DIV */
2, /* VEX_EXP */
2, /* VEX_MOD */
2, /* VEX_REM */
3, /* VEX_TO */
3, /* VEX_DOWNTO */
2, /* VEX_INDEX */
0, /* VEX_LEFT */
0, /* VEX_RIGHT */
0, /* VEX_LOW */
0, /* VEX_HIGH */
0, /* VEX_LENGTH */
0, /* VEX_RANGE */
0, /* VEX_REV_RANGE */
0, /* VEX_DRIVER */
2, /* VEX_IFT */
4, /* VEX_ARRAY */
3, /* VEX_INDEX_N */
0, /* VEX_OTHERS */
2, /* VEX_NUM_BIT */
0 /* VEX_ABS */
};
short VexOperArith[ VEX_MAX_OPERATOR ] =
{
0, /* VEX_CONCAT */
0, /* VEX_NOT */
1, /* VEX_NEG */
0, /* VEX_EVENT */
0, /* VEX_OR */
0, /* VEX_AND */
0, /* VEX_XOR */
0, /* VEX_NOR */
0, /* VEX_NAND */
0, /* VEX_NXOR */
1, /* VEX_EQ */
1, /* VEX_NE */
1, /* VEX_LT */
1, /* VEX_LE */
1, /* VEX_GT */
1, /* VEX_GE */
1, /* VEX_ADD */
1, /* VEX_SUB */
1, /* VEX_MUL */
1, /* VEX_DIV */
1, /* VEX_EXP */
1, /* VEX_MOD */
1, /* VEX_REM */
0, /* VEX_TO */
0, /* VEX_DOWNTO */
0, /* VEX_INDEX */
0, /* VEX_LEFT */
0, /* VEX_RIGHT */
0, /* VEX_LOW */
0, /* VEX_HIGH */
0, /* VEX_LENGTH */
0, /* VEX_RANGE */
0, /* VEX_REV_RANGE */
0, /* VEX_DRIVER */
0, /* VEX_IFT */
0, /* VEX_ARRAY */
0, /* VEX_INDEX_N */
1, /* VEX_OTHERS */
0, /* VEX_NUM_BIT */
1 /* VEX_ABS */
};
short VexOperNegative[ VEX_MAX_OPERATOR ] =
{
0, /* VEX_CONCAT */
1, /* VEX_NOT */
0, /* VEX_NEG */
0, /* VEX_EVENT */
0, /* VEX_OR */
0, /* VEX_AND */
0, /* VEX_XOR */
1, /* VEX_NOR */
1, /* VEX_NAND */
1, /* VEX_NXOR */
0, /* VEX_EQ */
0, /* VEX_NE */
0, /* VEX_LT */
0, /* VEX_LE */
0, /* VEX_GT */
0, /* VEX_GE */
0, /* VEX_ADD */
0, /* VEX_SUB */
0, /* VEX_MUL */
0, /* VEX_DIV */
0, /* VEX_EXP */
0, /* VEX_MOD */
0, /* VEX_REM */
0, /* VEX_TO */
0, /* VEX_DOWNTO */
0, /* VEX_INDEX */
0, /* VEX_LEFT */
0, /* VEX_RIGHT */
0, /* VEX_LOW */
0, /* VEX_HIGH */
0, /* VEX_LENGTH */
0, /* VEX_RANGE */
0, /* VEX_REV_RANGE */
0, /* VEX_DRIVER */
0, /* VEX_IFT */
0, /* VEX_ARRAY */
0, /* VEX_INDEX_N */
0, /* VEX_OTHERS */
0, /* VEX_NUM_BIT */
0, /* VEX_ABS */
};
short VexTypeDivisible[ VEX_MAX_TYPE ] =
{
0, /* SEVERITY */
0, /* BOOLEAN */
0, /* CHARACTER */
1, /* STRING */
0, /* BIT */
0, /* INTEGER */
0, /* NATURAL */
1, /* BIT_VECTOR */
0, /* STD_ULOGIC */
0, /* STD_LOGIC */
1, /* STD_ULOGIC_VECTOR */
1, /* STD_LOGIC_VECTOR */
0, /* X01 */
0, /* X01Z */
0, /* UX01 */
0, /* UX01Z */
1, /* UNSIGNED */
1, /* SIGNED */
0, /* SMALL_INT */
0, /* REG_BIT */
1, /* REG_VECTOR */
0, /* MUX_BIT */
1, /* MUX_VECTOR */
0, /* WOR_BIT */
1, /* WOR_VECTOR */
0, /* ENUMERATE */
1 /* ARRAY */
};
short VexTypeVector[ VEX_MAX_TYPE ] =
{
0, /* SEVERITY */
0, /* BOOLEAN */
0, /* CHARACTER */
1, /* STRING */
0, /* BIT */
1, /* INTEGER */
1, /* NATURAL */
1, /* BIT_VECTOR */
0, /* STD_ULOGIC */
0, /* STD_LOGIC */
1, /* STD_ULOGIC_VECTOR */
1, /* STD_LOGIC_VECTOR */
0, /* X01 */
0, /* X01Z */
0, /* UX01 */
0, /* UX01Z */
1, /* UNSIGNED */
1, /* SIGNED */
0, /* SMALL_INT */
0, /* REG_BIT */
1, /* REG_VECTOR */
0, /* MUX_BIT */
1, /* MUX_VECTOR */
0, /* WOR_BIT */
1, /* WOR_VECTOR */
1, /* ENUMERATE */
1 /* ARRAY */
};
static char *VexIsName = (char *)0;
static long VexIsOper = (long )0;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Is Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Is Vex Type Vector |
| |
\------------------------------------------------------------*/
int isvextypevector( Type )
int Type;
{
if ( ( Type < 0 ) ||
( Type >= VEX_MAX_TYPE ) )
{
return( -1 );
}
return( VexTypeVector[ Type ] );
}
/*------------------------------------------------------------\
| |
| Is Vex Type Divisible |
| |
\------------------------------------------------------------*/
int isvextypedivisible( Type )
int Type;
{
if ( ( Type < 0 ) ||
( Type >= VEX_MAX_TYPE ) )
{
return( -1 );
}
return( VexTypeDivisible[ Type ] );
}
/*------------------------------------------------------------\
| |
| Is Vex Positive Operator |
| |
\------------------------------------------------------------*/
int isvexpositiveoper( Oper )
long Oper;
{
if ( ( Oper < 0 ) ||
( Oper >= VEX_MAX_OPERATOR ) )
{
return( -1 );
}
return( ! VexOperNegative[ Oper ] );
}
/*------------------------------------------------------------\
| |
| Is Vex Negative Operator |
| |
\------------------------------------------------------------*/
int isvexnegativeoper( Oper )
long Oper;
{
if ( ( Oper < 0 ) ||
( Oper >= VEX_MAX_OPERATOR ) )
{
return( -1 );
}
return( VexOperNegative[ Oper ] );
}
/*------------------------------------------------------------\
| |
| Is Vex Unary Operator |
| |
\------------------------------------------------------------*/
int isvexunaryoper( Oper )
long Oper;
{
if ( ( Oper < 0 ) ||
( Oper >= VEX_MAX_OPERATOR ) )
{
return( -1 );
}
return( ! VexOperBinary[ Oper ] );
}
/*------------------------------------------------------------\
| |
| Is Vex Binary Operator |
| |
\------------------------------------------------------------*/
int isvexbinaryoper( Oper )
long Oper;
{
if ( ( Oper < 0 ) ||
( Oper >= VEX_MAX_OPERATOR ) )
{
return( -1 );
}
return( VexOperBinary[ Oper ] );
}
/*------------------------------------------------------------\
| |
| Is Vex Ternary Operator |
| |
\------------------------------------------------------------*/
int isvexternaryoper( Oper )
long Oper;
{
if ( ( Oper < 0 ) ||
( Oper >= VEX_MAX_OPERATOR ) )
{
return( -1 );
}
return( VexOperBinary[ Oper ] == 3 );
}
/*------------------------------------------------------------\
| |
| Is Local Operator In Expr |
| |
\------------------------------------------------------------*/
static int loc_isvexoperinexpr( Expr )
vexexpr *Expr;
{
chain_list *ScanOper;
if ( IsVexNodeAtom( Expr ) )
{
return( 0 );
}
if ( IsVexNodeOper( Expr ) )
{
if ( GetVexOperValue( Expr ) == VexIsOper )
{
return( 1 );
}
}
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
if ( loc_isvexoperinexpr( GetVexOperand( ScanOper ) ) )
{
return( 1 );
}
}
return( 0 );
}
/*------------------------------------------------------------\
| |
| Is Vex Operator In Expr |
| |
\------------------------------------------------------------*/
int isvexoperinexpr( Expr, Oper )
vexexpr *Expr;
long Oper;
{
VexIsOper = Oper;
return( loc_isvexoperinexpr( Expr ) );
}
/*------------------------------------------------------------\
| |
| Is Local Arithmetic Operator In Expr |
| |
\------------------------------------------------------------*/
static int loc_isvexarithoperinexpr( Expr )
vexexpr *Expr;
{
chain_list *ScanOper;
vexexpr *Operand1;
vexexpr *Operand2;
long Oper;
if ( IsVexNodeAtom( Expr ) )
{
return( 0 );
}
if ( IsVexNodeOper( Expr ) )
{
Oper = GetVexOperValue( Expr );
if ( VexOperArith[ Oper ] )
{
if ( ( Oper == VEX_EQ ) ||
( Oper == VEX_NE ) )
{
Operand1 = GetVexOperand( Expr->OPERAND );
Operand2 = GetVexOperand( Expr->OPERAND->NEXT );
if ( Operand1->WIDTH == Operand2->WIDTH )
{
return( 0 );
}
}
return( 1 );
}
}
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
if ( loc_isvexarithoperinexpr( GetVexOperand( ScanOper ) ) )
{
return( 1 );
}
}
return( 0 );
}
/*------------------------------------------------------------\
| |
| Is Vex Arithmetic Operator In Expr |
| |
\------------------------------------------------------------*/
int isvexarithoperinexpr( Expr )
vexexpr *Expr;
{
return( loc_isvexarithoperinexpr( Expr ) );
}
/*------------------------------------------------------------\
| |
| Is Local Name In Expr |
| |
\------------------------------------------------------------*/
static int loc_isvexnameinexpr( Expr )
vexexpr *Expr;
{
chain_list *ScanOper;
if ( IsVexNodeAtom( Expr ) )
{
if ( GetVexAtomValue( Expr ) == VexIsName ) return( 1 );
return( 0 );
}
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
if ( loc_isvexnameinexpr( GetVexOperand( ScanOper ) ) )
{
return( 1 );
}
}
return( 0 );
}
/*------------------------------------------------------------\
| |
| Is Vex Name In Expr |
| |
\------------------------------------------------------------*/
int isvexnameinexpr( Expr, Name )
vexexpr *Expr;
char *Name;
{
VexIsName = namealloc( Name );
return( loc_isvexnameinexpr( Expr ) );
}
/*------------------------------------------------------------\
| |
| Is Vex Equal Expr |
| |
\------------------------------------------------------------*/
int isvexequalexpr( Expr1, Expr2 )
vexexpr *Expr1;
vexexpr *Expr2;
{
chain_list *ScanOper1;
chain_list *ScanOper2;
if ( ( Expr1 == (vexexpr *)0 ) ||
( Expr2 == (vexexpr *)0 ) )
{
return( 0 );
}
if ( ( Expr1->VALUE != Expr2->VALUE ) ||
( Expr1->TYPE != Expr2->TYPE ) ||
( Expr1->LEFT != Expr2->LEFT ) ||
( Expr1->RIGHT != Expr2->RIGHT ) )
{
return( 0 );
}
if ( ! IsVexNodeAtom( Expr1 ) )
{
ScanOper1 = Expr1->OPERAND;
ScanOper2 = Expr2->OPERAND;
while ( ( ScanOper1 != (chain_list *)0 ) &&
( ScanOper2 != (chain_list *)0 ) )
{
if ( ! isvexequalexpr( GetVexOperand( ScanOper1 ),
GetVexOperand( ScanOper2 ) ) )
{
return( 0 );
}
ScanOper1 = ScanOper1->NEXT;
ScanOper2 = ScanOper2->NEXT;
}
if ( ( ScanOper1 != (chain_list *)0 ) ||
( ScanOper2 != (chain_list *)0 ) )
{
return( 0 );
}
}
return( 1 );
}

View File

@ -0,0 +1,79 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexis.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_IS_H
# define VEX_IS_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
extern short VexOperBinary[ VEX_MAX_OPERATOR ];
extern short VexOperNegative[ VEX_MAX_OPERATOR ];
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -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 Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexoptim.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include "vexoptim.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Optim Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Optim Vex Not Expr |
| |
\------------------------------------------------------------*/
vexexpr *optimvexnotexpr( Expr )
vexexpr *Expr;
{
vexexpr *Expr1;
char *Value;
char Buffer[ 128 ];
short Index;
long Oper;
long NotOper;
if ( IsVexNodeAtom( Expr ) )
{
if ( IsVexAtomLiteral( Expr ) )
{
Value = GetVexAtomValue( Expr );
Buffer[ 0 ] = Value[ 0 ];
for ( Index = 1; Index <= Expr->WIDTH; Index++ )
{
evalvexnotliteral( Value[ Index ], &Buffer[ Index ] );
}
Buffer[ Index++ ] = Value[ 0 ];
Buffer[ Index++ ] = '\0';
SetVexAtomValue( Expr, namealloc( Buffer ) );
return( Expr );
}
}
else
if ( IsVexNodeOper( Expr ) )
{
Oper = GetVexOperValue( Expr );
NotOper = getvexnotoper( Oper );
if ( Oper == VEX_NOT )
{
Expr1 = GetVexOperand( Expr->OPERAND );
SetVexOperand( Expr->OPERAND, (vexexpr *)0 );
freevexexpr( Expr );
return( Expr1 );
}
else
if ( NotOper != -1 )
{
SetVexOperValue( Expr, NotOper );
return( Expr );
}
}
Expr1 = createvexoper( VEX_NOT, Expr->WIDTH );
addvexhexpr( Expr1, Expr );
return( Expr1 );
}
/*------------------------------------------------------------\
| |
| Optim Vex Bin Expr |
| |
\------------------------------------------------------------*/
vexexpr *optimvexbinexpr( Oper, Width, Expr1, Expr2 )
long Oper;
short Width;
vexexpr *Expr1;
vexexpr *Expr2;
{
vexexpr *Expr;
chain_list *ScanOper;
long Oper1;
long Oper2;
int Binary;
int Negative;
Binary = isvexbinaryoper( Oper );
if ( ! Binary )
{
vexerror( VEX_OPERATOR_ERROR, Oper );
}
Negative = isvexnegativeoper( Oper );
if ( IsVexNodeOper( Expr1 ) ) Oper1 = GetVexOperValue( Expr1 );
else Oper1 = -1;
if ( IsVexNodeOper( Expr2 ) ) Oper2 = GetVexOperValue( Expr2 );
else Oper2 = -1;
if ( ( Negative ) ||
( Binary == 2 ) ||
( Oper2 != Oper ) ||
( ( Expr2->WIDTH != Width ) &&
( Oper != VEX_CONCAT ) ) )
{
Expr = createvexoper( Oper, Width );
addvexhexpr( Expr, Expr2 );
}
else
{
Expr = Expr2;
}
if ( ( Negative ) ||
( Binary == 2 ) ||
( Oper1 != Oper ) ||
( ( Expr2->WIDTH != Width ) &&
( Oper != VEX_CONCAT ) ) )
{
addvexhexpr( Expr, Expr1 );
}
else
{
ScanOper = Expr1->OPERAND;
while ( ScanOper->NEXT != (chain_list *)0 )
{
ScanOper = ScanOper->NEXT;
}
ScanOper->NEXT = Expr->OPERAND;
Expr->OPERAND = Expr1->OPERAND;
Expr1->OPERAND = (chain_list *)0;
freevexexpr( Expr1 );
}
return( Expr );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexoptim.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_OPTIM_H
# define VEX_OPTIM_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,240 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexshift.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include "vexshift.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Shift Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Shift Vex Atom Left |
| |
\------------------------------------------------------------*/
vexexpr *shiftvexatomleft( Expr, Count )
vexexpr *Expr;
short Count;
{
char *Value;
vexexpr *VexZero;
short Width;
if ( IsVexNodeAtom( Expr ) )
{
Value = GetVexAtomValue( Expr );
Width = Expr->WIDTH;
if ( Count >= Width )
{
/*
** "xxxx...x" -> "0000...0"
*/
VexZero = createvexatomveclit( VEX_ZERO, Width );
freevexexpr( Expr );
Expr = VexZero;
}
else
if ( Count >= 1 )
{
/*
** "xxxx...x" -> "xxxx...0"
*/
VexZero = createvexatomveclit( VEX_ZERO, Count );
if ( IsVexAtomDown( Expr ) )
{
Expr = slicevexatomvec( Expr, Expr->LEFT - Count, Expr->RIGHT );
}
else
{
Expr = slicevexatomvec( Expr, Expr->LEFT + Count, Expr->RIGHT );
}
Expr = createvexbinexpr( VEX_CONCAT, Width, Expr, VexZero );
Expr = simpvexexpr( Expr );
}
return( Expr );
}
return( (vexexpr *)0 );
}
/*------------------------------------------------------------\
| |
| Shift Vex Atom Right |
| |
\------------------------------------------------------------*/
vexexpr *shiftvexatomright( Expr, Count )
vexexpr *Expr;
short Count;
{
char *Value;
vexexpr *VexSign;
vexexpr *VexSignBit;
short Width;
short Index;
if ( IsVexNodeAtom( Expr ) )
{
Value = GetVexAtomValue( Expr );
Width = Expr->WIDTH;
if ( Count >= Width )
{
if ( IsVexAtomSigned( Expr ) )
{
/*
** "sxxx...x" -> "ssss...s"
*/
if ( IsVexAtomLiteral( Expr ) )
{
VexSign = createvexatomveclit( Value[ 1 ], Width );
}
else
{
VexSignBit = createvexatomvec( Value, Expr->LEFT, Expr->LEFT );
VexSign = VexSignBit;
for ( Index = 1; Index < Width; Index++ )
{
VexSign = createvexbinexpr( VEX_CONCAT, VexSign->WIDTH + 1,
VexSign, dupvexexpr( VexSignBit ) );
}
}
}
else
{
/*
** "xxxx...x" -> "0000...0"
*/
VexSign = createvexatomveclit( VEX_ZERO, Width );
freevexexpr( Expr );
}
Expr = VexSign;
}
else
if ( Count >= 1 )
{
if ( IsVexAtomSigned( Expr ) )
{
/*
** "sxxx...x" -> "ss..xxxx"
*/
if ( IsVexAtomLiteral( Expr ) )
{
VexSign = createvexatomveclit( Value[ 1 ], Count );
}
else
{
VexSignBit = createvexatomvec( Value, Expr->LEFT, Expr->LEFT );
VexSign = VexSignBit;
for ( Index = 1; Index < Count; Index++ )
{
VexSign = createvexbinexpr( VEX_CONCAT, VexSign->WIDTH + 1,
VexSign, dupvexexpr( VexSignBit ) );
}
}
}
else
{
/*
** "xxxx...x" -> "00..xxxx"
*/
VexSign = createvexatomveclit( VEX_ZERO, Count );
}
if ( IsVexAtomDown( Expr ) )
{
Expr = slicevexatomvec( Expr, Expr->LEFT, Expr->RIGHT + Count );
}
else
{
Expr = slicevexatomvec( Expr, Expr->LEFT, Expr->RIGHT - Count );
}
Expr = createvexbinexpr( VEX_CONCAT, Width, VexSign, Expr );
Expr = simpvexexpr( Expr );
}
return( Expr );
}
return( (vexexpr *)0 );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexshift.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_SHIFT_H
# define VEX_SHIFT_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexsimp.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef ABL_SIMP_H
# define ABL_SIMP_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,162 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexslice.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include "vexslice.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static char VexBuffer[ 128 ];
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Slice Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Slice Vex Atom Vector |
| |
\------------------------------------------------------------*/
vexexpr *slicevexatomvec( Expr, Left, Right )
vexexpr *Expr;
short Left;
short Right;
{
short Width;
short PosLeft;
short PosRight;
short PosMin;
short PosMax;
char Separ;
/*\
fprintf( stdout, "slicevexatomvec %d %d\n", Left, Right );
viewvexexprbound( Expr );
fprintf( stdout, " --> " );
\*/
if ( ( IsVexNodeAtom( Expr ) ) &&
( IsVexAtomVector( Expr ) ) )
{
PosLeft = getvexvectorpos( Expr, Left );
PosRight = getvexvectorpos( Expr, Right );
if ( ( PosLeft >= 0 ) &&
( PosRight >= 0 ) )
{
if ( Left < Right )
{
Width = 1 + Right - Left;
SetVexAtomUp( Expr );
}
else
{
Width = 1 + Left - Right;
SetVexAtomDown( Expr );
}
if ( IsVexAtomLiteral( Expr ) )
{
if ( Width == 1 ) Separ = '\'';
else Separ = '"';
if ( PosLeft > PosRight )
{
PosMin = PosRight;
PosMax = PosLeft;
}
else
{
PosMin = PosLeft;
PosMax = PosRight;
}
strcpy( VexBuffer, GetVexAtomValue( Expr ) );
VexBuffer[ PosMin ] = Separ;
VexBuffer[ PosMax + 2 ] = Separ;
VexBuffer[ PosMax + 3 ] = '\0';
SetVexAtomValue( Expr, namealloc( &VexBuffer[ PosMin ] ) );
}
Expr->LEFT = Left;
Expr->RIGHT = Right;
Expr->WIDTH = Width;
/*\
viewvexexprbound( Expr );
fprintf( stdout, "\n" );
\*/
return( Expr );
}
}
return( (vexexpr *)0 );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexslice.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_SLICE_H
# define VEX_SLICE_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,142 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexunflat.c |
| |
| Date : 03.12.99 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include "vexunflat.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Unflat Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Unflat Vex Expr |
| |
\------------------------------------------------------------*/
vexexpr *unflatvexexpr( Expr )
vexexpr *Expr;
{
vexexpr *ScanExpr;
chain_list *ScanChain;
long Oper;
if ( ( Expr == (vexexpr *)0 ) ||
( IsVexNodeAtom( Expr ) ) )
{
return( Expr );
}
if ( IsVexNodeOper( Expr ) )
{
Oper = GetVexOperValue( Expr );
if ( ( Oper == VEX_OR ) ||
( Oper == VEX_AND ) ||
( Oper == VEX_XOR ) ||
( Oper == VEX_NOR ) ||
( Oper == VEX_NAND ) ||
( Oper == VEX_NXOR ) ||
( Oper == VEX_ADD ) ||
( Oper == VEX_MUL ) )
{
if ( Expr->OPERAND->NEXT->NEXT != (chain_list *)0 )
{
if ( isvexnegativeoper( Oper ) )
{
Oper = getvexnotoper( Oper );
SetVexOperValue( Expr, Oper );
ScanExpr = createvexoper( VEX_NOT, Expr->WIDTH );
addvexhexpr( ScanExpr, Expr );
Expr = ScanExpr;
}
else
{
ScanExpr = createvexoper( Oper, Expr->WIDTH );
ScanExpr->OPERAND = Expr->OPERAND->NEXT;
Expr->OPERAND->NEXT = addchain( (chain_list *)0, (void *)ScanExpr );
}
}
}
}
for ( ScanChain = Expr->OPERAND;
ScanChain != (chain_list *)0;
ScanChain = ScanChain->NEXT )
{
ScanExpr = GetVexOperand( ScanChain );
ScanExpr = unflatvexexpr( ScanExpr );
SetVexOperand( ScanChain, ScanExpr );
}
return( Expr );
}

View File

@ -0,0 +1,75 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexunflat.h |
| |
| Date : 03.12.99 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# ifndef VEX_UNFLAT_H
# define VEX_UNFLAT_H
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif

View File

@ -0,0 +1,586 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexview.c |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
| Modified: Frédéric Pétrot |
| Add support for Verilog expressions |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Include Files |
| |
\------------------------------------------------------------*/
# include "mut.h"
# include "aut.h"
# include "vex.h"
# include <stdio.h>
# include <string.h>
# include "vexview.h"
# include "vexerror.h"
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Variables |
| |
\------------------------------------------------------------*/
static FILE *VexViewFile = (FILE *)0;
static int VexViewLength = 0;
static void (*VexViewFunction)();
static char *VexStringBuffer = (char *)0;
static int VexStringSize = 0;
static int VexStringLength = 0;
static int VexViewBound = 0;
static int VexViewLanguage = VEX_VIEW_VHDL;
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| View Functions |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| View Local Vex File |
| |
\------------------------------------------------------------*/
static void loc_viewvexfile( String, Length )
char *String;
int Length;
{
VexViewLength += Length;
if ( VexViewLength >= VEX_VIEW_MAX_LENGTH )
{
fprintf( VexViewFile, "\n" );
VexViewLength = 0;
}
if ( *String )
{
fwrite( String, sizeof( char ), Length, VexViewFile );
}
}
/*------------------------------------------------------------\
| |
| View Local Vex String |
| |
\------------------------------------------------------------*/
static void loc_viewvexstr( String, Length )
char *String;
int Length;
{
char *Buffer;
if ( ( VexStringLength + Length ) >= VexStringSize )
{
VexStringSize = VexStringSize << 1;
Buffer = (char *)autallocblock( VexStringSize );
strcpy( Buffer, VexStringBuffer );
autfreeblock( VexStringBuffer );
VexStringBuffer = Buffer;
}
VexViewLength += Length;
if ( VexViewLength >= VEX_VIEW_MAX_LENGTH )
{
VexViewLength = 0;
loc_viewvexstr( "\n", 1 );
}
strcpy( VexStringBuffer + VexStringLength, String );
VexStringLength += Length;
}
/*------------------------------------------------------------\
| |
| View Local Expr Vhdl All |
| |
\------------------------------------------------------------*/
static void loc_viewvexexprbound( Expr )
vexexpr *Expr;
{
char Buffer[ 32 ];
char Signed;
if ( IsVexNodeSigned( Expr ) ) Signed = 's';
else Signed = 'u';
if ( IsVexNodeVarWidth( Expr ) )
{
sprintf( Buffer, "{?:?:?:%c}", Signed );
}
else
{
sprintf( Buffer, "{%d:%d:%d:%c}", Expr->LEFT, Expr->RIGHT, Expr->WIDTH, Signed );
}
(*VexViewFunction)( Buffer, strlen( Buffer ) );
}
/*------------------------------------------------------------\
| |
| View Local Expr Vhdl Atom |
| |
\------------------------------------------------------------*/
static void loc_viewvexatom( Expr )
vexexpr *Expr;
{
char *String;
char Buffer[ 32 ];
int Index;
switch (VexViewLanguage)
{
case VEX_VIEW_VHDL:
String = GetVexAtomValue( Expr );
(*VexViewFunction)( String, strlen( String ) );
break;
case VEX_VIEW_VERILOG:
String = GetVexAtomValue( Expr );
if ( IsVexAtomLiteral ( Expr ) )
{
sprintf( Buffer, "%d'b", Expr->WIDTH );
(*VexViewFunction)( Buffer, strlen( Buffer ) );
for ( Index = 1;
Index < strlen ( String ) - 1;
Index++ )
{
if ( String[ Index ] == '-' )
{
(*VexViewFunction)( "?", 1 );
}
else
{
(*VexViewFunction)( String + Index, 1 );
}
}
}
else
{
(*VexViewFunction)( String, strlen( String ) );
}
break;
}
if ( VexViewBound )
{
loc_viewvexexprbound( Expr );
}
if ( ( IsVexAtomVector( Expr ) ) &&
( ! IsVexAtomLiteral( Expr ) ) )
{
if ( IsVexNodeVarWidth( Expr ) )
{
switch (VexViewLanguage)
{
case VEX_VIEW_VHDL:
strcpy( Buffer, "(??)" );
break;
case VEX_VIEW_VERILOG:
strcpy( Buffer, "[??]" );
break;
}
}
else
if ( Expr->LEFT == Expr->RIGHT )
{
switch (VexViewLanguage)
{
case VEX_VIEW_VHDL:
sprintf( Buffer, "(%d)", Expr->LEFT );
break;
case VEX_VIEW_VERILOG:
sprintf( Buffer, "[%d]", Expr->LEFT );
break;
}
}
else
{
switch (VexViewLanguage)
{
case VEX_VIEW_VHDL:
if ( Expr->LEFT < Expr->RIGHT )
{
sprintf( Buffer, "(%d to %d)", Expr->LEFT, Expr->RIGHT );
}
else
{
sprintf( Buffer, "(%d downto %d)", Expr->LEFT, Expr->RIGHT );
}
break;
case VEX_VIEW_VERILOG:
sprintf( Buffer, "[%d:%d]", Expr->LEFT, Expr->RIGHT );
break;
}
}
(*VexViewFunction)( Buffer, strlen( Buffer ) );
}
}
/*------------------------------------------------------------\
| |
| View Local Expr Vhdl |
| |
\------------------------------------------------------------*/
static void loc_viewvex( Expr )
vexexpr *Expr;
{
chain_list *ScanOper;
long Oper;
char *String;
int Length;
if ( IsVexNodeAtom( Expr ) )
{
loc_viewvexatom( Expr );
}
else
if ( IsVexNodeOper( Expr ) )
{
Oper = GetVexOperValue( Expr );
String = (char *)0;
switch (VexViewLanguage)
{
case VEX_VIEW_VHDL:
String = getvexoperuppername( Oper );
break;
case VEX_VIEW_VERILOG:
String = getvexoperverilogname( Oper );
break;
}
if ( String == (char *)0 )
{
vexerror( VEX_OPERATOR_ERROR, Oper );
}
Length = strlen( String );
if ( VexViewBound )
{
loc_viewvexexprbound( Expr );
}
if ( isvexunaryoper( Oper ) )
{
if ( ( Oper == VEX_EVENT ) ||
( Oper == VEX_DRIVER ) )
{
(*VexViewFunction)( "(", 1 );
loc_viewvex( GetVexOperand( Expr->OPERAND ) );
(*VexViewFunction)( "'", 1 );
(*VexViewFunction)( String, Length );
}
else
{
(*VexViewFunction)( String, Length );
(*VexViewFunction)( "(", 1 );
loc_viewvex( GetVexOperand( Expr->OPERAND ) );
}
}
else
{
if ( ( VexViewBound ) ||
( isvexpositiveoper( Oper ) ) )
{
if ( Oper == VEX_CONCAT && VexViewLanguage == VEX_VIEW_VERILOG )
{
(*VexViewFunction)( "{", 1 );
}
else
{
(*VexViewFunction)( "(", 1 );
}
}
else
{
switch (VexViewLanguage)
{
case VEX_VIEW_VHDL:
(*VexViewFunction)( "NOT(", 4 );
String = getvexoperuppername( getvexnotoper( Oper ) );
break;
case VEX_VIEW_VERILOG:
(*VexViewFunction)( "~(", 2 );
String = getvexoperverilogname( getvexnotoper( Oper ) );
break;
}
Length = strlen( String );
}
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
loc_viewvex( GetVexOperand( ScanOper ) );
if ( ScanOper->NEXT != (chain_list *)0 )
{
(*VexViewFunction)( " ", 1 );
(*VexViewFunction)( String, Length );
(*VexViewFunction)( " ", 1 );
}
}
}
if ( Oper == VEX_CONCAT && VexViewLanguage == VEX_VIEW_VERILOG )
{
(*VexViewFunction)( "}", 1 );
}
else
{
(*VexViewFunction)( ")", 1 );
}
}
else
{
String = GetVexFuncValue( Expr );
Length = strlen( String );
if ( VexViewBound )
{
if ( getvexstdfuncid( String ) != -1 )
{
(*VexViewFunction)( "(std)", 5 );
}
loc_viewvexexprbound( Expr );
}
(*VexViewFunction)( String, Length );
(*VexViewFunction)( "(", 1 );
for ( ScanOper = Expr->OPERAND;
ScanOper != (chain_list *)0;
ScanOper = ScanOper->NEXT )
{
loc_viewvex( GetVexOperand( ScanOper ) );
if ( ScanOper->NEXT != (chain_list *)0 )
{
(*VexViewFunction)( ",", 1 );
}
}
(*VexViewFunction)( ")", 1 );
}
}
/*------------------------------------------------------------\
| |
| View Vex Expr File |
| |
\------------------------------------------------------------*/
void viewvexexprfile( VexFile, Expr )
FILE *VexFile;
vexexpr *Expr;
{
VexViewFile = VexFile;
VexViewLength = 0;
VexViewFunction = loc_viewvexfile;
if ( Expr != (vexexpr *)0 ) loc_viewvex( Expr );
}
/*------------------------------------------------------------\
| |
| View Vex Expr |
| |
\------------------------------------------------------------*/
void viewvexexpr( Expr )
vexexpr *Expr;
{
viewvexexprfile( stdout, Expr );
}
/*------------------------------------------------------------\
| |
| View Vex Expr NewLine |
| |
\------------------------------------------------------------*/
void viewvexexprln( Expr )
vexexpr *Expr;
{
viewvexexprfile( stdout, Expr );
fprintf( stdout, "\n" );
}
/*------------------------------------------------------------\
| |
| View Vex Expr Bound |
| |
\------------------------------------------------------------*/
void viewvexexprbound( Expr )
vexexpr *Expr;
{
VexViewBound = 1;
viewvexexprfile( stdout, Expr );
VexViewBound = 0;
}
/*------------------------------------------------------------\
| |
| View Vex Expr Bound NewLine |
| |
\------------------------------------------------------------*/
void viewvexexprboundln( Expr )
vexexpr *Expr;
{
VexViewBound = 1;
viewvexexprfile( stdout, Expr );
fprintf( stdout, "\n" );
VexViewBound = 0;
}
/*------------------------------------------------------------\
| |
| View Vex Expr String |
| |
\------------------------------------------------------------*/
char *viewvexexprstr( Expr )
vexexpr *Expr;
{
if ( VexStringBuffer == (char *)0 )
{
VexStringBuffer = (char *)autallocblock( VEX_STRING_BUFFER_SIZE );
VexStringSize = VEX_STRING_BUFFER_SIZE;
}
VexStringLength = 0;
VexStringBuffer[ 0 ] = '\0';
VexViewLength = 0;
VexViewFunction = loc_viewvexstr;
if ( Expr != (vexexpr *)0 ) loc_viewvex( Expr );
return( VexStringBuffer );
}
/*------------------------------------------------------------\
| |
| View Vex Expr String Bound |
| |
\------------------------------------------------------------*/
char *viewvexexprstrbound( Expr )
vexexpr *Expr;
{
VexViewBound = 1;
viewvexexprstr( Expr );
VexViewBound = 0;
return( VexStringBuffer );
}
/*------------------------------------------------------------\
| |
| Set View Mode |
| |
\------------------------------------------------------------*/
void setvexviewmode( Mode )
int Mode;
{
VexViewLanguage = Mode;
}
/*------------------------------------------------------------\
| |
| Get View Mode |
| |
\------------------------------------------------------------*/
int getvexviewmode()
{
return( VexViewLanguage );
}

View File

@ -0,0 +1,79 @@
/*------------------------------------------------------------\
| |
| This file is part of the Alliance CAD System Copyright |
| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie|
| |
| Home page : http://www-asim.lip6.fr/alliance/ |
| E-mail support : mailto:alliance-support@asim.lip6.fr |
| |
| This progam is free software; you can redistribute it |
| and/or modify it under the terms of the GNU Library General|
| Public License as published by the Free Software Foundation |
| either version 2 of the License, or (at your option) any |
| later version. |
| |
| Alliance VLSI CAD System is distributed in the hope that |
| it will be useful, but WITHOUT ANY WARRANTY; |
| without even the implied warranty of MERCHANTABILITY or |
| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| Public License for more details. |
| |
| You should have received a copy of the GNU General Public |
| License along with the GNU C Library; see the file COPYING. |
| If not, write to the Free Software Foundation, Inc., |
| 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
\------------------------------------------------------------*/
#ifndef __P
# if defined(__STDC__) || defined(__GNUC__)
# define __P(x) x
# else
# define __P(x) ()
# endif
#endif
/*------------------------------------------------------------\
| |
| Tool : Vex |
| |
| File : vexview.h |
| |
| Date : 03.12.96 |
| |
| Author : Jacomme Ludovic |
| |
\------------------------------------------------------------*/
# ifndef VEX_VIEW_H
# define VEX_VIEW_H
/*------------------------------------------------------------\
| |
| Constants |
| |
\------------------------------------------------------------*/
# define VEX_VIEW_MAX_LENGTH 80
# define VEX_STRING_BUFFER_SIZE 512
/*------------------------------------------------------------\
| |
| Macro |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Types |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Varivexes |
| |
\------------------------------------------------------------*/
/*------------------------------------------------------------\
| |
| Functions |
| |
\------------------------------------------------------------*/
# endif