From 09e43f94b934de2ab1bc56af0ab08d7c0862a994 Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Wed, 20 Mar 2002 13:46:51 +0000 Subject: [PATCH] Ok bis --- alliance/src/abv/src/Makefile.am | 11 + alliance/src/abv/src/abv.h | 51 ++ alliance/src/abv/src/bvl_bcomp.l | 383 +++++++++++ alliance/src/abv/src/bvl_bedef.h | 84 +++ alliance/src/abv/src/bvl_blex.h | 40 ++ alliance/src/abv/src/bvl_bspec.c | 1032 ++++++++++++++++++++++++++++++ alliance/src/abv/src/bvl_bspec.h | 46 ++ alliance/src/abv/src/bvl_byacc.h | 90 +++ alliance/src/abv/src/bvl_drive.c | 553 ++++++++++++++++ alliance/src/abv/src/bvl_drive.h | 44 ++ alliance/src/abv/src/bvl_parse.c | 156 +++++ alliance/src/abv/src/bvl_parse.h | 47 ++ alliance/src/abv/src/bvl_utdef.h | 64 ++ alliance/src/abv/src/bvl_util.c | 706 ++++++++++++++++++++ alliance/src/abv/src/bvl_util.h | 43 ++ alliance/src/abv/src/bvl_utype.h | 58 ++ alliance/src/abv/src/main.c | 109 ++++ 17 files changed, 3517 insertions(+) create mode 100644 alliance/src/abv/src/Makefile.am create mode 100644 alliance/src/abv/src/abv.h create mode 100644 alliance/src/abv/src/bvl_bcomp.l create mode 100644 alliance/src/abv/src/bvl_bedef.h create mode 100644 alliance/src/abv/src/bvl_blex.h create mode 100644 alliance/src/abv/src/bvl_bspec.c create mode 100644 alliance/src/abv/src/bvl_bspec.h create mode 100644 alliance/src/abv/src/bvl_byacc.h create mode 100644 alliance/src/abv/src/bvl_drive.c create mode 100644 alliance/src/abv/src/bvl_drive.h create mode 100644 alliance/src/abv/src/bvl_parse.c create mode 100644 alliance/src/abv/src/bvl_parse.h create mode 100644 alliance/src/abv/src/bvl_utdef.h create mode 100644 alliance/src/abv/src/bvl_util.c create mode 100644 alliance/src/abv/src/bvl_util.h create mode 100644 alliance/src/abv/src/bvl_utype.h create mode 100644 alliance/src/abv/src/main.c diff --git a/alliance/src/abv/src/Makefile.am b/alliance/src/abv/src/Makefile.am new file mode 100644 index 00000000..b120b78f --- /dev/null +++ b/alliance/src/abv/src/Makefile.am @@ -0,0 +1,11 @@ +lib_LIBRARIES = libAbv.a +libAbv_a_SOURCES = bvl_bcomp.y bvl_bcomp.l \ +abv.h bvl_bspec.c bvl_drive.c bvl_parse.h bvl_util.h \ +bvl_bedef.h bvl_bspec.h bvl_drive.h bvl_utdef.h bvl_utype.h \ +bvl_blex.h bvl_byacc.h bvl_parse.c bvl_util.c +CLEANFILES = bvl_bcompyac.c bvl_bcompyac.h bvl_bcomplex.c + +bvl_bcompyac.c bvl_bcompyac.h : $(srcdir)/bvl_bcomp.y + $(YACC) -d $(YFLAGS) $(srcdir)/bvl_bcomp.y && sed -e "s/yy/bvl_y_/g" -e "s/YY/BVL_Y_/g" y.tab.c > bvl_bcompyac.c && sed -e "s/yy/bvl_y_/g" -e "s/YY/BVL_Y_/g" y.tab.h > bvl_bcompyac.h +bvl_bcomplex.c : $(srcdir)/bvl_bcomp.l bvl_bcompyac.h + $(LEX) -t $(srcdir)/bvl_bcomp.l | sed -e "s/yy/bvl_y_/g" -e "s/YY/BVL_Y_/g" > bvl_bcomplex.c diff --git a/alliance/src/abv/src/abv.h b/alliance/src/abv/src/abv.h new file mode 100644 index 00000000..6868369f --- /dev/null +++ b/alliance/src/abv/src/abv.h @@ -0,0 +1,51 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : abv201.h */ +/* date : Feb 10 1995 */ +/* version : v201 */ +/* contents : defines and structure definitions used in BVL library */ +/* */ +/* ###--------------------------------------------------------------### */ + +#ifndef ABV_BVLDEF +#define ABV_BVLDEF + +#define ABV_TRACE_MASK 0x00000001 /* print messages when parsing */ +#define ABV_KEEP_AUX_MASK 0x00000002 /* keep internal signals */ +#define ABV_SYNTH_MASK 0x00000004 /* special mode for synthesis */ + + /* ###------------------------------------------------------### */ + /* functions */ + /* ###------------------------------------------------------### */ + +extern struct befig *vhdlloadbefig (); +extern void vhdlsavebefig (); + +#endif diff --git a/alliance/src/abv/src/bvl_bcomp.l b/alliance/src/abv/src/bvl_bcomp.l new file mode 100644 index 00000000..ec31ea3f --- /dev/null +++ b/alliance/src/abv/src/bvl_bcomp.l @@ -0,0 +1,383 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU 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 +#include +#include +#include "mut.h" +#include "abl.h" +#include "abe.h" + +typedef struct bvl_expr + { + char *IDENT; /* identifier or constant name */ + struct chain *LIST_ABL; /* pointer on bvl_abllst list */ + short WIDTH; /* width of bit vector */ + } +bvl_ablstr; + +typedef struct + { + char *NAME; /* identifier name */ + short LEFT; /* vector's left index */ + short RIGHT; /* vector's right index */ + char FLAG; + } +bvl_name; + +struct g_type + { + int VALU; + char FLAG; + }; + +#include "bvl_bcompyac.h" +#include "bvl_blex.h" + +%} + +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) + +%% +\n { +/*printf ("Newline\n");*/ + BVL_LINNUM++; + } +[ \t] { +/*printf ("space\n");*/ + } +\& { +/*printf ("Ampersand\n");*/ + return(Ampersand); + } +\' { +/*printf ("Apostrophe\n");*/ + return(Apostrophe); + } +\( { +/*printf ("LeftParen\n");*/ + return(LeftParen); + } +\) { +/*printf ("RightParen\n");*/ + return(RightParen); + } +"**" { +/*printf ("DoubleStar\n");*/ + return(DoubleStar); + } +\* { +/*printf ("Star\n");*/ + return(Star); + } +\+ { +/*printf ("Plus\n");*/ + return(Plus); + } +\, { +/*printf ("Comma\n");*/ + return(Comma); + } +\- { +/*printf ("Minus\n");*/ + return(Minus); + } +":=" { +/*printf ("VarAsgn\n");*/ + return(VarAsgn); + } +\: { +/*printf ("Colon\n");*/ + return(Colon); + } +\; { +/*printf ("Semicolon\n");*/ + return(Semicolon); + } +"<=" { +/*printf ("_LESym\n");*/ + return(_LESym); + } +">=" { +/*printf ("_GESym\n");*/ + return(_GESym); + } +\< { +/*printf ("_LTSym\n");*/ + return(_LTSym); + } +\> { +/*printf ("_GTSym\n");*/ + return(_GTSym); + } += { +/*printf ("_EQSym\n");*/ + return(_EQSym); + } +\/= { +/*printf ("_NESym\n");*/ + return(_NESym); + } +"=>" { +/*printf ("Arrow\n");*/ + return(Arrow); + } +"<>" { +/*printf ("Box\n");*/ + return(Box); + } +\| { +/*printf ("Bar\n");*/ + return(Bar); + } +! { +/*printf ("Bar\n");*/ + return(Bar); + } +\. { +/*printf ("Dot\n");*/ + return(Dot); + } +\/ { +/*printf ("Slash\n");*/ + return(Slash); + } + +{letter}(_?{letter_or_digit})* { + int itoken; + + itoken = search (yytext); + if (itoken == EMPTYHT) + { + yylval.text = namealloc (yytext); +/*printf ("Identifier : %s\n", yytext);*/ + return (Identifier); + } + else + { +/*printf ("Key word : %s\n", yytext);*/ + 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 = namealloc (yytext); + return (CharacterLit); + } +(\"({graphic_character}|(\"\")|\%)*\")|(\%({graphic_character}|(\%\%)|\")*\%) { + yylval.text = namealloc (yytext); + return (StringLit); + } +{base_specifier}((\"{extended_digit}(_?{extended_digit})*\")|(\%{extended_digit}(_?{extended_digit})*\%)) { + yylval.text = namealloc (yytext); + return (BitStringLit); + } + +\-\-{space_character}*[pP][rR][aA][gG][mM][aA].*$ { + yylval.text = namealloc(yytext); return( PRAGMA ); + } + +\-\-.*$ + { + } + +. { + return (*yytext); + } +%% + +/* ###--------------------------------------------------------------### */ +/* function : yywrap */ +/* description : return 1 */ +/* called func. : none */ +/* ###--------------------------------------------------------------### */ + +int yywrap () + { + return (1); + } + +/* ###--------------------------------------------------------------### */ +/* 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("ms") , _MS ); + 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("ns") , _NS ); + 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("ps") , _PS ); + + 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("us") , _US ); + 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))); + } diff --git a/alliance/src/abv/src/bvl_bedef.h b/alliance/src/abv/src/bvl_bedef.h new file mode 100644 index 00000000..f3c4b16d --- /dev/null +++ b/alliance/src/abv/src/bvl_bedef.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_bedef.h */ +/* date : Jan 18 1993 */ +/* version : v106 */ +/* author : P.BAZARGAN, L.A.TABUSSE, VUONG H.N. */ +/* content : declaration of define used by yacc */ +/* */ +/* ###--------------------------------------------------------------### */ + +#define BVL_ICNDFN 1 /* input port */ +#define BVL_OCNDFN 2 /* output port */ +#define BVL_BCNDFN 3 /* inout port */ +#define BVL_CSTDFN 4 /* constant */ + +#define BVL_BITDFN 8 /* bit type */ +#define BVL_MUXDFN 16 /* mux_bit type */ +#define BVL_WORDFN 24 /* wor_bit type */ +#define BVL_RBIDFN 32 /* reg_bit type */ +#define BVL_BTVDFN 40 /* bit_vector type */ +#define BVL_MXVDFN 48 /* mux_vector type */ +#define BVL_WRVDFN 56 /* wor_vector type */ +#define BVL_RGVDFN 64 /* reg_vector type */ +#define BVL_NATDFN 88 /* natural type */ +#define BVL_NTVDFN 96 /* nat_vector type */ + +#define BVL_NORDFN 128 /* non guarded signal */ +#define BVL_BUSDFN 256 /* guarded signal (bus) */ +#define BVL_REGDFN 384 /* guarded signal (register)*/ + +#define BVL_MODDFN 0 /* field # 0 of dictionnary */ +#define BVL_SIGDFN 1 /* field # 1 of dictionnary */ +#define BVL_STBDFN 3 /* field # 3 of dictionnary */ +#define BVL_LBLDFN 4 /* field # 4 of dictionnary */ +#define BVL_WMXDFN 5 /* field # 5 of dictionnary */ +#define BVL_WMNDFN 6 /* field # 6 of dictionnary */ +#define BVL_PNTDFN 7 /* field # 7 of dictionnary */ + +#define BVL_UPTDFN 1 /* direction is up */ +#define BVL_DWTDFN 0 /* direction is down */ + +/* ###---------------------------------------------------------------### */ + +#define NE 9 +#define EQ 10 +#define NOPI 11 +#define NOPS 12 +#define ANDM 13 +#define CONC 14 +#define CONVRT 15 + +#define BVL_UNGDFN 0 +#define BVL_GRDDFN 1 + +/* ###---------------------------------------------------------------### */ + +/* #define BVL_INTDFN 0 */ /* int_val field of dtc_recrd */ diff --git a/alliance/src/abv/src/bvl_blex.h b/alliance/src/abv/src/bvl_blex.h new file mode 100644 index 00000000..9bb8c01a --- /dev/null +++ b/alliance/src/abv/src/bvl_blex.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_blex.h */ +/* date : Oct 4 1992 */ +/* version : v108 */ +/* author : TABUSSE L.A. */ +/* content : declaration of functions and global variables used by */ +/* lex */ +/* */ +/* ###--------------------------------------------------------------### */ + +extern int BVL_LINNUM; /* file's line number */ +static int search (); diff --git a/alliance/src/abv/src/bvl_bspec.c b/alliance/src/abv/src/bvl_bspec.c new file mode 100644 index 00000000..68db8ed9 --- /dev/null +++ b/alliance/src/abv/src/bvl_bspec.c @@ -0,0 +1,1032 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_bspec.c */ +/* date : Jan 18 1993 */ +/* version : v106 */ +/* authors : Pirouz BAZARGAN SABET, VUONG Huu Nghia */ +/* content : contains all specific functions used to build */ +/* behaviour data structures : */ +/* bvl_addgen , bvl_tobin , bvl_cpyabllst, */ +/* bvl_cpyablstr, bvl_crtabl, bvl_select */ +/* */ +/* ###--------------------------------------------------------------### */ + +/* 13 Nov 1992 : VHN Now when oper = EQ or NE return AND (or AND NOT) + of each member of the equality */ + +#include +#include +#include "mut.h" +#include "aut.h" +#include "abl.h" +#include "bdd.h" +#include "abe.h" + +typedef struct bvl_expr + { + char *IDENT; /* identifier or constant name */ + struct chain *LIST_ABL; /* pointer on bvl_abllst list */ + short WIDTH; /* width of bit vector */ + } +bvl_ablstr; + +#include "bvl_bspec.h" +#include "bvl_bedef.h" + +/* ###--------------------------------------------------------------### */ +/* function : bvl_addgen */ +/* description : create one or more BEGEN structures */ +/* For a scalar a BEGEN is created at the head of */ +/* existing BEGEN list. */ +/* For an array (including arraies of one element) a set */ +/* of BEGENs are created in a sorted list. BEGEN related */ +/* to the index i of the array is named `name(i)`. The */ +/* head of the list represents the right bound of the */ +/* array. This list is then chained to the head of */ +/* existing BEGEN list. */ +/* called func. : beh_addbegen, namealloc */ +/* ###--------------------------------------------------------------### */ + +struct begen *bvl_addgen (lastgeneric,nat_lst,nam_lst,type,left,right) + +struct begen *lastgeneric; /* pointer on the last begen structure */ +struct chain *nam_lst; /* generic's name list */ +struct chain *nat_lst; /* generic's value list */ +char *type; /* generic's type */ +short left; /* array's left bound (= -1 if scalar) */ +short right; /* array's right bound (= -1 if scalar) */ + + { + char extname[100]; + char *name; + struct begen *ptgen; + struct chain *ptauxnam; + struct chain *ptauxnat; + int i; + int inc = 1; + + ptgen = lastgeneric; + ptauxnam = nam_lst; + ptauxnat = nat_lst; + + if ((left == -1) && (right == -1)) + if ((ptauxnat != NULL) && (ptauxnat->NEXT == NULL)) + while (ptauxnam != NULL) + { + name = namealloc((char *)ptauxnam->DATA); + ptgen = beh_addbegen (ptgen,name,type,(void *)ptauxnat->DATA); + ptauxnam = ptauxnam->NEXT; + } + else + bvl_error(75,NULL); + else + { + if (left >= right) + inc = -1; + while (ptauxnam != NULL) + { + for (i=left ; i!=(right+inc) ; i+=inc) + { + sprintf (extname,"%s %d",(char *)ptauxnam->DATA,i); + name = namealloc(extname); + if (ptauxnat != NULL) + { + ptgen = beh_addbegen (ptgen,name,type,(void *)ptauxnat->DATA); + ptauxnat = ptauxnat->NEXT; + } + else + bvl_error(75,NULL); + } + if (ptauxnat != NULL) + bvl_error (75,NULL); + ptauxnat = nat_lst; + ptauxnam = ptauxnam->NEXT; + } + } + return (ptgen); + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_cpyabllst */ +/* description : duplicate bvl_abllst structure */ +/* called func. : addchain, reverse, dupablexpr */ +/* ###--------------------------------------------------------------### */ + +struct chain *bvl_cpyabllst (abllst) + +struct chain *abllst; + { + struct chain *pt_abllst = NULL; + + while (abllst != NULL) + { + pt_abllst = addchain (pt_abllst,dupablexpr((struct chain *)abllst->DATA)); + abllst = abllst->NEXT; + } + pt_abllst = reverse (pt_abllst); + return (pt_abllst); + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_cpyablstr */ +/* description : duplicate bvl_ablstr structure */ +/* called func. : mbkalloc , bvl_cpyabllst */ +/* ###--------------------------------------------------------------### */ + +bvl_ablstr bvl_cpyablstr (ablstr) + +bvl_ablstr ablstr; + { + bvl_ablstr pt_ablstr; + + pt_ablstr.IDENT = NULL; + pt_ablstr.WIDTH = ablstr.WIDTH; + pt_ablstr.LIST_ABL = bvl_cpyabllst (ablstr.LIST_ABL); + return (pt_ablstr); + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_crtabl */ +/* description : combine at most two ABLs and build a new one */ +/* The following operations can be performed : */ +/* CONC perform concatenation */ +/* NOPI initialize a structure for a signal (scalar */ +/* or array) */ +/* NOPS initialize a structure for a literal */ +/* NE create a structure with an ABL representing */ +/* the 'non equality' of two expressions */ +/* EQ create a structure with an ABL representing */ +/* the 'equality' of two expressions */ +/* NOT perform logical not of an expression */ +/* AND perform logical and between two expressions*/ +/* OR perform logical or between two expressions*/ +/* NAND perform logical nand between two expressions*/ +/* NOR perform logical nor between two expressions*/ +/* XOR perform logical xor between two expressions*/ +/* ANDM perform logical and between two expressions*/ +/* (the second expression is a scalar) */ +/* called func. : createablatom , createabloper, addablqexpr , beh_toolbug, */ +/* bvl_error , addchain , freechain */ +/* ###--------------------------------------------------------------### */ + +bvl_ablstr bvl_crtabl ( oper, expr1, expr2, left, right ) + +short oper; +bvl_ablstr expr1; +bvl_ablstr expr2; +int left; +int right; + + { + char name[256]; + char *name2; + struct chain *pt_abl1; + struct chain *pt_abl2; + struct chain *pt_aux1; + struct chain *pt_aux2; + bvl_ablstr result; + char lcl_buffer[256]; + short inc; + short i; + char true_flag_un = 0; + char true_flag_zero = 0; + + struct chain *abl_un = createablatom("'1'"); + struct chain *abl_zero = createablatom("'0'"); + result.IDENT = NULL; + result.LIST_ABL = NULL; + result.WIDTH = 0; + + switch (oper) + { + case CONC : + if ((expr1.LIST_ABL == NULL) || (expr2.LIST_ABL == NULL)) + beh_toolbug (4,"bvl_crtabl",NULL,0); + else + { + if (expr1.LIST_ABL == expr2.LIST_ABL) + beh_toolbug (16,"bvl_crtabl",NULL,0); + else + { + pt_aux2 = expr2.LIST_ABL; + while (pt_aux2->NEXT != NULL) + pt_aux2 = pt_aux2->NEXT; + + pt_aux2->NEXT = expr1.LIST_ABL; + + result.LIST_ABL = expr2.LIST_ABL; + result.WIDTH = expr1.WIDTH + expr2.WIDTH; + + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + } + break; + + case NOPI : + if ( expr1.IDENT == NULL ) + beh_toolbug (2,"bvl_crtabl",NULL,0); + else + { + if ((left == -1) && (right == -1)) + { + result.LIST_ABL = addchain(result.LIST_ABL,createablatom(expr1.IDENT)); + result.WIDTH = 1; + } + else + { + if (left <= right) + { + inc = 1; + result.WIDTH = right - left + 1; + } + else + { + inc = -1; + result.WIDTH = left - right + 1; + } + + for (i=left ; i!=(right+inc) ; i+=inc) + { + sprintf (name,"%s %i",expr1.IDENT,i); + name2 = namealloc (name); + result.LIST_ABL = addchain (result.LIST_ABL,createablatom(name2)); + } + } + expr1.IDENT = NULL; + } + break; + + case NOPS : + if ( expr1.IDENT == NULL ) + beh_toolbug (2,"bvl_crtabl",NULL,0); + else + { + bvl_tobin (lcl_buffer,expr1.IDENT,-1,-1); + if ((left == -1) && (right == -1)) + { + left = 0; + right = strlen (lcl_buffer) - 1; + } + + for (i=left ; i<=right ; i++) + { + switch ( lcl_buffer[i] ) + { + case '0' : + result.LIST_ABL = addchain (result.LIST_ABL,createablatom("'0'")); + break; + case '1' : + result.LIST_ABL = addchain (result.LIST_ABL,createablatom("'1'")); + break; +/*----------- Beware Not VHDL -------------*/ + case 'd' : + result.LIST_ABL = addchain (result.LIST_ABL,createablatom("'D'")); + break; + default : + beh_toolbug (15,"bvl_crtabl",NULL,expr1.IDENT[i]); + } + } + result.WIDTH = right - left + 1; + } + break; + + case ABL_STABLE : + if (expr1.LIST_ABL == NULL) + beh_toolbug (3,"bvl_crtabl",NULL,0); + else + { + pt_aux1 = expr1.LIST_ABL; + while (pt_aux1 != NULL) + { + pt_abl1 = createabloper (ABL_STABLE); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + pt_aux1->DATA = pt_abl1; + pt_aux1 = pt_aux1->NEXT; + } + + result.LIST_ABL = expr1.LIST_ABL; + result.WIDTH = expr1.WIDTH; + + expr1.LIST_ABL = NULL; + } + break; + + case ABL_NOT : + if (expr1.LIST_ABL == NULL) + beh_toolbug (3,"bvl_crtabl",NULL,0); + else + { + pt_aux1 = expr1.LIST_ABL; + while (pt_aux1 != NULL) + { + pt_abl1 = createabloper (ABL_NOT); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + pt_aux1->DATA = pt_abl1; + pt_aux1 = pt_aux1->NEXT; + } + + result.LIST_ABL = expr1.LIST_ABL; + result.WIDTH = expr1.WIDTH; + + expr1.LIST_ABL = NULL; + } + break; + + case EQ : + if ((expr1.LIST_ABL == NULL) || (expr2.LIST_ABL == NULL)) + beh_toolbug (4,"bvl_crtabl",NULL,0); + else + { + if (expr1.WIDTH != expr2.WIDTH) + { + bvl_error (38,NULL); + pt_abl2 = createablatom ("'1'"); + + pt_aux1 = expr1.LIST_ABL; + while (pt_aux1 != NULL) + { + freeablexpr (pt_aux1->DATA); + pt_aux1 = pt_aux1->NEXT; + } + pt_aux2 = expr2.LIST_ABL; + while (pt_aux2 != NULL) + { + freeablexpr (pt_aux2->DATA); + pt_aux2 = pt_aux2->NEXT; + } + } + else + { + pt_aux1 = expr1.LIST_ABL; + pt_aux2 = expr2.LIST_ABL; +# if 0 + /* If expr2 = '1' then return expr1 */ + while(pt_aux2 != NULL) + { + true_flag_un = 1; + if(!isablequalexpr(pt_aux2->DATA,abl_un)) + { + /* One abl not abl_un */ + true_flag_un = 0; + break; + } + pt_aux2 = pt_aux2->NEXT; + } + if(true_flag_un == 1) + { + pt_abl1 = (struct chain *)pt_aux1->DATA; + pt_aux1 = pt_aux1->NEXT; + if(pt_aux1 != NULL) + { + pt_abl2 = createabloper(ABL_AND); + addablqexpr(pt_abl2,pt_abl1); + pt_abl1 = pt_abl2; + } + while(pt_aux1 != NULL) + { + addablqexpr(pt_abl1,(struct chain *)pt_aux1->DATA); + pt_aux1 = pt_aux1->NEXT; + } + result.LIST_ABL = addchain(result.LIST_ABL,pt_abl1); + result.WIDTH = 1; + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + /* If expr2 = '0' then return NOT(expr1) */ + pt_aux2 = expr2.LIST_ABL; + true_flag_zero = 0; + while(pt_aux2 != NULL) + { + true_flag_zero = 1; + if(!isablequalexpr(pt_aux2->DATA,abl_zero)) + { + /* One abl not abl_zero */ + true_flag_zero = 0; + break; + } + pt_aux2 = pt_aux2->NEXT; + } + if(true_flag_zero == 1) + { + while(pt_aux1 != NULL) + { + pt_abl1 = createabloper(ABL_NOT); + addablqexpr(pt_abl1,(struct chain *)pt_aux1->DATA); + pt_aux1 = pt_aux1->NEXT; + if(pt_aux1 != NULL) + { + pt_abl2 = createabloper(ABL_AND); + addablqexpr(pt_abl2,pt_abl1); + pt_abl1 = pt_abl2; + } + while(pt_aux1 != NULL) + { + pt_abl2 = createabloper(ABL_NOT); + addablqexpr(pt_abl2,(struct chain *)pt_aux1->DATA); + addablqexpr(pt_abl1,pt_abl2); + pt_aux1 = pt_aux1->NEXT; + } + /* --pt_abl1 = createabloper(ABL_NOT); + addablqexpr(pt_abl1,(struct chain *)pt_aux1->DATA); + pt_aux1->DATA = pt_abl1; + pt_aux1 = pt_aux1->NEXT; + --- */ + } + result.LIST_ABL = addchain(result.LIST_ABL,pt_abl1); + result.WIDTH = 1; + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + pt_aux2 = expr2.LIST_ABL; + if((true_flag_zero == 0) && (true_flag_un == 0)) +# endif + { + pt_abl1 = createabloper (ABL_XOR); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + addablqexpr (pt_abl1, (struct chain *)pt_aux2->DATA); + + pt_aux1 = pt_aux1->NEXT; + pt_aux2 = pt_aux2->NEXT; + + while (pt_aux1 != NULL) + { + pt_abl2 = createabloper (ABL_OR); + addablqexpr (pt_abl2,pt_abl1); + + pt_abl1 = createabloper (ABL_XOR); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + addablqexpr (pt_abl1, (struct chain *)pt_aux2->DATA); + + addablqexpr (pt_abl2, pt_abl1); + pt_abl1 = pt_abl2; + + pt_aux1 = pt_aux1->NEXT; + pt_aux2 = pt_aux2->NEXT; + } + pt_abl2 = createabloper (ABL_NOT); + addablqexpr (pt_abl2, pt_abl1); + + result.LIST_ABL = addchain (result.LIST_ABL,pt_abl2); + result.WIDTH = 1; + freechain (expr1.LIST_ABL); + freechain (expr2.LIST_ABL); + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + } + } + break; + + case NE : + + if ((expr1.LIST_ABL == NULL) || (expr2.LIST_ABL == NULL)) + beh_toolbug (4,"bvl_crtabl",NULL,0); + else + { + if (expr1.WIDTH != expr2.WIDTH) + { + bvl_error(38,NULL); + pt_abl1 = createablatom ("'1'"); + + pt_aux1 = expr1.LIST_ABL; + while (pt_aux1 != NULL) + { + freeablexpr (pt_aux1->DATA); + pt_aux1 = pt_aux1->NEXT; + } + pt_aux2 = expr2.LIST_ABL; + while (pt_aux2 != NULL) + { + freeablexpr (pt_aux2->DATA); + pt_aux2 = pt_aux2->NEXT; + } + } + else + { + pt_aux1 = expr1.LIST_ABL; + pt_aux2 = expr2.LIST_ABL; + +# if 0 + /* If expr2 = '0' then return expr1 */ + while(pt_aux2 != NULL) + { + true_flag_zero = 1; + if(!isablequalexpr(pt_aux2->DATA,abl_zero)) + { + /* One abl not abl_zero */ + true_flag_zero = 0; + break; + } + pt_aux2 = pt_aux2->NEXT; + } + if(true_flag_zero == 1) + { + result.LIST_ABL = expr1.LIST_ABL; + result.WIDTH = 1; + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + /* If expr2 = '1' then return NOT(expr1) */ + pt_aux2 = expr2.LIST_ABL; + true_flag_un = 0; + while(pt_aux2 != NULL) + { + true_flag_un = 1; + if(!isablequalexpr(pt_aux2->DATA,abl_un)) + { + /* One abl not abl_un */ + true_flag_un = 0; + break; + } + pt_aux2 = pt_aux2->NEXT; + } + if(true_flag_un == 1) + { + while(pt_aux1 != NULL) + { + pt_abl1 = createabloper(ABL_NOT); + addablqexpr(pt_abl1,(struct chain *)pt_aux1->DATA); + pt_aux1->DATA = pt_abl1; + pt_aux1 = pt_aux1->NEXT; + } + result.LIST_ABL = expr1.LIST_ABL; + result.WIDTH = 1; + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + + + pt_aux2 = expr2.LIST_ABL; + if((true_flag_zero == 0) && (true_flag_un == 0)) +# endif + { + pt_abl1 = createabloper (ABL_XOR); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + addablqexpr (pt_abl1, (struct chain *)pt_aux2->DATA); + + pt_aux1 = pt_aux1->NEXT; + pt_aux2 = pt_aux2->NEXT; + + for (i=2 ; i<=expr1.WIDTH ; i++) + { + pt_abl2 = createabloper (ABL_OR); + addablqexpr (pt_abl2, pt_abl1); + + pt_abl1 = createabloper (ABL_XOR); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + addablqexpr (pt_abl1, (struct chain *)pt_aux2->DATA); + + addablqexpr (pt_abl2, pt_abl1); + pt_abl1 = pt_abl2; + + pt_aux1 = pt_aux1->NEXT; + pt_aux2 = pt_aux2->NEXT; + } + result.LIST_ABL = addchain(result.LIST_ABL,pt_abl1); + result.WIDTH = 1; + freechain (expr1.LIST_ABL); + freechain (expr2.LIST_ABL); + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + } + } + break; + + case ABL_AND : + case ABL_NAND : + case ABL_OR : + case ABL_NOR : + case ABL_XOR : + + if (expr1.LIST_ABL == NULL) + { + if (expr2.LIST_ABL == NULL) + beh_toolbug (4,"bvl_crtabl",NULL,0); + else + { + result.LIST_ABL = expr2.LIST_ABL; + result.WIDTH = expr2.WIDTH; + expr2.LIST_ABL = NULL; + } + } + else + { + if (expr2.LIST_ABL == NULL) + { + result.LIST_ABL = expr1.LIST_ABL; + result.WIDTH = expr1.WIDTH; + expr1.LIST_ABL = NULL; + } + else + { + if (expr1.LIST_ABL == expr2.LIST_ABL) + beh_toolbug (16,"bvl_crtabl",NULL,0); + else + { + if (expr1.WIDTH != expr2.WIDTH) + { + bvl_error(38,NULL); + } + else + { + pt_aux1 = expr1.LIST_ABL; + pt_aux2 = expr2.LIST_ABL; + + for (i=1 ; i<=expr1.WIDTH ; i++) + { + pt_abl1 = createabloper (oper); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + addablqexpr (pt_abl1, (struct chain *)pt_aux2->DATA); + + pt_aux1->DATA = (void *)pt_abl1; + + pt_aux1 = pt_aux1->NEXT; + pt_aux2 = pt_aux2->NEXT; + } + } + result.LIST_ABL = expr1.LIST_ABL; + result.WIDTH = expr1.WIDTH; + freechain (expr2.LIST_ABL); + expr1.LIST_ABL = NULL; + expr2.LIST_ABL = NULL; + } + } + } + break; + + case ANDM : + if ((expr1.LIST_ABL == NULL) || (expr2.LIST_ABL == NULL)) + beh_toolbug (4,"bvl_crtabl",NULL,0); + else + { + if (expr2.WIDTH != 1) + { + bvl_error( 38,NULL); + } + else + { + pt_aux1 = expr1.LIST_ABL; + pt_aux2 = expr2.LIST_ABL; + while (pt_aux1 != NULL) + { + pt_abl1 = createabloper (ABL_AND); + addablqexpr (pt_abl1, (struct chain *)pt_aux1->DATA); + addablqexpr (pt_abl1, dupablexpr((struct chain *)pt_aux2->DATA)); + pt_aux1->DATA = (void *)pt_abl1; + + pt_aux1 = pt_aux1->NEXT; + } + } + result.LIST_ABL = expr1.LIST_ABL; + result.WIDTH = expr1.WIDTH; + pt_aux2 = expr2.LIST_ABL; + while (pt_aux2 != NULL) + { + freeablexpr (pt_aux2->DATA); + pt_aux2 = pt_aux2->NEXT; + } + freechain (expr2.LIST_ABL); + expr2.LIST_ABL = NULL; + expr1.LIST_ABL = NULL; + } + break; + + default : + beh_toolbug (1,"bvl_crtabl",NULL,0); + } + + return (result); + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_select */ +/* description : create an abl representing the choice in a selected */ +/* signal assignment and perform unicity verification */ +/* using BDDs. */ +/* called func. : bvl_tobin , convertlogbddnode , addInputCct , */ +/* substPhyExpr, initializeCct, getlogbddnodeterm, */ +/* bvl_error , getlogbddnodenot , applylogbddnode , */ +/* addchain , namealloc */ +/* ###--------------------------------------------------------------### */ + +extern bddcircuit *BvlBddCircuit; + +void bvl_select (result,pt_str, pt_bdd, pt_ablstr) + +bvl_ablstr *result; +struct chain *pt_str; /* pointer on a list of choices */ +bddnode **pt_bdd; /* used to check if a choice is legal */ +bvl_ablstr pt_ablstr; /* tested expression */ + + { + char binstr[256]; + int i; + struct chain *pt_auxabl; + bddnode *pt_bddres; + bddnode *pt_bddnew; + bddnode *pt_bddtmp; + bddnode *pt_bddaux; + char nomvar[10]; + struct chain *pt_newabl; + struct chain *pt_newabl2; + static int oth_flg=0; + static int last_width=0; + + result->LIST_ABL = NULL; + result->IDENT = NULL; + + pt_bddtmp = getlogbddnodezero(); + + if (*pt_bdd == NULL) + { + if (last_width < pt_ablstr.WIDTH) + { + for (; last_widthDATA,-1,-1); + if (oth_flg != 0) + { + bvl_error(30,NULL); + } + + if (strcmp("others", (char *)pt_str->DATA)) + { + pt_bddres = getlogbddnodeone(); + + if (strlen (binstr) != pt_ablstr.WIDTH) + { + bvl_error(38,NULL); + } + for (i=0 ; binstr[i]!='\0' ; i++) + { + pt_bddaux = getlogbddnodeterm(i+2); + if (binstr[i] == '0') + pt_bddaux = getlogbddnodenot (pt_bddaux); + pt_bddres = applylogbddnode (ABL_AND, pt_bddaux, pt_bddres); + } + pt_bddnew = applylogbddnode (ABL_OR,*pt_bdd,pt_bddres); + + if (*pt_bdd == pt_bddnew) + { + bvl_error(28,NULL); + } + + *pt_bdd = pt_bddnew; + } + else + { + oth_flg = 1; + pt_bddres = getlogbddnodenot (*pt_bdd); + *pt_bdd = getlogbddnodeone(); + } + pt_bddtmp = applylogbddnode (ABL_OR,pt_bddtmp,pt_bddres); + pt_str = pt_str->NEXT; + } + + pt_newabl = convertlogbddnode (BvlBddCircuit, pt_bddtmp); + + pt_auxabl = pt_ablstr.LIST_ABL; + i = pt_ablstr.WIDTH - 1; + while (pt_auxabl != NULL) + { + sprintf (nomvar,"(%i)",i); +/*-------- + substPhyExpr (pt_newabl,namealloc(nomvar),(struct chain *)pt_auxabl->DATA); +---------*/ + pt_newabl2 = substdupablexpr (pt_newabl,namealloc(nomvar), + (struct chain *)pt_auxabl->DATA); + freeablexpr (pt_newabl); + pt_newabl = pt_newabl2; + + i--; + pt_auxabl = pt_auxabl->NEXT; + } + result->LIST_ABL = addchain (NULL, pt_newabl); + result->WIDTH = 1; + + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_tobin */ +/* description : transform a StringLit, BitStringLit or CharacterLit */ +/* in a string of '0' and '1's */ +/* ###--------------------------------------------------------------### */ + +int bvl_tobin (trg,src,left,right) + +char *trg; +char *src; +int left; +int right; + + { + char base; + int indx; + int j = 0; + int errflg = 0; + char lcl_trg[256]; + + lcl_trg[0] = '\0'; + + if (src == NULL) + { + strcpy (trg,"0"); + } + else + { + if (!strcmp (src,"others")) + { + strcpy(trg,src); + } + else + { + if ((src[0] != '\'') && (src[0] != '"') && (src[0] != '%')) + { + base = src[0]; + indx = 2; + } + else + { + base = 'B'; + indx = 1; + } + + switch (base) + { + case 'B' : + case 'b' : + while ((lcl_trg[j] = src[indx]) != '\0') + { + switch (src[indx]) + { + case '0': + case '1': + case 'd': /* Beware Not VHDL */ + j++; break; + + case '%' : + case '"' : + case '\'': + case '_' : + break; + + default : + errflg = 1; bvl_error(73,src); + } + indx++; + } + break; + + case 'O' : + case 'o' : + while (src[indx] != '\0') + { + j += 3; + switch (src[indx]) + { + case '0' : + strcat (lcl_trg,"000"); break; + case '1' : + strcat (lcl_trg,"001"); break; + case '2' : + strcat (lcl_trg,"010"); break; + case '3' : + strcat (lcl_trg,"011"); break; + case '4' : + strcat (lcl_trg,"100"); break; + case '5' : + strcat (lcl_trg,"101"); break; + case '6' : + strcat (lcl_trg,"110"); break; + case '7' : + strcat (lcl_trg,"111"); break; + case '"' : + case '%' : + case '_' : + j -= 3; break; + default : + j -= 3; errflg = 1; bvl_error(73,src); + } + indx++; + } + break; + + case 'X' : + case 'x' : + while (src[indx] != '\0') + { + j += 4; + switch (src[indx]) + { + case '0' : + strcat (lcl_trg,"0000"); break; + case '1' : + strcat (lcl_trg,"0001"); break; + case '2' : + strcat (lcl_trg,"0010"); break; + case '3' : + strcat (lcl_trg,"0011"); break; + case '4' : + strcat (lcl_trg,"0100"); break; + case '5' : + strcat (lcl_trg,"0101"); break; + case '6' : + strcat (lcl_trg,"0110"); break; + case '7' : + strcat (lcl_trg,"0111"); break; + case '8' : + strcat (lcl_trg,"1000"); break; + case '9' : + strcat (lcl_trg,"1001"); break; + case 'a' : + case 'A' : + strcat (lcl_trg,"1010"); break; + case 'b' : + case 'B' : + strcat (lcl_trg,"1011"); break; + case 'c' : + case 'C' : + strcat (lcl_trg,"1100"); break; + case 'd' : + case 'D' : + strcat (lcl_trg,"1101"); break; + case 'e' : + case 'E' : + strcat (lcl_trg,"1110"); break; + case 'f' : + case 'F' : + strcat (lcl_trg,"1111"); break; + case '%' : + case '"' : + case '_' : + j -= 4; break; + default : + j -= 4; errflg = 1; bvl_error(73,src); + } + indx++; + } + break; + + default : + beh_toolbug (17,"bvl_tobin",NULL,base); + } + + if ((j == 0) || (j <= right)) + { + trg[0] = '0'; + trg[1] = '\0'; + } + else + { + if (left != -1) + { + strcpy (trg, &lcl_trg[left]); + trg[right - left + 1] = '\0'; + } + else + strcpy (trg, lcl_trg); + } + } + } + + return (errflg); + } diff --git a/alliance/src/abv/src/bvl_bspec.h b/alliance/src/abv/src/bvl_bspec.h new file mode 100644 index 00000000..36483c73 --- /dev/null +++ b/alliance/src/abv/src/bvl_bspec.h @@ -0,0 +1,46 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_bspec.h */ +/* date : Jun 15 1992 */ +/* author : TABUSSE L.A. */ +/* content : declaration of functions and global variables used by */ +/* bvl_bspec.c */ +/* */ +/* ###--------------------------------------------------------------### */ + +extern bvl_ablstr BVL_EMPSTR; + +struct begen *bvl_addgen (); +struct chain *bvl_cpyabllst (); +bvl_ablstr bvl_cpyablstr (); +bvl_ablstr bvl_crtabl (); +void bvl_select (); +extern void bvl_error(); +extern int bvl_tobin(); diff --git a/alliance/src/abv/src/bvl_byacc.h b/alliance/src/abv/src/bvl_byacc.h new file mode 100644 index 00000000..9ab1c044 --- /dev/null +++ b/alliance/src/abv/src/bvl_byacc.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_byacc.h */ +/* date : Oct 4 1993 */ +/* version : v108 */ +/* author : Pirouz BAZARGAN SABET */ +/* content : declaration of external functions and global variables*/ +/* used by yacc */ +/* */ +/* ###--------------------------------------------------------------### */ + +typedef struct bvl_expr + { + char *IDENT; /* identifier or constant name */ + struct chain *LIST_ABL; /* pointer on bvl_abllst list */ + short WIDTH; /* width of bit vector */ + } +bvl_ablstr; + +typedef struct + { + char *NAME; /* identifier name */ + short LEFT; /* vector's left index */ + short RIGHT; /* vector's right index */ + char FLAG; /* scalar ('S') or array 'A' */ + } +bvl_name; + +struct g_type + { + int VALU; + char FLAG; + }; + +struct bddnode *BVL_BDDPNT; /* BDD pointer */ +char *BVL_MODNAM; /* curnennt model name */ +bvl_ablstr BVL_SLCEXP; /* structure filled with the */ +bvl_ablstr BVL_EMPSTR; /* empty structure used with NOT*/ + +extern int BVL_AUXMOD; /* simplify internal sig (= 1) */ + +static char *BVL_LBLNAM = NULL; /* label */ +static struct chain *BVL_NM1LST = NULL; /* 1-st name liste */ +static struct chain *BVL_GRDLST = NULL; /* list of guard's ABL */ +static struct chain *BVL_CNDLST = NULL; /* list of conditions (ABL) */ +static struct chain *BVL_VALLST = NULL; /* list of waveforms (ABL) */ +static struct befig *BVL_BEFPNT = NULL; /* current BEFIG pointer */ + +static struct beden **dic = NULL; /* dictionary */ + +struct chain *BVL_INTLST = NULL; +struct begen *BVL_GENPNT = NULL; + +extern char BVL_ERRFLG; /* set to 1 in case of error */ +extern struct befig *BVL_HEDFIG; /* head of befigs */ + +extern struct begen *bvl_addgen(); + +extern bvl_ablstr bvl_crtabl(); +extern bvl_ablstr bvl_cpyablstr(); +extern void bvl_select(); +extern void bvl_error(); +extern void *addstr (); diff --git a/alliance/src/abv/src/bvl_drive.c b/alliance/src/abv/src/bvl_drive.c new file mode 100644 index 00000000..c9e1c1ed --- /dev/null +++ b/alliance/src/abv/src/bvl_drive.c @@ -0,0 +1,553 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_drive.c */ +/* date : May 31 1994 */ +/* version : v109 */ +/* author : VUONG H.N. */ +/* description : This file contains VHDL drivers : */ +/* vhdlsavebefig() */ +/* */ +/* ###--------------------------------------------------------------### */ + +#include +#include +#include +#include +#include "mut.h" +#include "aut.h" +#include "abl.h" +#include "abe.h" +#include "abv.h" +#include "bvl_utype.h" +#include "bvl_utdef.h" +#include "bvl_drive.h" +#include "bvl_util.h" + +/* ###--------------------------------------------------------------### */ +/* function : vhdlsavebefig */ +/* description : print out a text file containing a data-flow VHDL */ +/* description */ +/* called func. : vhdlablname, mbkalloc, beh_message, beh_error , */ +/* beh_toolbug , getptype, reverse , bvl_abl2str */ +/* */ +/* ###--------------------------------------------------------------### */ + +void vhdlsavebefig (pthedbefig, trace_mode) + +struct befig *pthedbefig; +int trace_mode; + + { + char *suffix; + char *str; + char *mode; + char *type_mark; + int nrlabel = 0; + FILE *fd; + time_t clock; + int left,right; + char *name; + char *bus; + + struct begen *ptgeneric = NULL; /* current ptype pnt (generic) */ + struct bereg *ptbereg = NULL; /* current BEREG pointer */ + struct bemsg *ptbemsg = NULL; /* current BEMSG pointer */ + struct beout *ptbeout = NULL; /* current BEOUT pointer */ + struct bebus *ptbebus = NULL; /* current BEBUS pointer */ + struct beaux *ptbeaux = NULL; /* current BEAUX pointer */ + struct bebux *ptbebux = NULL; /* current BEBUX pointer */ + struct bepor *ptbepor = NULL; /* correctly ordered port list */ + struct biabl *ptbiabl = NULL; /* current BIABL pointer */ + + if (pthedbefig == NULL) + beh_toolbug (10,"bvl_decomp",NULL,0); + + if ((str = mbkgetenv ("VH_BEHSFX")) != NULL) + suffix = strtok (str, ":"); + else + suffix = "vbe"; + + /* ###------------------------------------------------------### */ + /* Opening result file */ + /* ###------------------------------------------------------### */ + + if ((fd = mbkfopen (pthedbefig->NAME, suffix, WRITE_TEXT)) == NULL) + { + beh_error (107, NULL); + autexit (1); + } + + if (trace_mode & ABV_TRACE_MASK) + beh_message (13, pthedbefig->NAME); + + time (&clock); + (void) fprintf (fd,"-- VHDL data flow description generated from `%s`\n", + pthedbefig->NAME); + (void) fprintf (fd, "--\t\tdate : %s\n\n", ctime(&clock)); + + /* ###------------------------------------------------------### */ + /* Entity declaration */ + /* ###------------------------------------------------------### */ + + (void) fprintf (fd,"-- Entity Declaration\n\n"); + (void) fprintf (fd,"ENTITY %s IS\n",vhdlablname(pthedbefig->NAME)); + + /* ###------------------------------------------------------### */ + /* Generic declaration */ + /* ###------------------------------------------------------### */ + + if ((ptgeneric = pthedbefig->BEGEN) != NULL) + { + ptgeneric = (struct begen *) reverse ((chain_list *)ptgeneric); + + (void) fprintf (fd," GENERIC (\n"); + while (ptgeneric != NULL) + { + (void)fprintf (fd," CONSTANT %s : NATURAL := %ld", + vhdlablname(ptgeneric->NAME),*((long *)ptgeneric->VALUE)); + if (ptgeneric->NEXT != NULL) + (void)fprintf(fd,";\t-- %s\n",(char *)ptgeneric->NAME); + else + (void)fprintf(fd,"\t-- %s\n",(char *)ptgeneric->NAME); + + ptgeneric = ptgeneric->NEXT; + } + (void) fprintf (fd," );\n"); + } + + /* ###------------------------------------------------------### */ + /* Port declaration */ + /* ###------------------------------------------------------### */ + + ptbepor = pthedbefig->BEPOR; + if (ptbepor != NULL) + { + (void) fprintf (fd," PORT (\n"); + pthedbefig->BEPOR = (struct bepor *)reverse ((chain_list *)pthedbefig->BEPOR); + + ptbepor = pthedbefig->BEPOR; + while (ptbepor != NULL) + { + switch (ptbepor->DIRECTION) + { + case 'I': + mode = namealloc("IN"); + break; + case 'O': + case 'Z': + mode = namealloc("OUT"); + break; + case 'B': + case 'T': + mode = namealloc("INOUT"); + break; + default : + beh_error (69, ptbepor->NAME); + } + ptbepor = (bepor_list *) bvl_vectnam (ptbepor,&left,&right,&name,0); + + if(left != -1) + { + switch (ptbepor->TYPE) + { + case 'B': + type_mark = namealloc("BIT_VECTOR"); + bus = ""; + break; + case 'W': + type_mark = namealloc("WOR_VECTOR"); + bus = namealloc("BUS"); + break; + case 'M': + type_mark = namealloc("MUX_VECTOR"); + bus = namealloc("BUS"); + break; + default : + beh_error (68, ptbepor->NAME); + } + (void)fprintf(fd," %s : %s %s(%d %s %d) %s",vhdlablname(name), mode, + type_mark, left, (left>=right)?"DOWNTO":"TO",right,bus); + } + else + { + switch (ptbepor->TYPE) + { + case 'B': + type_mark = "BIT"; break; + case 'W': + type_mark = "WOR_BIT BUS"; break; + case 'M': + type_mark = "MUX_BIT BUS"; break; + default : + beh_error (68, ptbepor->NAME); + } + + (void) fprintf (fd," %s : %s %s",vhdlablname(name), + mode,type_mark); + } + + if (ptbepor->NEXT != NULL) + (void) fprintf (fd,";\t-- %s\n",name); + else + (void) fprintf (fd,"\t-- %s\n );\n",name); + + ptbepor = ptbepor->NEXT; + } + + pthedbefig->BEPOR = (struct bepor *)reverse ((chain_list *)pthedbefig->BEPOR); + } + + (void) fprintf (fd,"END %s;\n\n\n",vhdlablname(pthedbefig->NAME)); + + /* ###------------------------------------------------------### */ + /* Architecture declaration */ + /* ###------------------------------------------------------### */ + + (void) fprintf (fd,"-- Architecture Declaration\n\n"); + (void) fprintf (fd,"ARCHITECTURE behaviour_data_flow OF %s IS\n", + vhdlablname(pthedbefig->NAME)); + + /* ###------------------------------------------------------### */ + /* Treatment of the BEREG list */ + /* ###------------------------------------------------------### */ + + pthedbefig->BEREG = (struct bereg *)reverse((chain_list *)pthedbefig->BEREG); + ptbereg = pthedbefig->BEREG; + while (ptbereg != NULL) + { + ptbereg = (bereg_list *)bvl_vectnam(ptbereg,&left,&right,&name,2); + if(left != -1) + { + (void)fprintf(fd," SIGNAL %s : REG_VECTOR(%d %s %d) REGISTER;\t-- %s\n", + vhdlablname(name),left,(left>=right)?"DOWNTO":"TO", + right,name); + } + else + { + (void) fprintf (fd," SIGNAL %s : REG_BIT REGISTER;\t-- %s\n", + vhdlablname(name),name); + } + ptbereg = ptbereg->NEXT; + } + pthedbefig->BEREG = (struct bereg *)reverse((chain_list *)pthedbefig->BEREG); + + /* ###------------------------------------------------------### */ + /* Treatment of the BEBUX list */ + /* ###------------------------------------------------------### */ + + pthedbefig->BEBUX = (struct bebux *)reverse((chain_list *)pthedbefig->BEBUX); + ptbebux = pthedbefig->BEBUX; + while (ptbebux != NULL) + { + ptbebux = (bebux_list *)bvl_vectnam(ptbebux,&left,&right,&name,1); + if(left != -1) + { + switch (ptbebux->TYPE) + { + case 'W': + type_mark = namealloc("WOR_VECTOR"); + break; + case 'M': + type_mark = namealloc("MUX_VECTOR"); + break; + } + (void)fprintf(fd," SIGNAL %s : %s(%d %s %d) BUS;\t-- %s\n", + vhdlablname(name),type_mark,left,(left>=right)?"DOWNTO":"TO", + right,name); + } + else + { + switch (ptbebux->TYPE) + { + case 'W': + type_mark = namealloc("WOR_BIT"); + break; + case 'M': + type_mark = namealloc("MUX_BIT"); + break; + } + (void) fprintf (fd," SIGNAL %s : %s BUS;\t\t-- %s\n",vhdlablname(name), + type_mark,name); + } + ptbebux = ptbebux->NEXT; + } + pthedbefig->BEBUX = (struct bebux *)reverse((chain_list *)pthedbefig->BEBUX); + + pthedbefig->BEAUX = (struct beaux *)reverse((chain_list *)pthedbefig->BEAUX); + ptbeaux = pthedbefig->BEAUX; + while (ptbeaux != NULL) + { + ptbeaux = (beaux_list *)bvl_vectnam(ptbeaux,&left,&right,&name,3); + if(left != -1) + { + (void)fprintf(fd," SIGNAL %s : BIT_VECTOR(%d %s %d);\t-- %s\n", + vhdlablname(name),left,(left>=right)?"DOWNTO":"TO", + right,name); + } + else + { + (void) fprintf (fd," SIGNAL %s : BIT;\t\t-- %s\n", + vhdlablname(name),name); + } + ptbeaux = ptbeaux->NEXT; + } + pthedbefig->BEAUX = (struct beaux *)reverse((chain_list *)pthedbefig->BEAUX); + + (void) fprintf (fd,"\nBEGIN\n"); + + /* ###------------------------------------------------------### */ + /* Print out a concurrent assert statement for each BEMSG */ + /* ###------------------------------------------------------### */ + + ptbemsg = pthedbefig->BEMSG; + while (ptbemsg != NULL) + { + if (ptbemsg->LABEL != NULL) + (void)fprintf(fd," %s :", ptbemsg->LABEL); + + (void) fprintf (fd," ASSERT (" ); + bvl_printablfile(fd, ptbemsg->ABL ); + (void) fprintf (fd," = '1')\n" ); + +/*\ + buffer = bvl_abl2str (ptbemsg->ABL,buffer,&buff_size); + (void) fprintf (fd," ASSERT (%s = '1')\n", bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + + if (ptbemsg->MESSAGE != NULL) + (void) fprintf (fd," REPORT %s\n",ptbemsg->MESSAGE); + + if (ptbemsg->LEVEL == 'W') + (void) fprintf (fd," SEVERITY WARNING;"); + else + (void) fprintf (fd," SEVERITY ERROR;"); + + (void) fprintf (fd,"\n\n"); + ptbemsg = ptbemsg->NEXT; + } + + /* ###------------------------------------------------------### */ + /* Print out a concurrent signal assignment for each BEAUX */ + /* ###------------------------------------------------------### */ + + ptbeaux = pthedbefig->BEAUX; + while (ptbeaux != NULL) + { + if (ptbeaux->ABL != NULL) + { + (void) fprintf (fd," %s <= ",bvl_vectorize(ptbeaux->NAME)); + bvl_printablfile( fd, ptbeaux->ABL); + (void) fprintf (fd,";\n"); + +/*\ + buffer = bvl_abl2str (ptbeaux->ABL,buffer,&buff_size); + (void) fprintf (fd," %s <= %s;\n",bvl_vectorize(ptbeaux->NAME),bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_error (40, ptbeaux->NAME); + ptbeaux = ptbeaux->NEXT; + } + + /* ###------------------------------------------------------### */ + /* Print out a block statement with one guarded concurrent */ + /* signal assignment for each BIABL of each BEREG */ + /* ###------------------------------------------------------### */ + + ptbereg = pthedbefig->BEREG; + while (ptbereg != NULL) + { + ptbiabl = ptbereg->BIABL; + while (ptbiabl != NULL) + { + (void) fprintf (fd," label%d : BLOCK ",nrlabel); + if (ptbiabl->CNDABL != NULL) + { + (void) fprintf (fd,"(" ); + bvl_printablfile( fd, ptbiabl->CNDABL ); + (void) fprintf (fd," = '1')\n" ); + +/*\ + buffer = bvl_abl2str (ptbiabl->CNDABL,buffer,&buff_size); + (void) fprintf (fd,"(%s = '1')\n",bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_toolbug (19,"bvl_decomp",ptbereg->NAME,0); + + (void) fprintf (fd," BEGIN\n %s <= GUARDED ",bvl_vectorize(ptbereg->NAME)); + if (ptbiabl->VALABL != NULL) + { + bvl_printablfile( fd, ptbiabl->VALABL ); + (void)fprintf (fd,";\n" ); +/*\ + buffer = bvl_abl2str (ptbiabl->VALABL,buffer,&buff_size); + (void) fprintf (fd,"%s;\n",bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_toolbug (20,"bvl_decomp",ptbereg->NAME,0); + + (void) fprintf ( fd," END BLOCK label%d;\n",nrlabel); + ptbiabl = ptbiabl->NEXT; + nrlabel++; + } + + ptbereg = ptbereg->NEXT; + } + + /* ###------------------------------------------------------### */ + /* Print out a block statement with one guarded concurrent */ + /* signal assignment for each BIABL of each BEBUX */ + /* ###------------------------------------------------------### */ + + ptbebux = pthedbefig->BEBUX; + while (ptbebux != NULL) + { + ptbiabl = ptbebux->BIABL; + while (ptbiabl != NULL) + { + (void) fprintf (fd," label%d : BLOCK (",nrlabel); + if (ptbiabl->CNDABL != NULL) + { + bvl_printablfile( fd, ptbiabl->CNDABL ); + (void) fprintf (fd," = '1')\n" ); + +/*\ + buffer = bvl_abl2str (ptbiabl->CNDABL,buffer,&buff_size); + (void) fprintf (fd,"%s = '1')\n",bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_toolbug (19,"bvl_decomp",ptbebux->NAME,0); + + (void) fprintf (fd," BEGIN\n %s <= GUARDED ", + bvl_vectorize(ptbebux->NAME)); + if (ptbiabl->VALABL != NULL) + { + bvl_printablfile( fd, ptbiabl->VALABL ); + (void) fprintf (fd,";\n" ); +/*\ + buffer = bvl_abl2str (ptbiabl->VALABL,buffer,&buff_size); + (void) fprintf (fd,"%s;\n",bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_toolbug (20,"bvl_decomp",ptbebux->NAME,0); + + (void) fprintf (fd," END BLOCK label%d;\n",nrlabel); + ptbiabl = ptbiabl->NEXT; + nrlabel++; + } + + ptbebux = ptbebux->NEXT; + } + + /* ###------------------------------------------------------### */ + /* Print out a block statement with one guarded concurrent */ + /* signal assignment for each BIABL of each BEBUS */ + /* ###------------------------------------------------------### */ + + ptbebus = pthedbefig->BEBUS; + while (ptbebus != NULL) + { + ptbiabl = ptbebus->BIABL; + while (ptbiabl != NULL) + { + (void) fprintf (fd,"\tlabel%d : BLOCK (",nrlabel); + if (ptbiabl->CNDABL != NULL) + { + bvl_printablfile ( fd, ptbiabl->CNDABL ); + (void) fprintf (fd," = '1')\n" ); +/*\ + buffer = bvl_abl2str (ptbiabl->CNDABL,buffer,&buff_size); + (void) fprintf (fd,"%s = '1')\n",bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_toolbug (19,"bvl_decomp",ptbebus->NAME,0); + + (void) fprintf (fd,"\tBEGIN\n\t%s <= GUARDED ",bvl_vectorize(ptbebus->NAME)); + if (ptbiabl->VALABL != NULL) + { + bvl_printablfile( fd, ptbiabl->VALABL ); + (void) fprintf (fd,";\n" ); + +/*\ + buffer = bvl_abl2str (ptbiabl->VALABL,buffer,&buff_size); + (void) fprintf (fd,"%s;\n",bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_toolbug (20,"bvl_decomp",ptbebus->NAME,0); + + (void) fprintf (fd,"\tEND BLOCK label%d;\n",nrlabel); + ptbiabl = ptbiabl->NEXT; + nrlabel++; + } + + ptbebus = ptbebus->NEXT; + } + + /* ###------------------------------------------------------### */ + /* Print out a concurrent signal assignment for each BEOUT */ + /* ###------------------------------------------------------### */ + + ptbeout = pthedbefig->BEOUT; + while (ptbeout != NULL) + { + if (ptbeout->ABL != NULL) + { + (void) fprintf (fd,"\n%s <= ",bvl_vectorize(ptbeout->NAME) ); + bvl_printablfile( fd, ptbeout->ABL ); + (void) fprintf (fd,";\n" ); +/*\ + buffer = bvl_abl2str(ptbeout->ABL,buffer,&buff_size); + (void) fprintf (fd,"\n%s <= %s;\n",bvl_vectorize(ptbeout->NAME), bvl_printabl(buffer)); + buffer[0] = '\0'; +\*/ + } + else + beh_error (40, ptbeout->NAME); + + ptbeout = ptbeout->NEXT; + } + + (void) fprintf (fd,"END;\n"); + (void) fclose (fd); + } diff --git a/alliance/src/abv/src/bvl_drive.h b/alliance/src/abv/src/bvl_drive.h new file mode 100644 index 00000000..5d8741b6 --- /dev/null +++ b/alliance/src/abv/src/bvl_drive.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_drive.h */ +/* date : may 31 1994 */ +/* version : v109 */ +/* author : VUONG H.N. */ +/* content : declaration of functions and global variables used by */ +/* the behavioural decompiler */ +/* */ +/* ###--------------------------------------------------------------### */ + + +extern char *bvl_vhdlname(); +extern char *bvl_abl2str(); +extern char *bvl_printabl(); +extern void bvl_message(); +extern char *bvl_vectorize (); +extern void *bvl_vectnam (); diff --git a/alliance/src/abv/src/bvl_parse.c b/alliance/src/abv/src/bvl_parse.c new file mode 100644 index 00000000..fa2f4612 --- /dev/null +++ b/alliance/src/abv/src/bvl_parse.c @@ -0,0 +1,156 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU 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 : bvl_parse.c */ +/* date : jun 15 1994 */ +/* version : v109 */ +/* author : L.A TABUSSE & H.N. VUONG & P. BAZARGAN-SABET */ +/* description : Parser VHDL --> BEH */ +/* called Func. : mbkalloc */ +/* */ +/* ###--------------------------------------------------------------### */ + +#include +#include +#include "mut.h" +#include "aut.h" +#include "abl.h" +#include "bdd.h" +#include "abe.h" +#include "abv.h" +#include "bvl_utype.h" +#include "bvl_utdef.h" +#include "bvl_parse.h" + +/* ###--------------------------------------------------------------### */ +/* Function : vhdlloadbefig */ +/* Content : Parse a .vbe file to produce a befig */ +/* Return : a pointer on a befig */ +/* ###--------------------------------------------------------------### */ + +bddcircuit *BvlBddCircuit = (bddcircuit *)0; +bddsystem *BvlBddSystem = (bddsystem *)0; + +struct befig *vhdlloadbefig (pt_befig, figname, trace_mode) + +struct befig *pt_befig; +char *figname; +int trace_mode; + +{ + char *tok; + char *str; + struct chain *behsfx_lst = NULL; + struct chain *suffix = NULL; + static unsigned int call_nbr = 0; + bddsystem *SaveBddSystem; + bddcircuit *SaveBddCircuit; + + SaveBddSystem = BddLocalSystem; + SaveBddCircuit = BddLocalCircuit; + + if ( BvlBddSystem == (bddsystem *)0 ) + { + BvlBddSystem = createbddsystem( 50, 1000, 200, 50000000 ); + BvlBddCircuit = createbddcircuit( "-select-", 200, 0, BvlBddSystem ); + } + + BddLocalSystem = BvlBddSystem; + BddLocalCircuit = BvlBddCircuit; + + /* ###------------------------------------------------------### */ + /* Create list of suffix for behavioural files from the */ + /* environment variable VH_BEHSFX */ + /* ###------------------------------------------------------### */ + + if ((str = mbkgetenv ("VH_BEHSFX")) != NULL) + { + tok = strtok (str, ":"); + while (tok != NULL) + { + behsfx_lst = addchain (behsfx_lst, tok); + tok = strtok (NULL, ":"); + } + behsfx_lst = (struct chain *) reverse (behsfx_lst); + } + else + behsfx_lst = addchain (NULL, "vbe"); + + /* ###------------------------------------------------------### */ + /* Searching the root file */ + /* ###------------------------------------------------------### */ + + suffix = behsfx_lst; + while (suffix != NULL) + { + if ((bvl_y_in = mbkfopen (figname, suffix->DATA, READ_TEXT)) != NULL) + { + sprintf (BVL_CURFIL, "%s.%s", figname, (char *)suffix->DATA); + break; + } + suffix = suffix->NEXT; + } + + if (bvl_y_in == NULL) + { + beh_error (100, figname); + autexit (1); + } + + /* ###------------------------------------------------------### */ + /* Running the behavioural compiler on the current file */ + /* ###------------------------------------------------------### */ + + if ((trace_mode & ABV_TRACE_MASK) != 0) + beh_message (3, BVL_CURFIL); + + if ((trace_mode & ABV_KEEP_AUX_MASK) == 0) + BVL_AUXMOD = 0; + else + BVL_AUXMOD = 1; + + BVL_LINNUM = 1; + + if (call_nbr != 0) + bvl_y_restart (bvl_y_in); + call_nbr++; + + bvl_y_parse (); + fclose (bvl_y_in); + bvl_y_in = NULL; + +/*\ + resetbddcircuit( BvlBddCircuit ); + resetbddsystem( BvlBddSystem ); +\*/ + + BddLocalSystem = SaveBddSystem; + BddLocalCircuit = SaveBddCircuit; + + return (BVL_HEDFIG); +} diff --git a/alliance/src/abv/src/bvl_parse.h b/alliance/src/abv/src/bvl_parse.h new file mode 100644 index 00000000..85f8e045 --- /dev/null +++ b/alliance/src/abv/src/bvl_parse.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_parse.h */ +/* date : May 31 1994 */ +/* version : v109 */ +/* author : L.A. TABUSSE & H.G. VUONG & P. BAZARGAN-SABET */ +/* description : */ +/* */ +/* ###--------------------------------------------------------------### */ + +char BVL_ERRFLG = 0; /* if = 1 no structure is made */ +int BVL_LINNUM = 1; /* file's line number */ +int BVL_AUXMOD; /* simplify internal sig (= 1) */ +char BVL_CURFIL[200]; /* current file's name */ +befig_list *BVL_HEDFIG = NULL; + +extern FILE *bvl_y_in; +extern int bvl_y_parse(); +extern void bvl_y_restart(); + +extern char *getenv(); diff --git a/alliance/src/abv/src/bvl_utdef.h b/alliance/src/abv/src/bvl_utdef.h new file mode 100644 index 00000000..a1b77ad4 --- /dev/null +++ b/alliance/src/abv/src/bvl_utdef.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_utdef.h */ +/* date : Jun 18 1992 */ +/* version : v103 */ +/* author : L.A.TABUSSE */ +/* content : declaration of external functions and global variables*/ +/* used by yacc */ +/* */ +/* ###--------------------------------------------------------------### */ + +#define BVL_ICNDFN 1 /* input port */ +#define BVL_OCNDFN 2 /* output port */ +#define BVL_BCNDFN 3 /* inout port */ + +#define BVL_BITDFN 8 /* bit type */ +#define BVL_MUXDFN 16 /* mux_bit type */ +#define BVL_WORDFN 24 /* wor_bit type */ +#define BVL_RBIDFN 32 /* reg_bit type */ + +#define BVL_NORDFN 128 /* non guarded signal */ +#define BVL_BUSDFN 256 /* guarded signal (bus) */ +#define BVL_REGDFN 384 /* guarded signal (register)*/ + +#define BVL_NAMDFN 0 +#define BVL_NEWDFN 1 + +#define BVL_MODDFN 0 /* mod_val field of dct_recrd */ +#define BVL_SIGDFN 1 /* sig_val field of dct_recrd */ +#define BVL_CCNDFN 2 /* ccn_val field of dct_recrd */ +#define BVL_RNGDFN 3 /* rng_val field of dct_recrd */ +#define BVL_LBLDFN 4 /* lbl_val field of dct_recrd */ +#define BVL_WMXDFN 5 /* wmx_val field of dct_recrd */ +#define BVL_WMNDFN 6 /* wmn_val field of dct_recrd */ +#define BVL_PNTDFN 7 /* pnt_val field of dct_recrd */ + +#define BVL_MXRDFN 30 diff --git a/alliance/src/abv/src/bvl_util.c b/alliance/src/abv/src/bvl_util.c new file mode 100644 index 00000000..d37e4413 --- /dev/null +++ b/alliance/src/abv/src/bvl_util.c @@ -0,0 +1,706 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_util.c */ +/* date : Jan 18 1993 */ +/* version : v106 */ +/* author : Pirouz BAZARGAN SABET */ +/* description : This file contains some utility functions : */ +/* bvl_error , bvl_y_error */ +/* */ +/* ###--------------------------------------------------------------### */ + +#include +#include +#include +#include +#include "mut.h" +#include "aut.h" +#include "abl.h" +#include "abe.h" +#include "bvl_utype.h" +#include "bvl_util.h" +#include "bvl_utdef.h" + +/* ###--------------------------------------------------------------### */ +/* function : bvl_error */ +/* ###--------------------------------------------------------------### */ + +void bvl_error (code, str1) + +int code; +char *str1; + + { + BVL_ERRFLG++; + (void)fprintf (stderr,"`%s` Error %d line %d :",BVL_CURFIL,code,BVL_LINNUM); + + 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 (mode, type, kind)\n"); + 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 (type, kind)\n"); + 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 19: + (void) fprintf (stderr,"label `%s` already used\n",str1); + break; + case 20: + (void) fprintf (stderr,"`%s` is incompatible with the block's label\n",str1); + break; + case 21: + (void) fprintf (stderr,"input port `%s` cannot be assigned\n",str1); + break; + case 22: + (void) fprintf (stderr,"unguarded signal `%s` assigned by guarded assignment\n",str1); + break; + case 23: + (void) fprintf (stderr,"guarded signal `%s` assigned by unguarded assignment\n",str1); + break; + case 25: + (void) fprintf (stderr,"some choices missing in the selected signal assignment\n"); + break; + case 26: + (void) fprintf (stderr,"output port `%s` cannot be read\n",str1); + break; + case 28: + (void) fprintf (stderr,"duplicate choice in selected signal assignment\n"); + break; + case 30: + (void) fprintf (stderr,"illegal use of OTHERS in selected signal assignment\n"); + break; + case 32: + (void) fprintf (stderr,"null array not supported\n"); + break; + case 33: + (void) fprintf (stderr,"incompatible constraint and type\n"); + break; + case 35: + (void) fprintf (stderr,"illegal assignment of `%s` (widths mismatch)\n",str1); + 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 39: + (void) fprintf (stderr,"signal `%s` assigned more than once\n",str1); + break; + case 40: + (void) fprintf (stderr,"signal `%s` never assigned\n",str1); + break; + + case 68: + (void) fprintf (stderr,"BEPOR type is unknown\n"); + break; + case 73: + (void) fprintf (stderr,"`%s` is not a bit string litteral\n",str1); + break; + case 74: + (void) fprintf (stderr,"bad generic declaration\n"); + break; + case 75: + (void) fprintf (stderr,"bad generic element\n"); + break; + case 76: + (void) fprintf (stderr,"`%s`: when expression must be a constant\n",str1); + break; + case 77: + (void) fprintf (stderr,"illegal generic declaration (type, kind)\n"); + break; + case 78: + (void) fprintf (stderr,"illegal constant declaration (type, kind)\n"); + break; + case 79: + (void) fprintf (stderr,"illegal use of attribute STABLE on `%s`\n",str1); + break; + + default: + (void) fprintf (stderr,"syntax error\n"); + break; + } + + if (BVL_ERRFLG > BVL_MXRDFN) + { + (void) fprintf (stderr,"Too many errors. Cannot continue further more\n"); + (void) fprintf (stderr,"\n Have a nice day...\n"); + autexit (1); + } + + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_y_error */ +/* ###--------------------------------------------------------------### */ +void bvl_y_error (str) + +char *str; + { + BVL_ERRFLG++; + (void)fprintf (stderr,"`%s` Error line %d : %s\n",BVL_CURFIL,BVL_LINNUM,str); + } + +/* ###--------------------------------------------------------------### */ +/* function : vhdlablname */ +/* ###--------------------------------------------------------------### */ + +/*\ +char *vhdlablname (name) + +char *name; + + { + char *new_name; + char *prv_name; + char *tmp_name; + char buffer[200]; + int i,j,flag,number; + static struct beden **namtab=NULL; + static char *keywrd [] = { + "abs" , "access" , + "after" , "alias" , + "all" , "and" , + "architecture", "array" , + "assert" , "attribute" , + "begin" , "bit" , + "bit_vector" , "block" , + "body" , "buffer" , + "bus" , "case" , + "component" , "configuration", + "constant" , "disconnect" , + "downto" , "else" , + "elsif" , "end" , + "entity" , "error" , + "exit" , "file" , + "for" , "function" , + "generate" , "generic" , + "guarded" , "if" , + "in" , "inout" , + "is" , "label" , + "library" , "linkage" , + "loop" , "map" , + "mod" , "mux_bit" , + "mux_vector" , "nand" , + "natural" , "new" , + "next" , "nor" , + "not" , "null" , + "of" , "on" , + "open" , "or" , + "others" , "out" , + "package" , "port" , + "procedure" , "process" , + "range" , "record" , + "reg_bit" , "reg_vector" , + "register" , "rem" , + "report" , "return" , + "select" , "severity" , + "signal" , "stable" , + "subtype" , "then" , + "to" , "transport" , + "type" , "units" , + "until" , "use" , + "variable" , "wait" , + "warning" , "when" , + "while" , "with" , + "wor_bit" , "wor_vector" , + "xor" + }; + + if (namtab == NULL) + { + namtab = beh_initab (); + for (i=0 ; i<93 ; i++) + beh_addtab (namtab, namealloc (keywrd [i]), NULL, BVL_NEWDFN , 1); + } + + tmp_name = namealloc (name); + new_name = (char *) beh_chktab (namtab,tmp_name,NULL,BVL_PNTDFN); + + if (beh_chktab (namtab,tmp_name,NULL,BVL_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))) + flag = 0; + else + { + if (flag == 1) + buffer[j++] = 'v'; + buffer[j] = '_'; + flag = 1; + } + i++; + j++; + } + if (buffer[j-1] == '_') + buffer[j++] = '0'; + buffer[j] = '\0'; + new_name = namealloc (buffer); + + prv_name = new_name; + while (beh_chktab (namtab,new_name,NULL,BVL_NEWDFN) != 0) + { + new_name = prv_name; + sprintf (buffer,"%s_%d",new_name,number++); + prv_name = new_name; + new_name = namealloc (buffer); + } + beh_addtab (namtab,new_name,NULL,BVL_NEWDFN,1); + beh_addtab (namtab,tmp_name,NULL,BVL_PNTDFN,(long)new_name); + beh_addtab (namtab,tmp_name,NULL,BVL_NAMDFN,1); + } + + return (new_name); + } +\*/ + + +/* ###--------------------------------------------------------------### */ +/* function : bvl_vectorize */ +/* description : put parenthesis on element of bussed signals */ +/* called func. : mbkalloc */ +/* ###--------------------------------------------------------------### */ + +char *bvl_vectorize(name) + +char *name; + { + char *new_name ; + char tmp1 [256]; + int i = 0; + static struct beden **tab = NULL; + + if (tab == NULL) + tab = beh_initab (); + + if ((new_name = (char *) beh_chktab (tab, name, NULL, BVL_PNTDFN)) == NULL) + { + strcpy (tmp1, name); + + while ((name [i] != '\0') && (name [i] != ' ' ) && (name [i] != '\'')) + i ++; + + tmp1 [i] = '\0'; + new_name = vhdlablname (tmp1); + + if (name [i] != '\0') + { + if (name [i] == ' ') + sprintf (tmp1, "%s (%s)", new_name, &name[i+1]); + else + sprintf (tmp1, "%s'%s" , new_name, &name[i+1]); + new_name = namealloc (tmp1); + } + beh_addtab (tab, name, NULL, BVL_PNTDFN, new_name); + } + + return (new_name); + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_vectnam */ +/* analyze a list of signal and return the bounds of the vectorised */ +/* signals, if they occure. */ +/* ###--------------------------------------------------------------### */ + +void *bvl_vectnam(pt_list,left,right,name,type) + +void *pt_list; +int *left, *right; +char **name; +char type; /* If type = 0 bepor_list, type = 1 bebux_list */ + /* If type = 2 bereg_list, type = 3 beaux_list */ + + { + char *blank_space; + char *sig_name; + char name_tmp[200]; + char number[200]; + bepor_list *ptpor; + bebux_list *ptbux; + beaux_list *ptaux; + bereg_list *ptreg; + char END = 0; + + /* Case bepor_list */ + if(type==0) + { + ptpor = (bepor_list *)pt_list; + *left = *right = -1; + sig_name = ptpor->NAME; + *name = (char*)mbkalloc(strlen(sig_name) + 1); + strcpy(*name,sig_name); + blank_space = strchr(*name,' '); + if (blank_space != NULL) + { + strcpy(number,blank_space); + *left = atoi(number); + *right = *left; + *blank_space = '\0'; + } + + while(!END) + { + if(ptpor->NEXT != NULL) + { + strcpy(name_tmp,(ptpor->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); + ptpor = ptpor->NEXT; + } + else + END = 1; + } + else + END = 1; + } + else + END = 1; + } + return(ptpor); + } + + /*case bebux_list */ + if(type==1) + { + ptbux = (bebux_list *)pt_list; + /* Extract the name and number of an element */ + *left = *right = -1; + sig_name = ptbux->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(ptbux->NEXT != NULL) + { + strcpy(name_tmp,ptbux->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); + ptbux = ptbux->NEXT; + } + else + END = 1; + } + else + END = 1; + } + else + END = 1; + } + return(ptbux); + } + + /*case bereg_list */ + if(type==2) + { + ptreg = (bereg_list *)pt_list; + /* Extract the name and number of an element */ + *left = *right = -1; + sig_name = ptreg->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(ptreg->NEXT != NULL) + { + strcpy(name_tmp,ptreg->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); + ptreg = ptreg->NEXT; + } + else + END = 1; + } + else + END = 1; + } + else + END = 1; + } + return(ptreg); + } + + /*case beaux_list */ + if(type==3) + { + ptaux = (beaux_list *)pt_list; + /* Extract the name and number of an element */ + *left = *right = -1; + sig_name = ptaux->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(ptaux->NEXT != NULL) + { + strcpy(name_tmp,ptaux->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); + ptaux = ptaux->NEXT; + } + else + END = 1; + } + else + END = 1; + } + else + END = 1; + } + return(ptaux); + } + return( (void *)0 ); + } + +/* ###--------------------------------------------------------------### */ +/* function : bvl_printabl */ +/* content : put a \n for a better presentation of an abl */ +/* ###--------------------------------------------------------------### */ +/*\ +char *bvl_printabl(chaine) +char *chaine; + { + char *chaine_tmp = NULL; + char *blanc = NULL; + + chaine_tmp = chaine; + while(strlen(chaine_tmp)>60) + { + chaine_tmp = &chaine_tmp[60]; + blanc = strchr(chaine_tmp,' '); + if(blanc != NULL) + { + *blanc = '\n'; + chaine_tmp = blanc; + } + } + return(chaine); + } +\*/ + +void bvl_printablfile( AblFile, Expr ) + + FILE *AblFile; + chain_list *Expr; +{ + viewablexprfile( AblFile, Expr, ABL_VIEW_VHDL ); +} + +/* ###--------------------------------------------------------------### */ +/* function : bvl_abl2str */ +/* description : return a string corresponding to an expression */ +/* called func. : */ +/* ###--------------------------------------------------------------### */ + +char *bvl_abl2str (expr, chaine, size_pnt) + +struct chain *expr; /* expression */ +char *chaine; /* target string */ +int *size_pnt; /* size of available space */ + + { + int operator; + char *oper ; + struct chain *operand ; + static char *str_z = NULL; + static char *str_o = NULL; + static char *str_d = NULL; + + if (str_z == NULL) + { + str_z = namealloc ("'0'"); + str_o = namealloc ("'1'"); + str_d = namealloc ("'d'"); + } + + /* ###------------------------------------------------------### */ + /* if there is not enough space left allocate a bigger block */ + /* ###------------------------------------------------------### */ + + if (*size_pnt < (strlen (chaine) + 50)) + { + *size_pnt = *size_pnt + 256; + chaine = (char *) realloc (chaine, *size_pnt); + } + + /* ###------------------------------------------------------### */ + /* if the expression is a terminal (atom) add its name to */ + /* the previous string */ + /* ###------------------------------------------------------### */ + + if (expr->NEXT == NULL) + { + if ((expr->DATA == (void *) str_z) || + (expr->DATA == (void *) str_o) || + (expr->DATA == (void *) str_d) ) + strcat (chaine, expr->DATA); + else + strcat (chaine, bvl_vectorize (expr->DATA)); + } + + else + { + /* ###------------------------------------------------------### */ + /* if the expression is not a terminal : */ + /* - for unary operators (not, stable) add */ + /* "operator ( operand )" to the previous string */ + /* */ + /* - for binary operators (and, or, nor, xor, ...) add */ + /* "(operand operator operand operator operand ...)" */ + /* ###------------------------------------------------------### */ + + operator = (int) ((struct chain *) expr->DATA)->DATA; + operand = (struct chain *)expr->NEXT->DATA; + + if (operator == ABL_STABLE) + { + strcat (chaine, bvl_vectorize (operand->DATA)); + strcat (chaine, "'STABLE"); + } + else + { + if (operator == ABL_NOT) + { + strcat (chaine, "not ("); + chaine = bvl_abl2str (operand, chaine, size_pnt); + } + else + { + oper = getablopername (operator); + strcat (chaine,"("); + while ( (expr = expr->NEXT) != NULL ) + { + chaine = bvl_abl2str (expr->DATA, chaine, size_pnt); + if (expr->NEXT) + { + strcat (chaine, " "); + strcat (chaine, oper); + strcat (chaine, " "); + } + } + } + strcat (chaine, ")"); + } + } + + return (chaine); + } diff --git a/alliance/src/abv/src/bvl_util.h b/alliance/src/abv/src/bvl_util.h new file mode 100644 index 00000000..e8a2c962 --- /dev/null +++ b/alliance/src/abv/src/bvl_util.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_util.h */ +/* date : Jun 15 1992 */ +/* version : v102 */ +/* author : Pirouz BAZARGAN SABET */ +/* description : This file contains declaration of global and external */ +/* variables and, functions used in `bvl_util.c` */ +/* */ +/* ###--------------------------------------------------------------### */ + +extern int BVL_LINNUM; /* file's line number */ +extern char BVL_ERRFLG; /* Error flag */ +extern char BVL_CURFIL[]; /* current file name */ + +extern void bvl_printablfile(); +extern void *bvl_vectnam(); diff --git a/alliance/src/abv/src/bvl_utype.h b/alliance/src/abv/src/bvl_utype.h new file mode 100644 index 00000000..ce8e91ff --- /dev/null +++ b/alliance/src/abv/src/bvl_utype.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU Library General| +| Public License as published by the Free Software Foundation | +| either version 2 of the License, or (at your option) any | +| later version. | +| | +| Alliance VLSI CAD System is distributed in the hope that | +| it will be useful, but WITHOUT ANY WARRANTY; | +| without even the implied warranty of MERCHANTABILITY or | +| FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | +| Public License for more details. | +| | +| You should have received a copy of the GNU General Public | +| License along with the GNU C Library; see the file COPYING. | +| If not, write to the Free Software Foundation, Inc., | +| 675 Mass Ave, Cambridge, MA 02139, USA. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : bvl_utype.h */ +/* date : Jun 15 1992 */ +/* version : v102 */ +/* 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; + }; diff --git a/alliance/src/abv/src/main.c b/alliance/src/abv/src/main.c new file mode 100644 index 00000000..7cf57d77 --- /dev/null +++ b/alliance/src/abv/src/main.c @@ -0,0 +1,109 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam is free software; you can redistribute it | +| and/or modify it under the terms of the GNU 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 +# include + +# include "mut.h" +# include "aut.h" +# include "abl.h" +# include "abe.h" +# include "abv.h" + + +/*------------------------------------------------------------\ +| | +| Usage | +| | +\------------------------------------------------------------*/ + +void BvlUsage() +{ + fprintf( stderr, "\t\tabvtest [Options] Input_name\n\n" ); + fprintf( stdout, "\t\tOptions : -V Sets Verbose mode on\n" ); + fprintf( stdout, "\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char **argv; +{ + befig_list *Figure; + char *InputFileName; + int Number; + int Index; + char Option; + long Value; + + int FlagVerbose = 0; + + mbkenv(); + autenv(); + ablenv(); + + InputFileName = (char *)0; + + if ( argc < 2 ) BvlUsage(); + + InputFileName = (char *)0; + + for ( Number = 1; Number < argc; Number++ ) + { + if ( argv[ Number ][ 0 ] == '-' ) + { + for ( Index = 1; argv[ Number ][ Index ] != '\0'; Index++ ) + { + Option = argv[ Number ][ Index ]; + + switch ( Option ) + { + case 'V' : FlagVerbose = 1; + break; + default : BvlUsage(); + } + } + } + else + if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ]; + else + BvlUsage(); + } + + if ( InputFileName == (char *)0 ) BvlUsage(); + + Figure = vhdlloadbefig( NULL, InputFileName, 0); + + beh_frebefig( Figure ); +}