specparams as far as pform.
This commit is contained in:
parent
a275133ff9
commit
e58030498f
11
Module.h
11
Module.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: Module.h,v 1.28 2003/01/26 21:15:58 steve Exp $"
|
||||
#ident "$Id: Module.h,v 1.29 2003/02/27 06:45:11 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <list>
|
||||
|
|
@ -77,6 +77,12 @@ class Module : public LineInfo {
|
|||
map<string,param_expr_t>parameters;
|
||||
map<string,param_expr_t>localparams;
|
||||
|
||||
|
||||
/* specparams are simpler then other params, in that they have
|
||||
no type information. They are merely constant
|
||||
expressions. */
|
||||
map<string,PExpr*>specparams;
|
||||
|
||||
/* The module also has defparam assignments which don't create
|
||||
new parameters within the module, but may be used to set
|
||||
values within this module (when instantiated) or in other
|
||||
|
|
@ -155,6 +161,9 @@ class Module : public LineInfo {
|
|||
|
||||
/*
|
||||
* $Log: Module.h,v $
|
||||
* Revision 1.29 2003/02/27 06:45:11 steve
|
||||
* specparams as far as pform.
|
||||
*
|
||||
* Revision 1.28 2003/01/26 21:15:58 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
55
parse.y
55
parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if HAVE_CVS_IDENT
|
||||
#ident "$Id: parse.y,v 1.172 2003/02/07 23:16:09 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.173 2003/02/27 06:45:11 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -201,6 +201,9 @@ const static struct str_pair_t str_strength = { PGate::STRONG, PGate::STRONG };
|
|||
|
||||
%type <range_delay> range_delay
|
||||
|
||||
%type <letter> spec_polarity
|
||||
%type <texts> specify_path_identifiers
|
||||
|
||||
%token K_TAND
|
||||
%right '?' ':'
|
||||
%left K_LOR
|
||||
|
|
@ -2163,8 +2166,12 @@ specify_simple_path_decl
|
|||
;
|
||||
|
||||
specify_simple_path
|
||||
: '(' specify_path_identifiers spec_polarity K_EG expression ')'
|
||||
| '(' specify_path_identifiers spec_polarity K_SG expression ')'
|
||||
: '(' specify_path_identifiers spec_polarity
|
||||
K_EG specify_path_identifiers ')'
|
||||
{ pform_make_specify_path($2, $3, false, $5); }
|
||||
| '(' specify_path_identifiers spec_polarity
|
||||
K_SG specify_path_identifiers ')'
|
||||
{ pform_make_specify_path($2, $3, true, $5); }
|
||||
| '(' error ')'
|
||||
{ yyerror(@2, "Invalid simple path");
|
||||
yyerrok;
|
||||
|
|
@ -2172,16 +2179,40 @@ specify_simple_path
|
|||
;
|
||||
|
||||
specify_path_identifiers
|
||||
: IDENTIFIER { }
|
||||
| IDENTIFIER '[' expr_primary ']' { }
|
||||
| specify_path_identifiers ',' IDENTIFIER { }
|
||||
| specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' { }
|
||||
: IDENTIFIER
|
||||
{ list<char*>*tmp = new list<char*>;
|
||||
tmp->push_back($1);
|
||||
$$ = tmp;
|
||||
}
|
||||
| IDENTIFIER '[' expr_primary ']'
|
||||
{ list<char*>*tmp = new list<char*>;
|
||||
tmp->push_back($1);
|
||||
$$ = tmp;
|
||||
}
|
||||
| specify_path_identifiers ',' IDENTIFIER
|
||||
{ list<char*>*tmp = $1;
|
||||
tmp->push_back($3);
|
||||
$$ = tmp;
|
||||
}
|
||||
| specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']'
|
||||
{ list<char*>*tmp = $1;
|
||||
tmp->push_back($3);
|
||||
$$ = tmp;
|
||||
}
|
||||
;
|
||||
|
||||
specparam
|
||||
: IDENTIFIER '=' expression
|
||||
{ delete $1;
|
||||
delete $3;
|
||||
{ PExpr*tmp = $3;
|
||||
if (!pform_expression_is_constant(tmp)) {
|
||||
yyerror(@3, "error: specparam value "
|
||||
"must be a constant expression.");
|
||||
delete tmp;
|
||||
tmp = 0;
|
||||
} else {
|
||||
pform_set_specparam($1, tmp);
|
||||
}
|
||||
delete $1;
|
||||
}
|
||||
| IDENTIFIER '=' expression ':' expression ':' expression
|
||||
{ delete $1;
|
||||
|
|
@ -2205,7 +2236,11 @@ specparam_list
|
|||
| specparam_list ',' specparam
|
||||
;
|
||||
|
||||
spec_polarity: '+' | '-' | ;
|
||||
spec_polarity
|
||||
: '+' { $$ = '+'; }
|
||||
| '-' { $$ = '-'; }
|
||||
| { $$ = 0; }
|
||||
;
|
||||
|
||||
spec_reference_event
|
||||
: K_posedge expression
|
||||
|
|
|
|||
21
pform.cc
21
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.108 2003/02/02 19:02:39 steve Exp $"
|
||||
#ident "$Id: pform.cc,v 1.109 2003/02/27 06:45:11 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1231,12 +1231,28 @@ void pform_set_localparam(const string&name, PExpr*expr)
|
|||
pform_cur_module->localparams[name].signed_flag = false;
|
||||
}
|
||||
|
||||
void pform_set_specparam(const string&name, PExpr*expr)
|
||||
{
|
||||
assert(expr);
|
||||
pform_cur_module->specparams[name] = expr;
|
||||
}
|
||||
|
||||
void pform_set_defparam(const hname_t&name, PExpr*expr)
|
||||
{
|
||||
assert(expr);
|
||||
pform_cur_module->defparms[name] = expr;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXXX Not implemented yet.
|
||||
*/
|
||||
extern void pform_make_specify_path(list<char*>*src, char pol,
|
||||
bool full_flag, list<char*>*dst)
|
||||
{
|
||||
delete src;
|
||||
delete dst;
|
||||
}
|
||||
|
||||
void pform_set_port_type(const struct vlltype&li,
|
||||
list<char*>*names,
|
||||
svector<PExpr*>*range,
|
||||
|
|
@ -1396,6 +1412,9 @@ int pform_parse(const char*path, FILE*file)
|
|||
|
||||
/*
|
||||
* $Log: pform.cc,v $
|
||||
* Revision 1.109 2003/02/27 06:45:11 steve
|
||||
* specparams as far as pform.
|
||||
*
|
||||
* Revision 1.108 2003/02/02 19:02:39 steve
|
||||
* Add support for signed ports and nets.
|
||||
*
|
||||
|
|
|
|||
12
pform.h
12
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.67 2003/02/02 19:02:40 steve Exp $"
|
||||
#ident "$Id: pform.h,v 1.68 2003/02/27 06:45:11 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -207,6 +207,13 @@ extern void pform_set_parameter(const string&name,
|
|||
extern void pform_set_localparam(const string&name, PExpr*expr);
|
||||
extern void pform_set_defparam(const hname_t&name, PExpr*expr);
|
||||
|
||||
/*
|
||||
* Functions related to specify blocks.
|
||||
*/
|
||||
extern void pform_set_specparam(const string&name, PExpr*expr);
|
||||
extern void pform_make_specify_path(list<char*>*src, char pol,
|
||||
bool full_flag, list<char*>*dst);
|
||||
|
||||
/*
|
||||
* pform_make_behavior creates processes that are declared with always
|
||||
* or initial items.
|
||||
|
|
@ -268,6 +275,9 @@ extern void pform_dump(ostream&out, Module*mod);
|
|||
|
||||
/*
|
||||
* $Log: pform.h,v $
|
||||
* Revision 1.68 2003/02/27 06:45:11 steve
|
||||
* specparams as far as pform.
|
||||
*
|
||||
* Revision 1.67 2003/02/02 19:02:40 steve
|
||||
* Add support for signed ports and nets.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.78 2003/01/26 21:15:59 steve Exp $"
|
||||
#ident "$Id: pform_dump.cc,v 1.79 2003/02/27 06:45:11 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -738,6 +738,13 @@ void Module::dump(ostream&out) const
|
|||
out << "/* ERROR */;" << endl;
|
||||
}
|
||||
|
||||
typedef map<string,PExpr*>::const_iterator specparm_iter_t;
|
||||
for (specparm_iter_t cur = specparams.begin()
|
||||
; cur != specparams.end() ; cur ++) {
|
||||
out << " specparam " << (*cur).first << " = "
|
||||
<< *(*cur).second << ";" << endl;
|
||||
}
|
||||
|
||||
for (parm_hiter_t cur = defparms.begin()
|
||||
; cur != defparms.end() ; cur ++) {
|
||||
out << " defparam " << (*cur).first << " = ";
|
||||
|
|
@ -856,6 +863,9 @@ void PUdp::dump(ostream&out) const
|
|||
|
||||
/*
|
||||
* $Log: pform_dump.cc,v $
|
||||
* Revision 1.79 2003/02/27 06:45:11 steve
|
||||
* specparams as far as pform.
|
||||
*
|
||||
* Revision 1.78 2003/01/26 21:15:59 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
Loading…
Reference in New Issue