Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Detect and ignore specify edge expressions

  • Loading branch information...
commit 87e813766a19773bb0dc6a14a78a3a43e1bb5f74 1 parent e24e776
steve authored
Showing with 53 additions and 23 deletions.
  1. +18 −2 lexor.lex
  2. +35 −21 parse.y
View
20 lexor.lex
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#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
# include "config.h"
@@ -109,6 +109,7 @@ static int comment_enter;
%s UDPTABLE
%x PPTIMESCALE
%x PPDEFAULT_NETTYPE
+%s EDGES
W [ \t\b\f\r]+
@@ -167,7 +168,7 @@ W [ \t\b\f\r]+
with "*" and return that. */
"("{W}*"*"{W}*")" { return '*'; }
-
+<EDGES>"]" { BEGIN(0); return yytext[0]; }
[}{;:\[\],()#=.@&!?<>%|^~+*/-] { return yytext[0]; }
\" { BEGIN(CSTRING); }
@@ -210,6 +211,17 @@ W [ \t\b\f\r]+
<UDPTABLE>[pP] { return 'p'; }
<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$_]* {
int rc = lexor_keyword_code(yytext, yyleng);
switch (rc) {
@@ -230,6 +242,10 @@ W [ \t\b\f\r]+
}
break;
+ case K_edge:
+ BEGIN(EDGES);
+ break;
+
default:
yylval.text = 0;
break;
View
56 parse.y
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#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
# 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_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_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_force K_forever K_fork K_function K_generate K_genvar
%token K_highz0 K_highz1 K_if K_ifnone
@@ -2758,25 +2759,38 @@ spec_polarity
;
spec_reference_event
- : K_posedge expression
- { delete $2; }
- | K_negedge expression
- { delete $2; }
- | K_posedge expr_primary K_TAND expression
- { delete $2;
- delete $4;
- }
- | K_negedge expr_primary K_TAND expression
- { delete $2;
- delete $4;
- }
- | expr_primary K_TAND expression
- { delete $1;
- delete $3;
- }
- | expr_primary
- { delete $1; }
- ;
+ : K_posedge expression
+ { delete $2; }
+ | K_negedge expression
+ { delete $2; }
+ | K_posedge expr_primary K_TAND expression
+ { delete $2;
+ delete $4;
+ }
+ | K_negedge expr_primary K_TAND expression
+ { delete $2;
+ delete $4;
+ }
+ | K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression
+ { delete $5;
+ delete $7;
+ }
+ | expr_primary K_TAND expression
+ { delete $1;
+ delete $3;
+ }
+ | expr_primary
+ { 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
: /* empty */
Please sign in to comment.
Something went wrong with that request. Please try again.