Detect and ignore specify edge expressions

This commit is contained in:
steve 2007-06-14 03:50:00 +00:00
parent e24e77660f
commit 87e813766a
2 changed files with 53 additions and 23 deletions

View File

@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: lexor.lex,v 1.95 2007/04/19 02:52:53 steve Exp $" #ident "$Id: lexor.lex,v 1.96 2007/06/14 03:50:00 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -109,6 +109,7 @@ static int comment_enter;
%s UDPTABLE %s UDPTABLE
%x PPTIMESCALE %x PPTIMESCALE
%x PPDEFAULT_NETTYPE %x PPDEFAULT_NETTYPE
%s EDGES
W [ \t\b\f\r]+ W [ \t\b\f\r]+
@ -167,7 +168,7 @@ W [ \t\b\f\r]+
with "*" and return that. */ with "*" and return that. */
"("{W}*"*"{W}*")" { return '*'; } "("{W}*"*"{W}*")" { return '*'; }
<EDGES>"]" { BEGIN(0); return yytext[0]; }
[}{;:\[\],()#=.@&!?<>%|^~+*/-] { return yytext[0]; } [}{;:\[\],()#=.@&!?<>%|^~+*/-] { return yytext[0]; }
\" { BEGIN(CSTRING); } \" { BEGIN(CSTRING); }
@ -210,6 +211,17 @@ W [ \t\b\f\r]+
<UDPTABLE>[pP] { return 'p'; } <UDPTABLE>[pP] { return 'p'; }
<UDPTABLE>[01\?\*\-] { return yytext[0]; } <UDPTABLE>[01\?\*\-] { return yytext[0]; }
<EDGES>"01" { return K_edge_descriptor; }
<EDGES>"0x" { return K_edge_descriptor; }
<EDGES>"0z" { return K_edge_descriptor; }
<EDGES>"10" { return K_edge_descriptor; }
<EDGES>"1x" { return K_edge_descriptor; }
<EDGES>"1z" { return K_edge_descriptor; }
<EDGES>"x0" { return K_edge_descriptor; }
<EDGES>"x1" { return K_edge_descriptor; }
<EDGES>"z0" { return K_edge_descriptor; }
<EDGES>"z1" { return K_edge_descriptor; }
[a-zA-Z_][a-zA-Z0-9$_]* { [a-zA-Z_][a-zA-Z0-9$_]* {
int rc = lexor_keyword_code(yytext, yyleng); int rc = lexor_keyword_code(yytext, yyleng);
switch (rc) { switch (rc) {
@ -230,6 +242,10 @@ W [ \t\b\f\r]+
} }
break; break;
case K_edge:
BEGIN(EDGES);
break;
default: default:
yylval.text = 0; yylval.text = 0;
break; break;

18
parse.y
View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #ifdef HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.238 2007/06/04 02:19:07 steve Exp $" #ident "$Id: parse.y,v 1.239 2007/06/14 03:50:00 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -157,7 +157,8 @@ static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
%token K_LOR K_LAND K_NAND K_NOR K_NXOR K_TRIGGER %token K_LOR K_LAND K_NAND K_NOR K_NXOR K_TRIGGER
%token K_always K_and K_assign K_begin K_bool K_buf K_bufif0 K_bufif1 K_case %token K_always K_and K_assign K_begin K_bool K_buf K_bufif0 K_bufif1 K_case
%token K_casex K_casez K_cmos K_deassign K_default K_defparam K_disable %token K_casex K_casez K_cmos K_deassign K_default K_defparam K_disable
%token K_edge K_else K_end K_endcase K_endfunction K_endgenerate K_endmodule %token K_edge K_edge_descriptor
%token K_else K_end K_endcase K_endfunction K_endgenerate K_endmodule
%token K_endprimitive K_endspecify K_endtable K_endtask K_event K_for %token K_endprimitive K_endspecify K_endtable K_endtask K_event K_for
%token K_force K_forever K_fork K_function K_generate K_genvar %token K_force K_forever K_fork K_function K_generate K_genvar
%token K_highz0 K_highz1 K_if K_ifnone %token K_highz0 K_highz1 K_if K_ifnone
@ -2770,6 +2771,10 @@ spec_reference_event
{ delete $2; { delete $2;
delete $4; delete $4;
} }
| K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression
{ delete $5;
delete $7;
}
| expr_primary K_TAND expression | expr_primary K_TAND expression
{ delete $1; { delete $1;
delete $3; delete $3;
@ -2778,6 +2783,15 @@ spec_reference_event
{ delete $1; } { delete $1; }
; ;
/* The edge_descriptor is detected by the lexor as the various
2-letter edge sequences that are supported here. For now, we
don't care what they are, because we do not yet support specify
edge events. */
edge_descriptor_list
: edge_descriptor_list ',' K_edge_descriptor
| K_edge_descriptor
;
spec_notifier_opt spec_notifier_opt
: /* empty */ : /* empty */
{ } { }