diff --git a/vpi/sdf_lexor.lex b/vpi/sdf_lexor.lex index 5f39380a9..a653ff53c 100644 --- a/vpi/sdf_lexor.lex +++ b/vpi/sdf_lexor.lex @@ -45,6 +45,7 @@ static int yywrap(void) %} %x CCOMMENT +%x EDGE_ID %% @@ -62,6 +63,16 @@ static int yywrap(void) /* Count lines so that the parser can assign line numbers. */ \n { sdflloc.first_line += 1; } + /* The other edge identifiers. */ +"01" {return K_01; } +"10" {return K_10; } +"0"[zZ] {return K_0Z; } +[zZ]"1" {return K_Z1; } +"1"[zZ] {return K_1Z; } +[zZ]"0" {return K_Z0; } +[pP][oO][sS][eE][dD][gG][eE] {return K_POSEDGE; } +[nN][eE][gG][eE][dD][gG][eE] {return K_NEGEDGE; } + /* Real values */ [0-9]+(\.[0-9]+)?([Ee][+-]?[0-9]+)? { yylval.real_val = strtod(yytext, 0); @@ -107,8 +118,6 @@ static struct { { "INTERCONNECT",K_INTERCONNECT }, { "INSTANCE", K_INSTANCE }, { "IOPATH", K_IOPATH }, - { "NEGEDGE", K_NEGEDGE }, - { "POSEDGE", K_POSEDGE }, { "PROCESS", K_PROCESS }, { "PROGRAM", K_PROGRAM }, { "RECOVERY", K_RECOVERY }, @@ -126,6 +135,16 @@ static struct { { 0, IDENTIFIER } }; +void start_edge_id(void) +{ + BEGIN(EDGE_ID); +} + +void stop_edge_id(void) +{ + BEGIN(0); +} + static int lookup_keyword(const char*text) { int idx; diff --git a/vpi/sdf_parse.y b/vpi/sdf_parse.y index f4859add1..f432ed9e6 100644 --- a/vpi/sdf_parse.y +++ b/vpi/sdf_parse.y @@ -48,6 +48,7 @@ char sdf_use_hchar = '.'; %token K_NEGEDGE K_POSEDGE K_PROCESS K_PROGRAM K_RECOVERY K_REMOVAL %token K_SDFVERSION K_SETUP K_SETUPHOLD K_TEMPERATURE K_TIMESCALE %token K_TIMINGCHECK K_VENDOR K_VERSION K_VOLTAGE K_WIDTH +%token K_01 K_10 K_0Z K_Z1 K_1Z K_Z0 %token HCHAR %token QSTRING IDENTIFIER @@ -301,13 +302,19 @@ port ; port_edge - : '(' edge_identifier port_instance ')' - { $$.vpi_edge = $2; $$.string_val = $3; } + : '(' {start_edge_id();} edge_identifier {stop_edge_id();} port_instance ')' + { $$.vpi_edge = $3; $$.string_val = $5; } ; edge_identifier : K_POSEDGE { $$ = vpiPosedge; } | K_NEGEDGE { $$ = vpiNegedge; } + | K_01 { $$ = vpiEdge01; } + | K_10 { $$ = vpiEdge10; } + | K_0Z { $$ = vpiEdge0x; } + | K_Z1 { $$ = vpiEdgex1; } + | K_1Z { $$ = vpiEdge1x; } + | K_Z0 { $$ = vpiEdgex0; } ; delval_list diff --git a/vpi/sdf_parse_priv.h b/vpi/sdf_parse_priv.h index 755bc5405..3483a81f9 100644 --- a/vpi/sdf_parse_priv.h +++ b/vpi/sdf_parse_priv.h @@ -1,7 +1,7 @@ #ifndef _sdf_parse_priv_h #define _sdf_parse_priv_h /* - * Copyright (c) 2007 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2009 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -35,4 +35,7 @@ extern const char*sdf_parse_path; /* Hierarchy separator character to use. */ extern char sdf_use_hchar; +extern void start_edge_id(void); +extern void stop_edge_id(void); + #endif diff --git a/vpi/sys_sdf.c b/vpi/sys_sdf.c index e89e4943c..cb5861b33 100644 --- a/vpi/sys_sdf.c +++ b/vpi/sys_sdf.c @@ -173,6 +173,7 @@ void sdf_iopath_delays(int vpi_edge, const char*src, const char*dst, /* The edge type must match too. But note that if this IOPATH has no edge, then it matches with all edges of the modpath object. */ +/* --> Is this correct in the context of the 10, 01, etc. edges? */ if (vpi_edge != vpiNoEdge && vpi_get(vpiEdge,path_t_in) != vpi_edge) continue;