From d1e82d3d12dd538593b8de6651a8914edbd7ec68 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 14 Jan 2008 11:26:30 -0800 Subject: [PATCH] V0.8: ignore edge-control specifiers Update the specify code in V0.8 to ignore edge-control specifiers. --- lexor.lex | 16 +++++++++++++++- parse.y | 14 +++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lexor.lex b/lexor.lex index 74b05e900..be62adb0f 100644 --- a/lexor.lex +++ b/lexor.lex @@ -101,6 +101,7 @@ static int comment_enter; %s UDPTABLE %x PPTIMESCALE %x PPDEFAULT_NETTYPE +%s EDGES W [ \t\b\f\r]+ @@ -158,7 +159,7 @@ W [ \t\b\f\r]+ with "*" and return that. */ "(*"{W}*")" { return '*'; } - +"]" { BEGIN(0); return yytext[0]; } [}{;:\[\],()#=.@&!?<>%|^~+*/-] { return yytext[0]; } \" { BEGIN(CSTRING); } @@ -201,12 +202,25 @@ W [ \t\b\f\r]+ [pP] { return 'p'; } [01\?\*\-] { return yytext[0]; } +"01" { return K_edge_descriptor; } +"0x" { return K_edge_descriptor; } +"0z" { return K_edge_descriptor; } +"10" { return K_edge_descriptor; } +"1x" { return K_edge_descriptor; } +"1z" { return K_edge_descriptor; } +"x0" { return K_edge_descriptor; } +"x1" { return K_edge_descriptor; } +"z0" { return K_edge_descriptor; } +"z1" { return K_edge_descriptor; } + [a-zA-Z_][a-zA-Z0-9$_]* { int rc = lexor_keyword_code(yytext, yyleng); if (rc == IDENTIFIER) { yylval.text = strdup(yytext); if (strncmp(yylval.text,"PATHPULSE$", 10) == 0) rc = PATHPULSE_IDENTIFIER; + } else if (rc == K_edge) { + BEGIN(EDGES); } else { yylval.text = 0; } diff --git a/parse.y b/parse.y index cd95cd56d..e11f56f7e 100644 --- a/parse.y +++ b/parse.y @@ -134,7 +134,8 @@ const static struct str_pair_t str_strength = { PGate::STRONG, PGate::STRONG }; %token K_LOR K_LAND K_NAND K_NOR K_NXOR K_TRIGGER %token K_always K_and K_assign K_begin 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_endmodule +%token K_edge K_edge_descriptor +%token K_else K_end K_endcase K_endfunction 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_highz0 K_highz1 K_if K_ifnone %token K_initial K_inout K_input K_integer K_join K_large K_localparam @@ -2503,6 +2504,12 @@ spec_reference_event { delete $2; delete $4; } + | K_edge '[' edge_descriptor_list ']' expr_primary + { delete $5; } + | K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression + { delete $5; + delete $7; + } | expr_primary K_TAND expression { delete $1; delete $3; @@ -2511,6 +2518,11 @@ spec_reference_event { delete $1; } ; +edge_descriptor_list + : edge_descriptor_list ',' K_edge_descriptor + | K_edge_descriptor + ; + spec_notifier_opt : /* empty */ { }