diff --git a/alliance/src/abv/Makefile.am b/alliance/src/abv/Makefile.am new file mode 100644 index 00000000..b120b78f --- /dev/null +++ b/alliance/src/abv/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/abv.h b/alliance/src/abv/abv.h new file mode 100644 index 00000000..6868369f --- /dev/null +++ b/alliance/src/abv/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/bvl_bcomp.l b/alliance/src/abv/bvl_bcomp.l new file mode 100644 index 00000000..ec31ea3f --- /dev/null +++ b/alliance/src/abv/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/bvl_bcomp.y b/alliance/src/abv/bvl_bcomp.y new file mode 100644 index 00000000..e425d42b --- /dev/null +++ b/alliance/src/abv/bvl_bcomp.y @@ -0,0 +1,2319 @@ +/*------------------------------------------------------------\ +| | +| 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_bcomp.yac */ +/* date : Oct 4 1993 */ +/* version : v108 */ +/* author : P. BAZARGAN, L.A. TABUSSE, VUONG H.N. */ +/* content : yacc rules for behavioural VHDL */ +/* */ +/* ###--------------------------------------------------------------### */ + +%{ +#include +#include +#include +#include "mut.h" +#include "aut.h" +#include "abl.h" +#include "bdd.h" +#include "abe.h" + +#include "bvl_utype.h" +#include "bvl_byacc.h" +#include "bvl_bedef.h" + +%} + +%union { + int valu; + char *text; + bvl_ablstr list; + bvl_name name; + struct g_type dble; + }; + +%token _AND +%token PRAGMA +%token _BEGIN +%token _END +%token _EQSym +%token _EXIT +%token _FILE +%token _GESym +%token _GTSym +%token _IN +%token _INOUT +%token _LABEL +%token _LESym +%token _LINKAGE +%token _LTSym +%token _NAND +%token _NESym +%token _NEXT +%token _NOR +%token _NOT +%token _NULL +%token _OR +%token _OUT +%token _XOR +%token ABS +%token ACCESS +%token AFTER +%token ALIAS +%token ALL +%token ARCHITECTURE +%token ARRAY +%token ASSERT +%token ATTRIBUTE +%token AbstractLit +%token Ampersand +%token Apostrophe +%token Arrow +%token BIT +%token BIT_VECTOR +%token _BLOCK +%token BODY +%token BUFFER +%token BUS +%token Bar +%token BasedInt +%token BasedReal +%token BitStringLit +%token Box +%token CASE +%token COMPONENT +%token CONFIGURATION +%token CONSTANT +%token CharacterLit +%token Colon +%token Comma +%token DISCONNECT +%token DOWNTO +%token DecimalInt +%token DecimalReal +%token Dot +%token DoubleStar +%token ELSE +%token ELSIF +%token ENTITY +%token ERROR +%token FOR +%token FUNCTION +%token GENERATE +%token GENERIC +%token GUARDED +%token IF +%token IS +%token Identifier +%token LIBRARY +%token LOOP +%token LeftParen +%token MAP +%token MOD +%token MUX_BIT +%token MUX_VECTOR +%token Minus +%token NATURAL +%token NATURAL_VECTOR +%token NEW +%token OF +%token ON +%token OPEN +%token OTHERS +%token PACKAGE +%token PORT +%token PROCEDURE +%token PROCESS +%token Plus +%token _PS +%token _NS +%token _US +%token _MS +%token RANGE +%token RECORD +%token REG_BIT +%token REG_VECTOR +%token REGISTER +%token REM +%token REPORT +%token RETURN +%token RightParen +%token SELECT +%token SEVERITY +%token SIGNAL +%token _STABLE +%token SUBTYPE +%token Semicolon +%token Slash +%token Star +%token StringLit +%token THEN +%token TO +%token TRANSPORT +%token _TYPE +%token UNITS +%token UNTIL +%token USE +%token VARIABLE +%token VarAsgn +%token WAIT +%token WARNING +%token WHEN +%token WHILE +%token WITH +%token WOR_BIT +%token WOR_VECTOR + +%left _AND _OR _NAND _NOR _XOR +%left _EQSym _NESym +%left _NOT + +%type choice +%type .simple_name. +%type simple_name +%type a_label +%type .label. +%type label +%type severity__message +%type report__message +%type .SEVERITY__expression. +%type .REPORT__expression. +%type .guard_expression. +%type guard_expression + +%type ...waveform__WHEN__choices.. +%type waveform__WHEN__choices +%type waveform_element +%type waveform +%type expression +%type .GUARDED. + +%type relation..AND__relation.. +%type relation..OR__relation.. +%type relation.NAND_NOR__relation. +%type relation..XOR__relation.. +%type relation +%type simple_expression +%type .sign.term..add_op__term.. +%type term +%type factor +%type primary +%type relational_operator +%type literal +%type aggregate + +%type .signal_kind. +%type .mode. +%type type_mark +%type .constraint. +%type constraint +%type range +%type direction +%type abstractlit +%type name +%type slice_name +%type indexed_name +%type target +%type attribute_name + +%type generic_element_association + +%type constant_VarAsgn__expression + +%start design_file + +%% + +design_file + : /*empty*/ + { + /* ###----------------------------------------------### */ + /* Initializations */ + /* - erroneous description presumed ! */ + /* ###----------------------------------------------### */ + + BVL_NM1LST = NULL; + BVL_GRDLST = NULL; + BVL_CNDLST = NULL; + BVL_VALLST = NULL; + BVL_ERRFLG = 0; + + dic = beh_initab (); + BVL_BEFPNT = beh_addbefig (BVL_HEDFIG,NULL); + BVL_BEFPNT->ERRFLG = 1; + BVL_HEDFIG = BVL_BEFPNT; + } + entity_declaration + architecture_body + { + struct beout *beout_pnt; + struct beaux *beaux_pnt; + struct bebus *bebus_pnt; + struct bereg *bereg_pnt; + + /* ###----------------------------------------------### */ + /* Checking that each output have at least one driver*/ + /* ###----------------------------------------------### */ + + beout_pnt = BVL_BEFPNT->BEOUT; + while (beout_pnt != NULL) + { + if (beout_pnt->ABL == NULL) + bvl_error (40, beout_pnt->NAME); + beout_pnt = beout_pnt->NEXT; + } + + beaux_pnt = BVL_BEFPNT->BEAUX; + while (beaux_pnt != NULL) + { + if (beaux_pnt->ABL == NULL) + bvl_error (40, beaux_pnt->NAME); + beaux_pnt = beaux_pnt->NEXT; + } + + bebus_pnt = BVL_BEFPNT->BEBUS; + while (bebus_pnt != NULL) + { + if (bebus_pnt->BIABL == NULL) + bvl_error (40, bebus_pnt->NAME); + bebus_pnt = bebus_pnt->NEXT; + } + + bereg_pnt = BVL_BEFPNT->BEREG; + while (bereg_pnt != NULL) + { + if (bereg_pnt->BIABL == NULL) + bvl_error (40,bereg_pnt->NAME); + bereg_pnt = bereg_pnt->NEXT; + } + + if (BVL_ERRFLG == 0) + BVL_BEFPNT->ERRFLG = 0; + + beh_fretab (dic); + } + ; + +entity_declaration + : ENTITY + simple_name + IS + { + BVL_BEFPNT->NAME = $2; + BVL_MODNAM = $2; + } + .generic_clause. + .port_clause. + END_ERR + .simple_name. + Semicolon_ERR + { + if (($8 != NULL) && ($8 != $2)) + bvl_error (1,$8); + } + | ENTITY + error + { + bvl_error (2,NULL); + } + ; + +.generic_clause. + : /*empty*/ + | generic_clause + { + BVL_BEFPNT->BEGEN = BVL_GENPNT; + BVL_GENPNT = NULL; + } + ; + +generic_clause + : GENERIC + LeftParen + formal_generic_list + RightParen_ERR + Semicolon_ERR + | GENERIC + error + Semicolon_ERR + { bvl_error (74,NULL); } + ; + +formal_generic_list + : formal_generic_element + ...formal_generic_element.. + ; + +...formal_generic_element.. + : /*empty*/ + | ...formal_generic_element.. + Semicolon_ERR + formal_generic_element + ; + +formal_generic_element + : CONSTANT + identifier_list + Colon + type_mark + .constraint. + generic_VarAsgn__expression + { + char *type; + + if ($5.FLAG == $4.FLAG) + { + BVL_NM1LST = reverse (BVL_NM1LST); + type = namealloc ("natural"); + BVL_GENPNT = bvl_addgen (BVL_GENPNT,BVL_INTLST,BVL_NM1LST, + type,$5.LEFT,$5.RIGHT); + } + else + bvl_error (33,NULL); + freechain (BVL_NM1LST); + freechain (BVL_INTLST); + BVL_NM1LST = NULL; + BVL_INTLST = NULL; + } + | error + { + /* ###----------------------------------------------### */ + /* The following 3 lines reject tokens until the */ + /* sync. token 'Semicolon' is found */ + /* ###----------------------------------------------### */ + + do + yychar = yylex (); + while ((yychar != Semicolon) && (yychar != 0)); + yyerrok; + bvl_error (75,NULL); + } + ; + +generic_VarAsgn__expression + : VarAsgn + generic_expression + ; + +generic_expression + : abstractlit + { + long *ptlong; + + ptlong = (long *) mbkalloc (sizeof(long)); + *ptlong = $1; + BVL_INTLST = addchain (BVL_INTLST,(void *)ptlong); + } + | generic_aggregate + ; + +generic_aggregate + : LeftParen + generic_element_association + { + long *ptlong; + + ptlong = (long *) mbkalloc (sizeof(long)); + *ptlong = $2; + BVL_INTLST = addchain (BVL_INTLST,(void *)ptlong); + } + ...generic_element_association.. + RightParen_ERR + ; + +...generic_element_association.. + : /* empty */ + | ...generic_element_association.. + Comma + generic_element_association + { + long *ptlong; + + ptlong = (long *) mbkalloc (sizeof(long)); + *ptlong = $3; + BVL_INTLST = addchain (BVL_INTLST,(void *)ptlong); + } + ; + +generic_element_association + : abstractlit + {$$ = $1;} + ; + +.constraint. + : /*empty*/ + { + $$.FLAG = 'S'; + $$.LEFT = -1; + $$.RIGHT = -1; + } + | constraint + { $$ = $1; } + ; + +constraint + : LeftParen + range + RightParen_ERR + { $$ = $2; } + ; + +range + : abstractlit + direction + abstractlit + { + $$.FLAG = 'A'; + $$.LEFT = $1; + $$.RIGHT = $3; + + if ((($1 > $3) && ($2 == BVL_UPTDFN)) || + (($1 < $3) && ($2 == BVL_DWTDFN)) || + (($1 < 0 ) || ($2 < 0 ))) + { + bvl_error (32,NULL); + } + } + ; + +direction + : TO + { $$ = BVL_UPTDFN; } + | DOWNTO + { $$ = BVL_DWTDFN; } + ; + +.port_clause. + : /*empty*/ + | port_clause + ; + +port_clause + : PORT + LeftParen + formal_port_list + RightParen_ERR + Semicolon_ERR + | PORT + error + Semicolon_ERR + { bvl_error (3,NULL); } + ; + +formal_port_list + : formal_port_element + ...formal_port_element.. + ; + +...formal_port_element.. + : /*empty*/ + | ...formal_port_element.. + Semicolon_ERR + formal_port_element + ; + +formal_port_element + : .SIGNAL. + identifier_list + Colon + .mode. + type_mark + .constraint. + .signal_kind. + { + char *signame; + int sigconf; + void *pnt; + + /* ###----------------------------------------------### */ + /* First, check the validity of the declaration. */ + /* Then, for each port, create the apropriate set of */ + /* structures (berin, bepor, beout, bebus) */ + /* ###----------------------------------------------### */ + + chkdcl ('P', $4, $5.VALU, $5.FLAG, $7, $6.FLAG, &sigconf); + + BVL_NM1LST = reverse (BVL_NM1LST); + while (BVL_NM1LST != NULL) + { + signame = (char *)BVL_NM1LST->DATA; + if (beh_chktab (dic,signame,BVL_MODNAM,BVL_SIGDFN) != 0) + bvl_error (4,signame); + + pnt = addstr (BVL_BEFPNT,'P',$4,$5.VALU,$5.FLAG,signame, + $6.LEFT,$6.RIGHT); + + beh_addtab (dic,signame,BVL_MODNAM,BVL_SIGDFN,sigconf); + beh_addtab (dic,signame,BVL_MODNAM,BVL_WMNDFN,$6.LEFT); + beh_addtab (dic,signame,BVL_MODNAM,BVL_WMXDFN,$6.RIGHT); + beh_addtab (dic,signame,BVL_MODNAM,BVL_PNTDFN,(int)pnt); + + BVL_NM1LST = delchain (BVL_NM1LST, BVL_NM1LST); + } + } + | error + { + /* ###----------------------------------------------### */ + /* The following 3 lines reject tokens until the */ + /* sync. token 'Semicolon' is found */ + /* ###----------------------------------------------### */ + + do + yychar = yylex (); + while ((yychar != Semicolon) && (yychar != 0)); + yyerrok; + + bvl_error (6,NULL); + } + ; + +.SIGNAL. + : /*empty*/ + | SIGNAL + ; + +.mode. + : /*empty*/ + { $$ = _IN; } + | _IN + { $$ = _IN; } + | _OUT + { $$ = _OUT; } + | _INOUT + { $$ = _INOUT; } + ; + +architecture_body + : ARCHITECTURE + Identifier + OF + simple_name + IS + { + if ($4 != BVL_MODNAM) + bvl_error (1,$4); + } + architecture_declarative_part + _BEGIN + architecture_statement_part + END_ERR + .simple_name. + Semicolon_ERR + { + if (($11 != NULL) && ($11 != $2)) + bvl_error (7,$11); + } + | ARCHITECTURE + error + { bvl_error (8,NULL); } + ; + +architecture_declarative_part + : ..block_declarative_item.. + ; + +..block_declarative_item.. + : /*empty*/ + | ..block_declarative_item.. + block_declarative_item + ; + +block_declarative_item + : signal_declaration + | pragma_declaration + | constant_declaration + | error + Semicolon_ERR + { bvl_error (9,NULL); } + ; + +pragma_declaration + : PRAGMA + { + char pragma[30]; + char type [100]; + char name [100]; + + sscanf((char *)$1,"-- %s %s %s", pragma,type,name); + + BVL_BEFPNT->BEPGM = beh_addbepgm(BVL_BEFPNT->BEPGM, + type,name,(void *)0); + } + ; + +constant_declaration + : CONSTANT + Identifier + Colon + type_mark + .constraint. + constant_VarAsgn__expression + Semicolon_ERR + { + int sigconf; + + if (chkdcl ('C',0,$4.VALU,$4.FLAG,0,$5.FLAG,&sigconf) == 0) + { + beh_addtab (dic,$2,BVL_MODNAM,BVL_WMNDFN,$5.LEFT); + beh_addtab (dic,$2,BVL_MODNAM,BVL_WMXDFN,$5.RIGHT); + beh_addtab (dic,$2,BVL_MODNAM,BVL_SIGDFN,sigconf); + beh_addtab (dic,$2,NULL,BVL_PNTDFN,$6); + } + } + ; + +constant_VarAsgn__expression + : VarAsgn + literal + { $$ = $2; } + ; + +signal_declaration + : SIGNAL + identifier_list + Colon + type_mark + .constraint. + .signal_kind. + Semicolon_ERR + { + char *signame; + int sigconf; + void *pnt; + int errflg; + + errflg = chkdcl ('S',0,$4.VALU,$4.FLAG,$6,$5.FLAG,&sigconf); + + /* ###----------------------------------------------### */ + /* First, check the validity of the declaration. */ + /* Then, for each signal, create the apropriate set of */ + /* structures (berin, bereg, beaux, bebux) */ + /* ###----------------------------------------------### */ + + BVL_NM1LST = reverse (BVL_NM1LST); + while (BVL_NM1LST != NULL) + { + signame = (char *)BVL_NM1LST->DATA; + if (beh_chktab (dic,signame,BVL_MODNAM,BVL_SIGDFN) != 0) + bvl_error (10,signame); + + pnt = addstr (BVL_BEFPNT,'S',0,$4.VALU,$4.FLAG,signame, + $5.LEFT,$5.RIGHT); + + beh_addtab (dic,signame,BVL_MODNAM,BVL_SIGDFN,sigconf); + beh_addtab (dic,signame,BVL_MODNAM,BVL_WMNDFN,$5.LEFT); + beh_addtab (dic,signame,BVL_MODNAM,BVL_WMXDFN,$5.RIGHT); + beh_addtab (dic,signame,BVL_MODNAM,BVL_PNTDFN,(int)pnt); + + BVL_NM1LST = delchain (BVL_NM1LST,BVL_NM1LST); + } + } + ; + +.signal_kind. + : /*empty*/ + { $$ = 0; } + | REGISTER + { $$ = REGISTER; } + | BUS + { $$ = BUS; } + ; + +architecture_statement_part + : ..concurrent_statement.. + ; + +..concurrent_statement.. + : /*empty*/ + | ..concurrent_statement.. + concurrent_statement + ; + +concurrent_statement + : block_statement + | concurrent_assertion_statement + | concurrent_signal_assignment_statement + | error + Semicolon_ERR + { bvl_error (18,NULL); } + ; + +block_statement + : a_label + _BLOCK + .guard_expression. + _BEGIN + { + if (beh_chktab (dic,$1,BVL_MODNAM,BVL_LBLDFN) != 0) + bvl_error (19,$1); + + beh_addtab (dic,$1,BVL_MODNAM,BVL_LBLDFN,1); + if ($3 != NULL) + BVL_GRDLST = addchain (BVL_GRDLST,(char *)$3); + } + set_of_statements + END_ERR + _BLOCK + .label. + Semicolon_ERR + { + if ($3 != NULL) + BVL_GRDLST = delchain (BVL_GRDLST,BVL_GRDLST); + if (($9 != NULL) && ($9 != $1)) + bvl_error (20,$9); + } + ; + +set_of_statements + : ..concurrent_statement.. + ; + +concurrent_assertion_statement + : a_label + unlabeled_concurrent_assertion_statement + { + if (beh_chktab (dic,$1,BVL_MODNAM,BVL_LBLDFN) != 0) + bvl_error (19,$1); + + beh_addtab (dic,$1,BVL_MODNAM,BVL_LBLDFN,1); + if (BVL_ERRFLG == 0) + BVL_BEFPNT->BEMSG->LABEL = $1; + } + | unlabeled_concurrent_assertion_statement + ; + +concurrent_signal_assignment_statement + : a_label + unlabeled_conditional_signal_assignment + { + if (beh_chktab (dic,$1,BVL_MODNAM,BVL_LBLDFN) != 0) + bvl_error (19,$1); + beh_addtab (dic,$1,BVL_MODNAM,BVL_LBLDFN,1); + } + | unlabeled_conditional_signal_assignment + | a_label + unlabeled_selected_signal_assignment + { + if (beh_chktab (dic,$1,BVL_MODNAM,BVL_LBLDFN) != 0) + bvl_error (19,$1); + beh_addtab (dic,$1,BVL_MODNAM,BVL_LBLDFN,1); + } + | unlabeled_selected_signal_assignment + ; + +unlabeled_concurrent_assertion_statement + : assertion_statement + ; + +assertion_statement + : ASSERT + expression + .REPORT__expression. + .SEVERITY__expression. + Semicolon_ERR + { + if (BVL_ERRFLG == 0) + { + BVL_BEFPNT->BEMSG = beh_addbemsg(BVL_BEFPNT->BEMSG,NULL,$4, + $3,$2.LIST_ABL->DATA,NULL); + } + } + ; + +unlabeled_conditional_signal_assignment + : target + _LESym + .GUARDED. + ..waveform__WHEN__condition__ELSE.. + waveform + Semicolon_ERR + { + int i; + struct beout *beout_pnt; + struct bebus *bebus_pnt; + struct bereg *bereg_pnt; + struct beaux *beaux_pnt; + struct bebux *bebux_pnt; + struct chain *abl_pnt; + struct bvl_expr expr0; + struct bvl_expr expr1; + struct bvl_expr expr2; + struct bvl_expr expr3; + struct bvl_expr expr4; + struct bvl_expr expr5; + struct bvl_expr expr6; + int rev_flg = 0; + int left_bnd; + int right_bnd; + int left; + int right; + int in_bound; + int out_bound; + int sig_width; + int sig_conf; + + expr4 = $5; + + while (BVL_CNDLST != NULL) + { + expr5 = *((bvl_ablstr *) BVL_CNDLST->DATA); + expr6 = *((bvl_ablstr *) BVL_VALLST->DATA); + + expr0 = bvl_cpyablstr (expr5); + expr1 = bvl_crtabl (ABL_NOT , expr5, BVL_EMPSTR,-1,-1); + expr5 = expr0; + expr2 = bvl_crtabl (ANDM, expr4, expr1 ,-1,-1); + expr3 = bvl_crtabl (ANDM, expr6, expr5 ,-1,-1); + expr4 = bvl_crtabl (ABL_OR , expr2, expr3 ,-1,-1); + + BVL_CNDLST = delchain (BVL_CNDLST,BVL_CNDLST); + BVL_VALLST = delchain (BVL_VALLST,BVL_VALLST); + } + + left_bnd = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_WMNDFN); + right_bnd = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_WMXDFN); + sig_conf = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_SIGDFN); + + left = $1.LEFT; + right = $1.RIGHT; + + if (left_bnd <= right_bnd) + { + sig_width = right_bnd - left_bnd + 1; + if (left <= right) + { + rev_flg = 0; + in_bound = right_bnd - right; + out_bound = right_bnd - left; + if ((left < left_bnd) || (right > right_bnd)) + bvl_error (36,$1.NAME); + } + else + { + rev_flg = 1; + in_bound = right_bnd - left; + out_bound = right_bnd - right; + if ((left > right_bnd) || (right < left_bnd)) + bvl_error (36,$1.NAME); + } + } + else + { + sig_width = left_bnd - right_bnd + 1; + if (left <= right) + { + rev_flg = 1; + in_bound = left - right_bnd; + out_bound = right - right_bnd; + if ((left < right_bnd) || (right > left_bnd)) + bvl_error (36,$1.NAME); + } + else + { + rev_flg = 0; + in_bound = right - right_bnd; + out_bound = left - right_bnd; + if ((left > left_bnd) || (right < right_bnd)) + bvl_error (36,$1.NAME); + } + } + + if ((out_bound - in_bound + 1) != expr4.WIDTH) + bvl_error (35,$1.NAME); + + if (rev_flg == 1) + expr4.LIST_ABL = reverse (expr4.LIST_ABL); + + abl_pnt = expr4.LIST_ABL; + + switch (sig_conf) + { + case (BVL_ICNDFN + BVL_BITDFN + BVL_NORDFN) : + bvl_error (21,$1.NAME); + break; + + case (BVL_OCNDFN + BVL_BITDFN + BVL_NORDFN) : + case (BVL_BCNDFN + BVL_BITDFN + BVL_NORDFN) : + if ($3 == BVL_GRDDFN) + bvl_error (22,$1.NAME); + beout_pnt = (struct beout *) + beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + if (beout_pnt->ABL != NULL) + bvl_error (39,beout_pnt->NAME); + else + beout_pnt->ABL = (struct chain *)abl_pnt->DATA; + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + beout_pnt = beout_pnt->NEXT; + } + } + break; + + case (BVL_OCNDFN + BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_OCNDFN + BVL_WORDFN + BVL_BUSDFN) : + case (BVL_BCNDFN + BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_BCNDFN + BVL_WORDFN + BVL_BUSDFN) : + if (($3 != BVL_GRDDFN) || (BVL_GRDLST == NULL)) + bvl_error (23,$1.NAME); + bebus_pnt = (struct bebus *) + beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + bebus_pnt->BINODE = beh_addbinode (bebus_pnt->BINODE, + NULL,NULL); + bebus_pnt->BIABL = beh_addbiabl (bebus_pnt->BIABL, + BVL_LBLNAM, + dupablexpr(BVL_GRDLST->DATA) , + abl_pnt->DATA); + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + bebus_pnt = bebus_pnt->NEXT; + } + } + break; + + case (BVL_BITDFN + BVL_NORDFN): + if ($3 == BVL_GRDDFN) + bvl_error (22,$1.NAME); + beaux_pnt = (struct beaux *) + beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + if (beaux_pnt->ABL != NULL) + bvl_error (39,beaux_pnt->NAME); + else + beaux_pnt->ABL = (struct chain *)abl_pnt->DATA; + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + beaux_pnt = beaux_pnt->NEXT; + } + } + break; + + case (BVL_RBIDFN + BVL_REGDFN): + if (($3 != BVL_GRDDFN) || (BVL_GRDLST == NULL)) + bvl_error (23,$1.NAME); + bereg_pnt = (struct bereg *) + beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + bereg_pnt->BINODE = beh_addbinode (bereg_pnt->BINODE, + NULL,NULL); + bereg_pnt->BIABL = beh_addbiabl (bereg_pnt->BIABL, + BVL_LBLNAM, + dupablexpr(BVL_GRDLST->DATA) , + abl_pnt->DATA); + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + bereg_pnt = bereg_pnt->NEXT; + } + } + break; + + case (BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_WORDFN + BVL_BUSDFN) : + if (($3 != BVL_GRDDFN) || (BVL_GRDLST == NULL)) + bvl_error (23,$1.NAME); + bebux_pnt = (struct bebux *) + beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + bebux_pnt->BINODE = beh_addbinode (bebux_pnt->BINODE, + NULL,NULL); + bebux_pnt->BIABL = beh_addbiabl (bebux_pnt->BIABL, + BVL_LBLNAM, + dupablexpr(BVL_GRDLST->DATA) , + abl_pnt->DATA); + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + bebux_pnt = bebux_pnt->NEXT; + } + } + break; + + default : + bvl_error (17,$1.NAME); + break; + } + } + ; + +..waveform__WHEN__condition__ELSE.. + : /*empty*/ + | ..waveform__WHEN__condition__ELSE.. + waveform + WHEN + expression + ELSE + { + struct bvl_expr *expr_pnt; + + expr_pnt = (bvl_ablstr *)mbkalloc(sizeof(bvl_ablstr)); + expr_pnt->WIDTH = $4.WIDTH; + expr_pnt->LIST_ABL = $4.LIST_ABL; + BVL_CNDLST = addchain (BVL_CNDLST,(char *) expr_pnt); + + expr_pnt = (bvl_ablstr *)mbkalloc(sizeof(bvl_ablstr)); + expr_pnt->WIDTH = $2.WIDTH; + expr_pnt->LIST_ABL = $2.LIST_ABL; + BVL_VALLST = addchain (BVL_VALLST,(char *) expr_pnt); + } + ; + +unlabeled_selected_signal_assignment + : WITH + expression + { + BVL_SLCEXP = $2; + BVL_BDDPNT = NULL; + } + SELECT + target + _LESym + .GUARDED. + waveform__WHEN__choices + ...waveform__WHEN__choices.. + Semicolon_ERR + { + int i; + struct beout *beout_pnt; + struct bebus *bebus_pnt; + struct bereg *bereg_pnt; + struct beaux *beaux_pnt; + struct bebux *bebux_pnt; + struct chain *abl_pnt; + struct bvl_expr expr1; + int rev_flg = 0; + int left_bnd; + int right_bnd; + int left; + int right; + int in_bound; + int out_bound; + int sig_width; + int sig_conf; + + expr1 = bvl_crtabl (ABL_OR ,$8 ,$9,-1,-1); + if (BVL_BDDPNT != getlogbddnodeone()) + bvl_error (25,NULL); + left_bnd = beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_WMNDFN); + right_bnd = beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_WMXDFN); + sig_conf = beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_SIGDFN); + + left = $5.LEFT; + right = $5.RIGHT; + if (left_bnd <= right_bnd) + { + sig_width = right_bnd - left_bnd + 1; + if (left <= right) + { + rev_flg = 0; + in_bound = right_bnd - right; + out_bound = right_bnd - left; + if ((left < left_bnd) || (right > right_bnd)) + bvl_error (36,$5.NAME); + } + else + { + rev_flg = 1; + in_bound = right_bnd - left; + out_bound = right_bnd - right; + if ((left > right_bnd) || (right < left_bnd)) + bvl_error (36,$5.NAME); + } + } + else + { + sig_width = left_bnd - right_bnd + 1; + if (left <= right) + { + rev_flg = 1; + in_bound = left - right_bnd; + out_bound = right - right_bnd; + if ((left < right_bnd) || (right > left_bnd)) + bvl_error (36,$5.NAME); + } + else + { + rev_flg = 0; + in_bound = right - right_bnd; + out_bound = left - right_bnd; + if ((left > left_bnd) || (right < right_bnd)) + bvl_error (36,$5.NAME); + } + } + + if ((out_bound - in_bound + 1) != expr1.WIDTH) + bvl_error (35,$5.NAME); + + if (rev_flg == 1) + expr1.LIST_ABL = reverse (expr1.LIST_ABL); + + abl_pnt = expr1.LIST_ABL; + + switch (sig_conf) + { + case (BVL_ICNDFN + BVL_BITDFN + BVL_NORDFN) : + bvl_error (21,$5.NAME); + break; + + case (BVL_OCNDFN + BVL_BITDFN + BVL_NORDFN) : + case (BVL_BCNDFN + BVL_BITDFN + BVL_NORDFN) : + if ($7 == BVL_GRDDFN) + bvl_error (22,$5.NAME); + beout_pnt = (struct beout *) + beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + if (beout_pnt->ABL != NULL) + bvl_error (39,beout_pnt->NAME); + else + beout_pnt->ABL = (struct chain *)abl_pnt->DATA; + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + beout_pnt = beout_pnt->NEXT; + } + } + break; + + case (BVL_OCNDFN + BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_OCNDFN + BVL_WORDFN + BVL_BUSDFN) : + case (BVL_BCNDFN + BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_BCNDFN + BVL_WORDFN + BVL_BUSDFN) : + if (($7 != BVL_GRDDFN) || (BVL_GRDLST == NULL)) + bvl_error (23,$5.NAME); + bebus_pnt = (struct bebus *) + beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + bebus_pnt->BINODE = beh_addbinode (bebus_pnt->BINODE, + NULL,NULL); + bebus_pnt->BIABL = beh_addbiabl (bebus_pnt->BIABL, + BVL_LBLNAM, + dupablexpr(BVL_GRDLST->DATA) , + abl_pnt->DATA); + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + bebus_pnt = bebus_pnt->NEXT; + } + } + break; + + case (BVL_BITDFN + BVL_NORDFN): + if ($7 == BVL_GRDDFN) + bvl_error (22,$5.NAME); + beaux_pnt = (struct beaux *) + beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + if (beaux_pnt->ABL != NULL) + bvl_error (39,beaux_pnt->NAME); + else + { + beaux_pnt->ABL = (struct chain *)abl_pnt->DATA; + } + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + beaux_pnt = beaux_pnt->NEXT; + } + } + break; + + case (BVL_RBIDFN + BVL_REGDFN): + if (($7 != BVL_GRDDFN) || (BVL_GRDLST == NULL)) + bvl_error (23,$5.NAME); + bereg_pnt = (struct bereg *) + beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + bereg_pnt->BINODE = beh_addbinode (bereg_pnt->BINODE, + NULL,NULL); + bereg_pnt->BIABL = beh_addbiabl (bereg_pnt->BIABL, + BVL_LBLNAM, + dupablexpr(BVL_GRDLST->DATA) , + abl_pnt->DATA); + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + bereg_pnt = bereg_pnt->NEXT; + } + } + break; + + case (BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_WORDFN + BVL_BUSDFN) : + if (($7 != BVL_GRDDFN) || (BVL_GRDLST == NULL)) + bvl_error (23,$5.NAME); + bebux_pnt = (struct bebux *) + beh_chktab (dic,$5.NAME,BVL_MODNAM,BVL_PNTDFN); + if (BVL_ERRFLG == 0) + { + for (i=0 ; i= in_bound) + { + bebux_pnt->BINODE = beh_addbinode (bebux_pnt->BINODE, + NULL,NULL); + bebux_pnt->BIABL = beh_addbiabl (bebux_pnt->BIABL, + BVL_LBLNAM, + dupablexpr(BVL_GRDLST->DATA) , + abl_pnt->DATA); + abl_pnt = abl_pnt->NEXT; + } + if (i >= out_bound) + break; + bebux_pnt = bebux_pnt->NEXT; + } + } + break; + + default : + bvl_error (17,$5.NAME); + break; + } + } + ; + +...waveform__WHEN__choices.. + : /*empty*/ + { $$ = BVL_EMPSTR; } + | ...waveform__WHEN__choices.. + Comma + waveform__WHEN__choices + { $$ = bvl_crtabl (ABL_OR,$1,$3,-1,-1); } + ; + +waveform__WHEN__choices + : waveform + WHEN + choices + { + struct bvl_expr expr1; + + bvl_select (&expr1,BVL_NM1LST,&BVL_BDDPNT,BVL_SLCEXP); + freechain (BVL_NM1LST); + BVL_NM1LST = NULL; + + $$ = bvl_crtabl (ANDM,$1,expr1,-1,-1); + } + ; + +waveform + : waveform_element + { $$ = $1; } + ; + +waveform_element + : expression + .AFTER__delay_expression. + { + $$ = $1; + } + ; + +.AFTER__delay_expression. + : /*empty*/ + {} + | AFTER + delay_expression + {} + ; + +delay_expression + : abstractlit + .time_unit. + {} + ; + +.time_unit. + : /*empty*/ + {} + | _PS + {} + | _NS + {} + | _US + {} + | _MS + {} + ; + +choices + : choice + { BVL_NM1LST = addchain (NULL ,$1); } + ..Bar__choice.. + { yyerrok; } + ; + +..Bar__choice.. + : /*empty*/ + | ..Bar__choice.. + Bar + choice + { + if ($3 == "others") + bvl_error (30,NULL); + BVL_NM1LST = addchain (BVL_NM1LST ,$3); + } + ; + +choice + : literal + { $$ = $1; } + | OTHERS + { $$ = "others"; } + | name + { + char *val; + char val2[256]; + int left; + int right; + int in_bound; + int out_bound; + int left_bnd; + int right_bnd; + int sig_conf; + + strcpy (val2,"B\""); + sig_conf = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_SIGDFN); + val = (char *) beh_chktab (dic,$1.NAME,NULL,BVL_PNTDFN); + if (sig_conf == 0) + bvl_error (17,$1.NAME); + else + { + if (sig_conf != BVL_CSTDFN) + bvl_error (76,$1.NAME); + } + + left_bnd = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_WMNDFN); + right_bnd = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_WMXDFN); + + left = $1.LEFT; + right = $1.RIGHT; + + if (left_bnd <= right_bnd) + { + if (left <= right) + { + in_bound = left - left_bnd; + out_bound = right - left_bnd; + if ((left < left_bnd) || (right > right_bnd)) + bvl_error (36,$1.NAME); + } + else + { + in_bound = left - right_bnd; + out_bound = right - right_bnd; + if ((left > right_bnd) || (right < left_bnd)) + bvl_error (36,$1.NAME); + } + } + else + { + if (left <= right) + { + in_bound = right - left_bnd; + out_bound = left - left_bnd; + if ((left < right_bnd) || (right > left_bnd)) + bvl_error (36,$1.NAME); + } + else + { + in_bound = right - right_bnd; + out_bound = left - right_bnd; + if ((left > left_bnd) || (right < right_bnd)) + bvl_error (36,$1.NAME); + } + } + + bvl_tobin (&val2[2],val,in_bound,out_bound); + strcat (val2,"\""); + $$ = namealloc (val2); + } + ; + +.REPORT__expression. + : /*empty*/ + { $$ = NULL; } + | REPORT + report__message + { $$ = $2; } + ; + +.SEVERITY__expression. + : /*empty*/ + { $$ = 'E'; } + | SEVERITY + severity__message + { $$ = $2; } + ; + +report__message + : StringLit + { $$ = $1; } + ; + +severity__message + : ERROR + { $$ = 'E'; } + | WARNING + { $$ = 'W'; } + ; + +expression + : relation..AND__relation.. + { $$ = $1; } + | relation..OR__relation.. + { $$ = $1; } + | relation.NAND_NOR__relation. + { $$ = $1; } + | relation..XOR__relation.. + { $$ = $1; } + ; + +relation..AND__relation.. + : relation + _AND + relation + { $$ = bvl_crtabl (ABL_AND ,$1 ,$3 ,-1,-1); } + | relation..AND__relation.. + _AND + relation + { $$ = bvl_crtabl (ABL_AND ,$1 ,$3 ,-1,-1); } + ; + +relation..OR__relation.. + : relation + _OR + relation + { $$ = bvl_crtabl (ABL_OR ,$1 ,$3 ,-1,-1); } + | relation..OR__relation.. + _OR + relation + { $$ = bvl_crtabl (ABL_OR ,$1 ,$3 ,-1,-1); } + ; + +relation.NAND_NOR__relation. + : relation + { $$ = $1; } + | relation + _NAND + relation + { $$ = bvl_crtabl (ABL_NAND ,$1 ,$3 ,-1,-1); } + | relation + _NOR + relation + { $$ = bvl_crtabl (ABL_NOR ,$1 ,$3 ,-1,-1); } + ; + + +relation..XOR__relation.. + : relation + _XOR + relation + { $$ = bvl_crtabl (ABL_XOR ,$1 ,$3 ,-1,-1); } + | relation..XOR__relation.. + _XOR + relation + { $$ = bvl_crtabl (ABL_XOR ,$1 ,$3 ,-1,-1); } + ; + +relation + : simple_expression + { $$ = $1; } + | simple_expression + relational_operator + simple_expression + { $$ = bvl_crtabl ($2 ,$1 ,$3 ,-1,-1); } + ; + +simple_expression + : .sign.term..add_op__term.. + { $$ = $1; } + ; + +.sign.term..add_op__term.. + : term + { $$ = $1; } + | .sign.term..add_op__term.. + Ampersand + term + { $$ = bvl_crtabl (CONC,$1,$3,-1,-1); } + + ; + +term + : factor + { $$ = $1; } + ; + +factor + : primary + { $$ = $1; } + | _NOT + primary + { $$ = bvl_crtabl (ABL_NOT,$2,BVL_EMPSTR,-1,-1); } + ; + +primary + : literal + { + struct bvl_expr expr1; + expr1.IDENT = $1; + $$ = bvl_crtabl (NOPS,expr1,BVL_EMPSTR,-1,-1); + } + | aggregate + { $$ = $1; } + | name + { + struct bvl_expr expr1; + int left; + int right; + int left_bnd; + int right_bnd; + int in_bound; + int out_bound; + int sig_conf; + + sig_conf = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_SIGDFN); + switch (sig_conf) + { + case (BVL_ICNDFN + BVL_BITDFN + BVL_NORDFN) : + case (BVL_BCNDFN + BVL_BITDFN + BVL_NORDFN) : + case (BVL_BCNDFN + BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_BCNDFN + BVL_WORDFN + BVL_BUSDFN) : + case (BVL_BITDFN + BVL_NORDFN): + case (BVL_MUXDFN + BVL_BUSDFN): + case (BVL_WORDFN + BVL_BUSDFN): + case (BVL_RBIDFN + BVL_REGDFN): + case (BVL_CSTDFN): + break; + case (BVL_OCNDFN + BVL_BITDFN + BVL_NORDFN) : + case (BVL_OCNDFN + BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_OCNDFN + BVL_WORDFN + BVL_BUSDFN) : + bvl_error (26,$1.NAME); + break; + default : + bvl_error (17,$1.NAME); + break; + } + + left_bnd = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_WMNDFN); + right_bnd = beh_chktab (dic,$1.NAME,BVL_MODNAM,BVL_WMXDFN); + + left = $1.LEFT; + right = $1.RIGHT; + + if (left_bnd <= right_bnd) + { + if (left <= right) + { + in_bound = left - left_bnd; + out_bound = right - left_bnd; + if ((left < left_bnd) || (right > right_bnd)) + bvl_error (36,$1.NAME); + } + else + { + in_bound = right - left_bnd; + out_bound = left - left_bnd; + if ((left > right_bnd) || (right < left_bnd)) + bvl_error (36,$1.NAME); + } + } + else + { + if (left <= right) + { + in_bound = left - right_bnd; + out_bound = right - right_bnd; + if ((left < right_bnd) || (right > left_bnd)) + bvl_error (36,$1.NAME); + } + else + { + in_bound = right - right_bnd; + out_bound = left - right_bnd; + if ((left > left_bnd) || (right < right_bnd)) + bvl_error (36,$1.NAME); + } + } + + if (sig_conf != BVL_CSTDFN) + { + expr1.IDENT = $1.NAME; + if($1.FLAG == 'X') + { + expr1 = bvl_crtabl (NOPI,expr1,BVL_EMPSTR,left,right); + $$ = bvl_crtabl (ABL_STABLE,expr1,BVL_EMPSTR,left,right); + } + else + $$ = bvl_crtabl (NOPI,expr1,BVL_EMPSTR,left,right); + } + else + { + expr1.IDENT = (char *)beh_chktab(dic,$1.NAME,NULL,BVL_PNTDFN); + $$ = bvl_crtabl (NOPS,expr1,BVL_EMPSTR,in_bound,out_bound); + } + } + ; + +relational_operator + : _EQSym + { $$ = EQ; } + | _NESym + { $$ = NE; } + ; + +literal + : CharacterLit + { $$ = $1; } + | StringLit + { $$ = $1; } + | BitStringLit + { $$ = $1; } + ; + +aggregate + : LeftParen + expression + RightParen + { $$ = $2; } + ; + +name + : simple_name + { + $$.NAME = $1; + $$.LEFT = beh_chktab (dic,$1,BVL_MODNAM,BVL_WMNDFN); + $$.RIGHT = beh_chktab (dic,$1,BVL_MODNAM,BVL_WMXDFN); + } + | indexed_name + { $$ = $1; } + | slice_name + { $$ = $1; } + | attribute_name + { $$ = $1; } + ; + +indexed_name + : simple_name + LeftParen + abstractlit + RightParen_ERR + { + $$.NAME = $1; + $$.LEFT = $3; + $$.RIGHT = $3; + } + ; + +slice_name + : simple_name + LeftParen + abstractlit + direction + abstractlit + RightParen_ERR + { + if ((($5 > $3) && ($4 != BVL_UPTDFN)) || + (($5 < $3) && ($4 != BVL_DWTDFN))) + bvl_error (32,$1); + + $$.NAME = $1; + $$.LEFT = $3; + $$.RIGHT = $5; + } + ; + +attribute_name + : simple_name + Apostrophe + attribute_designator + { + char extname[100]; + char *lclname; + int sig_conf; + struct bvl_expr expr1; + struct bvl_expr expr2; + struct chain *ptabl; + + sig_conf = beh_chktab (dic,$1,BVL_MODNAM,BVL_SIGDFN); + switch (sig_conf) + { + case (BVL_ICNDFN + BVL_BITDFN + BVL_NORDFN) : + case (BVL_BCNDFN + BVL_BITDFN + BVL_NORDFN) : + case (BVL_BCNDFN + BVL_MUXDFN + BVL_BUSDFN) : + case (BVL_BCNDFN + BVL_WORDFN + BVL_BUSDFN) : + case (BVL_BITDFN + BVL_NORDFN): + case (BVL_MUXDFN + BVL_BUSDFN): + case (BVL_WORDFN + BVL_BUSDFN): + case (BVL_RBIDFN + BVL_REGDFN): + break; + default : + bvl_error (79,$1); + } + + if (beh_chktab (dic,$1,BVL_MODNAM,BVL_WMNDFN) != -1) + bvl_error (79,$1); + + sprintf (extname,"%s'delayed",$1); + lclname = namealloc (extname); + + if (BVL_ERRFLG == 0) + { + if (beh_chktab (dic,$1,BVL_MODNAM,BVL_STBDFN) == 0) + { + expr1.IDENT = $1; + expr1.WIDTH = 1; + expr2 = bvl_crtabl (NOPI,expr1,BVL_EMPSTR,-1,-1); + ptabl = expr2.LIST_ABL->DATA; + + if (BVL_AUXMOD == 1) + BVL_BEFPNT->BERIN=beh_addberin(BVL_BEFPNT->BERIN,lclname); + + BVL_BEFPNT->BEDLY = beh_addbeaux(BVL_BEFPNT->BEDLY,lclname, + ptabl,NULL); + beh_addtab (dic,$1 ,BVL_MODNAM,BVL_STBDFN,1); + beh_addtab (dic,lclname,BVL_MODNAM,BVL_WMNDFN,-1); + beh_addtab (dic,lclname,BVL_MODNAM,BVL_WMXDFN,-1); + beh_addtab (dic,lclname,BVL_MODNAM,BVL_SIGDFN, + (BVL_ICNDFN + BVL_BITDFN + BVL_NORDFN)); + } + } + BVL_BEFPNT->TYPE |= BEH_STABLE; + $$.NAME = $1; + $$.LEFT = -1; + $$.RIGHT = -1; + $$.FLAG = 'X'; + + } + ; + +attribute_designator + : _STABLE + ; + +type_mark + : BIT + { $$.VALU = BIT; $$.FLAG = 'S'; } + | WOR_BIT + { $$.VALU = WOR_BIT; $$.FLAG = 'S'; } + | MUX_BIT + { $$.VALU = MUX_BIT; $$.FLAG = 'S'; } + | BIT_VECTOR + { $$.VALU = BIT; $$.FLAG = 'A'; } + | WOR_VECTOR + { $$.VALU = WOR_BIT; $$.FLAG = 'A'; } + | MUX_VECTOR + { $$.VALU = MUX_BIT; $$.FLAG = 'A'; } + | REG_BIT + { $$.VALU = REG_BIT; $$.FLAG = 'S'; } + | REG_VECTOR + { $$.VALU = REG_BIT; $$.FLAG = 'A'; } + | NATURAL + { $$.VALU = NATURAL; $$.FLAG = 'S'; } + | NATURAL_VECTOR + { $$.VALU = NATURAL; $$.FLAG = 'A'; } + ; + +identifier_list + : Identifier + { BVL_NM1LST = addchain (BVL_NM1LST,$1); } + ...identifier.. + ; + +...identifier.. + : /*empty*/ + | ...identifier.. + Comma + Identifier + { BVL_NM1LST = addchain (BVL_NM1LST,$3); } + ; + +.label. + : /*empty*/ + { $$ = NULL; } + | label + { $$ = $1; } + ; + +.guard_expression. + : /*empty*/ + { $$ = NULL; } + | guard_expression + { $$ = $1; } + ; + +guard_expression + : LeftParen + expression + RightParen_ERR + { $$ = (char *)$2.LIST_ABL->DATA; } + ; + +.GUARDED. + : /*empty*/ + { $$ = BVL_UNGDFN ; } + | GUARDED + { $$ = BVL_GRDDFN; } + ; + +.simple_name. + : /*empty*/ + { $$ = NULL; } + | simple_name + { $$ = $1; } + ; + +simple_name + : Identifier + { $$ = $1; } + ; + +target + : name + { $$ = $1; } + ; + +a_label + : label + Colon + { + BVL_LBLNAM = $1; + $$ = $1; + } + ; + +label + : Identifier + { $$ = $1; } + ; + +abstractlit + : AbstractLit + { $$ = atoi ($1); } + ; + +RightParen_ERR + : RightParen + { yyerrok; } + ; + +Semicolon_ERR + : Semicolon + { yyerrok; } + ; + +END_ERR + : _END + { yyerrok; } + ; +%% + +void *addstr (ptfig, object, mode, type, flag, name, left, right) + +struct befig *ptfig; +char object; +int mode; +int type; +char flag; +char *name; +short left; +short right; + + { + void *pnt = NULL; + char porflg = 0; + char rinflg = 0; + char outflg = 0; + char busflg = 0; + char auxflg = 0; + char buxflg = 0; + char regflg = 0; + char lclmod; + char lcltyp; + char extname[100]; + short i; + short inc = 1; + + switch (object) + { + case 'P': + + /* ###------------------------------------------------------### */ + /* if object is a port ... */ + /* ###------------------------------------------------------### */ + + porflg = 1; + switch (mode) + { + case _IN: + lclmod = 'I'; lcltyp = 'B'; rinflg = 1; break; + case _OUT: + switch (type) + { + case BIT: + lclmod = 'O'; lcltyp = 'B'; outflg = 1; break; + case MUX_BIT: + lclmod = 'Z'; lcltyp = 'M'; busflg = 1; break; + case WOR_BIT: + lclmod = 'Z'; lcltyp = 'W'; busflg = 1; break; + } + break; + case _INOUT: + rinflg = 1; + switch (type) + { + case BIT: + lclmod = 'B'; lcltyp = 'B'; outflg = 1; break; + case MUX_BIT: + lclmod = 'T'; lcltyp = 'M'; busflg = 1; break; + case WOR_BIT: + lclmod = 'T'; lcltyp = 'W'; busflg = 1; break; + } + break; + } + break; + + case 'S': + + /* ###------------------------------------------------------### */ + /* if object is a signal ... */ + /* ###------------------------------------------------------### */ + + switch (type) + { + case BIT: + lcltyp = 'B'; rinflg = BVL_AUXMOD; auxflg = 1; break; + case REG_BIT: + rinflg = 1; regflg = 1; break; + case MUX_BIT: + lcltyp = 'M'; rinflg = 1; buxflg = 1; break; + case WOR_BIT: + lcltyp = 'W'; rinflg = 1; buxflg = 1; break; + } + break; + } + + if (flag == 'S') + { + /* ###------------------------------------------------------### */ + /* if object is a scalar ... */ + /* ###------------------------------------------------------### */ + + if (porflg == 1) + ptfig->BEPOR = beh_addbepor (ptfig->BEPOR,name,lclmod,lcltyp); + if (rinflg == 1) + ptfig->BERIN = beh_addberin (ptfig->BERIN,name); + if (outflg == 1) + ptfig->BEOUT = beh_addbeout (ptfig->BEOUT,name,NULL,NULL); + if (busflg == 1) + ptfig->BEBUS = beh_addbebus (ptfig->BEBUS,name,NULL,NULL,lcltyp); + if (auxflg == 1) + ptfig->BEAUX = beh_addbeaux (ptfig->BEAUX,name,NULL,NULL); + if (buxflg == 1) + ptfig->BEBUX = beh_addbebux (ptfig->BEBUX,name,NULL,NULL,lcltyp); + if (regflg == 1) + ptfig->BEREG = beh_addbereg (ptfig->BEREG,name,NULL,NULL); + + } + else + { + /* ###------------------------------------------------------### */ + /* if object is an array ... */ + /* ###------------------------------------------------------### */ + + if (left >= right) + inc = -1; + + for (i=left ; i!=(right+inc) ; i+=inc) + { + sprintf (extname,"%s %d",name,i); + + if (porflg == 1) + ptfig->BEPOR = beh_addbepor (ptfig->BEPOR,extname,lclmod,lcltyp); + if (rinflg == 1) + ptfig->BERIN = beh_addberin (ptfig->BERIN,extname); + if (outflg == 1) + ptfig->BEOUT = beh_addbeout (ptfig->BEOUT,extname,NULL,NULL); + if (busflg == 1) + ptfig->BEBUS = beh_addbebus (ptfig->BEBUS,extname,NULL,NULL,lcltyp); + if (auxflg == 1) + ptfig->BEAUX = beh_addbeaux (ptfig->BEAUX,extname,NULL,NULL); + if (buxflg == 1) + ptfig->BEBUX = beh_addbebux (ptfig->BEBUX,extname,NULL,NULL,lcltyp); + if (regflg == 1) + ptfig->BEREG = beh_addbereg (ptfig->BEREG,extname,NULL,NULL); + } + } + + if (outflg == 1) + pnt = (void *) ptfig->BEOUT; + if (busflg == 1) + pnt = (void *) ptfig->BEBUS; + if (auxflg == 1) + pnt = (void *) ptfig->BEAUX; + if (buxflg == 1) + pnt = (void *) ptfig->BEBUX; + if (regflg == 1) + pnt = (void *) ptfig->BEREG; + + return (pnt); + } + +int chkdcl (object,mode,type,flag,kind,constraint,conf) + +char object; +int mode; +int type; +char flag; +int kind; +char constraint; +int *conf; + + { + int errflg = 0; + int lclcnf = 0; + + if (flag != constraint) + { + errflg = 1; + bvl_error (33,NULL); + } + else + { + switch (object) + { + case 'P': + /* ###------------------------------------------------------### */ + /* If object is a port : */ + /* - if type is bit, no guard indication can be used */ + /* - if type is wor_bit or mux_bit, bus kind must be used */ + /* - other types are illegal */ + /* ###------------------------------------------------------### */ + + switch (type) + { + case BIT: + + lclcnf += BVL_BITDFN + BVL_NORDFN; + switch (mode) + { + case _IN : + lclcnf += BVL_ICNDFN; break; + case _OUT: + lclcnf += BVL_OCNDFN; break; + case _INOUT : + lclcnf += BVL_BCNDFN; break; + case _LINKAGE : + case 0 : + errflg = 1; break; + } + if (kind != 0) + errflg = 1; + break; + + case MUX_BIT: + + lclcnf += BVL_MUXDFN + BVL_BUSDFN; + switch (mode) + { + case _OUT : + lclcnf += BVL_OCNDFN; break; + case _INOUT : + lclcnf += BVL_BCNDFN; break; + case _IN : + case _LINKAGE : + case 0 : + errflg = 1; break; + } + if (kind != BUS) + errflg = 1; + break; + + case WOR_BIT: + + lclcnf += BVL_WORDFN + BVL_BUSDFN; + switch (mode) + { + case _OUT : + lclcnf += BVL_OCNDFN; break; + case _INOUT : + lclcnf += BVL_BCNDFN; break; + case _IN : + case _LINKAGE : + case 0 : + errflg = 1; break; + } + if (kind != BUS) + errflg = 1; + break; + + case REG_BIT: + case NATURAL: + + errflg = 1; + break; + } + if (errflg == 1) + bvl_error (5,NULL); + break; + + case 'G': + /* ###------------------------------------------------------### */ + /* If object is a generic : */ + /* - only natural type is allowed */ + /* ###------------------------------------------------------### */ + + if ((type != NATURAL) || (mode != 0) || (kind != 0)) + { + errflg = 1; + bvl_error (77,NULL); + } + break; + + case 'S': + /* ###------------------------------------------------------### */ + /* If object is a signal : */ + /* - no mode can be specified */ + /* - if type is bit no guard indication can be used */ + /* - if type is wor_bit or mux_bit, bus kind must be used */ + /* - if type is reg_bit, register kind must be used */ + /* - other types are illegal */ + /* ###------------------------------------------------------### */ + + switch (type) + { + case BIT: + lclcnf += BVL_BITDFN + BVL_NORDFN; + if ((mode != 0) || (kind != 0)) + errflg = 1; + break; + case MUX_BIT: + lclcnf += BVL_MUXDFN + BVL_BUSDFN; + if ((mode != 0) || (kind != BUS)) + errflg = 1; + break; + case WOR_BIT: + lclcnf += BVL_WORDFN + BVL_BUSDFN; + if ((mode != 0) || (kind != BUS)) + errflg = 1; + break; + case REG_BIT: + lclcnf += BVL_RBIDFN + BVL_REGDFN; + if ((mode != 0) || (kind != REGISTER)) + errflg = 1; + break; + case NATURAL: + errflg = 1; break; + } + + if (mode != 0) + errflg = 1; + + if (errflg == 1) + bvl_error (11,NULL); + break; + + case 'C': + /* ###------------------------------------------------------### */ + /* If object is a constant : */ + /* - only bit type without any other indication is legal */ + /* ###------------------------------------------------------### */ + + lclcnf += BVL_CSTDFN; + if ((type != BIT) || (mode != 0) || (kind != 0)) + { + errflg = 1; + bvl_error (78,NULL); + } + break; + } + } + + *conf = lclcnf ; + return (errflg); + } diff --git a/alliance/src/abv/bvl_bedef.h b/alliance/src/abv/bvl_bedef.h new file mode 100644 index 00000000..f3c4b16d --- /dev/null +++ b/alliance/src/abv/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/bvl_blex.h b/alliance/src/abv/bvl_blex.h new file mode 100644 index 00000000..9bb8c01a --- /dev/null +++ b/alliance/src/abv/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/bvl_bspec.c b/alliance/src/abv/bvl_bspec.c new file mode 100644 index 00000000..68db8ed9 --- /dev/null +++ b/alliance/src/abv/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/bvl_bspec.h b/alliance/src/abv/bvl_bspec.h new file mode 100644 index 00000000..36483c73 --- /dev/null +++ b/alliance/src/abv/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/bvl_byacc.h b/alliance/src/abv/bvl_byacc.h new file mode 100644 index 00000000..9ab1c044 --- /dev/null +++ b/alliance/src/abv/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/bvl_drive.c b/alliance/src/abv/bvl_drive.c new file mode 100644 index 00000000..c9e1c1ed --- /dev/null +++ b/alliance/src/abv/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/bvl_drive.h b/alliance/src/abv/bvl_drive.h new file mode 100644 index 00000000..5d8741b6 --- /dev/null +++ b/alliance/src/abv/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/bvl_parse.c b/alliance/src/abv/bvl_parse.c new file mode 100644 index 00000000..fa2f4612 --- /dev/null +++ b/alliance/src/abv/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/bvl_parse.h b/alliance/src/abv/bvl_parse.h new file mode 100644 index 00000000..85f8e045 --- /dev/null +++ b/alliance/src/abv/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/bvl_utdef.h b/alliance/src/abv/bvl_utdef.h new file mode 100644 index 00000000..a1b77ad4 --- /dev/null +++ b/alliance/src/abv/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/bvl_util.c b/alliance/src/abv/bvl_util.c new file mode 100644 index 00000000..d37e4413 --- /dev/null +++ b/alliance/src/abv/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/bvl_util.h b/alliance/src/abv/bvl_util.h new file mode 100644 index 00000000..e8a2c962 --- /dev/null +++ b/alliance/src/abv/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/bvl_utype.h b/alliance/src/abv/bvl_utype.h new file mode 100644 index 00000000..ce8e91ff --- /dev/null +++ b/alliance/src/abv/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/main.c b/alliance/src/abv/main.c new file mode 100644 index 00000000..7cf57d77 --- /dev/null +++ b/alliance/src/abv/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 ); +}