V0.8: ignore edge-control specifiers

Update the specify code in V0.8 to ignore edge-control specifiers.
This commit is contained in:
Cary R 2008-01-14 11:26:30 -08:00 committed by Stephen Williams
parent d70ccb6895
commit d1e82d3d12
2 changed files with 28 additions and 2 deletions

View File

@ -101,6 +101,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]+
@ -158,7 +159,7 @@ W [ \t\b\f\r]+
with "*" and return that. */ with "*" and return that. */
"(*"{W}*")" { return '*'; } "(*"{W}*")" { return '*'; }
<EDGES>"]" { BEGIN(0); return yytext[0]; }
[}{;:\[\],()#=.@&!?<>%|^~+*/-] { return yytext[0]; } [}{;:\[\],()#=.@&!?<>%|^~+*/-] { return yytext[0]; }
\" { BEGIN(CSTRING); } \" { BEGIN(CSTRING); }
@ -201,12 +202,25 @@ 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);
if (rc == IDENTIFIER) { if (rc == IDENTIFIER) {
yylval.text = strdup(yytext); yylval.text = strdup(yytext);
if (strncmp(yylval.text,"PATHPULSE$", 10) == 0) if (strncmp(yylval.text,"PATHPULSE$", 10) == 0)
rc = PATHPULSE_IDENTIFIER; rc = PATHPULSE_IDENTIFIER;
} else if (rc == K_edge) {
BEGIN(EDGES);
} else { } else {
yylval.text = 0; yylval.text = 0;
} }

14
parse.y
View File

@ -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_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_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_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_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_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 %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 $2;
delete $4; 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 | expr_primary K_TAND expression
{ delete $1; { delete $1;
delete $3; delete $3;
@ -2511,6 +2518,11 @@ spec_reference_event
{ delete $1; } { delete $1; }
; ;
edge_descriptor_list
: edge_descriptor_list ',' K_edge_descriptor
| K_edge_descriptor
;
spec_notifier_opt spec_notifier_opt
: /* empty */ : /* empty */
{ } { }