Keep parameter constants for the ivl_target API.
This commit is contained in:
parent
7e9095acf2
commit
1222153cdf
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: design_dump.cc,v 1.137 2003/01/27 05:09:17 steve Exp $"
|
||||
#ident "$Id: design_dump.cc,v 1.138 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -703,8 +703,8 @@ void NetScope::dump(ostream&o) const
|
|||
/* Dump the parameters for this scope. */
|
||||
{
|
||||
map<string,param_expr_t>::const_iterator pp;
|
||||
for (pp = parameters_.begin()
|
||||
; pp != parameters_.end() ; pp ++) {
|
||||
for (pp = parameters.begin()
|
||||
; pp != parameters.end() ; pp ++) {
|
||||
o << " parameter ";
|
||||
|
||||
if ((*pp).second.signed_flag)
|
||||
|
|
@ -718,8 +718,8 @@ void NetScope::dump(ostream&o) const
|
|||
*(*pp).second.expr << ";" << endl;
|
||||
}
|
||||
|
||||
for (pp = localparams_.begin()
|
||||
; pp != localparams_.end() ; pp ++) {
|
||||
for (pp = localparams.begin()
|
||||
; pp != localparams.end() ; pp ++) {
|
||||
o << " localparam " << (*pp).first << " = " <<
|
||||
*(*pp).second.expr << ";" << endl;
|
||||
}
|
||||
|
|
@ -903,6 +903,13 @@ void NetEConst::dump(ostream&o) const
|
|||
o << value_;
|
||||
}
|
||||
|
||||
void NetEConstParam::dump(ostream&o) const
|
||||
{
|
||||
o << "<" << name_ << "=";
|
||||
NetEConst::dump(o);
|
||||
o << ">";
|
||||
}
|
||||
|
||||
void NetECReal::dump(ostream&o) const
|
||||
{
|
||||
o << value_;
|
||||
|
|
@ -1021,6 +1028,9 @@ void Design::dump(ostream&o) const
|
|||
|
||||
/*
|
||||
* $Log: design_dump.cc,v $
|
||||
* Revision 1.138 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.137 2003/01/27 05:09:17 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
|
|
|
|||
19
dup_expr.cc
19
dup_expr.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: dup_expr.cc,v 1.10 2003/01/26 21:15:58 steve Exp $"
|
||||
#ident "$Id: dup_expr.cc,v 1.11 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -25,6 +25,20 @@
|
|||
# include "netlist.h"
|
||||
# include <cassert>
|
||||
|
||||
NetEConst* NetEConst::dup_expr() const
|
||||
{
|
||||
NetEConst*tmp = new NetEConst(value_);
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
NetEConstParam* NetEConstParam::dup_expr() const
|
||||
{
|
||||
NetEConstParam*tmp = new NetEConstParam(scope_, name_, value());
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
NetEScope* NetEScope::dup_expr() const
|
||||
{
|
||||
assert(0);
|
||||
|
|
@ -95,6 +109,9 @@ NetEVariable* NetEVariable::dup_expr() const
|
|||
|
||||
/*
|
||||
* $Log: dup_expr.cc,v $
|
||||
* Revision 1.11 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.10 2003/01/26 21:15:58 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
31
elab_expr.cc
31
elab_expr.cc
|
|
@ -17,11 +17,11 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_expr.cc,v 1.70 2003/03/07 02:44:34 steve Exp $"
|
||||
#ident "$Id: elab_expr.cc,v 1.71 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
||||
# include "compiler.h"
|
||||
|
||||
# include "pform.h"
|
||||
# include "netlist.h"
|
||||
|
|
@ -428,15 +428,15 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
bool sys_task_arg) const
|
||||
{
|
||||
assert(scope);
|
||||
NetScope*found_in;
|
||||
|
||||
// If the identifier name is a parameter name, then return
|
||||
// a reference to the parameter expression.
|
||||
if (const NetExpr*ex = des->find_parameter(scope, path_)) {
|
||||
if (const NetExpr*ex = des->find_parameter(scope, path_, found_in)) {
|
||||
NetExpr*tmp;
|
||||
if (dynamic_cast<const NetExpr*>(ex))
|
||||
tmp = ex->dup_expr();
|
||||
else
|
||||
tmp = new NetEParam(des, scope, path_);
|
||||
|
||||
assert(ex);
|
||||
tmp = ex? ex->dup_expr() : new NetEParam(des, scope, path_);
|
||||
|
||||
if (msb_ && lsb_) {
|
||||
/* If the parameter has a part select, we support
|
||||
|
|
@ -549,8 +549,20 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope,
|
|||
tmp->set_line(*this);
|
||||
tmp = stmp;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* No bit or part select. Make the constant into a
|
||||
NetEConstParam if possible. */
|
||||
NetEConst*ctmp = dynamic_cast<NetEConst*>(tmp);
|
||||
if (ctmp != 0) {
|
||||
const char*name
|
||||
= lex_strings.add(path_.peek_name(0));
|
||||
NetEConstParam*ptmp
|
||||
= new NetEConstParam(found_in, name, ctmp->value());
|
||||
delete tmp;
|
||||
tmp = ptmp;
|
||||
}
|
||||
}
|
||||
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
|
|
@ -902,6 +914,9 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const
|
|||
|
||||
/*
|
||||
* $Log: elab_expr.cc,v $
|
||||
* Revision 1.71 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.70 2003/03/07 02:44:34 steve
|
||||
* Implement $realtobits.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: elab_net.cc,v 1.108 2003/03/06 00:28:41 steve Exp $"
|
||||
#ident "$Id: elab_net.cc,v 1.109 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1260,6 +1260,8 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
|||
NetNet*sig = des->find_signal(scope, path_);
|
||||
|
||||
if (sig == 0) {
|
||||
NetScope*found_in;
|
||||
|
||||
/* If the identifier is a memory instead of a signal,
|
||||
then handle it elsewhere. Create a RAM. */
|
||||
if (NetMemory*mem = des->find_memory(scope, path_))
|
||||
|
|
@ -1267,7 +1269,7 @@ NetNet* PEIdent::elaborate_net(Design*des, NetScope*scope,
|
|||
rise, fall, decay);
|
||||
|
||||
|
||||
if (const NetExpr*pe = des->find_parameter(scope, path_)) {
|
||||
if (const NetExpr*pe = des->find_parameter(scope, path_, found_in)) {
|
||||
|
||||
const NetEConst*pc = dynamic_cast<const NetEConst*>(pe);
|
||||
assert(pc);
|
||||
|
|
@ -2277,6 +2279,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
|
|||
|
||||
/*
|
||||
* $Log: elab_net.cc,v $
|
||||
* Revision 1.109 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.108 2003/03/06 00:28:41 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
10
emit.cc
10
emit.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: emit.cc,v 1.71 2003/01/26 21:15:58 steve Exp $"
|
||||
#ident "$Id: emit.cc,v 1.72 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -414,6 +414,11 @@ void NetEConst::expr_scan(struct expr_scan_t*tgt) const
|
|||
tgt->expr_const(this);
|
||||
}
|
||||
|
||||
void NetEConstParam::expr_scan(struct expr_scan_t*tgt) const
|
||||
{
|
||||
tgt->expr_param(this);
|
||||
}
|
||||
|
||||
void NetECReal::expr_scan(struct expr_scan_t*tgt) const
|
||||
{
|
||||
tgt->expr_creal(this);
|
||||
|
|
@ -492,6 +497,9 @@ bool emit(const Design*des, const char*type)
|
|||
|
||||
/*
|
||||
* $Log: emit.cc,v $
|
||||
* Revision 1.72 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.71 2003/01/26 21:15:58 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
6
eval.cc
6
eval.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: eval.cc,v 1.32 2002/10/19 22:59:49 steve Exp $"
|
||||
#ident "$Id: eval.cc,v 1.33 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -136,6 +136,7 @@ verinum* PEBinary::eval_const(const Design*des, const NetScope*scope) const
|
|||
*/
|
||||
verinum* PEIdent::eval_const(const Design*des, const NetScope*scope) const
|
||||
{
|
||||
NetScope*found_in;
|
||||
assert(scope);
|
||||
const NetExpr*expr = des->find_parameter(scope, path_);
|
||||
|
||||
|
|
@ -226,6 +227,9 @@ verinum* PEUnary::eval_const(const Design*des, const NetScope*scope) const
|
|||
|
||||
/*
|
||||
* $Log: eval.cc,v $
|
||||
* Revision 1.33 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.32 2002/10/19 22:59:49 steve
|
||||
* Redo the parameter vector support to allow
|
||||
* parameter names in range expressions.
|
||||
|
|
|
|||
29
eval_tree.cc
29
eval_tree.cc
|
|
@ -17,10 +17,11 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: eval_tree.cc,v 1.47 2003/02/07 02:47:58 steve Exp $"
|
||||
#ident "$Id: eval_tree.cc,v 1.48 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
# include "compiler.h"
|
||||
|
||||
# include <iostream>
|
||||
|
||||
|
|
@ -912,13 +913,22 @@ NetExpr* NetEParam::eval_tree()
|
|||
|
||||
// If the parameter that I refer to is already evaluated, then
|
||||
// return the constant value.
|
||||
if (dynamic_cast<NetEConst*>(nexpr))
|
||||
return nexpr;
|
||||
if (NetEConst*tmp = dynamic_cast<NetEConst*>(nexpr)) {
|
||||
verinum val = tmp->value();
|
||||
const char*name = lex_strings.add(name_.peek_name(0));
|
||||
NetEConstParam*ptmp = new NetEConstParam(scope_, name, val);
|
||||
ptmp->set_line(*this);
|
||||
delete nexpr;
|
||||
return ptmp;
|
||||
}
|
||||
|
||||
// Try to evaluate the expression. If I cannot, then the
|
||||
// expression is not a constant expression and I fail here.
|
||||
NetExpr*res = nexpr->eval_tree();
|
||||
if (res == 0) {
|
||||
cerr << get_line() << ": internal error: Unable to evaluate "
|
||||
<< " parameter " << name_ << " expression:"
|
||||
<< *nexpr << endl;
|
||||
delete nexpr;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -926,7 +936,15 @@ NetExpr* NetEParam::eval_tree()
|
|||
// The result can be saved as the value of the parameter for
|
||||
// future reference, and return a copy to the caller.
|
||||
scope_->replace_parameter(name_.peek_name(0), res);
|
||||
return res->dup_expr();
|
||||
|
||||
NetEConst*tmp = dynamic_cast<NetEConst*>(res);
|
||||
assert(tmp);
|
||||
|
||||
verinum val = tmp->value();
|
||||
const char*name = lex_strings.add(name_.peek_name(0));
|
||||
NetEConstParam*ptmp = new NetEConstParam(scope_, name, val);
|
||||
|
||||
return ptmp;
|
||||
}
|
||||
|
||||
NetEConst* NetESelect::eval_tree()
|
||||
|
|
@ -1222,6 +1240,9 @@ NetEConst* NetEUReduce::eval_tree()
|
|||
|
||||
/*
|
||||
* $Log: eval_tree.cc,v $
|
||||
* Revision 1.48 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.47 2003/02/07 02:47:58 steve
|
||||
* NetEBDiv handles real value constant expressions.
|
||||
*
|
||||
|
|
|
|||
144
ivl_target.h
144
ivl_target.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: ivl_target.h,v 1.114 2003/03/06 01:24:37 steve Exp $"
|
||||
#ident "$Id: ivl_target.h,v 1.115 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -95,6 +95,12 @@ _BEGIN_DECL
|
|||
* there are backward references to all the device pins that point
|
||||
* to it.
|
||||
*
|
||||
* ivl_parameter_t
|
||||
* Scopes have zero or more parameter objects that represent
|
||||
* parameters that the source defined. The parameter has a value
|
||||
* that is fully elaborated, with defparams and other parameter
|
||||
* overrides taken care of.
|
||||
*
|
||||
* ivl_process_t
|
||||
* A Verilog process is represented by one of these. A process may
|
||||
* be an "initial" or an "always" process. These come from initial
|
||||
|
|
@ -120,6 +126,10 @@ _BEGIN_DECL
|
|||
* -- A Note About Names --
|
||||
* The names of objects are complete, hierarchical names. That is,
|
||||
* they include the instance name of the module that contains them.
|
||||
*
|
||||
* basenames are the name of the object without the containing
|
||||
* scope. These names are unique within a scope, but not necessarily
|
||||
* throughout the design.
|
||||
*/
|
||||
typedef struct ivl_design_s *ivl_design_t;
|
||||
typedef struct ivl_event_s *ivl_event_t;
|
||||
|
|
@ -132,6 +142,7 @@ typedef struct ivl_udp_s *ivl_udp_t;
|
|||
typedef struct ivl_net_probe_s*ivl_net_probe_t;
|
||||
typedef struct ivl_nexus_s *ivl_nexus_t;
|
||||
typedef struct ivl_nexus_ptr_s*ivl_nexus_ptr_t;
|
||||
typedef struct ivl_parameter_s*ivl_parameter_t;
|
||||
typedef struct ivl_process_s *ivl_process_t;
|
||||
typedef struct ivl_scope_s *ivl_scope_t;
|
||||
typedef struct ivl_signal_s *ivl_signal_t;
|
||||
|
|
@ -438,6 +449,13 @@ extern ivl_nexus_t ivl_event_pos(ivl_event_t net, unsigned idx);
|
|||
* node. It can be applied to any expression node, and returns the
|
||||
* *output* width of the expression node.
|
||||
*
|
||||
* ivl_expr_parameter
|
||||
* This function returns the ivl_parameter_t object that represents
|
||||
* this object, or 0 (nil) if it is not a parameter value. This
|
||||
* function allows the code generator to detect the case where the
|
||||
* expression is a parameter. This will normally only return a
|
||||
* non-nil value for constants.
|
||||
*
|
||||
* ivl_expr_opcode
|
||||
* IVL_EX_BINARY and IVL_EX_UNARY expression nodes include an
|
||||
* opcode from this table:
|
||||
|
|
@ -467,6 +485,8 @@ extern ivl_expr_t ivl_expr_oper1(ivl_expr_t net);
|
|||
extern ivl_expr_t ivl_expr_oper2(ivl_expr_t net);
|
||||
/* IVL_EX_TERNARY */
|
||||
extern ivl_expr_t ivl_expr_oper3(ivl_expr_t net);
|
||||
/* and expression */
|
||||
extern ivl_parameter_t ivl_expr_parameter(ivl_expr_t net);
|
||||
/* IVL_EX_CONCAT IVL_EX_UFUNC */
|
||||
extern ivl_expr_t ivl_expr_parm(ivl_expr_t net, unsigned idx);
|
||||
/* IVL_EX_CONCAT IVL_EX_SFUNC IVL_EX_UFUNC */
|
||||
|
|
@ -811,6 +831,37 @@ extern ivl_net_logic_t ivl_nexus_ptr_log(ivl_nexus_ptr_t net);
|
|||
extern ivl_lpm_t ivl_nexus_ptr_lpm(ivl_nexus_ptr_t net);
|
||||
extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
|
||||
|
||||
/* PARAMETER
|
||||
* Parameters are named constants associated with a scope. The user
|
||||
* may set in the Verilog source the value of parameters, and that
|
||||
* leads to ivl_parameter_t objects contained in the ivl_scope_t
|
||||
* objects.
|
||||
*
|
||||
* Parameters are essentially named constants. These constant values
|
||||
* can be accessed by looking at the scope (using ivl_scope_param) or
|
||||
* they can be discovered when they are used, via the
|
||||
* ivl_expr_parameter function. The fact that a constant has a name
|
||||
* (i.e. is a parameter) does not otherwise impose on the value or
|
||||
* interpretation of the constant expression so far as ivl_target is
|
||||
* concerned. The target may need this information, or may choose to
|
||||
* completely ignore it.
|
||||
*
|
||||
* ivl_parameter_basename
|
||||
* return the name of the parameter.
|
||||
*
|
||||
* ivl_parameter_scope
|
||||
* Return the scope of the parameter. The parameter name is only
|
||||
* unique within its scope.
|
||||
*
|
||||
* ivl_parameter_expr
|
||||
* Return the value of the parameter. This should be a simple
|
||||
* constant expression, an IVL_EX_STRING or IVL_EX_NUMBER.
|
||||
*/
|
||||
extern const char* ivl_parameter_basename(ivl_parameter_t net);
|
||||
extern ivl_scope_t ivl_parameter_scope(ivl_parameter_t net);
|
||||
extern ivl_expr_t ivl_parameter_expr(ivl_parameter_t net);
|
||||
|
||||
|
||||
/* SCOPE
|
||||
* Scopes of various sort have these properties. Use these methods to
|
||||
* access them. Scopes come to exist in the elaborated design
|
||||
|
|
@ -876,6 +927,11 @@ extern ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net);
|
|||
* ivl_scope_basename is the name of the scope without the included
|
||||
* hierarchy.
|
||||
*
|
||||
* ivl_scope_param
|
||||
* ivl_scope_params
|
||||
* A scope has zero or more named parameters. These parameters have
|
||||
* a name and an expression value.
|
||||
*
|
||||
* ivl_scope_parent
|
||||
* If this is a non-root scope, then the parent is the scope that
|
||||
* contains this scope. Otherwise, the parent is nil.
|
||||
|
|
@ -925,6 +981,8 @@ extern unsigned ivl_scope_vars(ivl_scope_t net);
|
|||
extern ivl_variable_t ivl_scope_var(ivl_scope_t net, unsigned idx);
|
||||
extern const char* ivl_scope_name(ivl_scope_t net);
|
||||
extern const char* ivl_scope_basename(ivl_scope_t net);
|
||||
extern unsigned ivl_scope_params(ivl_scope_t net);
|
||||
extern ivl_parameter_t ivl_scope_param(ivl_scope_t net, unsigned idx);
|
||||
extern ivl_scope_t ivl_scope_parent(ivl_scope_t net);
|
||||
extern unsigned ivl_scope_ports(ivl_scope_t net);
|
||||
extern ivl_signal_t ivl_scope_port(ivl_scope_t net, unsigned idx);
|
||||
|
|
@ -1146,6 +1204,9 @@ _END_DECL
|
|||
|
||||
/*
|
||||
* $Log: ivl_target.h,v $
|
||||
* Revision 1.115 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.114 2003/03/06 01:24:37 steve
|
||||
* Obsolete the ivl_event_name function.
|
||||
*
|
||||
|
|
@ -1168,86 +1229,5 @@ _END_DECL
|
|||
* implementation of vpiSystemTime the $time functions
|
||||
* to properly account for this. Also add $simtime
|
||||
* to get the simulation time.
|
||||
*
|
||||
* Revision 1.108 2002/10/23 01:47:17 steve
|
||||
* Fix synth2 handling of aset/aclr signals where
|
||||
* flip-flops are split by begin-end blocks.
|
||||
*
|
||||
* Revision 1.107 2002/09/26 03:18:04 steve
|
||||
* Generate vvp code for asynch set/reset of NetFF.
|
||||
*
|
||||
* Revision 1.106 2002/09/12 15:49:43 steve
|
||||
* Add support for binary nand operator.
|
||||
*
|
||||
* Revision 1.105 2002/08/24 05:03:40 steve
|
||||
* Missing declaration of ivl_memory_scope.
|
||||
*
|
||||
* Revision 1.104 2002/08/12 01:34:59 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
* Revision 1.103 2002/08/05 04:18:45 steve
|
||||
* Store only the base name of memories.
|
||||
*
|
||||
* Revision 1.102 2002/08/04 18:28:14 steve
|
||||
* Do not use hierarchical names of memories to
|
||||
* generate vvp labels. -tdll target does not
|
||||
* used hierarchical name string to look up the
|
||||
* memory objects in the design.
|
||||
*
|
||||
* Revision 1.101 2002/07/05 21:26:17 steve
|
||||
* Avoid emitting to vvp local net symbols.
|
||||
*
|
||||
* Revision 1.100 2002/06/21 04:59:35 steve
|
||||
* Carry integerness throughout the compilation.
|
||||
*
|
||||
* Revision 1.99 2002/06/11 03:34:33 steve
|
||||
* Spelling patch (Larry Doolittle)
|
||||
*
|
||||
* Revision 1.98 2002/05/27 00:08:45 steve
|
||||
* Support carrying the scope of named begin-end
|
||||
* blocks down to the code generator, and have
|
||||
* the vvp code generator use that to support disable.
|
||||
*
|
||||
* Revision 1.97 2002/05/26 01:39:02 steve
|
||||
* Carry Verilog 2001 attributes with processes,
|
||||
* all the way through to the ivl_target API.
|
||||
*
|
||||
* Divide signal reference counts between rval
|
||||
* and lval references.
|
||||
*
|
||||
* Revision 1.96 2002/05/24 04:36:23 steve
|
||||
* Verilog 2001 attriubtes on nets/wires.
|
||||
*
|
||||
* Revision 1.95 2002/05/23 03:08:51 steve
|
||||
* Add language support for Verilog-2001 attribute
|
||||
* syntax. Hook this support into existing $attribute
|
||||
* handling, and add number and void value types.
|
||||
*
|
||||
* Add to the ivl_target API new functions for access
|
||||
* of complex attributes attached to gates.
|
||||
*
|
||||
* Revision 1.94 2002/03/17 19:30:20 steve
|
||||
* Add API to support user defined function.
|
||||
*
|
||||
* Revision 1.93 2002/03/09 02:10:22 steve
|
||||
* Add the NetUserFunc netlist node.
|
||||
*
|
||||
* Revision 1.92 2002/01/28 00:52:41 steve
|
||||
* Add support for bit select of parameters.
|
||||
* This leads to a NetESelect node and the
|
||||
* vvp code generator to support that.
|
||||
*
|
||||
* Revision 1.91 2002/01/03 04:19:01 steve
|
||||
* Add structural modulus support down to vvp.
|
||||
*
|
||||
* Revision 1.90 2001/12/15 02:13:17 steve
|
||||
* The IVL_SIT_WIRE type does not exist, it is a
|
||||
* synonym for IVL_SIT_TRI.
|
||||
*
|
||||
* Revision 1.89 2001/12/06 03:11:00 steve
|
||||
* Add ivl_logic_delay function to ivl_target.
|
||||
*
|
||||
* Revision 1.88 2001/11/14 03:28:49 steve
|
||||
* DLL target support for force and release.
|
||||
*/
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_design.cc,v 1.35 2003/03/06 04:37:12 steve Exp $"
|
||||
#ident "$Id: net_design.cc,v 1.36 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -179,7 +179,38 @@ NetScope* Design::find_scope(NetScope*scope, const hname_t&path) const
|
|||
* working up towards the root, looking for the named parameter. The
|
||||
* name in this case can be hierarchical, so there is an inner loop to
|
||||
* follow the scopes of the name down to to key.
|
||||
*
|
||||
* The expression value of the parameter is returned as the result,
|
||||
* and the scope that contains the parameter is returned in the out
|
||||
* argument found_in.
|
||||
*/
|
||||
const NetExpr* Design::find_parameter(NetScope*scope,
|
||||
const hname_t&path,
|
||||
NetScope*&found_in) const
|
||||
{
|
||||
for ( ; scope ; scope = scope->parent()) {
|
||||
unsigned hidx = 0;
|
||||
|
||||
NetScope*cur = scope;
|
||||
while (path.peek_name(hidx+1)) {
|
||||
cur = cur->child(path.peek_name(hidx));
|
||||
if (cur == 0)
|
||||
break;
|
||||
hidx += 1;
|
||||
}
|
||||
|
||||
if (cur == 0)
|
||||
continue;
|
||||
|
||||
if (const NetExpr*res = cur->get_parameter(path.peek_name(hidx))) {
|
||||
found_in = cur;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const NetExpr* Design::find_parameter(const NetScope*scope,
|
||||
const hname_t&path) const
|
||||
{
|
||||
|
|
@ -199,6 +230,7 @@ const NetExpr* Design::find_parameter(const NetScope*scope,
|
|||
|
||||
if (const NetExpr*res = cur->get_parameter(path.peek_name(hidx)))
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
@ -279,8 +311,8 @@ void NetScope::evaluate_parameters(Design*des)
|
|||
|
||||
typedef map<string,param_expr_t>::iterator mparm_it_t;
|
||||
|
||||
for (mparm_it_t cur = parameters_.begin()
|
||||
; cur != parameters_.end() ; cur ++) {
|
||||
for (mparm_it_t cur = parameters.begin()
|
||||
; cur != parameters.end() ; cur ++) {
|
||||
|
||||
long msb = 0;
|
||||
long lsb = 0;
|
||||
|
|
@ -376,7 +408,9 @@ void NetScope::evaluate_parameters(Design*des)
|
|||
if (nexpr == 0) {
|
||||
cerr << (*cur).second.expr->get_line()
|
||||
<< ": internal error: "
|
||||
"unable to evaluate parameter value: " <<
|
||||
<< "unable to evaluate parameter "
|
||||
<< (*cur).first
|
||||
<< " value: " <<
|
||||
*expr << endl;
|
||||
des->errors += 1;
|
||||
continue;
|
||||
|
|
@ -651,6 +685,9 @@ void Design::delete_process(NetProcTop*top)
|
|||
|
||||
/*
|
||||
* $Log: net_design.cc,v $
|
||||
* Revision 1.36 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.35 2003/03/06 04:37:12 steve
|
||||
* lex_strings.add module names earlier.
|
||||
*
|
||||
|
|
|
|||
19
net_scope.cc
19
net_scope.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: net_scope.cc,v 1.27 2003/03/06 04:37:12 steve Exp $"
|
||||
#ident "$Id: net_scope.cc,v 1.28 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -81,7 +81,7 @@ NetScope::~NetScope()
|
|||
NetExpr* NetScope::set_parameter(const string&key, NetExpr*expr,
|
||||
NetExpr*msb, NetExpr*lsb, bool signed_flag)
|
||||
{
|
||||
param_expr_t&ref = parameters_[key];
|
||||
param_expr_t&ref = parameters[key];
|
||||
NetExpr* res = ref.expr;
|
||||
ref.expr = expr;
|
||||
ref.msb = msb;
|
||||
|
|
@ -96,7 +96,7 @@ NetExpr* NetScope::set_parameter(const string&key, NetExpr*expr,
|
|||
bool NetScope::replace_parameter(const string&key, NetExpr*expr)
|
||||
{
|
||||
bool flag = true;
|
||||
param_expr_t&ref = parameters_[key];
|
||||
param_expr_t&ref = parameters[key];
|
||||
|
||||
NetExpr* res = ref.expr;
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ bool NetScope::replace_parameter(const string&key, NetExpr*expr)
|
|||
|
||||
NetExpr* NetScope::set_localparam(const string&key, NetExpr*expr)
|
||||
{
|
||||
param_expr_t&ref = localparams_[key];
|
||||
param_expr_t&ref = localparams[key];
|
||||
NetExpr* res = ref.expr;
|
||||
ref.expr = expr;
|
||||
ref.msb = 0;
|
||||
|
|
@ -128,12 +128,12 @@ const NetExpr* NetScope::get_parameter(const string&key) const
|
|||
{
|
||||
map<string,param_expr_t>::const_iterator idx;
|
||||
|
||||
idx = parameters_.find(key);
|
||||
if (idx != parameters_.end())
|
||||
idx = parameters.find(key);
|
||||
if (idx != parameters.end())
|
||||
return (*idx).second.expr;
|
||||
|
||||
idx = localparams_.find(key);
|
||||
if (idx != localparams_.end())
|
||||
idx = localparams.find(key);
|
||||
if (idx != localparams.end())
|
||||
return (*idx).second.expr;
|
||||
|
||||
return 0;
|
||||
|
|
@ -448,6 +448,9 @@ string NetScope::local_hsymbol()
|
|||
|
||||
/*
|
||||
* $Log: net_scope.cc,v $
|
||||
* Revision 1.28 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.27 2003/03/06 04:37:12 steve
|
||||
* lex_strings.add module names earlier.
|
||||
*
|
||||
|
|
|
|||
26
netlist.cc
26
netlist.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.cc,v 1.207 2003/03/06 00:28:42 steve Exp $"
|
||||
#ident "$Id: netlist.cc,v 1.208 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -1890,13 +1890,26 @@ bool NetEConst::has_width() const
|
|||
return value_.has_len();
|
||||
}
|
||||
|
||||
NetEConst* NetEConst::dup_expr() const
|
||||
NetEConstParam::NetEConstParam(NetScope*s, const char*n, const verinum&v)
|
||||
: NetEConst(v), scope_(s), name_(n)
|
||||
{
|
||||
NetEConst*tmp = new NetEConst(value_);
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
NetEConstParam::~NetEConstParam()
|
||||
{
|
||||
}
|
||||
|
||||
const char* NetEConstParam::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
const NetScope* NetEConstParam::scope() const
|
||||
{
|
||||
return scope_;
|
||||
}
|
||||
|
||||
|
||||
NetEMemory::NetEMemory(NetMemory*m, NetExpr*i)
|
||||
: NetExpr(m->width()), mem_(m), idx_(i)
|
||||
{
|
||||
|
|
@ -2178,6 +2191,9 @@ const NetProc*NetTaskDef::proc() const
|
|||
|
||||
/*
|
||||
* $Log: netlist.cc,v $
|
||||
* Revision 1.208 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.207 2003/03/06 00:28:42 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
55
netlist.h
55
netlist.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: netlist.h,v 1.279 2003/03/06 00:28:42 steve Exp $"
|
||||
#ident "$Id: netlist.h,v 1.280 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -1019,6 +1019,26 @@ class NetEConst : public NetExpr {
|
|||
verinum value_;
|
||||
};
|
||||
|
||||
class NetEConstParam : public NetEConst {
|
||||
|
||||
public:
|
||||
explicit NetEConstParam(NetScope*scope, const char*name,
|
||||
const verinum&val);
|
||||
~NetEConstParam();
|
||||
|
||||
const char* name() const;
|
||||
const NetScope*scope() const;
|
||||
|
||||
virtual void expr_scan(struct expr_scan_t*) const;
|
||||
virtual void dump(ostream&) const;
|
||||
|
||||
virtual NetEConstParam* dup_expr() const;
|
||||
|
||||
private:
|
||||
NetScope*scope_;
|
||||
const char*name_;
|
||||
};
|
||||
|
||||
/*
|
||||
* This class represents a constant real value.
|
||||
*/
|
||||
|
|
@ -2317,7 +2337,7 @@ class NetEBinary : public NetExpr {
|
|||
NetExpr* left_;
|
||||
NetExpr* right_;
|
||||
|
||||
virtual void eval_sub_tree_();
|
||||
void eval_sub_tree_();
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -3002,20 +3022,23 @@ class NetScope {
|
|||
|
||||
map<hname_t,NetExpr*>defparams;
|
||||
|
||||
private:
|
||||
TYPE type_;
|
||||
const char* name_;
|
||||
|
||||
signed char time_unit_, time_prec_;
|
||||
|
||||
public:
|
||||
/* After everything is all set up, the code generators like
|
||||
access to these things to make up the parameter lists. */
|
||||
struct param_expr_t {
|
||||
NetExpr*expr;
|
||||
NetExpr*msb;
|
||||
NetExpr*lsb;
|
||||
bool signed_flag;
|
||||
};
|
||||
map<string,param_expr_t>parameters_;
|
||||
map<string,param_expr_t>localparams_;
|
||||
map<string,param_expr_t>parameters;
|
||||
map<string,param_expr_t>localparams;
|
||||
|
||||
private:
|
||||
TYPE type_;
|
||||
const char* name_;
|
||||
|
||||
signed char time_unit_, time_prec_;
|
||||
|
||||
NetEvent *events_;
|
||||
NetVariable*vars_;
|
||||
|
|
@ -3086,8 +3109,13 @@ class Design {
|
|||
|
||||
/* This method searches for a parameter, starting in the given
|
||||
scope. This method handles the upward searches that the
|
||||
NetScope class itself does not support. */
|
||||
const NetExpr*find_parameter(const NetScope*, const hname_t&path) const;
|
||||
NetScope class itself does not support.
|
||||
|
||||
The scope of the located expression is stored in the
|
||||
found_in argument. */
|
||||
const NetExpr*find_parameter( NetScope*, const hname_t&path,
|
||||
NetScope*&found_in) const;
|
||||
const NetExpr*find_parameter( const NetScope*, const hname_t&path) const;
|
||||
|
||||
void run_defparams();
|
||||
void evaluate_parameters();
|
||||
|
|
@ -3207,6 +3235,9 @@ extern ostream& operator << (ostream&, NetNet::Type);
|
|||
|
||||
/*
|
||||
* $Log: netlist.h,v $
|
||||
* Revision 1.280 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.279 2003/03/06 00:28:42 steve
|
||||
* All NetObj objects have lex_string base names.
|
||||
*
|
||||
|
|
|
|||
50
t-dll-api.cc
50
t-dll-api.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll-api.cc,v 1.95 2003/03/06 04:32:40 steve Exp $"
|
||||
#ident "$Id: t-dll-api.cc,v 1.96 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -356,6 +356,20 @@ extern "C" ivl_expr_t ivl_expr_oper3(ivl_expr_t net)
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern "C" ivl_parameter_t ivl_expr_parameter(ivl_expr_t net)
|
||||
{
|
||||
switch (net->type_) {
|
||||
case IVL_EX_NUMBER:
|
||||
return net->u_.number_.parameter;
|
||||
case IVL_EX_STRING:
|
||||
return net->u_.string_.parameter;
|
||||
case IVL_EX_REALNUM:
|
||||
return net->u_.real_.parameter;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" ivl_expr_t ivl_expr_parm(ivl_expr_t net, unsigned idx)
|
||||
{
|
||||
assert(net);
|
||||
|
|
@ -1091,6 +1105,24 @@ extern "C" ivl_signal_t ivl_nexus_ptr_sig(ivl_nexus_ptr_t net)
|
|||
return net->l.sig;
|
||||
}
|
||||
|
||||
extern "C" const char* ivl_parameter_basename(ivl_parameter_t net)
|
||||
{
|
||||
assert(net);
|
||||
return net->basename;
|
||||
}
|
||||
|
||||
extern "C" ivl_expr_t ivl_parameter_expr(ivl_parameter_t net)
|
||||
{
|
||||
assert(net);
|
||||
return net->value;
|
||||
}
|
||||
|
||||
extern "C" ivl_scope_t ivl_parameter_scope(ivl_parameter_t net)
|
||||
{
|
||||
assert(net);
|
||||
return net->scope;
|
||||
}
|
||||
|
||||
extern "C" ivl_process_type_t ivl_process_type(ivl_process_t net)
|
||||
{
|
||||
return net->type_;
|
||||
|
|
@ -1254,6 +1286,19 @@ extern "C" const char* ivl_scope_name(ivl_scope_t net)
|
|||
return name_buffer;
|
||||
}
|
||||
|
||||
extern "C" unsigned ivl_scope_params(ivl_scope_t net)
|
||||
{
|
||||
assert(net);
|
||||
return net->nparam_;
|
||||
}
|
||||
|
||||
extern "C" ivl_parameter_t ivl_scope_param(ivl_scope_t net, unsigned idx)
|
||||
{
|
||||
assert(net);
|
||||
assert(idx < net->nparam_);
|
||||
return net->param_ + idx;
|
||||
}
|
||||
|
||||
extern "C" ivl_scope_t ivl_scope_parent(ivl_scope_t net)
|
||||
{
|
||||
assert(net);
|
||||
|
|
@ -1752,6 +1797,9 @@ extern "C" ivl_variable_type_t ivl_variable_type(ivl_variable_t net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-api.cc,v $
|
||||
* Revision 1.96 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.95 2003/03/06 04:32:40 steve
|
||||
* Wrong sense of need compared to have.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll-expr.cc,v 1.34 2003/03/01 06:25:30 steve Exp $"
|
||||
#ident "$Id: t-dll-expr.cc,v 1.35 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -276,6 +276,21 @@ void dll_target::expr_const(const NetEConst*net)
|
|||
}
|
||||
}
|
||||
|
||||
void dll_target::expr_param(const NetEConstParam*net)
|
||||
{
|
||||
ivl_scope_t scope = find_scope(des_, net->scope());
|
||||
ivl_parameter_t par = scope_find_param(scope, net->name());
|
||||
|
||||
if (par == 0) {
|
||||
cerr << net->get_line() << ": internal error: "
|
||||
<< "Parameter " << net->name() << " missing from "
|
||||
<< ivl_scope_name(scope) << endl;
|
||||
}
|
||||
assert(par);
|
||||
assert(par->value);
|
||||
expr_ = par->value;
|
||||
}
|
||||
|
||||
void dll_target::expr_creal(const NetECReal*net)
|
||||
{
|
||||
assert(expr_ == 0);
|
||||
|
|
@ -564,6 +579,9 @@ void dll_target::expr_variable(const NetEVariable*net)
|
|||
|
||||
/*
|
||||
* $Log: t-dll-expr.cc,v $
|
||||
* Revision 1.35 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.34 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
|
|
|
|||
81
t-dll.cc
81
t-dll.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll.cc,v 1.107 2003/03/06 01:24:37 steve Exp $"
|
||||
#ident "$Id: t-dll.cc,v 1.108 2003/03/10 23:40:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -439,6 +439,80 @@ static void scope_add_var(ivl_scope_t scope, ivl_variable_t net)
|
|||
scope->var_[scope->nvar_-1] = net;
|
||||
}
|
||||
|
||||
ivl_parameter_t dll_target::scope_find_param(ivl_scope_t scope,
|
||||
const char*name)
|
||||
{
|
||||
unsigned idx = 0;
|
||||
while (idx < scope->nparam_) {
|
||||
if (strcmp(name, scope->param_[idx].basename) == 0)
|
||||
return scope->param_ + idx;
|
||||
|
||||
idx += 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This method scans the parameters of the scope, and makes
|
||||
* ivl_parameter_t objects. This involves saving the name and scanning
|
||||
* the expression value.
|
||||
*/
|
||||
void dll_target::make_scope_parameters(ivl_scope_t scope, const NetScope*net)
|
||||
{
|
||||
scope->nparam_ = net->parameters.size();
|
||||
if (scope->nparam_ == 0) {
|
||||
scope->param_ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
scope->param_ = new struct ivl_parameter_s [scope->nparam_];
|
||||
|
||||
unsigned idx = 0;
|
||||
typedef map<string,NetScope::param_expr_t>::const_iterator pit_t;
|
||||
|
||||
for (pit_t cur_pit = net->parameters.begin()
|
||||
; cur_pit != net->parameters.end() ; cur_pit ++) {
|
||||
|
||||
assert(idx < scope->nparam_);
|
||||
ivl_parameter_t cur_par = scope->param_ + idx;
|
||||
cur_par->basename = lex_strings.add( (*cur_pit).first.c_str() );
|
||||
cur_par->scope = scope;
|
||||
|
||||
NetExpr*etmp = (*cur_pit).second.expr;
|
||||
|
||||
if (const NetEConst*e = dynamic_cast<const NetEConst*>(etmp)) {
|
||||
|
||||
expr_const(e);
|
||||
assert(expr_);
|
||||
|
||||
switch (expr_->type_) {
|
||||
case IVL_EX_STRING:
|
||||
expr_->u_.string_.parameter = cur_par;
|
||||
break;
|
||||
case IVL_EX_NUMBER:
|
||||
expr_->u_.number_.parameter = cur_par;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
} else if (const NetECReal*e = dynamic_cast<const NetECReal*>(etmp)) {
|
||||
|
||||
expr_creal(e);
|
||||
assert(expr_);
|
||||
assert(expr_->type_ == IVL_EX_REALNUM);
|
||||
expr_->u_.real_.parameter = cur_par;
|
||||
|
||||
}
|
||||
|
||||
cur_par->value = expr_;
|
||||
expr_ = 0;
|
||||
|
||||
idx += 1;
|
||||
}
|
||||
}
|
||||
|
||||
void dll_target::add_root(ivl_design_s &des_, const NetScope *s)
|
||||
{
|
||||
ivl_scope_t root_ = new struct ivl_scope_s;
|
||||
|
|
@ -459,6 +533,7 @@ void dll_target::add_root(ivl_design_s &des_, const NetScope *s)
|
|||
root_->mem_ = 0;
|
||||
root_->nvar_ = 0;
|
||||
root_->var_ = 0;
|
||||
make_scope_parameters(root_, s);
|
||||
root_->type_ = IVL_SCT_MODULE;
|
||||
root_->tname_ = root_->name_;
|
||||
root_->time_units = s->time_unit();
|
||||
|
|
@ -1819,6 +1894,7 @@ void dll_target::scope(const NetScope*net)
|
|||
scope->mem_ = 0;
|
||||
scope->nvar_ = 0;
|
||||
scope->var_ = 0;
|
||||
make_scope_parameters(scope, net);
|
||||
scope->time_units = net->time_unit();
|
||||
|
||||
switch (net->type()) {
|
||||
|
|
@ -2023,6 +2099,9 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj };
|
|||
|
||||
/*
|
||||
* $Log: t-dll.cc,v $
|
||||
* Revision 1.108 2003/03/10 23:40:53 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.107 2003/03/06 01:24:37 steve
|
||||
* Obsolete the ivl_event_name function.
|
||||
*
|
||||
|
|
|
|||
28
t-dll.h
28
t-dll.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: t-dll.h,v 1.99 2003/03/01 06:25:30 steve Exp $"
|
||||
#ident "$Id: t-dll.h,v 1.100 2003/03/10 23:40:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "target.h"
|
||||
|
|
@ -133,6 +133,7 @@ struct dll_target : public target_t, public expr_scan_t {
|
|||
void expr_memory(const NetEMemory*);
|
||||
void expr_const(const NetEConst*);
|
||||
void expr_creal(const NetECReal*);
|
||||
void expr_param(const NetEConstParam*);
|
||||
void expr_scope(const NetEScope*);
|
||||
void expr_select(const NetESelect*);
|
||||
void expr_sfunc(const NetESFunc*);
|
||||
|
|
@ -155,11 +156,17 @@ struct dll_target : public target_t, public expr_scan_t {
|
|||
static ivl_signal_t find_signal(ivl_design_s &des, const NetNet*net);
|
||||
static ivl_memory_t find_memory(ivl_design_s &des, const NetMemory*net);
|
||||
static ivl_variable_t find_variable(ivl_design_s &des, const NetVariable*net);
|
||||
|
||||
static ivl_parameter_t scope_find_param(ivl_scope_t scope,
|
||||
const char*name);
|
||||
|
||||
void add_root(ivl_design_s &des_, const NetScope *s);
|
||||
|
||||
void sub_off_from_expr_(long);
|
||||
void mul_expr_by_const_(long);
|
||||
|
||||
void make_scope_parameters(ivl_scope_t scope, const NetScope*net);
|
||||
|
||||
static ivl_expr_t expr_from_value_(const verinum&that);
|
||||
};
|
||||
|
||||
|
|
@ -207,6 +214,7 @@ struct ivl_expr_s {
|
|||
|
||||
struct {
|
||||
char*bits_;
|
||||
ivl_parameter_t parameter;
|
||||
} number_;
|
||||
|
||||
struct {
|
||||
|
|
@ -226,6 +234,7 @@ struct ivl_expr_s {
|
|||
|
||||
struct {
|
||||
char*value_;
|
||||
ivl_parameter_t parameter;
|
||||
} string_;
|
||||
|
||||
struct {
|
||||
|
|
@ -251,6 +260,7 @@ struct ivl_expr_s {
|
|||
|
||||
struct {
|
||||
double value;
|
||||
ivl_parameter_t parameter;
|
||||
} real_;
|
||||
|
||||
struct {
|
||||
|
|
@ -465,7 +475,15 @@ struct ivl_memory_s {
|
|||
int root_;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* This is the implementation of a parameter. Each scope has a list of
|
||||
* these.
|
||||
*/
|
||||
struct ivl_parameter_s {
|
||||
const char*basename;
|
||||
ivl_scope_t scope;
|
||||
ivl_expr_t value;
|
||||
};
|
||||
/*
|
||||
* All we know about a process it its type (initial or always) and the
|
||||
* single statement that is it. A process also has a scope, although
|
||||
|
|
@ -513,6 +531,9 @@ struct ivl_scope_s {
|
|||
unsigned nvar_;
|
||||
ivl_variable_t* var_;
|
||||
|
||||
unsigned nparam_;
|
||||
ivl_parameter_t param_;
|
||||
|
||||
/* Scopes that are tasks/functions have a definition. */
|
||||
ivl_statement_t def;
|
||||
|
||||
|
|
@ -651,6 +672,9 @@ struct ivl_variable_s {
|
|||
|
||||
/*
|
||||
* $Log: t-dll.h,v $
|
||||
* Revision 1.100 2003/03/10 23:40:54 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.99 2003/03/01 06:25:30 steve
|
||||
* Add the lex_strings string handler, and put
|
||||
* scope names and system task/function names
|
||||
|
|
|
|||
10
target.cc
10
target.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: target.cc,v 1.65 2003/01/30 16:23:08 steve Exp $"
|
||||
#ident "$Id: target.cc,v 1.66 2003/03/10 23:40:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -323,6 +323,11 @@ void expr_scan_t::expr_const(const NetEConst*)
|
|||
"unhandled expr_const." << endl;
|
||||
}
|
||||
|
||||
void expr_scan_t::expr_param(const NetEConstParam*that)
|
||||
{
|
||||
expr_const(that);
|
||||
}
|
||||
|
||||
void expr_scan_t::expr_creal(const NetECReal*)
|
||||
{
|
||||
cerr << "expr_scan_t (" << typeid(*this).name() << "): "
|
||||
|
|
@ -403,6 +408,9 @@ void expr_scan_t::expr_binary(const NetEBinary*ex)
|
|||
|
||||
/*
|
||||
* $Log: target.cc,v $
|
||||
* Revision 1.66 2003/03/10 23:40:54 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.65 2003/01/30 16:23:08 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
|
|
|
|||
6
target.h
6
target.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: target.h,v 1.61 2003/01/26 21:15:59 steve Exp $"
|
||||
#ident "$Id: target.h,v 1.62 2003/03/10 23:40:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "netlist.h"
|
||||
|
|
@ -131,6 +131,7 @@ struct target_t {
|
|||
struct expr_scan_t {
|
||||
virtual ~expr_scan_t();
|
||||
virtual void expr_const(const NetEConst*);
|
||||
virtual void expr_param(const NetEConstParam*);
|
||||
virtual void expr_creal(const NetECReal*);
|
||||
virtual void expr_concat(const NetEConcat*);
|
||||
virtual void expr_memory(const NetEMemory*);
|
||||
|
|
@ -167,6 +168,9 @@ extern const struct target *target_table[];
|
|||
|
||||
/*
|
||||
* $Log: target.h,v $
|
||||
* Revision 1.62 2003/03/10 23:40:54 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.61 2003/01/26 21:15:59 steve
|
||||
* Rework expression parsing and elaboration to
|
||||
* accommodate real/realtime values and expressions.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: stub.c,v 1.74 2003/03/07 06:04:58 steve Exp $"
|
||||
#ident "$Id: stub.c,v 1.75 2003/03/10 23:40:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -38,6 +38,7 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
|||
{
|
||||
unsigned idx;
|
||||
const ivl_expr_type_t code = ivl_expr_type(net);
|
||||
ivl_parameter_t par = ivl_expr_parameter(net);
|
||||
unsigned width = ivl_expr_width(net);
|
||||
const char*sign = ivl_expr_signed(net)? "signed" : "unsigned";
|
||||
const char*vt = "?";
|
||||
|
|
@ -84,7 +85,12 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
|||
for (idx = width ; idx > 0 ; idx -= 1)
|
||||
fprintf(out, "%c", bits[idx-1]);
|
||||
|
||||
fprintf(out, ", %s>\n", sign);
|
||||
fprintf(out, ", %s", sign);
|
||||
if (par != 0)
|
||||
fprintf(out, ", parameter=%s",
|
||||
ivl_parameter_basename(par));
|
||||
|
||||
fprintf(out, ">\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +102,13 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
|||
break;
|
||||
|
||||
case IVL_EX_STRING:
|
||||
fprintf(out, "%*s<string=\"%s\", width=%u>\n", ind, "",
|
||||
fprintf(out, "%*s<string=\"%s\", width=%u", ind, "",
|
||||
ivl_expr_string(net), ivl_expr_width(net));
|
||||
if (par != 0)
|
||||
fprintf(out, ", parameter=%s",
|
||||
ivl_parameter_basename(par));
|
||||
|
||||
fprintf(out, ">\n");
|
||||
break;
|
||||
|
||||
case IVL_EX_SFUNC:
|
||||
|
|
@ -145,7 +156,12 @@ static void show_expression(ivl_expr_t net, unsigned ind)
|
|||
fprintf(out, "%*s<realnum=%f (", ind, "", tmp.rv);
|
||||
for (idx = sizeof(double) ; idx > 0 ; idx -= 1)
|
||||
fprintf(out, "%02x", tmp.bv[idx-1]);
|
||||
fprintf(out, ")>\n");
|
||||
fprintf(out, ")");
|
||||
if (par != 0)
|
||||
fprintf(out, ", parameter=%s",
|
||||
ivl_parameter_basename(par));
|
||||
|
||||
fprintf(out, ">\n");
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -488,6 +504,13 @@ static int show_process(ivl_process_t net, void*x)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void show_parameter(ivl_parameter_t net)
|
||||
{
|
||||
const char*name = ivl_parameter_basename(net);
|
||||
fprintf(out, " parameter %s;\n", name);
|
||||
show_expression(ivl_parameter_expr(net), 7);
|
||||
}
|
||||
|
||||
static void show_variable(ivl_variable_t net)
|
||||
{
|
||||
const char*type = "?";
|
||||
|
|
@ -719,9 +742,9 @@ static int show_scope(ivl_scope_t net, void*x)
|
|||
{
|
||||
unsigned idx;
|
||||
|
||||
fprintf(out, "scope: %s (%u signals, %u logic)",
|
||||
ivl_scope_name(net), ivl_scope_sigs(net),
|
||||
ivl_scope_logs(net));
|
||||
fprintf(out, "scope: %s (%u parameters, %u signals, %u logic)",
|
||||
ivl_scope_name(net), ivl_scope_params(net),
|
||||
ivl_scope_sigs(net), ivl_scope_logs(net));
|
||||
|
||||
switch (ivl_scope_type(net)) {
|
||||
case IVL_SCT_MODULE:
|
||||
|
|
@ -747,6 +770,9 @@ static int show_scope(ivl_scope_t net, void*x)
|
|||
|
||||
fprintf(out, " time units = 10e%d\n", ivl_scope_time_units(net));
|
||||
|
||||
for (idx = 0 ; idx < ivl_scope_params(net) ; idx += 1)
|
||||
show_parameter(ivl_scope_param(net, idx));
|
||||
|
||||
for (idx = 0 ; idx < ivl_scope_vars(net) ; idx += 1)
|
||||
show_variable(ivl_scope_var(net, idx));
|
||||
|
||||
|
|
@ -792,6 +818,9 @@ int target_design(ivl_design_t des)
|
|||
|
||||
/*
|
||||
* $Log: stub.c,v $
|
||||
* Revision 1.75 2003/03/10 23:40:54 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.74 2003/03/07 06:04:58 steve
|
||||
* Raw dump of double values for testing purposes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: draw_vpi.c,v 1.2 2003/03/07 02:43:32 steve Exp $"
|
||||
#ident "$Id: draw_vpi.c,v 1.3 2003/03/10 23:40:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -58,7 +58,8 @@ struct vector_info draw_vpi_taskfunc_call(ivl_statement_t tnet,
|
|||
struct vector_info *vec = 0x0;
|
||||
unsigned int vecs= 0;
|
||||
unsigned int veci= 0;
|
||||
|
||||
|
||||
ivl_parameter_t par;
|
||||
|
||||
/* Figure out how many expressions are going to be evaluated
|
||||
for this task call. I won't need to evaluate expressions
|
||||
|
|
@ -184,8 +185,13 @@ struct vector_info draw_vpi_taskfunc_call(ivl_statement_t tnet,
|
|||
}
|
||||
|
||||
case IVL_EX_STRING:
|
||||
fprintf(vvp_out, ", \"%s\"",
|
||||
ivl_expr_string(expr));
|
||||
if (( par = ivl_expr_parameter(expr) )) {
|
||||
fprintf(vvp_out, ", P_%p", par);
|
||||
|
||||
} else {
|
||||
fprintf(vvp_out, ", \"%s\"",
|
||||
ivl_expr_string(expr));
|
||||
}
|
||||
continue;
|
||||
|
||||
case IVL_EX_SCOPE:
|
||||
|
|
@ -247,6 +253,9 @@ struct vector_info draw_vpi_taskfunc_call(ivl_statement_t tnet,
|
|||
|
||||
/*
|
||||
* $Log: draw_vpi.c,v $
|
||||
* Revision 1.3 2003/03/10 23:40:54 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.2 2003/03/07 02:43:32 steve
|
||||
* Handle general $function arguments as expresions.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vvp_scope.c,v 1.88 2003/03/06 01:17:46 steve Exp $"
|
||||
#ident "$Id: vvp_scope.c,v 1.89 2003/03/10 23:40:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -1570,7 +1570,21 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
}
|
||||
|
||||
fprintf(vvp_out, " .timescale %d;\n", ivl_scope_time_units(net));
|
||||
|
||||
|
||||
for (idx = 0 ; idx < ivl_scope_params(net) ; idx += 1) {
|
||||
ivl_parameter_t par = ivl_scope_param(net, idx);
|
||||
ivl_expr_t pex = ivl_parameter_expr(par);
|
||||
switch (ivl_expr_type(pex)) {
|
||||
case IVL_EX_STRING:
|
||||
fprintf(vvp_out, "P_%p .param \"%s\", string, \"%s\";\n",
|
||||
par, ivl_parameter_basename(par),
|
||||
ivl_expr_string(pex));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan the scope for logic devices. For each device, draw out
|
||||
a functor that connects pin 0 to the output, and the
|
||||
remaining pins to inputs. */
|
||||
|
|
@ -1634,6 +1648,9 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
|
||||
/*
|
||||
* $Log: vvp_scope.c,v $
|
||||
* Revision 1.89 2003/03/10 23:40:54 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.88 2003/03/06 01:17:46 steve
|
||||
* Use number for event labels.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_user.h,v 1.19 2003/02/17 06:39:47 steve Exp $"
|
||||
#ident "$Id: vpi_user.h,v 1.20 2003/03/10 23:40:54 steve Exp $"
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -162,6 +162,7 @@ typedef struct t_vpi_value {
|
|||
#define vpiNamedEvent 34
|
||||
#define vpiNamedFork 35
|
||||
#define vpiNet 36
|
||||
#define vpiParameter 41
|
||||
#define vpiRealVar 47
|
||||
#define vpiReg 48
|
||||
#define vpiSysFuncCall 56
|
||||
|
|
@ -372,6 +373,9 @@ EXTERN_C_END
|
|||
|
||||
/*
|
||||
* $Log: vpi_user.h,v $
|
||||
* Revision 1.20 2003/03/10 23:40:54 steve
|
||||
* Keep parameter constants for the ivl_target API.
|
||||
*
|
||||
* Revision 1.19 2003/02/17 06:39:47 steve
|
||||
* Add at least minimal implementations for several
|
||||
* acc_ functions. Add support for standard ACC
|
||||
|
|
|
|||
Loading…
Reference in New Issue