Idem mbkvhdlg
This commit is contained in:
parent
7f2ea98a2c
commit
753084c881
|
@ -0,0 +1 @@
|
|||
SUBDIRS = src
|
|
@ -0,0 +1,47 @@
|
|||
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/04/26 11:55:45 ludo Exp $
|
||||
dnl
|
||||
dnl
|
||||
AC_INIT(src/mvl_drive.c)
|
||||
AM_INIT_AUTOMAKE(mbkvhdl, 4.1)
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_CC
|
||||
AC_PROG_YACC
|
||||
AM_PROG_LEX
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(strings.h unistd.h)
|
||||
AC_C_CONST
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AM_ALLIANCE
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
])
|
|
@ -0,0 +1,15 @@
|
|||
YFLAGS = -d
|
||||
AM_CFLAGS = @ALLIANCE_CFLAGS@
|
||||
lib_LIBRARIES = libMvl.a
|
||||
|
||||
libMvl_a_SOURCES = mvl_drive.c mvl_parse.h mvl_sspec.c mvl_syacc.h mvl_utype.h \
|
||||
mvl_drive.h mvl_scomp_l.l mvl_sspec.h mvl_utdef.h \
|
||||
mvl.h mvl_scomp_y.y mvl_stdef.h mvl_util.c \
|
||||
mvl_parse.c mvl_slex.h mvl_stype.h mvl_util.h
|
||||
|
||||
CLEANFILES = mvl_scomp_y.c mvl_scomp_y.h mvl_scomp_l.c
|
||||
|
||||
mvl_scomp_y.c mvl_scomp_y.h : $(srcdir)/mvl_scomp_y.y
|
||||
$(YACC) $(YFLAGS) $(srcdir)/mvl_scomp_y.y && sed -e "s/yy/mvl_y_/g" -e "s/YY/MVL_Y_/g" y.tab.c > mvl_scomp_y.c && sed -e "s/yy/mvl_y_/g" -e "s/YY/MVL_Y_/g" y.tab.h > mvl_scomp_y.h
|
||||
mvl_scomp_l.c : $(srcdir)/mvl_scomp_l.l mvl_scomp_y.h
|
||||
$(LEX) -t $(srcdir)/mvl_scomp_l.l | sed -e "s/yy/mvl_y_/g" -e "s/YY/MVL_Y_/g" > mvl_scomp_l.c
|
|
@ -0,0 +1 @@
|
|||
/* This file is needed */
|
|
@ -0,0 +1,414 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_drive.c */
|
||||
/* date : Sep 24 1993 */
|
||||
/* author : VUONG Huu Nghia */
|
||||
/* description : This file contains a MBK-->VHDL driver : */
|
||||
/* functions : vhdlsavelofig() */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <mut.h>
|
||||
#include <mlo.h>
|
||||
#include "mvl_utype.h"
|
||||
#include "mvl_utdef.h"
|
||||
#include "mvl_drive.h"
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : vhdlsavelofig */
|
||||
/* description : print out a texte file containing a structural VHDL */
|
||||
/* description */
|
||||
/* called func. : mvl_vhdlname , getsigname, mvl_message, mvl_error ,*/
|
||||
/* mvl_toolbug, getptype, reverse, mvl_abl2str */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void vhdlsavelofig (ptfig)
|
||||
|
||||
struct lofig *ptfig;
|
||||
{
|
||||
extern char *getsigname ();
|
||||
struct loins *ptins = NULL;
|
||||
struct locon *ptcon = NULL;
|
||||
struct locon *tmp_ptcon = NULL;
|
||||
struct locon *ptscan = NULL;
|
||||
struct losig *ptsig = NULL;
|
||||
struct chain *ptmodel = NULL;
|
||||
struct chain *ptchain = NULL;
|
||||
struct chain *sig_list = NULL;
|
||||
FILE *ptfile ;
|
||||
time_t clock ;
|
||||
char *mode = NULL;
|
||||
char *name ;
|
||||
char *sig_name ;
|
||||
int left ;
|
||||
int right ;
|
||||
int i ;
|
||||
char new_name[200];
|
||||
char first = 1 ;
|
||||
char* bit_type, *vect_type, *bus_type;
|
||||
|
||||
|
||||
if (ptfig == NULL)
|
||||
mvl_toolbug (10, "mvl_decomp", NULL, 0);
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Opening result file */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
if ((ptfile = mbkfopen (ptfig->NAME, "vst", "w")) == NULL)
|
||||
{
|
||||
mvl_error (107, NULL);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
time (&clock);
|
||||
fprintf (ptfile,"-- VHDL structural description generated from `%s`\n",
|
||||
ptfig->NAME);
|
||||
fprintf (ptfile,"--\t\tdate : %s\n\n",ctime(&clock));
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Entity declaration */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
fprintf (ptfile,"-- Entity Declaration\n\n");
|
||||
fprintf (ptfile,"ENTITY %s IS\n", mvl_vhdlname (ptfig->NAME));
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Port declaration */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
if (ptfig->LOCON != NULL)
|
||||
{
|
||||
fprintf (ptfile," PORT (\n");
|
||||
ptfig->LOCON = (struct locon *) reverse ((chain_list *)ptfig->LOCON);
|
||||
ptcon = ptfig->LOCON;
|
||||
while (ptcon != NULL)
|
||||
{/*modified by Francois Donnet 29/08/2000 */
|
||||
switch (ptcon->DIRECTION)
|
||||
{
|
||||
case IN:
|
||||
mode = namealloc ("in");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
case OUT:
|
||||
mode = namealloc ("out");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
case INOUT:
|
||||
mode = namealloc ("inout");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
case TRANSCV:
|
||||
mode = namealloc ("inout");
|
||||
vect_type = "MUX_VECTOR";
|
||||
bit_type = "MUX_BIT";
|
||||
bus_type = "bus";
|
||||
break;
|
||||
case TRISTATE:
|
||||
mode = namealloc ("out");
|
||||
vect_type = "MUX_VECTOR";
|
||||
bit_type = "MUX_BIT";
|
||||
bus_type = "bus";
|
||||
break;
|
||||
case 'X': default:
|
||||
mode = namealloc ("linkage");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
}
|
||||
ptcon = (struct locon *) mvl_vectnam (ptcon,&left,&right,&name,1);
|
||||
if (left != -1)
|
||||
{
|
||||
fprintf (ptfile," %s : %s %s(%d %s %d) %s",
|
||||
mvl_vhdlname (name), mode, vect_type, left,
|
||||
(left >= right)? "DOWNTO":"TO",right,bus_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (ptfile," %s : %s %s %s",mvl_vhdlname(name),mode,bit_type,bus_type);
|
||||
}
|
||||
|
||||
if (ptcon->NEXT != NULL)
|
||||
fprintf (ptfile,";\t-- %s\n",name);
|
||||
else
|
||||
fprintf (ptfile,"\t-- %s\n",name);
|
||||
|
||||
ptcon = ptcon->NEXT;
|
||||
mbkfree (name);
|
||||
}
|
||||
fprintf (ptfile, " );\n");
|
||||
}
|
||||
fprintf (ptfile,"END %s;\n\n",mvl_vhdlname(ptfig->NAME));
|
||||
ptfig->LOCON = (struct locon *) reverse ((chain_list *)ptfig->LOCON);
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Architecture declaration */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
fprintf (ptfile,"-- Architecture Declaration\n\n");
|
||||
fprintf (ptfile,"ARCHITECTURE VST OF %s IS\n",
|
||||
mvl_vhdlname(ptfig->NAME));
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Component declaration : first make a list of models, then */
|
||||
/* for each model print out a "component declaration" */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
ptmodel = NULL;
|
||||
for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT)
|
||||
{
|
||||
for (ptchain = ptmodel ; ptchain ; ptchain = ptchain->NEXT)
|
||||
{
|
||||
if (((struct loins *)ptchain->DATA)->FIGNAME == ptins->FIGNAME)
|
||||
break;
|
||||
}
|
||||
if (ptchain == NULL)
|
||||
ptmodel = addchain(ptmodel,ptins);
|
||||
}
|
||||
|
||||
for (ptchain = ptmodel ; ptchain ; ptchain = ptchain->NEXT)
|
||||
{
|
||||
ptins = (struct loins *)ptchain->DATA;
|
||||
fprintf (ptfile," COMPONENT %s\n port (\n",
|
||||
mvl_vhdlname(ptins->FIGNAME));
|
||||
|
||||
ptins->LOCON = (struct locon *) reverse ((chain_list *)ptins->LOCON);
|
||||
ptcon = ptins->LOCON;
|
||||
while (ptcon != NULL)
|
||||
{
|
||||
switch (ptcon->DIRECTION)
|
||||
{
|
||||
case IN:
|
||||
mode = namealloc ("in");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
case OUT:
|
||||
mode = namealloc ("out");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
case INOUT:
|
||||
mode = namealloc ("inout");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
case TRANSCV:
|
||||
mode = namealloc ("inout");
|
||||
vect_type = "MUX_VECTOR";
|
||||
bit_type = "MUX_BIT";
|
||||
bus_type = "bus";
|
||||
break;
|
||||
case TRISTATE:
|
||||
mode = namealloc ("out");
|
||||
vect_type = "MUX_VECTOR";
|
||||
bit_type = "MUX_BIT";
|
||||
bus_type = "bus";
|
||||
break;
|
||||
case 'X': default:
|
||||
mode = namealloc ("linkage");
|
||||
vect_type = "BIT_VECTOR";
|
||||
bit_type = "BIT";
|
||||
bus_type = "";
|
||||
break;
|
||||
}
|
||||
ptcon = (struct locon *) mvl_vectnam (ptcon,&left,&right,&name,1);
|
||||
if (left != -1)
|
||||
{
|
||||
fprintf (ptfile," %s : %s %s(%d %s %d) %s",
|
||||
mvl_vhdlname (name), mode, vect_type, left,
|
||||
(left >= right)? "DOWNTO":"TO",right,bus_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (ptfile," %s : %s %s %s",mvl_vhdlname(name),mode,bit_type,bus_type);
|
||||
}
|
||||
|
||||
if (ptcon->NEXT != NULL)
|
||||
fprintf(ptfile, ";\t-- %s\n",name);
|
||||
else
|
||||
fprintf(ptfile, "\t-- %s\n",name);
|
||||
|
||||
ptcon = ptcon->NEXT;
|
||||
free(name);
|
||||
}
|
||||
ptins->LOCON = (struct locon *) reverse ((chain_list *)ptins->LOCON);
|
||||
fprintf (ptfile, " );\n END COMPONENT;\n\n");
|
||||
}
|
||||
|
||||
freechain (ptmodel);
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Signal declaration */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
ptsig = ptfig->LOSIG;
|
||||
while (ptsig != NULL)
|
||||
{
|
||||
if (ptsig->TYPE == 'I')
|
||||
{
|
||||
fprintf (ptfile," SIGNAL %s : BIT;\t-- %s\n",
|
||||
mvl_vhdlname(getsigname(ptsig)),getsigname(ptsig));
|
||||
}
|
||||
ptsig = ptsig->NEXT;
|
||||
}
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Description block */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
fprintf (ptfile,"\nBEGIN\n\n");
|
||||
ptfig->LOINS = (struct loins *) reverse ((chain_list *)ptfig->LOINS);
|
||||
|
||||
for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT)
|
||||
{
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Instantiation of a model */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
fprintf (ptfile," %s : %s\n PORT MAP (\n",
|
||||
mvl_vhdlname(ptins->INSNAME),mvl_vhdlname(ptins->FIGNAME));
|
||||
ptcon = ptins->LOCON;
|
||||
while (ptcon != NULL)
|
||||
{
|
||||
tmp_ptcon = (struct locon *) mvl_vectnam (ptcon,&left,&right,&name,1);
|
||||
fprintf (ptfile," %s => ",mvl_vhdlname (name));
|
||||
|
||||
if (left != -1)
|
||||
{
|
||||
/* ###------------------------------------------------------### */
|
||||
/* The connected signals are bused */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
for (i=abs(left-right) ; i>=0 ; i--)
|
||||
{
|
||||
ptsig = ptcon->SIG;
|
||||
if (ptsig->TYPE == 'I')
|
||||
{
|
||||
/* ###-------------------------------------------------### */
|
||||
/* The signal is internal */
|
||||
/* ###-------------------------------------------------### */
|
||||
|
||||
sig_name = namealloc (mvl_vhdlname(getsigname(ptsig)));
|
||||
sig_list = addchain (sig_list, sig_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ###-------------------------------------------------### */
|
||||
/* The signal is external */
|
||||
/* ###-------------------------------------------------### */
|
||||
|
||||
for (ptscan = ptfig->LOCON ; ptscan ; ptscan = ptscan->NEXT)
|
||||
{
|
||||
if (ptscan->SIG == ptsig)
|
||||
break;
|
||||
}
|
||||
if (ptscan == NULL)
|
||||
{
|
||||
printf ("\n*** mbk error *** no external connector \n");
|
||||
printf (" driving vhdl file %s\n", ptfig->NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
mvl_name (ptscan->NAME,new_name);
|
||||
sig_name = namealloc (new_name);
|
||||
sig_list = addchain (sig_list, sig_name);
|
||||
}
|
||||
}
|
||||
if (i > 0)
|
||||
ptcon = ptcon->NEXT;
|
||||
}
|
||||
|
||||
first = 1;
|
||||
while (sig_list != NULL)
|
||||
{
|
||||
if (first != 1)
|
||||
{
|
||||
fprintf (ptfile,"& %s",(char *)(sig_list->DATA));
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (ptfile,"%s",(char *)(sig_list->DATA));
|
||||
first = 0;
|
||||
}
|
||||
sig_list = sig_list->NEXT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ###------------------------------------------------------### */
|
||||
/* The connected signals is simple */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
ptsig = ptcon->SIG;
|
||||
if (ptsig->TYPE == 'I')
|
||||
{
|
||||
fprintf (ptfile, "%s", mvl_vhdlname (getsigname(ptsig)));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ptscan = ptfig->LOCON ; ptscan ; ptscan = ptscan->NEXT)
|
||||
{
|
||||
if (ptscan->SIG == ptsig)
|
||||
break;
|
||||
}
|
||||
if (ptscan == NULL)
|
||||
{
|
||||
printf ("\n*** mbk error *** no external connector \n");
|
||||
printf (" driving vhdl file %s\n", ptfig->NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
mvl_name (ptscan->NAME,new_name);
|
||||
fprintf(ptfile, "%s", new_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ptcon->NEXT != NULL)
|
||||
fprintf (ptfile, ",\n");
|
||||
ptcon = ptcon->NEXT;
|
||||
free(name);
|
||||
}
|
||||
fprintf(ptfile, ");\n");
|
||||
}
|
||||
ptfig->LOINS = (struct loins *) reverse ((chain_list *)ptfig->LOINS);
|
||||
fprintf (ptfile, "\nend VST;\n");
|
||||
fclose (ptfile);
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_drive.h */
|
||||
/* date : Nov 12 91 */
|
||||
/* author : L.A. TABUSSE & P. BAZARGAN-SABET & VUONG H.N. */
|
||||
/* */
|
||||
/* content : declaration of functions and global variables used by */
|
||||
/* the structural MBK-> VHDL driver */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
|
||||
extern void mvl_addtab();
|
||||
extern int mvl_chktab();
|
||||
extern void mvl_toolbug();
|
||||
extern void mvl_message();
|
||||
extern void mvl_error();
|
||||
extern char *mvl_vhdlname();
|
||||
extern void *mvl_name();
|
||||
extern char *mvl_abl2str();
|
||||
extern void *mvl_vectnam();
|
||||
extern char mvl_chkconsistency();
|
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_parse.c */
|
||||
/* date : Feb 15 1995 */
|
||||
/* author : L.A TABUSSE & H.N. VUONG & P. BAZARGAN-SABET */
|
||||
/* description : Parser VHDL --> MBK */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <mut.h>
|
||||
#include <mlo.h>
|
||||
#include "mvl_parse.h"
|
||||
#include "mvl_utdef.h"
|
||||
|
||||
void vhdlloadlofig (pt_lofig, figname, mode)
|
||||
|
||||
struct lofig *pt_lofig;
|
||||
char *figname ;
|
||||
char mode ;
|
||||
|
||||
{
|
||||
struct lofig *pt_lofig_tmp;
|
||||
struct loins *pt_loins ;
|
||||
struct loins *pt_loinsaux;
|
||||
struct locon *pt_locon ;
|
||||
struct locon *pt_loconaux;
|
||||
struct losig *pt_losig ;
|
||||
struct losig *pt_losigaux;
|
||||
char filename[120];
|
||||
char local_mbk_fast_mode;
|
||||
static int call_nbr = 0;
|
||||
|
||||
/* Initialization of some variables */
|
||||
MVL_LINNUM = 1;
|
||||
MVL_MBKMOD = mode;
|
||||
strcpy (MVL_CURFIL, figname);
|
||||
|
||||
/* FAST_MODE asked for MBK */
|
||||
local_mbk_fast_mode = FAST_MODE;
|
||||
FAST_MODE = 'Y';
|
||||
|
||||
if ((mode != 'A') && (mode != 'P') && (mode != 'C'))
|
||||
{
|
||||
printf("vhdlloadfig : Bad mode '%c' asked\n", mode);
|
||||
FAST_MODE = local_mbk_fast_mode;
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
/* Opening file */
|
||||
mvl_y_in = (FILE *) mbkfopen(figname, IN_LO, READ_TEXT);
|
||||
if((mvl_y_in == NULL) && (mode == 'P'))
|
||||
{
|
||||
strcpy(IN_LO, "vbe");
|
||||
mvl_y_in = (FILE *) mbkfopen(figname, IN_LO, READ_TEXT);
|
||||
}
|
||||
|
||||
if(mvl_y_in == NULL)
|
||||
{
|
||||
(void)fprintf(stderr,"\n*** mbk error *** can't open file : %s.%s\n",
|
||||
figname, IN_LO);
|
||||
FAST_MODE = local_mbk_fast_mode;
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
/* TRACE_MODE asked for MBK */
|
||||
if(TRACE_MODE == 'Y')
|
||||
{
|
||||
(void)printf("\n--- mbk --- parsing file : %s.%s in mode : %c\n",
|
||||
figname, IN_LO, mode);
|
||||
}
|
||||
|
||||
MVL_LOFPNT = pt_lofig; /* passing main parameter */
|
||||
|
||||
if (call_nbr != 0)
|
||||
mvl_y_restart (mvl_y_in);
|
||||
|
||||
call_nbr ++;
|
||||
|
||||
/* -------------------------------------------------------------------*/
|
||||
/* Parsing : If mode is P or A, then normal parsing, if mode is C */
|
||||
/* then parsing of a new figure, then from the new one, we fill the */
|
||||
/* old one. */
|
||||
/* -------------------------------------------------------------------*/
|
||||
|
||||
if((mode == 'P') || (mode == 'A'))
|
||||
{
|
||||
if(mvl_y_parse() != 0)
|
||||
{
|
||||
(void)fprintf(stderr,"\n*** mbk error *** abnormal parsing for : %s\n",filename);
|
||||
FAST_MODE = local_mbk_fast_mode;
|
||||
EXIT(1);
|
||||
}
|
||||
}
|
||||
|
||||
if(mode == 'C')
|
||||
{
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Saving the lofig pointer, creating a new one to allow the */
|
||||
/* parsing of the figure in 'A' mode. */
|
||||
/* ---------------------------------------------------------------- */
|
||||
pt_lofig_tmp = pt_lofig;
|
||||
MVL_LOFPNT = (lofig_list *)mbkalloc(sizeof(lofig_list));
|
||||
MVL_LOFPNT->MODE = 'A';
|
||||
MVL_LOFPNT->NAME = namealloc(figname);
|
||||
MVL_LOFPNT->MODELCHAIN = NULL;
|
||||
MVL_LOFPNT->LOINS = NULL;
|
||||
MVL_LOFPNT->LOTRS = NULL;
|
||||
MVL_LOFPNT->LOCON = NULL;
|
||||
MVL_LOFPNT->LOSIG = NULL;
|
||||
MVL_LOFPNT->BKSIG = NULL;
|
||||
MVL_LOFPNT->USER = NULL;
|
||||
MVL_LOFPNT->NEXT = NULL;
|
||||
|
||||
MVL_MBKMOD = 'A';
|
||||
|
||||
if(mvl_y_parse() != 0)
|
||||
{
|
||||
(void)fprintf(stderr,"\n*** mbk error *** abnormal parsing for : %s\n",filename);
|
||||
FAST_MODE = local_mbk_fast_mode;
|
||||
EXIT(1);
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* Now, with the new figure, we duplicate the new informations */
|
||||
/* to fill the old one. */
|
||||
/* ---------------------------------------------------------------- */
|
||||
pt_lofig = mvl_fill(pt_lofig_tmp, MVL_LOFPNT);
|
||||
}
|
||||
|
||||
MVL_MBKMOD = mode;
|
||||
/* Closing file */
|
||||
if(fclose(mvl_y_in) != 0)
|
||||
{
|
||||
(void)fprintf(stderr,"\n*** mbk error *** can't close file : %s\n",filename);
|
||||
FAST_MODE = local_mbk_fast_mode;
|
||||
EXIT(1);
|
||||
}
|
||||
|
||||
if(strcmp(IN_LO,"vbe") == 0)
|
||||
{
|
||||
/* Correction Ludo, Fred, Alain le 25/08/2000 */
|
||||
FAST_MODE = local_mbk_fast_mode;
|
||||
/* Fin correction */
|
||||
strcpy(IN_LO,"vst");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode == 'P' )
|
||||
{
|
||||
pt_locon = MVL_LOFPNT->LOCON;
|
||||
while (pt_locon != NULL)
|
||||
{
|
||||
if (pt_locon->TYPE == 'I')
|
||||
{
|
||||
pt_loconaux = pt_locon;
|
||||
pt_locon = pt_locon->NEXT;
|
||||
dellocon(MVL_LOFPNT, pt_loconaux->NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* pt_locon->SIG = NULL; */
|
||||
pt_locon = pt_locon->NEXT;
|
||||
}
|
||||
}
|
||||
pt_losig = MVL_LOFPNT->LOSIG;
|
||||
while (pt_losig != NULL)
|
||||
{
|
||||
if (pt_losig->TYPE == 'E')
|
||||
{
|
||||
pt_losig = pt_losig->NEXT;
|
||||
continue;
|
||||
}
|
||||
pt_losigaux = pt_losig;
|
||||
pt_losig = pt_losig->NEXT;
|
||||
dellosig(MVL_LOFPNT, pt_losigaux->INDEX);
|
||||
}
|
||||
pt_loins = MVL_LOFPNT->LOINS;
|
||||
while (pt_loins != NULL)
|
||||
{
|
||||
pt_loinsaux = pt_loins;
|
||||
pt_loins = pt_loins->NEXT;
|
||||
delloins(MVL_LOFPNT, pt_loinsaux->INSNAME);
|
||||
}
|
||||
}
|
||||
FAST_MODE = local_mbk_fast_mode;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_parse.h */
|
||||
/* date : Nov 12 1991 */
|
||||
/* author : L.A. TABUSSE & H.G. VUONG & P. BAZARGAN-SABET */
|
||||
/* description : variable for Parser VHDL --> MBK */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
char MVL_MBKMOD; /* The mode of getlofig */
|
||||
char MVL_ERRFLG = 0; /* if = 1 no structure is made */
|
||||
int MVL_LINNUM = 1; /* file's line number */
|
||||
char MVL_CURFIL[200]; /* current file's name */
|
||||
|
||||
struct dct_entry **MVL_HSHTAB; /* dictionnary's entry points */
|
||||
|
||||
extern void mvl_error();
|
||||
extern struct lofig *mvl_fill();
|
||||
|
||||
extern struct dct_entry **mvl_initab();
|
||||
extern void mvl_fretab();
|
||||
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
struct lofig *MVL_LOFPNT = NULL; /* current LOFIG pointer */
|
||||
|
||||
extern FILE *mvl_y_in;
|
||||
extern int mvl_y_parse();
|
||||
extern void mvl_decomp();
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
|
@ -0,0 +1,302 @@
|
|||
%{
|
||||
/*###----------------------------------------------------------------###*/
|
||||
/* */
|
||||
/* Filename : mvl_scomp.lex */
|
||||
/* Authors : L.A. TABUSSE */
|
||||
/* VUONG H.N. */
|
||||
/* Date : Jan 29 1992 */
|
||||
/* Contents : Lexical VHDL Analyser */
|
||||
/* For any details refer to the IEEE Standard */
|
||||
/* VHDL LRM Chapter 13 : Lexical Elements */
|
||||
/* Called func. : namealloc <mbk.h>, mbkalloc <mbk>, find_mc*/
|
||||
/* */
|
||||
/*###----------------------------------------------------------------###*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <mut.h>
|
||||
#include <mlo.h>
|
||||
#include "mvl_stype.h"
|
||||
#include "mvl_scomp_y.h"
|
||||
#include "mvl_slex.h"
|
||||
#include "mvl_stdef.h"
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : search */
|
||||
/* description : check that an identifier is a reserved word or not */
|
||||
/* called func. : addht, addhtitem, gethtitem, namealloc */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
static int search (key)
|
||||
|
||||
char *key;
|
||||
|
||||
{
|
||||
static ht *pt_hash = NULL;
|
||||
|
||||
if (pt_hash == NULL)
|
||||
{
|
||||
pt_hash = addht (107);
|
||||
|
||||
addhtitem (pt_hash, namealloc("abs") , ABS );
|
||||
addhtitem (pt_hash, namealloc("access") , ACCESS );
|
||||
addhtitem (pt_hash, namealloc("after") , AFTER );
|
||||
addhtitem (pt_hash, namealloc("alias") , ALIAS );
|
||||
addhtitem (pt_hash, namealloc("all") , ALL );
|
||||
addhtitem (pt_hash, namealloc("and") , _AND );
|
||||
addhtitem (pt_hash, namealloc("architecture") , ARCHITECTURE );
|
||||
addhtitem (pt_hash, namealloc("array") , ARRAY );
|
||||
addhtitem (pt_hash, namealloc("assert") , ASSERT );
|
||||
addhtitem (pt_hash, namealloc("attribute") , ATTRIBUTE );
|
||||
|
||||
addhtitem (pt_hash, namealloc("begin") , _BEGIN );
|
||||
addhtitem (pt_hash, namealloc("bit") , BIT );
|
||||
addhtitem (pt_hash, namealloc("bit_vector") , BIT_VECTOR );
|
||||
addhtitem (pt_hash, namealloc("block") , BLOCK );
|
||||
addhtitem (pt_hash, namealloc("body") , BODY );
|
||||
addhtitem (pt_hash, namealloc("buffer") , BUFFER );
|
||||
addhtitem (pt_hash, namealloc("bus") , BUS );
|
||||
|
||||
addhtitem (pt_hash, namealloc("case") , CASE );
|
||||
addhtitem (pt_hash, namealloc("component") , COMPONENT );
|
||||
addhtitem (pt_hash, namealloc("configuration"), CONFIGURATION);
|
||||
addhtitem (pt_hash, namealloc("constant") , CONSTANT );
|
||||
|
||||
addhtitem (pt_hash, namealloc("disconnect") , DISCONNECT );
|
||||
addhtitem (pt_hash, namealloc("downto") , DOWNTO );
|
||||
|
||||
addhtitem (pt_hash, namealloc("else") , ELSE );
|
||||
addhtitem (pt_hash, namealloc("elsif") , ELSIF );
|
||||
addhtitem (pt_hash, namealloc("end") , _END );
|
||||
addhtitem (pt_hash, namealloc("entity") , ENTITY );
|
||||
addhtitem (pt_hash, namealloc("error") , ERROR );
|
||||
addhtitem (pt_hash, namealloc("exit") , _EXIT );
|
||||
|
||||
addhtitem (pt_hash, namealloc("file") , _FILE );
|
||||
addhtitem (pt_hash, namealloc("for") , FOR );
|
||||
addhtitem (pt_hash, namealloc("function") , FUNCTION );
|
||||
|
||||
addhtitem (pt_hash, namealloc("generate") , GENERATE );
|
||||
addhtitem (pt_hash, namealloc("generic") , GENERIC );
|
||||
addhtitem (pt_hash, namealloc("guarded") , GUARDED );
|
||||
|
||||
addhtitem (pt_hash, namealloc("if") , IF );
|
||||
addhtitem (pt_hash, namealloc("in") , _IN );
|
||||
addhtitem (pt_hash, namealloc("inout") , _INOUT );
|
||||
addhtitem (pt_hash, namealloc("is") , IS );
|
||||
|
||||
addhtitem (pt_hash, namealloc("label") , _LABEL );
|
||||
addhtitem (pt_hash, namealloc("library") , LIBRARY );
|
||||
addhtitem (pt_hash, namealloc("linkage") , _LINKAGE );
|
||||
addhtitem (pt_hash, namealloc("loop") , LOOP );
|
||||
|
||||
addhtitem (pt_hash, namealloc("map") , MAP );
|
||||
addhtitem (pt_hash, namealloc("mod") , MOD );
|
||||
addhtitem (pt_hash, namealloc("mux_bit") , MUX_BIT );
|
||||
addhtitem (pt_hash, namealloc("mux_vector") , MUX_VECTOR );
|
||||
|
||||
addhtitem (pt_hash, namealloc("nand") , _NAND );
|
||||
addhtitem (pt_hash, namealloc("natural") , NATURAL );
|
||||
addhtitem (pt_hash, namealloc("new") , NEW );
|
||||
addhtitem (pt_hash, namealloc("next") , _NEXT );
|
||||
addhtitem (pt_hash, namealloc("nor") , _NOR );
|
||||
addhtitem (pt_hash, namealloc("not") , _NOT );
|
||||
addhtitem (pt_hash, namealloc("null") , _NULL );
|
||||
|
||||
addhtitem (pt_hash, namealloc("of") , OF );
|
||||
addhtitem (pt_hash, namealloc("on") , ON );
|
||||
addhtitem (pt_hash, namealloc("open") , OPEN );
|
||||
addhtitem (pt_hash, namealloc("or") , _OR );
|
||||
addhtitem (pt_hash, namealloc("others") , OTHERS );
|
||||
addhtitem (pt_hash, namealloc("out") , _OUT );
|
||||
|
||||
addhtitem (pt_hash, namealloc("package") , PACKAGE );
|
||||
addhtitem (pt_hash, namealloc("port") , PORT );
|
||||
addhtitem (pt_hash, namealloc("procedure") , PROCEDURE );
|
||||
addhtitem (pt_hash, namealloc("process") , PROCESS );
|
||||
|
||||
addhtitem (pt_hash, namealloc("range") , RANGE );
|
||||
addhtitem (pt_hash, namealloc("record") , RECORD );
|
||||
addhtitem (pt_hash, namealloc("reg_bit") , REG_BIT );
|
||||
addhtitem (pt_hash, namealloc("reg_vector") , REG_VECTOR );
|
||||
addhtitem (pt_hash, namealloc("register") , REGISTER );
|
||||
addhtitem (pt_hash, namealloc("rem") , REM );
|
||||
addhtitem (pt_hash, namealloc("report") , REPORT );
|
||||
addhtitem (pt_hash, namealloc("return") , RETURN );
|
||||
|
||||
addhtitem (pt_hash, namealloc("select") , SELECT );
|
||||
addhtitem (pt_hash, namealloc("severity") , SEVERITY );
|
||||
addhtitem (pt_hash, namealloc("signal") , SIGNAL );
|
||||
addhtitem (pt_hash, namealloc("stable") , _STABLE );
|
||||
addhtitem (pt_hash, namealloc("subtype") , SUBTYPE );
|
||||
|
||||
addhtitem (pt_hash, namealloc("then") , THEN );
|
||||
addhtitem (pt_hash, namealloc("to") , TO );
|
||||
addhtitem (pt_hash, namealloc("transport") , TRANSPORT );
|
||||
addhtitem (pt_hash, namealloc("type") , _TYPE );
|
||||
|
||||
addhtitem (pt_hash, namealloc("units") , UNITS );
|
||||
addhtitem (pt_hash, namealloc("until") , UNTIL );
|
||||
addhtitem (pt_hash, namealloc("use") , USE );
|
||||
|
||||
addhtitem (pt_hash, namealloc("variable") , VARIABLE );
|
||||
|
||||
addhtitem (pt_hash, namealloc("wait") , WAIT );
|
||||
addhtitem (pt_hash, namealloc("warning") , WARNING );
|
||||
addhtitem (pt_hash, namealloc("when") , WHEN );
|
||||
addhtitem (pt_hash, namealloc("while") , WHILE );
|
||||
addhtitem (pt_hash, namealloc("with") , WITH );
|
||||
addhtitem (pt_hash, namealloc("wor_bit") , WOR_BIT );
|
||||
addhtitem (pt_hash, namealloc("wor_vector") , WOR_VECTOR );
|
||||
|
||||
addhtitem (pt_hash, namealloc("xor") , _XOR );
|
||||
}
|
||||
|
||||
return (gethtitem (pt_hash, namealloc(key)));
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
upper_case_letter [A-Z]
|
||||
digit [0-9]
|
||||
special_character [\#\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\_\|]
|
||||
space_character [ \t]
|
||||
format_effector [\t\v\r\l\f]
|
||||
end_of_line \n
|
||||
lower_case_letter [a-z]
|
||||
other_special_character [\!\$\@\?\[\\\]\^\`\{\}\~]
|
||||
|
||||
graphic_character ({basic_graphic_character}|{lower_case_letter}|{other_special_character})
|
||||
basic_graphic_character ({upper_case_letter}|{digit}|{special_character}|{space_character})
|
||||
letter ({upper_case_letter}|{lower_case_letter})
|
||||
letter_or_digit ({letter}|{digit})
|
||||
decimal_literal {integer}(\.{integer})?({exponent})?
|
||||
integer {digit}(_?{digit})*
|
||||
exponent ([eE][-+]?{integer})
|
||||
base {integer}
|
||||
based_integer {extended_digit}(_?{extended_digit})*
|
||||
extended_digit ({digit}|[a-fA-F])
|
||||
base_specifier (B|b|O|o|X|x)
|
||||
%%
|
||||
{space_character} {
|
||||
/* nothing */
|
||||
/* separators */
|
||||
}
|
||||
\& {
|
||||
return(Ampersand);
|
||||
}
|
||||
\' {
|
||||
return(Apostrophe);
|
||||
}
|
||||
\( {
|
||||
return(LeftParen);
|
||||
}
|
||||
\) {
|
||||
return(RightParen);
|
||||
}
|
||||
"**" {
|
||||
return(DoubleStar);
|
||||
}
|
||||
\* {
|
||||
return(Star);
|
||||
}
|
||||
\+ {
|
||||
return(Plus);
|
||||
}
|
||||
\, {
|
||||
return(Comma);
|
||||
}
|
||||
\- {
|
||||
return(Minus);
|
||||
}
|
||||
":=" {
|
||||
return(VarAsgn);
|
||||
}
|
||||
\: {
|
||||
return(Colon);
|
||||
}
|
||||
\; {
|
||||
return(Semicolon);
|
||||
}
|
||||
"<=" {
|
||||
return(_LESym);
|
||||
}
|
||||
">=" {
|
||||
return(_GESym);
|
||||
}
|
||||
\< {
|
||||
return(_LTSym);
|
||||
}
|
||||
\> {
|
||||
return(_GTSym);
|
||||
}
|
||||
= {
|
||||
return(_EQSym);
|
||||
}
|
||||
\/= {
|
||||
return(_NESym);
|
||||
}
|
||||
"=>" {
|
||||
return(Arrow);
|
||||
}
|
||||
"<>" {
|
||||
return(Box);
|
||||
}
|
||||
\| {
|
||||
return(Bar);
|
||||
}
|
||||
! {
|
||||
return(Bar);
|
||||
}
|
||||
\. {
|
||||
return(Dot);
|
||||
}
|
||||
\/ {
|
||||
return(Slash);
|
||||
}
|
||||
{letter}(_?{letter_or_digit})* {
|
||||
int itoken;
|
||||
|
||||
itoken = search (yytext);
|
||||
if (itoken == EMPTYHT)
|
||||
{
|
||||
yylval.text = namealloc(yytext);
|
||||
return ( Identifier );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( itoken );
|
||||
}
|
||||
}
|
||||
({decimal_literal})|({base}#{based_integer}(\.{based_integer})?#({exponent})?)|({base}:{based_integer}(\.{based_integer})?:({exponent})?) {
|
||||
yylval.text = mbkalloc((unsigned int)strlen(yytext)+1);
|
||||
strcpy(yylval.text,yytext);
|
||||
return ( AbstractLit );
|
||||
}
|
||||
'({graphic_character}|\"|\%)' {
|
||||
yylval.text = mbkalloc((unsigned int)strlen(yytext)+1);
|
||||
strcpy(yylval.text,yytext);
|
||||
return ( CharacterLit );
|
||||
}
|
||||
(\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) {
|
||||
yylval.text = mbkalloc((unsigned int)strlen(yytext)+1);
|
||||
strcpy(yylval.text,yytext);
|
||||
return ( StringLit );
|
||||
}
|
||||
{base_specifier}(\"{extended_digit}(_?{extended_digit})*\"|\%{extended_digit}(_?{extended_digit})*\%) {
|
||||
yylval.text = mbkalloc((unsigned int)strlen(yytext)+1);
|
||||
strcpy(yylval.text,yytext);
|
||||
return ( BitStringLit );
|
||||
}
|
||||
\n {
|
||||
/* end of line */
|
||||
MVL_LINNUM++;
|
||||
}
|
||||
\-\-.*$ {
|
||||
/* comment */
|
||||
/* nothing */
|
||||
}
|
||||
. {
|
||||
return (*yytext);
|
||||
}
|
||||
%%
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_slex.h */
|
||||
/* date : Nov 6 91 */
|
||||
/* author : TABUSSE L.A. */
|
||||
/* */
|
||||
/* content : declaration of functions and global variables used by */
|
||||
/* lex */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#include "mvl_stdef.h"
|
||||
|
||||
extern int MVL_LINNUM; /* file's line number */
|
||||
|
||||
typedef struct {
|
||||
char nom[MVL_LG_MC];
|
||||
int kval;
|
||||
} el_mc;
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_sspec.yac */
|
||||
/* date : Jan 29 1992 */
|
||||
/* author : P. BAZARGAN */
|
||||
/* L.A. TABUSSE */
|
||||
/* VUONG H.N. */
|
||||
/* */
|
||||
/* content : these functions are used to build up MBK's structures */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mut.h>
|
||||
#include <mlo.h>
|
||||
#include "mvl_stype.h"
|
||||
#include "mvl_sspec.h"
|
||||
#include "mvl_stdef.h"
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_addlosig */
|
||||
/* description : create one or more losig structures (for an array a */
|
||||
/* losig is created for each bit) */
|
||||
/* called func. : addlosig, addchain */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
struct losig *mvl_addlosig (ptfig, index, type, ptype, name, left, right)
|
||||
|
||||
lofig_list *ptfig; /* pointer on LOFIG structure */
|
||||
int index; /* index of the first signal */
|
||||
char type ; /* signal's type */
|
||||
char ptype; /* signal's resolution function */
|
||||
char *name ; /* signal's name */
|
||||
short left ; /* array's left bound (= -1 if scalar) */
|
||||
short right; /* array's right bound (= -1 if scalar) */
|
||||
|
||||
{
|
||||
char extname[100];
|
||||
short i ;
|
||||
short inc = 1;
|
||||
struct chain *pt_chlst ;
|
||||
struct losig *ptsig ;
|
||||
|
||||
if ((left==-1) && (right==-1))
|
||||
{
|
||||
pt_chlst = addchain (NULL, name);
|
||||
ptsig = addlosig (ptfig, index, pt_chlst, type);
|
||||
|
||||
if (ptype != '0')
|
||||
ptsig->USER = addptype (ptsig->USER, ptype, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (left >= right) /* array */
|
||||
inc = -1;
|
||||
|
||||
for (i=left ; i!=(right+inc) ; i+=inc)
|
||||
{
|
||||
sprintf (extname, "%s %d", name, i);
|
||||
pt_chlst = addchain (NULL, extname);
|
||||
ptsig = addlosig (ptfig, index, pt_chlst, type);
|
||||
|
||||
if (ptype != '0')
|
||||
ptsig->USER = addptype (ptsig->USER, ptype, NULL);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
return (ptsig);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_addlocon */
|
||||
/* description : create one or more locon structures (for an array a */
|
||||
/* locon is created for each bit) */
|
||||
/* called func. : addlocon, addchain */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
struct locon *mvl_addlocon (ptfig, ptsig, dir, name, left, right)
|
||||
|
||||
struct lofig *ptfig; /* BEFIG structure's pointer */
|
||||
struct losig *ptsig; /* external signal's pointer */
|
||||
char dir ; /* port's mode */
|
||||
char *name ; /* port's name */
|
||||
short left ; /* array left bound (= -1 if scalar) */
|
||||
short right; /* array right bound (= -1 if scalar) */
|
||||
|
||||
{
|
||||
char extname[100];
|
||||
short i ;
|
||||
short inc = 1;
|
||||
struct locon *ptcon ;
|
||||
struct locon *ptcontmp ;
|
||||
|
||||
if ((left==-1) && (right==-1))
|
||||
{
|
||||
ptcon = addlocon (ptfig, name, ptsig, dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (left >= right)
|
||||
inc = -1;
|
||||
|
||||
for (i=left ; i!=(right+inc) ; i+=inc)
|
||||
{
|
||||
sprintf (extname, "%s %d", name, i);
|
||||
ptcon = addlocon (ptfig, extname, NULL, dir);
|
||||
}
|
||||
|
||||
if (ptsig != NULL)
|
||||
{
|
||||
ptcontmp = ptcon;
|
||||
for (i=left ; i!=(right+inc) ; i+=inc)
|
||||
{
|
||||
ptcontmp->SIG = ptsig;
|
||||
ptcontmp = ptcontmp->NEXT;
|
||||
ptsig = ptsig->NEXT;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (ptcon);
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_sspec.h */
|
||||
/* authors : VUONG H.N., L.A. TABUSSE, P. BAZARGAN */
|
||||
/* date : Aug 31 91 */
|
||||
/* content : contains all specific functions used to build */
|
||||
/* structural data structures, unless they are in <mbk> */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
losig_list *mvl_addlosig ();
|
||||
locon_list *mvl_addlocon ();
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_stdef.h */
|
||||
/* date : Nov 6 1991 */
|
||||
/* author : P.BAZARGAN, L.A.TABUSSE, VUONG H.N. */
|
||||
/* content : declaration of defines used in asimut 's structural */
|
||||
/* function */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#define MVL_LG_MC 15
|
||||
#define MVL_NB_MC ((tab_mc-1 + sizeof(tab_mc)/(sizeof(tab_mc[0])) - tab_mc+1))
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#define MVL_UKNDFN 0 /* unknown port map mode */
|
||||
#define MVL_EXPDFN 1 /* explicit port map */
|
||||
#define MVL_IMPDFN 2 /* implicit port map */
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#define MVL_ROTDFN 1 /* root model */
|
||||
#define MVL_CHDDFN 2 /* child model */
|
||||
|
||||
#define MVL_ICNDFN 1 /* input port */
|
||||
#define MVL_OCNDFN 2 /* output port */
|
||||
#define MVL_BCNDFN 3 /* inout port */
|
||||
#define MVL_XCNDFN 4 /* linkage port */
|
||||
|
||||
#define MVL_BITDFN 8 /* bit type */
|
||||
#define MVL_MUXDFN 16 /* mux_bit type */
|
||||
#define MVL_WORDFN 24 /* wor_bit type */
|
||||
#define MVL_BTVDFN 40 /* bit_vector type */
|
||||
#define MVL_MXVDFN 48 /* mux_vector type */
|
||||
#define MVL_WRVDFN 56 /* wor_vector type */
|
||||
#define MVL_RGVDFN 64 /* reg_vector type */
|
||||
#define MVL_CVTDFN 72 /* convertion type */
|
||||
#define MVL_BOLDFN 80 /* boolean type */
|
||||
|
||||
#define MVL_NORDFN 128 /* non guarded signal */
|
||||
#define MVL_BUSDFN 256 /* guarded signal (bus) */
|
||||
|
||||
#define MVL_MODMSK 7 /* signal mode mask (3 bits) */
|
||||
#define MVL_TYPMSK 120 /* signal type mask (4 bits) */
|
||||
#define MVL_GRDMSK 896 /* signal guard mask (3 bits) */
|
||||
|
||||
#define MVL_MODDFN 0 /* mod_val field of dct_recrd */
|
||||
#define MVL_SIGDFN 1 /* sig_val field of dct_recrd */
|
||||
#define MVL_CCNDFN 2 /* ccn_val field of dct_recrd */
|
||||
#define MVL_RNGDFN 3 /* rng_val field of dct_recrd */
|
||||
#define MVL_LBLDFN 4 /* lbl_val field of dct_recrd */
|
||||
#define MVL_RGTDFN 5 /* rgt_val field of dct_recrd */
|
||||
#define MVL_LFTDFN 6 /* lft_val field of dct_recrd */
|
||||
#define MVL_PNTDFN 7 /* pnt_val field of dct_recrd */
|
||||
|
||||
#define MVL_UPTDFN 1 /* direction is up */
|
||||
#define MVL_DWTDFN 0 /* direction is down */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_stype.h */
|
||||
/* date : Oct 15 1991 */
|
||||
/* author : P. BAZARGAN, L.A. TABUSSE, VUONG H.N. */
|
||||
/* */
|
||||
/* contents : This file contains defines and structure definitions */
|
||||
/* for the structural compiler */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *NAME; /* identifier name */
|
||||
short LEFT; /* vector's left index */
|
||||
short RIGHT; /* vector's right index */
|
||||
short ERR_FLG;
|
||||
}
|
||||
mvl_name;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short WIDTH; /* expression's width */
|
||||
struct chain *LIST; /* list of losig pointers */
|
||||
}
|
||||
mvl_expr;
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_syacc.h */
|
||||
/* date : Nov 07 1991 */
|
||||
/* author : P.BAZARGAN, L.A.TABUSSE, VUONG H.N. */
|
||||
/* content : declaration of external functions and global variables*/
|
||||
/* used by yacc */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
extern char MVL_MBKMOD; /* 'A' or 'P' or 'C') */
|
||||
extern char MVL_ERRFLG; /* if = 1 no structure is made */
|
||||
extern struct lofig *MVL_LOFPNT; /* current LOFIG pointer */
|
||||
|
||||
|
||||
extern struct dct_entry **MVL_HSHTAB; /* dictionnary's entry points */
|
||||
|
||||
extern struct dct_entry **mvl_initab();
|
||||
extern void mvl_addtab();
|
||||
extern int mvl_chktab();
|
||||
extern void mvl_fretab();
|
||||
extern void mvl_error();
|
||||
extern void mvl_warning();
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
extern losig_list *mvl_addlosig ();
|
||||
extern locon_list *mvl_addlocon ();
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* ###---------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_utdef.h */
|
||||
/* date : Nov 6 91 */
|
||||
/* author : L.A.TABUSSE */
|
||||
/* */
|
||||
/* content : declaration of external functions and global variables */
|
||||
/* used by yacc */
|
||||
/* */
|
||||
/* ###---------------------------------------------------------------### */
|
||||
|
||||
|
||||
#define MVL_ROTDFN 1 /* root model */
|
||||
#define MVL_CHDDFN 2 /* child model */
|
||||
|
||||
|
||||
#define MVL_ICNDFN 1 /* input port */
|
||||
#define MVL_OCNDFN 2 /* output port */
|
||||
#define MVL_BCNDFN 3 /* inout port */
|
||||
|
||||
#define MVL_BITDFN 8 /* bit type */
|
||||
#define MVL_MUXDFN 16 /* mux_bit type */
|
||||
#define MVL_WORDFN 24 /* wor_bit type */
|
||||
#define MVL_RBIDFN 32 /* reg_bit type */
|
||||
#define MVL_BTVDFN 40 /* bit_vector type */
|
||||
#define MVL_MXVDFN 48 /* mux_vector type */
|
||||
#define MVL_WRVDFN 56 /* wor_vector type */
|
||||
#define MVL_RGVDFN 64 /* reg_vector type */
|
||||
#define MVL_CVTDFN 72 /* convertion type */
|
||||
#define MVL_BOLDFN 80 /* boolean type */
|
||||
|
||||
#define MVL_NORDFN 128 /* non guarded signal */
|
||||
#define MVL_BUSDFN 256 /* guarded signal (bus) */
|
||||
#define MVL_REGDFN 384 /* guarded signal (register)*/
|
||||
|
||||
#define MVL_MODMSK 7 /* signal mode mask (3 bits) */
|
||||
#define MVL_TYPMSK 120 /* signal type mask (4 bits) */
|
||||
#define MVL_GRDMSK 896 /* signal guard mask (3 bits) */
|
||||
|
||||
#define MVL_NAMDFN 0
|
||||
#define MVL_NEWDFN 1
|
||||
|
||||
#define MVL_MODDFN 0 /* mod_val field of dct_recrd */
|
||||
#define MVL_SIGDFN 1 /* sig_val field of dct_recrd */
|
||||
#define MVL_CCNDFN 2 /* ccn_val field of dct_recrd */
|
||||
#define MVL_RNGDFN 3 /* rng_val field of dct_recrd */
|
||||
#define MVL_LBLDFN 4 /* lbl_val field of dct_recrd */
|
||||
#define MVL_WMXDFN 5 /* wmx_val field of dct_recrd */
|
||||
#define MVL_WMNDFN 6 /* wmn_val field of dct_recrd */
|
||||
#define MVL_PNTDFN 7 /* pnt_val field of dct_recrd */
|
||||
|
||||
#define MVL_ALODFN 60 /* minimal size of allocation */
|
||||
/* for dct_entry and dct_recrd */
|
||||
#define MVL_HSZDFN 97 /* number of entry points in the */
|
||||
/* dictionnary */
|
||||
#define MVL_MXRDFN 30
|
|
@ -0,0 +1,971 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_util.c */
|
||||
/* date : Jan 06 1993 */
|
||||
/* author : P. BAZARGAN-SABET */
|
||||
/* update : VUONG H.N. */
|
||||
/* */
|
||||
/* description : This file contains some utility functions : */
|
||||
/* mvl_addtab , mvl_chktab , mvl_fretab , mvl_error , */
|
||||
/* mvl_addent , mvl_addrcd , yy_b_error , mvl_y_error , */
|
||||
/* yy_v_error , yy_b_wrap , mvl_y_wrap , yy_v_wrap , */
|
||||
/* mvl_toolbug, mvl_message, mvl_reverse, mvl_warning, */
|
||||
/* mvl_initab , mvl_deltab, */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <mut.h>
|
||||
#include <mlo.h>
|
||||
#include "mvl_utype.h"
|
||||
#include "mvl_util.h"
|
||||
#include "mvl_utdef.h"
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_deltab */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
void mvl_deltab (head,key_str,ctx_str)
|
||||
|
||||
struct dct_entry **head;
|
||||
char *key_str;
|
||||
char *ctx_str;
|
||||
|
||||
{
|
||||
int found = 0;
|
||||
int index;
|
||||
struct dct_entry *entry_pnt;
|
||||
struct dct_entry *last_entry = NULL;
|
||||
struct dct_recrd *recrd_pnt;
|
||||
struct dct_recrd *last_recrd = NULL;
|
||||
|
||||
index = ((unsigned long)key_str) % MVL_HSZDFN;
|
||||
entry_pnt = head [index];
|
||||
|
||||
while (entry_pnt != NULL)
|
||||
{
|
||||
if (entry_pnt->key == key_str)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
last_entry = entry_pnt;
|
||||
entry_pnt = entry_pnt->next;
|
||||
}
|
||||
|
||||
if (found == 1)
|
||||
{
|
||||
found = 0;
|
||||
recrd_pnt = entry_pnt->data;
|
||||
while (recrd_pnt != NULL)
|
||||
{
|
||||
if (recrd_pnt->key == ctx_str)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
last_recrd = recrd_pnt;
|
||||
recrd_pnt = recrd_pnt->next;
|
||||
}
|
||||
|
||||
if (found == 1)
|
||||
{
|
||||
if (last_recrd == NULL)
|
||||
entry_pnt->data = recrd_pnt->next;
|
||||
else
|
||||
last_recrd->next = recrd_pnt->next;
|
||||
|
||||
recrd_pnt->next = MVL_DCRHED;
|
||||
MVL_DCRHED = recrd_pnt;
|
||||
|
||||
if (entry_pnt->data == NULL)
|
||||
{
|
||||
if (last_entry == NULL)
|
||||
head[index] = entry_pnt->next;
|
||||
else
|
||||
last_entry->next = entry_pnt->next;
|
||||
|
||||
entry_pnt->next = MVL_DCEHED;
|
||||
MVL_DCEHED = entry_pnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_initab */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
struct dct_entry **mvl_initab ()
|
||||
|
||||
{
|
||||
struct dct_entry **head;
|
||||
int i;
|
||||
|
||||
head = (struct dct_entry **)
|
||||
mbkalloc (sizeof(struct dct_entry *) * MVL_HSZDFN);
|
||||
|
||||
for (i=0 ; i<MVL_HSZDFN ; i++)
|
||||
head[i] = NULL;
|
||||
|
||||
return (head);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_warning */
|
||||
/* content : print out warning messages on the standard error output */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_warning (code,str1)
|
||||
int code;
|
||||
char *str1;
|
||||
{
|
||||
static char first_time = 0;
|
||||
|
||||
switch(code)
|
||||
{
|
||||
case 2:
|
||||
if (first_time != 1)
|
||||
{
|
||||
(void)fprintf (stderr,"Warning %d : ",code);
|
||||
(void)fprintf(stderr,"consistency checks will be disabled\n");
|
||||
first_time = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 42:
|
||||
(void) fprintf (stderr,"Warning : connection missing on port `%s`\n",
|
||||
str1);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
(void)fprintf(stderr,"Warning %d : ",code);
|
||||
(void)fprintf(stderr,"unknown Warning code\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_toolbug */
|
||||
/* content : print out bugs messages on the standard error output */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_toolbug (code,str1,str2,nbr1)
|
||||
|
||||
int code;
|
||||
char *str1;
|
||||
char *str2;
|
||||
int nbr1;
|
||||
|
||||
{
|
||||
(void) fprintf (stderr,"Fatal error %d executing `%s`: ", code,str1);
|
||||
switch (code)
|
||||
{
|
||||
case 10:
|
||||
(void) fprintf (stderr,"decompiler called on empty lofig\n");
|
||||
break;
|
||||
}
|
||||
EXIT (1);
|
||||
}
|
||||
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_message */
|
||||
/* content : print out messages on the standard error output */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_message (code,str1,nmb1)
|
||||
|
||||
int code;
|
||||
char *str1;
|
||||
int nmb1;
|
||||
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
default:
|
||||
(void) fprintf (stderr,"mvl_message : code %d unknown.\n",code);
|
||||
}
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_addtab */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_addtab (head,key_str,ctx_str,field,valu)
|
||||
|
||||
struct dct_entry **head;
|
||||
char *key_str;
|
||||
char *ctx_str;
|
||||
int field;
|
||||
int valu;
|
||||
|
||||
{
|
||||
int found = 0;
|
||||
int index;
|
||||
struct dct_entry *entry_pnt;
|
||||
struct dct_recrd *recrd_pnt;
|
||||
|
||||
index = ((unsigned long) key_str) % MVL_HSZDFN;
|
||||
entry_pnt = head[index];
|
||||
|
||||
while (entry_pnt != NULL)
|
||||
{
|
||||
if (entry_pnt->key == key_str)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
entry_pnt = entry_pnt->next;
|
||||
}
|
||||
|
||||
if (found == 0)
|
||||
{
|
||||
head[index] = mvl_addent (head[index],key_str);
|
||||
entry_pnt = head[index];
|
||||
}
|
||||
|
||||
found = 0;
|
||||
recrd_pnt = entry_pnt->data;
|
||||
while (recrd_pnt != NULL)
|
||||
{
|
||||
if (recrd_pnt->key == ctx_str)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
recrd_pnt = recrd_pnt->next;
|
||||
}
|
||||
|
||||
if (found == 0)
|
||||
{
|
||||
entry_pnt->data = mvl_addrcd (entry_pnt->data,ctx_str);
|
||||
recrd_pnt = entry_pnt->data ;
|
||||
}
|
||||
|
||||
switch (field)
|
||||
{
|
||||
case 0 :
|
||||
recrd_pnt->fd0_val = valu;
|
||||
break;
|
||||
case 1 :
|
||||
recrd_pnt->fd1_val = valu;
|
||||
break;
|
||||
case 2 :
|
||||
recrd_pnt->fd2_val = valu;
|
||||
break;
|
||||
case 3 :
|
||||
recrd_pnt->fd3_val = valu;
|
||||
break;
|
||||
case 4 :
|
||||
recrd_pnt->fd4_val = valu;
|
||||
break;
|
||||
case 5 :
|
||||
recrd_pnt->fd5_val = valu;
|
||||
break;
|
||||
case 6 :
|
||||
recrd_pnt->fd6_val = valu;
|
||||
break;
|
||||
case 7 :
|
||||
recrd_pnt->pnt_val = valu;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_chktab */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
int mvl_chktab (head,key_str,ctx_str,field)
|
||||
|
||||
struct dct_entry **head;
|
||||
char *key_str;
|
||||
char *ctx_str;
|
||||
int field;
|
||||
|
||||
{
|
||||
int found = 0;
|
||||
int valu = 0;
|
||||
struct dct_entry *entry_pnt;
|
||||
struct dct_recrd *recrd_pnt;
|
||||
|
||||
entry_pnt = head [((unsigned long)key_str) % MVL_HSZDFN];
|
||||
|
||||
while (entry_pnt != NULL)
|
||||
{
|
||||
if (entry_pnt->key == key_str)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
entry_pnt = entry_pnt->next;
|
||||
}
|
||||
|
||||
if (found == 1)
|
||||
{
|
||||
found = 0;
|
||||
recrd_pnt = entry_pnt->data;
|
||||
while (recrd_pnt != NULL)
|
||||
{
|
||||
if (recrd_pnt->key == ctx_str)
|
||||
{
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
recrd_pnt = recrd_pnt->next;
|
||||
}
|
||||
if (found == 1)
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case 0 :
|
||||
valu = recrd_pnt->fd0_val;
|
||||
break;
|
||||
case 1 :
|
||||
valu = recrd_pnt->fd1_val;
|
||||
break;
|
||||
case 2 :
|
||||
valu = recrd_pnt->fd2_val;
|
||||
break;
|
||||
case 3 :
|
||||
valu = recrd_pnt->fd3_val;
|
||||
break;
|
||||
case 4 :
|
||||
valu = recrd_pnt->fd4_val;
|
||||
break;
|
||||
case 5 :
|
||||
valu = recrd_pnt->fd5_val;
|
||||
break;
|
||||
case 6 :
|
||||
valu = recrd_pnt->fd6_val;
|
||||
break;
|
||||
case 7 :
|
||||
valu = recrd_pnt->pnt_val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (valu);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_fretab */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_fretab (pt_hash)
|
||||
|
||||
struct dct_entry **pt_hash;
|
||||
{
|
||||
struct dct_entry *pt_entry;
|
||||
struct dct_entry *pt_nxtentry;
|
||||
struct dct_recrd *pt_record;
|
||||
int i;
|
||||
|
||||
if (pt_hash != NULL)
|
||||
{
|
||||
for (i=0 ; i<MVL_HSZDFN ; i++)
|
||||
{
|
||||
if ((pt_entry = pt_hash[i]) != NULL)
|
||||
{
|
||||
while (pt_entry != NULL)
|
||||
{
|
||||
pt_record = pt_entry->data;
|
||||
|
||||
while (pt_record->next != NULL)
|
||||
pt_record = pt_record->next;
|
||||
|
||||
pt_record->next = MVL_DCRHED;
|
||||
MVL_DCRHED = pt_entry->data;
|
||||
|
||||
pt_nxtentry = pt_entry->next;
|
||||
pt_entry->next = MVL_DCEHED;
|
||||
MVL_DCEHED = pt_entry;
|
||||
pt_entry = pt_nxtentry;
|
||||
}
|
||||
}
|
||||
}
|
||||
free (pt_hash);
|
||||
}
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_error */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_error (code,str1)
|
||||
|
||||
int code;
|
||||
char *str1;
|
||||
|
||||
{
|
||||
MVL_ERRFLG++;
|
||||
if (code < 100)
|
||||
(void)fprintf (stderr,"`%s` Error %d line %d :",MVL_CURFIL,code,MVL_LINNUM);
|
||||
else
|
||||
{
|
||||
if (code < 200)
|
||||
(void)fprintf (stderr,"Error %d :",code);
|
||||
}
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case 1:
|
||||
(void) fprintf (stderr,"`%s` is incompatible with the entity name\n",str1);
|
||||
break;
|
||||
case 2:
|
||||
(void) fprintf (stderr,"bad entity declaration\n");
|
||||
break;
|
||||
case 3:
|
||||
(void) fprintf (stderr,"bad port clause declaration\n");
|
||||
break;
|
||||
case 4:
|
||||
(void) fprintf (stderr,"port `%s` already declared\n",str1);
|
||||
break;
|
||||
case 5:
|
||||
(void) fprintf (stderr,"illegal port declaration `%s` (mode, type, guard mark)\n",str1);
|
||||
break;
|
||||
case 6:
|
||||
(void) fprintf (stderr,"bad port declaration\n");
|
||||
break;
|
||||
case 7:
|
||||
(void) fprintf (stderr,"`%s` is incompatible with the architecture name\n",str1);
|
||||
break;
|
||||
case 8:
|
||||
(void) fprintf (stderr,"bad architecture declaration\n");
|
||||
break;
|
||||
case 9:
|
||||
(void) fprintf (stderr,"illegal declaration\n");
|
||||
break;
|
||||
case 10:
|
||||
(void) fprintf (stderr,"signal `%s` already declared\n",str1);
|
||||
break;
|
||||
case 11:
|
||||
(void) fprintf (stderr,"illegal signal declaration `%s` (type, guard mark)\n",str1);
|
||||
break;
|
||||
case 12:
|
||||
(void) fprintf (stderr,"component `%s` already declared\n",str1);
|
||||
break;
|
||||
case 13:
|
||||
(void) fprintf (stderr,"instance `%s` already declared\n",str1);
|
||||
break;
|
||||
case 14:
|
||||
(void) fprintf (stderr,"`%s` unknown component\n",str1);
|
||||
break;
|
||||
case 15:
|
||||
(void) fprintf (stderr,"illegal usage of implicit port map description\n");
|
||||
break;
|
||||
case 16:
|
||||
(void) fprintf (stderr,"`%s` unknown local port\n",str1);
|
||||
break;
|
||||
case 17:
|
||||
(void) fprintf (stderr,"`%s` unknown port or signal\n",str1);
|
||||
break;
|
||||
case 18:
|
||||
(void) fprintf (stderr,"illegal concurrent statement\n");
|
||||
break;
|
||||
case 31:
|
||||
(void) fprintf (stderr,"bad signal association\n");
|
||||
break;
|
||||
case 32:
|
||||
(void) fprintf (stderr,"null array not supported\n");
|
||||
break;
|
||||
case 33:
|
||||
(void) fprintf (stderr,"illegal constraint in declaration of type\n");
|
||||
break;
|
||||
case 36:
|
||||
(void) fprintf (stderr,"signal `%s` used out of declared range\n",str1);
|
||||
break;
|
||||
case 38:
|
||||
(void) fprintf (stderr,"width or/and type mismatch\n");
|
||||
break;
|
||||
case 41:
|
||||
(void) fprintf (stderr,"port `%s` connected to more than one signal\n",str1);
|
||||
break;
|
||||
case 76:
|
||||
(void) fprintf (stderr,"instance %s mismatch with the model\n",str1);
|
||||
break;
|
||||
case 107:
|
||||
(void) fprintf (stderr,"Cannot open result file\n");
|
||||
break;
|
||||
case 200:
|
||||
(void) fprintf (stderr,"\n cannot continue further more.\n");
|
||||
(void) fprintf (stderr,"\n Have a nice day...\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
(void) fprintf (stderr,"syntax error\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if (MVL_ERRFLG > MVL_MXRDFN)
|
||||
{
|
||||
(void) fprintf (stderr,"Too many errors. Cannot continue further more\n");
|
||||
(void) fprintf (stderr,"\n Have a nice day...\n");
|
||||
EXIT (1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_addent */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
static struct dct_entry *mvl_addent (head , key)
|
||||
|
||||
struct dct_entry *head;
|
||||
char *key;
|
||||
|
||||
{
|
||||
struct dct_entry *entry;
|
||||
int i;
|
||||
|
||||
if (MVL_DCEHED == NULL)
|
||||
{
|
||||
MVL_DCEHED = (struct dct_entry *)
|
||||
mbkalloc (sizeof(struct dct_entry) * MVL_ALODFN);
|
||||
|
||||
entry = MVL_DCEHED;
|
||||
for (i=1 ; i<MVL_ALODFN ; i++)
|
||||
{
|
||||
entry->next = entry + 1;
|
||||
entry++;
|
||||
}
|
||||
entry->next = NULL;
|
||||
}
|
||||
|
||||
entry = MVL_DCEHED;
|
||||
MVL_DCEHED = MVL_DCEHED->next;
|
||||
|
||||
entry->next = head;
|
||||
entry->data = NULL;
|
||||
entry->key = key;
|
||||
|
||||
return (entry);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_addrcd */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
static struct dct_recrd *mvl_addrcd (head , key)
|
||||
|
||||
struct dct_recrd *head;
|
||||
char *key;
|
||||
|
||||
{
|
||||
struct dct_recrd *recrd;
|
||||
int i;
|
||||
|
||||
if (MVL_DCRHED == NULL)
|
||||
{
|
||||
MVL_DCRHED = (struct dct_recrd *)
|
||||
mbkalloc (sizeof(struct dct_recrd) * MVL_ALODFN);
|
||||
|
||||
recrd = MVL_DCRHED;
|
||||
for (i=1 ; i<MVL_ALODFN ; i++)
|
||||
{
|
||||
recrd->next = recrd + 1;
|
||||
recrd++;
|
||||
}
|
||||
recrd->next = NULL;
|
||||
}
|
||||
|
||||
recrd = MVL_DCRHED;
|
||||
MVL_DCRHED = MVL_DCRHED->next;
|
||||
|
||||
recrd->next = head;
|
||||
recrd->fd0_val = 0;
|
||||
recrd->fd1_val = 0;
|
||||
recrd->fd2_val = 0;
|
||||
recrd->fd3_val = 0;
|
||||
recrd->fd4_val = 0;
|
||||
recrd->fd5_val = 0;
|
||||
recrd->fd6_val = 0;
|
||||
recrd->pnt_val = 0;
|
||||
recrd->key = key;
|
||||
|
||||
return (recrd);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl__y_error */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_y_error (str)
|
||||
|
||||
char *str;
|
||||
{
|
||||
MVL_ERRFLG++;
|
||||
(void)fprintf (stderr,"`%s` Error line %d : %s\n",MVL_CURFIL,MVL_LINNUM,str);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_y_wrap */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
int mvl_y_wrap ()
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_avers */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
char *mvl_avers ()
|
||||
{
|
||||
return ("-- V 1.3 --");
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_vhdlname */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
char *mvl_vhdlname (name)
|
||||
|
||||
char *name;
|
||||
|
||||
{
|
||||
char *new_name;
|
||||
char *prv_name;
|
||||
char *tmp_name;
|
||||
char buffer[200];
|
||||
int i,j,flag,number;
|
||||
static struct dct_entry **namtab=NULL;
|
||||
|
||||
if (namtab == NULL)
|
||||
namtab = mvl_initab ();
|
||||
|
||||
tmp_name = namealloc (name);
|
||||
new_name = (char *) mvl_chktab (namtab,tmp_name,NULL,MVL_PNTDFN);
|
||||
|
||||
if (mvl_chktab (namtab,tmp_name,NULL,MVL_NAMDFN) == 0)
|
||||
{
|
||||
i = 0;
|
||||
j = 0;
|
||||
number = 0;
|
||||
flag = 1;
|
||||
while (tmp_name[i] != '\0')
|
||||
{
|
||||
buffer[j] = tmp_name[i];
|
||||
if ( ((tmp_name[i] >= 'a') && (tmp_name[i] <= 'z')) ||
|
||||
((tmp_name[i] >= 'A') && (tmp_name[i] <= 'Z')) ||
|
||||
((tmp_name[i] >= '0') && (tmp_name[i] <= '9') && (i != 0)) ||
|
||||
((tmp_name[i] == '(') || (tmp_name[i] == ')')) )
|
||||
{
|
||||
flag = 0;
|
||||
}
|
||||
else
|
||||
if ((tmp_name[i] >= '0') && (tmp_name[i] <= '9') && (i == 0))
|
||||
{
|
||||
strcpy( &buffer[ j ], "noname" );
|
||||
j += 6;
|
||||
buffer[j] = tmp_name[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (flag == 1) buffer[j++] = 'v';
|
||||
buffer[j] = '_';
|
||||
flag = 1;
|
||||
}
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
if (buffer[j-1] == '_') j--;
|
||||
buffer[j] = '\0';
|
||||
new_name = namealloc (buffer);
|
||||
|
||||
prv_name = new_name;
|
||||
while (mvl_chktab (namtab,new_name,NULL,MVL_NEWDFN) != 0)
|
||||
{
|
||||
new_name = prv_name;
|
||||
sprintf (buffer,"%s_%d",new_name,number++);
|
||||
prv_name = new_name;
|
||||
new_name = namealloc (buffer);
|
||||
}
|
||||
mvl_addtab (namtab,new_name,NULL,MVL_NEWDFN,1);
|
||||
mvl_addtab (namtab,tmp_name,NULL,MVL_PNTDFN,(int)new_name);
|
||||
mvl_addtab (namtab,tmp_name,NULL,MVL_NAMDFN,1);
|
||||
}
|
||||
|
||||
return (new_name);
|
||||
}
|
||||
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_name */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void mvl_name (name,new_name)
|
||||
|
||||
char *name;
|
||||
char *new_name;
|
||||
|
||||
{
|
||||
char *blank_space;
|
||||
|
||||
/* Transformation des blancs en parentheses */
|
||||
strcpy(new_name,name);
|
||||
blank_space = strchr(new_name,' ');
|
||||
if(blank_space != NULL)
|
||||
{
|
||||
*blank_space = '(';
|
||||
blank_space = strchr(new_name,'\0');
|
||||
/* Transformation du dernier caractere en ) */
|
||||
if(blank_space != NULL)
|
||||
{
|
||||
*blank_space = ')';
|
||||
blank_space++;
|
||||
*blank_space = '\0';
|
||||
}
|
||||
}
|
||||
strcpy(new_name,mvl_vhdlname(new_name));
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_vectnam */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
void *mvl_vectnam(pt_list,left,right,name,type)
|
||||
|
||||
void *pt_list;
|
||||
int *left, *right;
|
||||
char **name;
|
||||
char type;
|
||||
|
||||
{
|
||||
char *blank_space;
|
||||
char *sig_name;
|
||||
char name_tmp[200];
|
||||
char number[200];
|
||||
losig_list *ptsig;
|
||||
locon_list *ptcon;
|
||||
char END = 0;
|
||||
|
||||
/* Case losig_list */
|
||||
if(type==0)
|
||||
{
|
||||
ptsig = (losig_list *)pt_list;
|
||||
if (ptsig->TYPE == 'I')
|
||||
{
|
||||
*left = *right = -1;
|
||||
sig_name = getsigname(ptsig);
|
||||
*name = (char*)mbkalloc(strlen(sig_name) + 1);
|
||||
strcpy(*name,sig_name);
|
||||
blank_space = strchr(*name,' ');
|
||||
if (blank_space != NULL)
|
||||
{
|
||||
strcpy(number,blank_space);
|
||||
*right = atoi(number);
|
||||
*left = *right;
|
||||
*blank_space = '\0';
|
||||
}
|
||||
|
||||
while(!END)
|
||||
{
|
||||
if(ptsig->NEXT != NULL)
|
||||
{
|
||||
strcpy(name_tmp,getsigname(ptsig->NEXT));
|
||||
blank_space = strchr(name_tmp,' ');
|
||||
if(blank_space!=NULL)
|
||||
{
|
||||
strcpy(number,blank_space);
|
||||
*blank_space = '\0';
|
||||
if(!strcmp(*name,name_tmp))
|
||||
{
|
||||
*left = atoi(number);
|
||||
ptsig = ptsig->NEXT;
|
||||
}
|
||||
else
|
||||
END = 1;
|
||||
}
|
||||
else
|
||||
END = 1;
|
||||
}
|
||||
else
|
||||
END = 1;
|
||||
}
|
||||
return(ptsig);
|
||||
}
|
||||
else
|
||||
{
|
||||
*name = NULL;
|
||||
return(ptsig);
|
||||
}
|
||||
}
|
||||
|
||||
/*case locon_list */
|
||||
if(type==1)
|
||||
{
|
||||
ptcon = (locon_list *)pt_list;
|
||||
/* Extract the name and number of an element */
|
||||
*left = *right = -1;
|
||||
sig_name = ptcon->NAME;
|
||||
*name = (char *)mbkalloc(strlen(sig_name) + 1);
|
||||
strcpy(*name,sig_name);
|
||||
blank_space = strchr(*name,' ');
|
||||
if (blank_space != NULL)
|
||||
{
|
||||
strcpy(number,blank_space);
|
||||
*right = atoi(number);
|
||||
*left = *right;
|
||||
*blank_space = '\0';
|
||||
}
|
||||
|
||||
while(END != 1)
|
||||
{
|
||||
if(ptcon->NEXT != NULL)
|
||||
{
|
||||
strcpy(name_tmp,ptcon->NEXT->NAME);
|
||||
blank_space = strchr(name_tmp,' ');
|
||||
if(blank_space!=NULL)
|
||||
{
|
||||
strcpy(number,blank_space);
|
||||
*blank_space = '\0';
|
||||
if(!strcmp(*name,name_tmp))
|
||||
{
|
||||
*right = atoi(number);
|
||||
ptcon = ptcon->NEXT;
|
||||
}
|
||||
else
|
||||
END = 1;
|
||||
}
|
||||
else
|
||||
END = 1;
|
||||
}
|
||||
else
|
||||
END = 1;
|
||||
}
|
||||
return(ptcon);
|
||||
}
|
||||
/* To avoid Warning from GCC */
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_reverse */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
struct chain *mvl_reverse (head)
|
||||
|
||||
struct chain *head;
|
||||
|
||||
{
|
||||
struct chain *last_pnt = NULL;
|
||||
struct chain *curr_pnt = NULL;
|
||||
struct chain *next_pnt = NULL;
|
||||
|
||||
if (head != NULL)
|
||||
{
|
||||
last_pnt = head;
|
||||
curr_pnt = head->NEXT;
|
||||
last_pnt->NEXT = NULL;
|
||||
|
||||
if (curr_pnt != NULL)
|
||||
{
|
||||
next_pnt = curr_pnt->NEXT;
|
||||
|
||||
while (next_pnt != NULL)
|
||||
{
|
||||
curr_pnt->NEXT = last_pnt;
|
||||
|
||||
/* ###------------------------------------------------------### */
|
||||
/* Now shift the window to the next structure */
|
||||
/* ###------------------------------------------------------### */
|
||||
|
||||
last_pnt = curr_pnt;
|
||||
curr_pnt = next_pnt;
|
||||
next_pnt = next_pnt->NEXT;
|
||||
}
|
||||
|
||||
curr_pnt->NEXT = last_pnt;
|
||||
}
|
||||
else
|
||||
curr_pnt = head;
|
||||
}
|
||||
|
||||
return (curr_pnt);
|
||||
}
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* function : mvl_fill */
|
||||
/* content : Fill a lofig of mode 'P' with another lofig of mode 'A' */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
struct lofig *mvl_fill (lofig_P, lofig_A)
|
||||
|
||||
struct lofig *lofig_P;
|
||||
struct lofig *lofig_A;
|
||||
|
||||
{
|
||||
struct locon *ptlocon_P, *ptlocon_A;
|
||||
struct chain *ptchain;
|
||||
struct lofig *ptlofig;
|
||||
struct losig *ptlosig;
|
||||
|
||||
/* MODELCHAIN */
|
||||
ptchain = lofig_P->MODELCHAIN;
|
||||
lofig_P->MODELCHAIN = lofig_A->MODELCHAIN;
|
||||
|
||||
/* LOCON */
|
||||
ptlocon_P = lofig_P->LOCON;
|
||||
ptlocon_A = lofig_A->LOCON;
|
||||
|
||||
while(ptlocon_A != NULL)
|
||||
{
|
||||
if(ptlocon_A->NAME == ptlocon_P->NAME)
|
||||
{
|
||||
ptlocon_P->SIG = ptlocon_A->SIG;
|
||||
}
|
||||
else
|
||||
{
|
||||
(void)fprintf(stderr,"\n*** mbk error *** bad consistency in figure %s,\n external interface are different\n", lofig_P->NAME);
|
||||
}
|
||||
ptlocon_A = ptlocon_A->NEXT;
|
||||
ptlocon_P = ptlocon_P->NEXT;
|
||||
}
|
||||
|
||||
/* LOSIG */
|
||||
ptlosig = lofig_P->LOSIG;
|
||||
lofig_P->LOSIG = lofig_A->LOSIG;
|
||||
|
||||
/* LOINS */
|
||||
lofig_P->LOINS = lofig_A->LOINS;
|
||||
|
||||
/* LOTRS */
|
||||
lofig_P->LOTRS = lofig_A->LOTRS;
|
||||
|
||||
/* USER */
|
||||
lofig_P->USER = lofig_A->USER;
|
||||
|
||||
/* MODE */
|
||||
lofig_P->MODE = 'A';
|
||||
|
||||
/* Freeing the memory zone unusable */
|
||||
|
||||
freechain(ptchain);
|
||||
|
||||
while (lofig_A->LOCON != NULL)
|
||||
{
|
||||
(void)dellocon(lofig_A, lofig_A->LOCON->NAME);
|
||||
}
|
||||
|
||||
ptlofig = addlofig(" bidon");
|
||||
ptlofig->LOSIG = ptlosig;
|
||||
(void)dellofig(ptlofig->NAME);
|
||||
|
||||
|
||||
|
||||
return(lofig_P);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/* ###--------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_util.h */
|
||||
/* date : Oct 4 1991 */
|
||||
/* author : P. BAZARGAN-SABET */
|
||||
/* */
|
||||
/* description : This file contains declaration of global and external */
|
||||
/* variables and, functions used in `mvl_util.c` */
|
||||
/* */
|
||||
/* ###--------------------------------------------------------------### */
|
||||
|
||||
extern int MVL_LINNUM; /* file's line number */
|
||||
extern char MVL_ERRFLG; /* Error flag */
|
||||
extern char MVL_CURFIL[]; /* current file name */
|
||||
|
||||
static struct dct_entry *MVL_DCEHED; /* free dct_entry's head */
|
||||
static struct dct_recrd *MVL_DCRHED; /* free dct_recrd's head */
|
||||
|
||||
static struct dct_entry *mvl_addent();
|
||||
static struct dct_recrd *mvl_addrcd();
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* This file is part of the Alliance CAD System
|
||||
* Copyright (C) Laboratoire LIP6 - Département ASIM
|
||||
* Universite Pierre et Marie Curie
|
||||
*
|
||||
* Home page : http://www-asim.lip6.fr/alliance/
|
||||
* E-mail support : mailto:alliance-support@asim.lip6.fr
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Library General Public License as published
|
||||
* by the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Alliance VLSI CAD System is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
* Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with the GNU C Library; see the file COPYING. If not, write to the Free
|
||||
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* ###---------------------------------------------------------------### */
|
||||
/* */
|
||||
/* file : mvl_utype.h */
|
||||
/* date : Aug 8 91 */
|
||||
/* author : P.BAZARGAN L.A.TABUSSE VUONG H.N. */
|
||||
/* */
|
||||
/* content : declaration of external functions and global variables */
|
||||
/* used by yacc */
|
||||
/* */
|
||||
/* ###---------------------------------------------------------------### */
|
||||
|
||||
struct dct_entry
|
||||
{
|
||||
struct dct_entry *next;
|
||||
struct dct_recrd *data;
|
||||
char *key;
|
||||
};
|
||||
|
||||
struct dct_recrd
|
||||
{
|
||||
struct dct_recrd *next;
|
||||
char *key;
|
||||
short fd0_val;
|
||||
short fd1_val;
|
||||
short fd2_val;
|
||||
short fd3_val;
|
||||
short fd4_val;
|
||||
short fd5_val;
|
||||
short fd6_val;
|
||||
int pnt_val;
|
||||
};
|
Loading…
Reference in New Issue