diff options
-rw-r--r-- | examples/ifchain2.vhd | 1 | ||||
-rw-r--r-- | src/vhd2vl.l | 7 | ||||
-rw-r--r-- | src/vhd2vl.y | 18 |
3 files changed, 26 insertions, 0 deletions
diff --git a/examples/ifchain2.vhd b/examples/ifchain2.vhd index 6b12150..837dace 100644 --- a/examples/ifchain2.vhd +++ b/examples/ifchain2.vhd @@ -31,5 +31,6 @@ begin end if; -- enable end if; -- clk, rst_n end process clk_src; +assert (counter < CLK_DIV_VAL) report "test case" severity error; end rtl; diff --git a/src/vhd2vl.l b/src/vhd2vl.l index 5c88605..4253fd4 100644 --- a/src/vhd2vl.l +++ b/src/vhd2vl.l @@ -130,6 +130,13 @@ void getbasedstring(unsigned skip); "conv_integer" { return CONVFUNC_1;} "left" { return LEFT;} "high" { return LEFT;} +"assert" {return ASSERT;} +"report" {return REPORT;} +"severity" {return SEVERITY;} +"failure" {return FAILURE;} +"error" {return ERROR;} +"warning" {return WARNING;} +"note" {return NOTE;} \"[ \!#-~]*\" | \'[01xz]\' { getstring(1); return STRING;} diff --git a/src/vhd2vl.y b/src/vhd2vl.y index bbc15f3..bbf01f1 100644 --- a/src/vhd2vl.y +++ b/src/vhd2vl.y @@ -712,6 +712,7 @@ slist *emit_io_list(slist *sl) %token <txt> STRING NAME RANGE NULLV OPEN %token <txt> CONVFUNC_1 CONVFUNC_2 BASED FLOAT LEFT %token <txt> SCIENTIFIC REAL +%token <txt> ASSERT REPORT SEVERITY WARNING ERROR FAILURE NOTE %token <n> NATURAL %type <n> trad @@ -724,6 +725,7 @@ slist *emit_io_list(slist *sl) %type <sl> edge %type <sl> elsepart wlist wvalue cases %type <sl> with_item with_list +%type <sl> vhdassert %type <sg> s_list %type <n> dir delay %type <v> type vec_range @@ -733,6 +735,7 @@ slist *emit_io_list(slist *sl) %type <ss> signal %type <txt> opt_is opt_generic opt_entity opt_architecture opt_begin %type <txt> generate endgenerate +%type <txt> sevlevel %right '=' /* Logic operators: */ @@ -824,6 +827,16 @@ endgenerate : END GENERATE; norem : /*Empty*/ {skipRem = 1;} yesrem : /*Empty*/ {skipRem = 0;} +/* Beginning support for assertions. Currently parsed but not translated. */ +vhdassert : ASSERT exprc REPORT STRING SEVERITY sevlevel ';' { + fprintf(stderr,"WARNING (line %d): Ignoring assertion.\n",lineno); + $$=NULL; + } + +sevlevel : WARNING | ERROR | FAILURE | NOTE { + $$=NULL; + } + /* Entity */ /* 1 2 3 4 5 6 7 8 9 10 11 12 13 */ entity : ENTITY NAME IS rem PORT '(' rem portlist ')' ';' rem END opt_entity oname ';' { @@ -1566,6 +1579,11 @@ a_body : rem {$$=addind($1);} sl=addtxt(sl,"endgenerate\n"); $$=addsl(sl,$15); /* a_body:2 */ } + | rem vhdassert a_body { + slist *sl; + sl=addsl($1,$2); + $$=addsl(sl,$3); + } ; oname : {$$=NULL;} |