Parse all specify paths to pform.
This commit is contained in:
parent
97234cb7ca
commit
c1c2381261
6
PSpec.cc
6
PSpec.cc
|
|
@ -17,13 +17,15 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: PSpec.cc,v 1.1 2006/09/26 19:48:40 steve Exp $"
|
||||
#ident "$Id: PSpec.cc,v 1.2 2007/02/12 01:52:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "PSpec.h"
|
||||
|
||||
PSpecPath::PSpecPath(unsigned src_cnt, unsigned dst_cnt)
|
||||
: src(src_cnt), dst(dst_cnt)
|
||||
: conditional(false), condition(0), edge(0),
|
||||
src(src_cnt), dst(dst_cnt),
|
||||
data_source_expression(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
33
PSpec.h
33
PSpec.h
|
|
@ -19,13 +19,37 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: PSpec.h,v 1.1 2006/09/23 04:57:19 steve Exp $"
|
||||
#ident "$Id: PSpec.h,v 1.2 2007/02/12 01:52:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "LineInfo.h"
|
||||
# include "StringHeap.h"
|
||||
# include <vector>
|
||||
|
||||
class PExpr;
|
||||
|
||||
/*
|
||||
* The PSpecPath is the parse of a specify path, which is in its most
|
||||
* general form <path> = <delays>. The <delays> are collected into the
|
||||
* "delays" vector in all cases, and the variety is in the other
|
||||
* members.
|
||||
*
|
||||
* All paths also have a list of source names in the src vector, and a
|
||||
* list of destination names in the dst vector. These pairs are the
|
||||
* actual paths.
|
||||
*
|
||||
* If the path is a simple path, then:
|
||||
* condition == nil
|
||||
* edge == 0
|
||||
* data_source_expression == nil
|
||||
*
|
||||
* If the path is conditional, then conditional == true and condition
|
||||
* 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.
|
||||
*/
|
||||
class PSpecPath : public LineInfo {
|
||||
|
||||
public:
|
||||
|
|
@ -37,10 +61,17 @@ class PSpecPath : public LineInfo {
|
|||
void dump(std::ostream&out, unsigned ind) const;
|
||||
|
||||
public:
|
||||
// Condition expression, if present.
|
||||
bool conditional;
|
||||
class PExpr* condition;
|
||||
// Edge specification (-1==negedge, 0 = no edge, 1==posedge)
|
||||
int edge;
|
||||
// Ordered set of source nodes of a path
|
||||
std::vector<perm_string> src;
|
||||
// Ordered set of destination nodes of a path
|
||||
std::vector<perm_string> dst;
|
||||
// Data source expression
|
||||
class PExpr* data_source_expression;
|
||||
|
||||
std::vector<class PExpr*>delays;
|
||||
};
|
||||
|
|
|
|||
28
elaborate.cc
28
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.358 2007/02/01 05:52:24 steve Exp $"
|
||||
#ident "$Id: elaborate.cc,v 1.359 2007/02/12 01:52:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -41,6 +41,7 @@
|
|||
# include "util.h"
|
||||
# include "parse_api.h"
|
||||
# include "compiler.h"
|
||||
# include "ivl_assert.h"
|
||||
|
||||
|
||||
static Link::strength_t drive_type(PGate::strength_t drv)
|
||||
|
|
@ -2914,6 +2915,28 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
|
|||
if (!gn_specify_blocks_flag)
|
||||
return;
|
||||
|
||||
/* Check for various path types that are not supported. */
|
||||
|
||||
if (conditional) {
|
||||
cerr << get_line() << ": sorry: Conditional specify paths"
|
||||
<< " are not supported." << endl;
|
||||
cerr << get_line() << ": : Use -g no-specify to ignore"
|
||||
<< " specify blocks." << endl;
|
||||
des->errors += 1;
|
||||
}
|
||||
|
||||
ivl_assert(*this, conditional || (condition==0));
|
||||
|
||||
if (edge != 0) {
|
||||
cerr << get_line() << ": sorry: Edge sensitive specify paths"
|
||||
<< " are not supported." << endl;
|
||||
cerr << get_line() << ": : Use -g no-specify to ignore"
|
||||
<< " specify blocks." << endl;
|
||||
des->errors += 1;
|
||||
}
|
||||
|
||||
ivl_assert(*this, data_source_expression==0 || edge != 0);
|
||||
|
||||
ndelays = delays.size();
|
||||
if (ndelays > 12)
|
||||
ndelays = 12;
|
||||
|
|
@ -3343,6 +3366,9 @@ Design* elaborate(list<perm_string>roots)
|
|||
|
||||
/*
|
||||
* $Log: elaborate.cc,v $
|
||||
* Revision 1.359 2007/02/12 01:52:21 steve
|
||||
* Parse all specify paths to pform.
|
||||
*
|
||||
* Revision 1.358 2007/02/01 05:52:24 steve
|
||||
* More generous handling of errors in blocks.
|
||||
*
|
||||
|
|
|
|||
54
parse.y
54
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.225 2007/01/29 02:07:34 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.226 2007/02/12 01:52:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
# include "compiler.h"
|
||||
# include "pform.h"
|
||||
# include "Statement.h"
|
||||
# include "PSpec.h"
|
||||
# include <sstream>
|
||||
|
||||
class PSpecPath;
|
||||
|
|
@ -179,7 +180,7 @@ static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
|
|||
%token KK_attribute
|
||||
|
||||
%type <number> number
|
||||
%type <flag> signed_opt udp_reg_opt
|
||||
%type <flag> signed_opt udp_reg_opt edge_operator
|
||||
%type <drive> drive_strength drive_strength_opt dr_strength0 dr_strength1
|
||||
%type <letter> udp_input_sym udp_output_sym
|
||||
%type <text> udp_input_list udp_sequ_entry udp_comb_entry
|
||||
|
|
@ -242,6 +243,7 @@ static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
|
|||
%type <perm_strings> specify_path_identifiers
|
||||
|
||||
%type <specpath> specify_simple_path specify_simple_path_decl
|
||||
%type <specpath> specify_edge_path specify_edge_path_decl
|
||||
|
||||
%token K_TAND
|
||||
%right '?' ':'
|
||||
|
|
@ -2518,16 +2520,28 @@ specify_item
|
|||
{ pform_module_specify_path($1);
|
||||
}
|
||||
| specify_edge_path_decl ';'
|
||||
{
|
||||
{ pform_module_specify_path($1);
|
||||
}
|
||||
| K_if '(' expression ')' specify_simple_path_decl ';'
|
||||
{
|
||||
{ PSpecPath*tmp = $5;
|
||||
if (tmp) tmp->condition = $3;
|
||||
pform_module_specify_path(tmp);
|
||||
}
|
||||
| K_if '(' expression ')' specify_edge_path_decl ';'
|
||||
{
|
||||
{ PSpecPath*tmp = $5;
|
||||
if (tmp) {
|
||||
tmp->conditional = true;
|
||||
tmp->condition = $3;
|
||||
}
|
||||
pform_module_specify_path(tmp);
|
||||
}
|
||||
| K_ifnone specify_simple_path_decl ';'
|
||||
{
|
||||
{ PSpecPath*tmp = $2;
|
||||
if (tmp) {
|
||||
tmp->conditional = true;
|
||||
tmp->condition = 0;
|
||||
}
|
||||
pform_module_specify_path(tmp);
|
||||
}
|
||||
| K_Shold '(' spec_reference_event ',' spec_reference_event
|
||||
',' delay_value spec_notifier_opt ')' ';'
|
||||
|
|
@ -2572,19 +2586,29 @@ specify_item_list
|
|||
|
||||
specify_edge_path_decl
|
||||
: specify_edge_path '=' '(' delay_value_list ')'
|
||||
{ delete $4; }
|
||||
{ $$ = pform_assign_path_delay($1, $4); }
|
||||
| specify_edge_path '=' delay_value_simple
|
||||
{ svector<PExpr*>*tmp = new svector<PExpr*>(1);
|
||||
(*tmp)[0] = $3;
|
||||
$$ = pform_assign_path_delay($1, tmp);
|
||||
}
|
||||
;
|
||||
|
||||
edge_operator : K_posedge { $$ = true; } | K_negedge { $$ = false; } ;
|
||||
|
||||
specify_edge_path
|
||||
: '(' K_posedge specify_path_identifiers spec_polarity K_EG IDENTIFIER ')'
|
||||
| '(' K_posedge specify_path_identifiers spec_polarity K_EG '(' expr_primary polarity_operator expression ')' ')'
|
||||
| '(' K_posedge specify_path_identifiers spec_polarity K_SG IDENTIFIER ')'
|
||||
| '(' K_posedge specify_path_identifiers spec_polarity K_SG '(' expr_primary polarity_operator expression ')' ')'
|
||||
| '(' K_negedge specify_path_identifiers spec_polarity K_EG IDENTIFIER ')'
|
||||
| '(' K_negedge specify_path_identifiers spec_polarity K_EG '(' expr_primary polarity_operator expression ')' ')'
|
||||
| '(' K_negedge specify_path_identifiers spec_polarity K_SG IDENTIFIER ')'
|
||||
| '(' K_negedge specify_path_identifiers spec_polarity K_SG '(' expr_primary polarity_operator expression ')' ')'
|
||||
: '(' edge_operator specify_path_identifiers spec_polarity
|
||||
K_EG specify_path_identifiers ')'
|
||||
{ $$ = pform_make_specify_edge_path(@1, $2, $3, $4, false, $6, 0); }
|
||||
| '(' 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); }
|
||||
| '(' 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); }
|
||||
;
|
||||
|
||||
polarity_operator
|
||||
|
|
|
|||
25
pform.cc
25
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.139 2007/01/27 05:36:11 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.140 2007/02/12 01:52:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1562,8 +1562,26 @@ extern PSpecPath* pform_make_specify_path(const struct vlltype&li,
|
|||
return path;
|
||||
}
|
||||
|
||||
extern PSpecPath*pform_make_specify_edge_path(const struct vlltype&li,
|
||||
bool edge_flag, /*posedge==true */
|
||||
list<perm_string>*src, char pol,
|
||||
bool full_flag, list<perm_string>*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->data_source_expression = data_source_expression;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
extern PSpecPath* pform_assign_path_delay(PSpecPath*path, svector<PExpr*>*del)
|
||||
{
|
||||
if (path == 0)
|
||||
return 0;
|
||||
|
||||
assert(path->delays.size() == 0);
|
||||
|
||||
path->delays.resize(del->count());
|
||||
|
|
@ -1578,6 +1596,8 @@ extern PSpecPath* pform_assign_path_delay(PSpecPath*path, svector<PExpr*>*del)
|
|||
|
||||
extern void pform_module_specify_path(PSpecPath*obj)
|
||||
{
|
||||
if (obj == 0)
|
||||
return;
|
||||
pform_cur_module->specify_paths.push_back(obj);
|
||||
}
|
||||
|
||||
|
|
@ -1744,6 +1764,9 @@ int pform_parse(const char*path, FILE*file)
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.140 2007/02/12 01:52:21 steve
|
||||
* Parse all specify paths to pform.
|
||||
*
|
||||
* Revision 1.139 2007/01/27 05:36:11 steve
|
||||
* Fix padding of x when literal is sized and unsigned.
|
||||
*
|
||||
|
|
|
|||
11
pform.h
11
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.87 2006/09/23 04:57:19 steve Exp $"
|
||||
#ident "$Id: pform.h,v 1.88 2007/02/12 01:52:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -265,7 +265,13 @@ extern void pform_set_specparam(perm_string name, PExpr*expr);
|
|||
extern PSpecPath*pform_make_specify_path(const struct vlltype&li,
|
||||
list<perm_string>*src, char pol,
|
||||
bool full_flag, list<perm_string>*dst);
|
||||
extern PSpecPath*pform_make_specify_edge_path(const struct vlltype&li,
|
||||
bool edge_flag, /*posedge==true */
|
||||
list<perm_string>*src, char pol,
|
||||
bool full_flag, list<perm_string>*dst,
|
||||
PExpr*data_source_expression);
|
||||
extern PSpecPath*pform_assign_path_delay(PSpecPath*obj, svector<PExpr*>*delays);
|
||||
|
||||
extern void pform_module_specify_path(PSpecPath*obj);
|
||||
|
||||
/*
|
||||
|
|
@ -328,6 +334,9 @@ extern void pform_dump(ostream&out, Module*mod);
|
|||
|
||||
/*
|
||||
* $Log: pform.h,v $
|
||||
* Revision 1.88 2007/02/12 01:52:21 steve
|
||||
* Parse all specify paths to pform.
|
||||
*
|
||||
* Revision 1.87 2006/09/23 04:57:19 steve
|
||||
* Basic support for specify timing.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: pform_dump.cc,v 1.94 2006/09/23 04:57:19 steve Exp $"
|
||||
#ident "$Id: pform_dump.cc,v 1.95 2007/02/12 01:52:21 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -742,7 +742,18 @@ void PProcess::dump(ostream&out, unsigned ind) const
|
|||
|
||||
void PSpecPath::dump(std::ostream&out, unsigned ind) const
|
||||
{
|
||||
out << setw(ind) << "" << "specify path (";
|
||||
out << setw(ind) << "" << "specify path ";
|
||||
|
||||
if (condition)
|
||||
out << "if (" << *condition << ") ";
|
||||
|
||||
out << "(";
|
||||
if (edge) {
|
||||
if (edge > 0)
|
||||
out << "posedge ";
|
||||
else
|
||||
out << "negedge ";
|
||||
}
|
||||
|
||||
for (unsigned idx = 0 ; idx < src.size() ; idx += 1) {
|
||||
if (idx > 0) out << ", ";
|
||||
|
|
@ -752,12 +763,18 @@ void PSpecPath::dump(std::ostream&out, unsigned ind) const
|
|||
|
||||
out << " => ";
|
||||
|
||||
if (data_source_expression)
|
||||
out << "(";
|
||||
|
||||
for (unsigned idx = 0 ; idx < dst.size() ; idx += 1) {
|
||||
if (idx > 0) out << ", ";
|
||||
assert(dst[idx]);
|
||||
out << dst[idx];
|
||||
}
|
||||
|
||||
if (data_source_expression)
|
||||
out << " : " << *data_source_expression << ")";
|
||||
|
||||
out << ") = (";
|
||||
for (unsigned idx = 0 ; idx < delays.size() ; idx += 1) {
|
||||
if (idx > 0) out << ", ";
|
||||
|
|
@ -1007,6 +1024,9 @@ void PUdp::dump(ostream&out) const
|
|||
|
||||
/*
|
||||
* $Log: pform_dump.cc,v $
|
||||
* Revision 1.95 2007/02/12 01:52:21 steve
|
||||
* Parse all specify paths to pform.
|
||||
*
|
||||
* Revision 1.94 2006/09/23 04:57:19 steve
|
||||
* Basic support for specify timing.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue