From f621448ced57671c97251ff259540bdb43d81390 Mon Sep 17 00:00:00 2001 From: steve Date: Fri, 13 Apr 2007 02:34:35 +0000 Subject: [PATCH] Parse edge sensitive paths without edge specifier. --- PSpec.h | 6 +++--- elaborate.cc | 15 +++++++++++---- parse.y | 22 +++++++++++++--------- pform.cc | 12 ++++++------ pform.h | 7 +++++-- 5 files changed, 38 insertions(+), 24 deletions(-) diff --git a/PSpec.h b/PSpec.h index aaba5f322..ce8f8d3a7 100644 --- a/PSpec.h +++ b/PSpec.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: PSpec.h,v 1.2 2007/02/12 01:52:21 steve Exp $" +#ident "$Id: PSpec.h,v 1.3 2007/04/13 02:34:35 steve Exp $" #endif # include "LineInfo.h" @@ -47,8 +47,8 @@ class PExpr; * is the condition expression. If the condition expression is nil, * then this is an ifnone conditional path. * -* If edge != 0, then the path is edge sensitive and the optional -* data_source_expression may be present. +* If data_source_expression != nil, then the path is edge sensitive +* and the edge might not be 0. */ class PSpecPath : public LineInfo { diff --git a/elaborate.cc b/elaborate.cc index 9a3ec9bc9..e117b6bfb 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: elaborate.cc,v 1.367 2007/04/05 03:09:50 steve Exp $" +#ident "$Id: elaborate.cc,v 1.368 2007/04/13 02:34:35 steve Exp $" #endif # include "config.h" @@ -3007,7 +3007,6 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const } ivl_assert(*this, conditional || (condition==0)); - ivl_assert(*this, data_source_expression==0 || edge != 0); ndelays = delays.size(); if (ndelays > 12) @@ -3099,8 +3098,13 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const src.size(), condit_sig); path->set_line(*this); - if (edge > 0) path->set_posedge(); - if (edge < 0) path->set_negedge(); + // The presence of the data_source_expression indicates + // that this is an edge sensitive path. If so, then set + // the edges. Note that edge==0 is BOTH edges. + if (data_source_expression) { + if (edge >= 0) path->set_posedge(); + if (edge <= 0) path->set_negedge(); + } switch (ndelays) { case 12: @@ -3409,6 +3413,9 @@ Design* elaborate(listroots) /* * $Log: elaborate.cc,v $ + * Revision 1.368 2007/04/13 02:34:35 steve + * Parse edge sensitive paths without edge specifier. + * * Revision 1.367 2007/04/05 03:09:50 steve * Allow implicit wires in assign l-value. * diff --git a/parse.y b/parse.y index fe626d6b8..a83c32616 100644 --- a/parse.y +++ b/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.233 2007/04/01 23:02:03 steve Exp $" +#ident "$Id: parse.y,v 1.234 2007/04/13 02:34:35 steve Exp $" #endif # include "config.h" @@ -2626,18 +2626,22 @@ specify_edge_path_decl edge_operator : K_posedge { $$ = true; } | K_negedge { $$ = false; } ; specify_edge_path - : '(' edge_operator specify_path_identifiers spec_polarity - K_EG specify_path_identifiers ')' - { $$ = pform_make_specify_edge_path(@1, $2, $3, $4, false, $6, 0); } + : '(' specify_path_identifiers spec_polarity + K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' + { int edge_flag = 0; + $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); } | '(' edge_operator specify_path_identifiers spec_polarity K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' - { $$ = pform_make_specify_edge_path(@1, $2, $3, $4, false, $7, $9);} - | '(' edge_operator specify_path_identifiers spec_polarity - K_SG specify_path_identifiers ')' - { $$ = pform_make_specify_edge_path(@1, $2, $3, $4, true, $6, 0); } + { int edge_flag = $2? 1 : -1; + $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);} + | '(' specify_path_identifiers spec_polarity + K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' + { int edge_flag = 0; + $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); } | '(' edge_operator specify_path_identifiers spec_polarity K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' - { $$ = pform_make_specify_edge_path(@1, $2, $3, $4, true, $7, $9); } + { int edge_flag = $2? 1 : -1; + $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); } ; polarity_operator diff --git a/pform.cc b/pform.cc index 88aaf8217..d4ce67558 100644 --- a/pform.cc +++ b/pform.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform.cc,v 1.142 2007/03/07 04:24:59 steve Exp $" +#ident "$Id: pform.cc,v 1.143 2007/04/13 02:34:35 steve Exp $" #endif # include "config.h" @@ -1563,16 +1563,13 @@ extern PSpecPath* pform_make_specify_path(const struct vlltype&li, } extern PSpecPath*pform_make_specify_edge_path(const struct vlltype&li, - bool edge_flag, /*posedge==true */ + int edge_flag, /*posedge==true */ list*src, char pol, bool full_flag, list*dst, PExpr*data_source_expression) { PSpecPath*tmp = pform_make_specify_path(li, src, pol, full_flag, dst); - if (edge_flag) - tmp->edge = 1; - else - tmp->edge = -1; + tmp->edge = edge_flag; tmp->data_source_expression = data_source_expression; return tmp; } @@ -1768,6 +1765,9 @@ int pform_parse(const char*path, FILE*file) /* * $Log: pform.cc,v $ + * Revision 1.143 2007/04/13 02:34:35 steve + * Parse edge sensitive paths without edge specifier. + * * Revision 1.142 2007/03/07 04:24:59 steve * Make integer width controllable. * diff --git a/pform.h b/pform.h index 55126329c..fcae8b421 100644 --- a/pform.h +++ b/pform.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: pform.h,v 1.88 2007/02/12 01:52:21 steve Exp $" +#ident "$Id: pform.h,v 1.89 2007/04/13 02:34:35 steve Exp $" #endif # include "netlist.h" @@ -266,7 +266,7 @@ extern PSpecPath*pform_make_specify_path(const struct vlltype&li, list*src, char pol, bool full_flag, list*dst); extern PSpecPath*pform_make_specify_edge_path(const struct vlltype&li, - bool edge_flag, /*posedge==true */ + int edge_flag, /*posedge==true */ list*src, char pol, bool full_flag, list*dst, PExpr*data_source_expression); @@ -334,6 +334,9 @@ extern void pform_dump(ostream&out, Module*mod); /* * $Log: pform.h,v $ + * Revision 1.89 2007/04/13 02:34:35 steve + * Parse edge sensitive paths without edge specifier. + * * Revision 1.88 2007/02/12 01:52:21 steve * Parse all specify paths to pform. *