Support parameter, localparam, and event declarations in any scope.
Currently, parameters and localparams declared in tasks, functions, generate blocks, and named blocks are placed in the parent module scope. Event declarations in these scopes are not permitted (a syntax error is reported). This patch corrects this behaviour, so that all the above declarations are accepted and are placed in the scope in which they are declared. Note that the IEEE standard does not permit parameter declarations in generate blocks. This patch causes the parser to reject such declarations.
This commit is contained in:
parent
626394d198
commit
a4973c217d
34
Module.h
34
Module.h
|
|
@ -76,40 +76,6 @@ class Module : public PScope, public LineInfo {
|
||||||
|
|
||||||
NetNet::Type default_nettype;
|
NetNet::Type default_nettype;
|
||||||
|
|
||||||
struct range_t {
|
|
||||||
// True if this is an exclude
|
|
||||||
bool exclude_flag;
|
|
||||||
// lower bound
|
|
||||||
// If low_open_flag is false and low_expr=0, then use -inf
|
|
||||||
bool low_open_flag;
|
|
||||||
PExpr*low_expr;
|
|
||||||
// upper bound
|
|
||||||
// If high_open_flag is false and high_expr=0, then use +inf
|
|
||||||
bool high_open_flag;
|
|
||||||
PExpr*high_expr;
|
|
||||||
// Next range description in list
|
|
||||||
struct range_t*next;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* The module has parameters that are evaluated when the
|
|
||||||
module is elaborated. During parsing, I put the parameters
|
|
||||||
into this map. */
|
|
||||||
struct param_expr_t : public LineInfo {
|
|
||||||
param_expr_t() : type(IVL_VT_NO_TYPE), msb(0), lsb(0), signed_flag(false), expr(0), range(0) { }
|
|
||||||
// Type information
|
|
||||||
ivl_variable_type_t type;
|
|
||||||
PExpr*msb;
|
|
||||||
PExpr*lsb;
|
|
||||||
bool signed_flag;
|
|
||||||
// Value expression
|
|
||||||
PExpr*expr;
|
|
||||||
// If there are range constraints, list them here
|
|
||||||
range_t*range;
|
|
||||||
};
|
|
||||||
map<perm_string,param_expr_t>parameters;
|
|
||||||
map<perm_string,param_expr_t>localparams;
|
|
||||||
|
|
||||||
|
|
||||||
/* specparams are simpler then other params, in that they have
|
/* specparams are simpler then other params, in that they have
|
||||||
no type information. They are merely constant
|
no type information. They are merely constant
|
||||||
expressions. */
|
expressions. */
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,6 @@ class PGenerate : public LineInfo, public LexicalScope {
|
||||||
list<PGate*> gates;
|
list<PGate*> gates;
|
||||||
void add_gate(PGate*);
|
void add_gate(PGate*);
|
||||||
|
|
||||||
list<PProcess*> behaviors;
|
|
||||||
|
|
||||||
// Tasks instantiated within this scheme.
|
// Tasks instantiated within this scheme.
|
||||||
map<perm_string,PTask*> tasks;
|
map<perm_string,PTask*> tasks;
|
||||||
map<perm_string,PFunction*>funcs;
|
map<perm_string,PFunction*>funcs;
|
||||||
|
|
|
||||||
57
PScope.h
57
PScope.h
|
|
@ -19,11 +19,14 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
# include "LineInfo.h"
|
||||||
# include "StringHeap.h"
|
# include "StringHeap.h"
|
||||||
# include "pform_types.h"
|
# include "pform_types.h"
|
||||||
|
# include "ivl_target.h"
|
||||||
# include <map>
|
# include <map>
|
||||||
|
|
||||||
class PEvent;
|
class PEvent;
|
||||||
|
class PExpr;
|
||||||
class AProcess;
|
class AProcess;
|
||||||
class PProcess;
|
class PProcess;
|
||||||
class PWire;
|
class PWire;
|
||||||
|
|
@ -36,7 +39,7 @@ class NetScope;
|
||||||
* represents lexical scope. For example, a module, a function/task, a
|
* represents lexical scope. For example, a module, a function/task, a
|
||||||
* named block is derived from a PScope.
|
* named block is derived from a PScope.
|
||||||
*
|
*
|
||||||
* NOTE: This is note the same concept as the "scope" of an elaborated
|
* NOTE: This is not the same concept as the "scope" of an elaborated
|
||||||
* hierarchy. That is represented by NetScope objects after elaboration.
|
* hierarchy. That is represented by NetScope objects after elaboration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -47,7 +50,43 @@ class LexicalScope {
|
||||||
// A virtual destructor is so that dynamic_cast can work.
|
// A virtual destructor is so that dynamic_cast can work.
|
||||||
virtual ~LexicalScope() { }
|
virtual ~LexicalScope() { }
|
||||||
|
|
||||||
// Nets an variables (wires) in the scope
|
struct range_t {
|
||||||
|
// True if this is an exclude
|
||||||
|
bool exclude_flag;
|
||||||
|
// lower bound
|
||||||
|
// If low_open_flag is false and low_expr=0, then use -inf
|
||||||
|
bool low_open_flag;
|
||||||
|
PExpr*low_expr;
|
||||||
|
// upper bound
|
||||||
|
// If high_open_flag is false and high_expr=0, then use +inf
|
||||||
|
bool high_open_flag;
|
||||||
|
PExpr*high_expr;
|
||||||
|
// Next range description in list
|
||||||
|
struct range_t*next;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The scope has parameters that are evaluated when the scope
|
||||||
|
is elaborated. During parsing, I put the parameters into
|
||||||
|
this map. */
|
||||||
|
struct param_expr_t : public LineInfo {
|
||||||
|
param_expr_t() : type(IVL_VT_NO_TYPE), msb(0), lsb(0), signed_flag(false), expr(0), range(0) { }
|
||||||
|
// Type information
|
||||||
|
ivl_variable_type_t type;
|
||||||
|
PExpr*msb;
|
||||||
|
PExpr*lsb;
|
||||||
|
bool signed_flag;
|
||||||
|
// Value expression
|
||||||
|
PExpr*expr;
|
||||||
|
// If there are range constraints, list them here
|
||||||
|
range_t*range;
|
||||||
|
};
|
||||||
|
map<perm_string,param_expr_t>parameters;
|
||||||
|
map<perm_string,param_expr_t>localparams;
|
||||||
|
|
||||||
|
// Named events in the scope.
|
||||||
|
map<perm_string,PEvent*>events;
|
||||||
|
|
||||||
|
// Nets and variables (wires) in the scope
|
||||||
map<perm_string,PWire*>wires;
|
map<perm_string,PWire*>wires;
|
||||||
PWire* wires_find(perm_string name);
|
PWire* wires_find(perm_string name);
|
||||||
|
|
||||||
|
|
@ -55,6 +94,15 @@ class LexicalScope {
|
||||||
list<PProcess*> behaviors;
|
list<PProcess*> behaviors;
|
||||||
list<AProcess*> analog_behaviors;
|
list<AProcess*> analog_behaviors;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void dump_parameters_(ostream&out, unsigned indent) const;
|
||||||
|
|
||||||
|
void dump_localparams_(ostream&out, unsigned indent) const;
|
||||||
|
|
||||||
|
void dump_events_(ostream&out, unsigned indent) const;
|
||||||
|
|
||||||
|
void dump_wires_(ostream&out, unsigned indent) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -76,12 +124,7 @@ class PScope : public LexicalScope {
|
||||||
perm_string pscope_name() const { return name_; }
|
perm_string pscope_name() const { return name_; }
|
||||||
PScope* pscope_parent() { return parent_; }
|
PScope* pscope_parent() { return parent_; }
|
||||||
|
|
||||||
// Named events in the scope.
|
|
||||||
map<perm_string,PEvent*>events;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dump_wires_(ostream&out, unsigned indent) const;
|
|
||||||
|
|
||||||
bool elaborate_sig_wires_(Design*des, NetScope*scope) const;
|
bool elaborate_sig_wires_(Design*des, NetScope*scope) const;
|
||||||
|
|
||||||
bool elaborate_behaviors_(Design*des, NetScope*scope) const;
|
bool elaborate_behaviors_(Design*des, NetScope*scope) const;
|
||||||
|
|
|
||||||
243
elab_scope.cc
243
elab_scope.cc
|
|
@ -46,7 +46,41 @@
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
# include "ivl_assert.h"
|
# include "ivl_assert.h"
|
||||||
|
|
||||||
void Module::elaborate_parm_item_(perm_string name, const param_expr_t&cur,
|
typedef map<perm_string,LexicalScope::param_expr_t>::const_iterator mparm_it_t;
|
||||||
|
|
||||||
|
static void collect_scope_parameters_(NetScope*scope,
|
||||||
|
const map<perm_string,LexicalScope::param_expr_t>¶meters)
|
||||||
|
{
|
||||||
|
for (mparm_it_t cur = parameters.begin()
|
||||||
|
; cur != parameters.end() ; cur ++) {
|
||||||
|
|
||||||
|
NetEParam*tmp = new NetEParam;
|
||||||
|
tmp->set_line(*((*cur).second.expr));
|
||||||
|
tmp->cast_signed( (*cur).second.signed_flag );
|
||||||
|
|
||||||
|
scope->set_parameter((*cur).first, tmp, (*cur).second.type,
|
||||||
|
0, 0, false, 0, (*cur).second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void collect_scope_localparams_(NetScope*scope,
|
||||||
|
const map<perm_string,LexicalScope::param_expr_t>&localparams)
|
||||||
|
{
|
||||||
|
for (mparm_it_t cur = localparams.begin()
|
||||||
|
; cur != localparams.end() ; cur ++) {
|
||||||
|
|
||||||
|
NetEParam*tmp = new NetEParam;
|
||||||
|
tmp->set_line(*((*cur).second.expr));
|
||||||
|
if ((*cur).second.msb)
|
||||||
|
tmp->cast_signed( (*cur).second.signed_flag );
|
||||||
|
|
||||||
|
scope->set_parameter((*cur).first, tmp, (*cur).second.type,
|
||||||
|
0, 0, false, 0, (*cur).second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void elaborate_parm_item_(perm_string name,
|
||||||
|
const LexicalScope::param_expr_t&cur,
|
||||||
Design*des, NetScope*scope)
|
Design*des, NetScope*scope)
|
||||||
{
|
{
|
||||||
PExpr*ex = cur.expr;
|
PExpr*ex = cur.expr;
|
||||||
|
|
@ -72,7 +106,7 @@ void Module::elaborate_parm_item_(perm_string name, const param_expr_t&cur,
|
||||||
}
|
}
|
||||||
|
|
||||||
NetScope::range_t*range_list = 0;
|
NetScope::range_t*range_list = 0;
|
||||||
for (Module::range_t*range = cur.range ; range ; range = range->next) {
|
for (LexicalScope::range_t*range = cur.range ; range ; range = range->next) {
|
||||||
NetScope::range_t*tmp = new NetScope::range_t;
|
NetScope::range_t*tmp = new NetScope::range_t;
|
||||||
tmp->exclude_flag = range->exclude_flag;
|
tmp->exclude_flag = range->exclude_flag;
|
||||||
tmp->low_open_flag = range->low_open_flag;
|
tmp->low_open_flag = range->low_open_flag;
|
||||||
|
|
@ -131,6 +165,66 @@ void Module::elaborate_parm_item_(perm_string name, const param_expr_t&cur,
|
||||||
delete val;
|
delete val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void elaborate_scope_parameters_(Design*des, NetScope*scope,
|
||||||
|
const map<perm_string,LexicalScope::param_expr_t>¶meters)
|
||||||
|
{
|
||||||
|
for (mparm_it_t cur = parameters.begin()
|
||||||
|
; cur != parameters.end() ; cur ++) {
|
||||||
|
|
||||||
|
elaborate_parm_item_((*cur).first, (*cur).second, des, scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void elaborate_scope_localparams_(Design*des, NetScope*scope,
|
||||||
|
const map<perm_string,LexicalScope::param_expr_t>&localparams)
|
||||||
|
{
|
||||||
|
for (mparm_it_t cur = localparams.begin()
|
||||||
|
; cur != localparams.end() ; cur ++) {
|
||||||
|
|
||||||
|
elaborate_parm_item_((*cur).first, (*cur).second, des, scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void replace_scope_parameters_(NetScope*scope, const LineInfo&loc,
|
||||||
|
const Module::replace_t&replacements)
|
||||||
|
{
|
||||||
|
for (Module::replace_t::const_iterator cur = replacements.begin()
|
||||||
|
; cur != replacements.end() ; cur ++) {
|
||||||
|
|
||||||
|
NetExpr*val = (*cur).second;
|
||||||
|
if (val == 0) {
|
||||||
|
cerr << loc.get_fileline() << ": internal error: "
|
||||||
|
<< "Missing expression in parameter replacement for "
|
||||||
|
<< (*cur).first;
|
||||||
|
}
|
||||||
|
assert(val);
|
||||||
|
if (debug_scopes) {
|
||||||
|
cerr << loc.get_fileline() << ": debug: "
|
||||||
|
<< "Replace " << (*cur).first
|
||||||
|
<< " with expression " << *val
|
||||||
|
<< " from " << val->get_fileline() << "." << endl;
|
||||||
|
cerr << loc.get_fileline() << ": : "
|
||||||
|
<< "Type=" << val->expr_type() << endl;
|
||||||
|
}
|
||||||
|
bool flag = scope->replace_parameter((*cur).first, val);
|
||||||
|
if (! flag) {
|
||||||
|
cerr << val->get_fileline() << ": warning: parameter "
|
||||||
|
<< (*cur).first << " not found in "
|
||||||
|
<< scope_path(scope) << "." << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void elaborate_scope_events_(Design*des, NetScope*scope,
|
||||||
|
const map<perm_string,PEvent*>&events)
|
||||||
|
{
|
||||||
|
for (map<perm_string,PEvent*>::const_iterator et = events.begin()
|
||||||
|
; et != events.end() ; et ++ ) {
|
||||||
|
|
||||||
|
(*et).second->elaborate_scope(des, scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void elaborate_scope_tasks(Design*des, NetScope*scope,
|
static void elaborate_scope_tasks(Design*des, NetScope*scope,
|
||||||
const LineInfo&loc,
|
const LineInfo&loc,
|
||||||
const map<perm_string,PTask*>&tasks)
|
const map<perm_string,PTask*>&tasks)
|
||||||
|
|
@ -242,79 +336,25 @@ bool Module::elaborate_scope(Design*des, NetScope*scope,
|
||||||
// the pform and just place a NetEParam placeholder in the
|
// the pform and just place a NetEParam placeholder in the
|
||||||
// place of the elaborated expression.
|
// place of the elaborated expression.
|
||||||
|
|
||||||
typedef map<perm_string,param_expr_t>::const_iterator mparm_it_t;
|
// Scan the parameters in the module, and create stub parameter
|
||||||
|
// entries in the scope for the parameter names.
|
||||||
|
|
||||||
// This loop scans the parameters in the module, and creates
|
collect_scope_parameters_(scope, parameters);
|
||||||
// stub parameter entries in the scope for the parameter name.
|
|
||||||
|
|
||||||
for (mparm_it_t cur = parameters.begin()
|
|
||||||
; cur != parameters.end() ; cur ++) {
|
|
||||||
|
|
||||||
NetEParam*tmp = new NetEParam;
|
|
||||||
tmp->set_line(*((*cur).second.expr));
|
|
||||||
tmp->cast_signed( (*cur).second.signed_flag );
|
|
||||||
|
|
||||||
scope->set_parameter((*cur).first, tmp, (*cur).second.type,
|
|
||||||
0, 0, false, 0, (*cur).second);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (mparm_it_t cur = localparams.begin()
|
|
||||||
; cur != localparams.end() ; cur ++) {
|
|
||||||
|
|
||||||
NetEParam*tmp = new NetEParam;
|
|
||||||
tmp->set_line(*((*cur).second.expr));
|
|
||||||
if ((*cur).second.msb)
|
|
||||||
tmp->cast_signed( (*cur).second.signed_flag );
|
|
||||||
|
|
||||||
scope->set_parameter((*cur).first, tmp, (*cur).second.type,
|
|
||||||
0, 0, false, 0, (*cur).second);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
collect_scope_localparams_(scope, localparams);
|
||||||
|
|
||||||
// Now scan the parameters again, this time elaborating them
|
// Now scan the parameters again, this time elaborating them
|
||||||
// for use as parameter values. This is after the previous
|
// for use as parameter values. This is after the previous
|
||||||
// scan so that local parameter names can be used in the
|
// scan so that local parameter names can be used in the
|
||||||
// r-value expressions.
|
// r-value expressions.
|
||||||
|
|
||||||
for (mparm_it_t cur = parameters.begin()
|
elaborate_scope_parameters_(des, scope, parameters);
|
||||||
; cur != parameters.end() ; cur ++) {
|
|
||||||
|
|
||||||
elaborate_parm_item_((*cur).first, (*cur).second, des, scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* run parameter replacements that were collected from the
|
/* run parameter replacements that were collected from the
|
||||||
containing scope and meant for me. */
|
containing scope and meant for me. */
|
||||||
for (replace_t::const_iterator cur = replacements.begin()
|
replace_scope_parameters_(scope, *this, replacements);
|
||||||
; cur != replacements.end() ; cur ++) {
|
|
||||||
|
|
||||||
NetExpr*val = (*cur).second;
|
elaborate_scope_localparams_(des, scope, localparams);
|
||||||
if (val == 0) {
|
|
||||||
cerr << get_fileline() << ": internal error: "
|
|
||||||
<< "Missing expression in parameter replacement for "
|
|
||||||
<< (*cur).first;
|
|
||||||
}
|
|
||||||
assert(val);
|
|
||||||
if (debug_scopes) {
|
|
||||||
cerr << get_fileline() << ": debug: "
|
|
||||||
<< "Replace " << (*cur).first
|
|
||||||
<< " with expression " << *val
|
|
||||||
<< " from " << val->get_fileline() << "." << endl;
|
|
||||||
cerr << get_fileline() << ": : "
|
|
||||||
<< "Type=" << val->expr_type() << endl;
|
|
||||||
}
|
|
||||||
bool flag = scope->replace_parameter((*cur).first, val);
|
|
||||||
if (! flag) {
|
|
||||||
cerr << val->get_fileline() << ": warning: parameter "
|
|
||||||
<< (*cur).first << " not found in "
|
|
||||||
<< scope_path(scope) << "." << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (mparm_it_t cur = localparams.begin()
|
|
||||||
; cur != localparams.end() ; cur ++) {
|
|
||||||
|
|
||||||
elaborate_parm_item_((*cur).first, (*cur).second, des, scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run through the defparams for this module, elaborate the
|
// Run through the defparams for this module, elaborate the
|
||||||
// expressions in this context and save the result is a table
|
// expressions in this context and save the result is a table
|
||||||
|
|
@ -401,11 +441,7 @@ bool Module::elaborate_scope(Design*des, NetScope*scope,
|
||||||
// elaboration, so do it now. This allows for normal
|
// elaboration, so do it now. This allows for normal
|
||||||
// elaboration to reference these events.
|
// elaboration to reference these events.
|
||||||
|
|
||||||
for (map<perm_string,PEvent*>::const_iterator et = events.begin()
|
elaborate_scope_events_(des, scope, events);
|
||||||
; et != events.end() ; et ++ ) {
|
|
||||||
|
|
||||||
(*et).second->elaborate_scope(des, scope);
|
|
||||||
}
|
|
||||||
|
|
||||||
return des->errors == 0;
|
return des->errors == 0;
|
||||||
}
|
}
|
||||||
|
|
@ -693,6 +729,16 @@ void PGenerate::elaborate_subscope_(Design*des, NetScope*scope)
|
||||||
(*cur) -> generate_scope(des, scope);
|
(*cur) -> generate_scope(des, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scan the localparams in this scope, and create stub parameter
|
||||||
|
// entries in the scope for the parameter names.
|
||||||
|
collect_scope_localparams_(scope, localparams);
|
||||||
|
|
||||||
|
// Now scan the localparams again, this time elaborating them
|
||||||
|
// for use as parameter values.
|
||||||
|
elaborate_scope_localparams_(des, scope, localparams);
|
||||||
|
|
||||||
|
// Scan through all the task and function declarations in this
|
||||||
|
// scope.
|
||||||
elaborate_scope_tasks(des, scope, *this, tasks);
|
elaborate_scope_tasks(des, scope, *this, tasks);
|
||||||
elaborate_scope_funcs(des, scope, *this, funcs);
|
elaborate_scope_funcs(des, scope, *this, funcs);
|
||||||
|
|
||||||
|
|
@ -710,6 +756,9 @@ void PGenerate::elaborate_subscope_(Design*des, NetScope*scope)
|
||||||
(*cur) -> statement() -> elaborate_scope(des, scope);
|
(*cur) -> statement() -> elaborate_scope(des, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scan through all the named events in this scope.
|
||||||
|
elaborate_scope_events_(des, scope, events);
|
||||||
|
|
||||||
// Save the scope that we created, for future use.
|
// Save the scope that we created, for future use.
|
||||||
scope_list_.push_back(scope);
|
scope_list_.push_back(scope);
|
||||||
}
|
}
|
||||||
|
|
@ -991,6 +1040,25 @@ void PFunction::elaborate_scope(Design*des, NetScope*scope) const
|
||||||
{
|
{
|
||||||
assert(scope->type() == NetScope::FUNC);
|
assert(scope->type() == NetScope::FUNC);
|
||||||
|
|
||||||
|
// Scan the parameters in the function, and create stub parameter
|
||||||
|
// entries in the scope for the parameter names.
|
||||||
|
|
||||||
|
collect_scope_parameters_(scope, parameters);
|
||||||
|
|
||||||
|
collect_scope_localparams_(scope, localparams);
|
||||||
|
|
||||||
|
// Now scan the parameters again, this time elaborating them
|
||||||
|
// for use as parameter values. This is after the previous
|
||||||
|
// scan so that local parameter names can be used in the
|
||||||
|
// r-value expressions.
|
||||||
|
|
||||||
|
elaborate_scope_parameters_(des, scope, parameters);
|
||||||
|
|
||||||
|
elaborate_scope_localparams_(des, scope, localparams);
|
||||||
|
|
||||||
|
// Scan through all the named events in this scope.
|
||||||
|
elaborate_scope_events_(des, scope, events);
|
||||||
|
|
||||||
if (statement_)
|
if (statement_)
|
||||||
statement_->elaborate_scope(des, scope);
|
statement_->elaborate_scope(des, scope);
|
||||||
}
|
}
|
||||||
|
|
@ -999,6 +1067,25 @@ void PTask::elaborate_scope(Design*des, NetScope*scope) const
|
||||||
{
|
{
|
||||||
assert(scope->type() == NetScope::TASK);
|
assert(scope->type() == NetScope::TASK);
|
||||||
|
|
||||||
|
// Scan the parameters in the task, and create stub parameter
|
||||||
|
// entries in the scope for the parameter names.
|
||||||
|
|
||||||
|
collect_scope_parameters_(scope, parameters);
|
||||||
|
|
||||||
|
collect_scope_localparams_(scope, localparams);
|
||||||
|
|
||||||
|
// Now scan the parameters again, this time elaborating them
|
||||||
|
// for use as parameter values. This is after the previous
|
||||||
|
// scan so that local parameter names can be used in the
|
||||||
|
// r-value expressions.
|
||||||
|
|
||||||
|
elaborate_scope_parameters_(des, scope, parameters);
|
||||||
|
|
||||||
|
elaborate_scope_localparams_(des, scope, localparams);
|
||||||
|
|
||||||
|
// Scan through all the named events in this scope.
|
||||||
|
elaborate_scope_events_(des, scope, events);
|
||||||
|
|
||||||
if (statement_)
|
if (statement_)
|
||||||
statement_->elaborate_scope(des, scope);
|
statement_->elaborate_scope(des, scope);
|
||||||
}
|
}
|
||||||
|
|
@ -1035,11 +1122,29 @@ void PBlock::elaborate_scope(Design*des, NetScope*scope) const
|
||||||
? NetScope::FORK_JOIN
|
? NetScope::FORK_JOIN
|
||||||
: NetScope::BEGIN_END);
|
: NetScope::BEGIN_END);
|
||||||
my_scope->set_line(get_file(), get_lineno());
|
my_scope->set_line(get_file(), get_lineno());
|
||||||
|
|
||||||
|
// Scan the parameters in the module, and create stub parameter
|
||||||
|
// entries in the scope for the parameter names.
|
||||||
|
|
||||||
|
collect_scope_parameters_(my_scope, parameters);
|
||||||
|
|
||||||
|
collect_scope_localparams_(my_scope, localparams);
|
||||||
|
|
||||||
|
// Now scan the parameters again, this time elaborating them
|
||||||
|
// for use as parameter values. This is after the previous
|
||||||
|
// scan so that local parameter names can be used in the
|
||||||
|
// r-value expressions.
|
||||||
|
|
||||||
|
elaborate_scope_parameters_(des, my_scope, parameters);
|
||||||
|
|
||||||
|
elaborate_scope_localparams_(des, my_scope, localparams);
|
||||||
|
|
||||||
|
// Scan through all the named events in this scope.
|
||||||
|
elaborate_scope_events_(des, my_scope, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned idx = 0 ; idx < list_.count() ; idx += 1)
|
for (unsigned idx = 0 ; idx < list_.count() ; idx += 1)
|
||||||
list_[idx] -> elaborate_scope(des, my_scope);
|
list_[idx] -> elaborate_scope(des, my_scope);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
9
parse.y
9
parse.y
|
|
@ -157,7 +157,7 @@ static PECallFunction*make_call_function(perm_string tn, PExpr*arg1, PExpr*arg2)
|
||||||
svector<lgate>*gates;
|
svector<lgate>*gates;
|
||||||
|
|
||||||
Module::port_t *mport;
|
Module::port_t *mport;
|
||||||
Module::range_t* value_range;
|
LexicalScope::range_t* value_range;
|
||||||
svector<Module::port_t*>*mports;
|
svector<Module::port_t*>*mports;
|
||||||
|
|
||||||
named_pexpr_t*named_pexpr;
|
named_pexpr_t*named_pexpr;
|
||||||
|
|
@ -464,6 +464,10 @@ block_item_decl
|
||||||
| attribute_list_opt K_realtime real_variable_list ';'
|
| attribute_list_opt K_realtime real_variable_list ';'
|
||||||
{ delete $3; }
|
{ delete $3; }
|
||||||
|
|
||||||
|
| K_event list_of_identifiers ';'
|
||||||
|
{ pform_make_events($2, @1.text, @1.first_line);
|
||||||
|
}
|
||||||
|
|
||||||
| K_parameter parameter_assign_decl ';'
|
| K_parameter parameter_assign_decl ';'
|
||||||
| K_localparam localparam_assign_decl ';'
|
| K_localparam localparam_assign_decl ';'
|
||||||
|
|
||||||
|
|
@ -2036,9 +2040,6 @@ module_item
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
| K_defparam defparam_assign_list ';'
|
| K_defparam defparam_assign_list ';'
|
||||||
| K_event list_of_identifiers ';'
|
|
||||||
{ pform_make_events($2, @1.text, @1.first_line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Most gate types have an optional drive strength and optional
|
/* Most gate types have an optional drive strength and optional
|
||||||
three-value delay. These rules handle the different cases. */
|
three-value delay. These rules handle the different cases. */
|
||||||
|
|
|
||||||
61
pform.cc
61
pform.cc
|
|
@ -170,52 +170,39 @@ void pform_bind_attributes(map<perm_string,PExpr*>&attributes,
|
||||||
delete attr;
|
delete attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static LexicalScope*pform_get_cur_scope()
|
||||||
|
{
|
||||||
|
if (pform_cur_generate)
|
||||||
|
if (pform_cur_generate->lexical_scope)
|
||||||
|
return pform_cur_generate->lexical_scope;
|
||||||
|
else
|
||||||
|
return pform_cur_generate;
|
||||||
|
else
|
||||||
|
return lexical_scope;
|
||||||
|
}
|
||||||
|
|
||||||
PWire*pform_get_wire_in_scope(perm_string name)
|
PWire*pform_get_wire_in_scope(perm_string name)
|
||||||
{
|
{
|
||||||
/* Note that if we are processing a generate, then the
|
/* Note that if we are processing a generate, then the
|
||||||
scope depth will be empty because generate schemes
|
scope depth will be empty because generate schemes
|
||||||
cannot be within sub-scopes. Only directly in
|
cannot be within sub-scopes. Only directly in
|
||||||
modules. */
|
modules. */
|
||||||
if (pform_cur_generate)
|
return pform_get_cur_scope()->wires_find(name);
|
||||||
if (pform_cur_generate->lexical_scope)
|
|
||||||
return pform_cur_generate->lexical_scope->wires_find(name);
|
|
||||||
else
|
|
||||||
return pform_cur_generate->wires_find(name);
|
|
||||||
else
|
|
||||||
return lexical_scope->wires_find(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pform_put_wire_in_scope(perm_string name, PWire*net)
|
static void pform_put_wire_in_scope(perm_string name, PWire*net)
|
||||||
{
|
{
|
||||||
if (pform_cur_generate)
|
pform_get_cur_scope()->wires[name] = net;
|
||||||
if (pform_cur_generate->lexical_scope)
|
|
||||||
pform_cur_generate->lexical_scope->wires[name] = net;
|
|
||||||
else
|
|
||||||
pform_cur_generate->wires[name] = net;
|
|
||||||
else
|
|
||||||
lexical_scope->wires[name] = net;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pform_put_behavior_in_scope(PProcess*pp)
|
static void pform_put_behavior_in_scope(PProcess*pp)
|
||||||
{
|
{
|
||||||
if (pform_cur_generate)
|
pform_get_cur_scope()->behaviors.push_back(pp);
|
||||||
if (pform_cur_generate->lexical_scope)
|
|
||||||
pform_cur_generate->lexical_scope->behaviors.push_back(pp);
|
|
||||||
else
|
|
||||||
pform_cur_generate->behaviors.push_back(pp);
|
|
||||||
else
|
|
||||||
lexical_scope->behaviors.push_back(pp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pform_put_behavior_in_scope(AProcess*pp)
|
void pform_put_behavior_in_scope(AProcess*pp)
|
||||||
{
|
{
|
||||||
if (pform_cur_generate)
|
pform_get_cur_scope()->analog_behaviors.push_back(pp);
|
||||||
if (pform_cur_generate->lexical_scope)
|
|
||||||
pform_cur_generate->lexical_scope->analog_behaviors.push_back(pp);
|
|
||||||
else
|
|
||||||
pform_cur_generate->analog_behaviors.push_back(pp);
|
|
||||||
else
|
|
||||||
lexical_scope->analog_behaviors.push_back(pp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pform_set_default_nettype(NetNet::Type type,
|
void pform_set_default_nettype(NetNet::Type type,
|
||||||
|
|
@ -1045,7 +1032,7 @@ static void pform_make_event(perm_string name, const char*fn, unsigned ln)
|
||||||
{
|
{
|
||||||
PEvent*event = new PEvent(name);
|
PEvent*event = new PEvent(name);
|
||||||
FILE_NAME(event, fn, ln);
|
FILE_NAME(event, fn, ln);
|
||||||
pform_cur_module->events[name] = event;
|
pform_get_cur_scope()->events[name] = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pform_make_events(list<perm_string>*names, const char*fn, unsigned ln)
|
void pform_make_events(list<perm_string>*names, const char*fn, unsigned ln)
|
||||||
|
|
@ -1705,7 +1692,7 @@ void pform_set_reg_idx(perm_string name, PExpr*l, PExpr*r)
|
||||||
cur->set_memory_idx(l, r);
|
cur->set_memory_idx(l, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::range_t* pform_parameter_value_range(bool exclude_flag,
|
LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag,
|
||||||
bool low_open, PExpr*low_expr,
|
bool low_open, PExpr*low_expr,
|
||||||
bool hig_open, PExpr*hig_expr)
|
bool hig_open, PExpr*hig_expr)
|
||||||
{
|
{
|
||||||
|
|
@ -1714,7 +1701,7 @@ Module::range_t* pform_parameter_value_range(bool exclude_flag,
|
||||||
if (low_expr == 0) low_open = false;
|
if (low_expr == 0) low_open = false;
|
||||||
if (hig_expr == 0) hig_open = false;
|
if (hig_expr == 0) hig_open = false;
|
||||||
|
|
||||||
Module::range_t*tmp = new Module::range_t;
|
LexicalScope::range_t*tmp = new LexicalScope::range_t;
|
||||||
tmp->exclude_flag = exclude_flag;
|
tmp->exclude_flag = exclude_flag;
|
||||||
tmp->low_open_flag = low_open;
|
tmp->low_open_flag = low_open;
|
||||||
tmp->low_expr = low_expr;
|
tmp->low_expr = low_expr;
|
||||||
|
|
@ -1727,10 +1714,15 @@ Module::range_t* pform_parameter_value_range(bool exclude_flag,
|
||||||
void pform_set_parameter(const struct vlltype&loc,
|
void pform_set_parameter(const struct vlltype&loc,
|
||||||
perm_string name, ivl_variable_type_t type,
|
perm_string name, ivl_variable_type_t type,
|
||||||
bool signed_flag, svector<PExpr*>*range, PExpr*expr,
|
bool signed_flag, svector<PExpr*>*range, PExpr*expr,
|
||||||
Module::range_t*value_range)
|
LexicalScope::range_t*value_range)
|
||||||
{
|
{
|
||||||
|
if (pform_get_cur_scope() == pform_cur_generate) {
|
||||||
|
VLerror("parameter declarations are not permitted in generate blocks");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
assert(expr);
|
assert(expr);
|
||||||
Module::param_expr_t&parm = pform_cur_module->parameters[name];
|
Module::param_expr_t&parm = pform_get_cur_scope()->parameters[name];
|
||||||
FILE_NAME(&parm, loc);
|
FILE_NAME(&parm, loc);
|
||||||
|
|
||||||
parm.expr = expr;
|
parm.expr = expr;
|
||||||
|
|
@ -1749,6 +1741,7 @@ void pform_set_parameter(const struct vlltype&loc,
|
||||||
parm.signed_flag = signed_flag;
|
parm.signed_flag = signed_flag;
|
||||||
parm.range = value_range;
|
parm.range = value_range;
|
||||||
|
|
||||||
|
if (pform_get_cur_scope() == pform_cur_module)
|
||||||
pform_cur_module->param_names.push_back(name);
|
pform_cur_module->param_names.push_back(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1757,7 +1750,7 @@ void pform_set_localparam(const struct vlltype&loc,
|
||||||
bool signed_flag, svector<PExpr*>*range, PExpr*expr)
|
bool signed_flag, svector<PExpr*>*range, PExpr*expr)
|
||||||
{
|
{
|
||||||
assert(expr);
|
assert(expr);
|
||||||
Module::param_expr_t&parm = pform_cur_module->localparams[name];
|
Module::param_expr_t&parm = pform_get_cur_scope()->localparams[name];
|
||||||
FILE_NAME(&parm, loc);
|
FILE_NAME(&parm, loc);
|
||||||
|
|
||||||
parm.expr = expr;
|
parm.expr = expr;
|
||||||
|
|
|
||||||
4
pform.h
4
pform.h
|
|
@ -272,7 +272,7 @@ extern void pform_set_attrib(perm_string name, perm_string key,
|
||||||
extern void pform_set_type_attrib(perm_string name, const string&key,
|
extern void pform_set_type_attrib(perm_string name, const string&key,
|
||||||
char*value);
|
char*value);
|
||||||
|
|
||||||
extern Module::range_t* pform_parameter_value_range(bool exclude_flag,
|
extern LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag,
|
||||||
bool low_open, PExpr*low_expr,
|
bool low_open, PExpr*low_expr,
|
||||||
bool hig_open, PExpr*hig_expr);
|
bool hig_open, PExpr*hig_expr);
|
||||||
|
|
||||||
|
|
@ -281,7 +281,7 @@ extern void pform_set_parameter(const struct vlltype&loc,
|
||||||
ivl_variable_type_t type,
|
ivl_variable_type_t type,
|
||||||
bool signed_flag,
|
bool signed_flag,
|
||||||
svector<PExpr*>*range,
|
svector<PExpr*>*range,
|
||||||
PExpr*expr, Module::range_t*value_range);
|
PExpr*expr, LexicalScope::range_t*value_range);
|
||||||
extern void pform_set_localparam(const struct vlltype&loc,
|
extern void pform_set_localparam(const struct vlltype&loc,
|
||||||
perm_string name,
|
perm_string name,
|
||||||
ivl_variable_type_t type,
|
ivl_variable_type_t type,
|
||||||
|
|
|
||||||
172
pform_dump.cc
172
pform_dump.cc
|
|
@ -595,8 +595,15 @@ void PBlock::dump(ostream&out, unsigned ind) const
|
||||||
out << " : " << pscope_name();
|
out << " : " << pscope_name();
|
||||||
out << endl;
|
out << endl;
|
||||||
|
|
||||||
if (pscope_name() != 0)
|
if (pscope_name() != 0) {
|
||||||
|
dump_parameters_(out, ind+2);
|
||||||
|
|
||||||
|
dump_localparams_(out, ind+2);
|
||||||
|
|
||||||
|
dump_events_(out, ind+2);
|
||||||
|
|
||||||
dump_wires_(out, ind+2);
|
dump_wires_(out, ind+2);
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned idx = 0 ; idx < list_.count() ; idx += 1) {
|
for (unsigned idx = 0 ; idx < list_.count() ; idx += 1) {
|
||||||
if (list_[idx])
|
if (list_[idx])
|
||||||
|
|
@ -815,6 +822,12 @@ void PFunction::dump(ostream&out, unsigned ind) const
|
||||||
out << (*ports_)[idx]->basename() << ";" << endl;
|
out << (*ports_)[idx]->basename() << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump_parameters_(out, ind);
|
||||||
|
|
||||||
|
dump_localparams_(out, ind);
|
||||||
|
|
||||||
|
dump_events_(out, ind);
|
||||||
|
|
||||||
dump_wires_(out, ind);
|
dump_wires_(out, ind);
|
||||||
|
|
||||||
if (statement_)
|
if (statement_)
|
||||||
|
|
@ -860,6 +873,12 @@ void PTask::dump(ostream&out, unsigned ind) const
|
||||||
out << (*ports_)[idx]->basename() << ";" << endl;
|
out << (*ports_)[idx]->basename() << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dump_parameters_(out, ind);
|
||||||
|
|
||||||
|
dump_localparams_(out, ind);
|
||||||
|
|
||||||
|
dump_events_(out, ind);
|
||||||
|
|
||||||
dump_wires_(out, ind);
|
dump_wires_(out, ind);
|
||||||
|
|
||||||
if (statement_)
|
if (statement_)
|
||||||
|
|
@ -996,11 +1015,11 @@ void PGenerate::dump(ostream&out, unsigned indent) const
|
||||||
|
|
||||||
out << endl;
|
out << endl;
|
||||||
|
|
||||||
for (map<perm_string,PWire*>::const_iterator idx = wires.begin()
|
dump_localparams_(out, indent+2);
|
||||||
; idx != wires.end() ; idx++) {
|
|
||||||
|
|
||||||
(*idx).second->dump(out, indent+2);
|
dump_events_(out, indent+2);
|
||||||
}
|
|
||||||
|
dump_wires_(out, indent+2);
|
||||||
|
|
||||||
for (list<PGate*>::const_iterator idx = gates.begin()
|
for (list<PGate*>::const_iterator idx = gates.begin()
|
||||||
; idx != gates.end() ; idx++) {
|
; idx != gates.end() ; idx++) {
|
||||||
|
|
@ -1025,7 +1044,83 @@ void PGenerate::dump(ostream&out, unsigned indent) const
|
||||||
out << setw(indent) << "" << "endgenerate" << endl;
|
out << setw(indent) << "" << "endgenerate" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PScope::dump_wires_(ostream&out, unsigned indent) const
|
void LexicalScope::dump_parameters_(ostream&out, unsigned indent) const
|
||||||
|
{
|
||||||
|
typedef map<perm_string,param_expr_t>::const_iterator parm_iter_t;
|
||||||
|
for (parm_iter_t cur = parameters.begin()
|
||||||
|
; cur != parameters.end() ; cur ++) {
|
||||||
|
out << setw(indent) << "" << "parameter "
|
||||||
|
<< (*cur).second.type << " ";
|
||||||
|
if ((*cur).second.signed_flag)
|
||||||
|
out << "signed ";
|
||||||
|
if ((*cur).second.msb)
|
||||||
|
out << "[" << *(*cur).second.msb << ":"
|
||||||
|
<< *(*cur).second.lsb << "] ";
|
||||||
|
out << (*cur).first << " = ";
|
||||||
|
if ((*cur).second.expr)
|
||||||
|
out << *(*cur).second.expr;
|
||||||
|
else
|
||||||
|
out << "/* ERROR */";
|
||||||
|
for (LexicalScope::range_t*tmp = (*cur).second.range
|
||||||
|
; tmp ; tmp = tmp->next) {
|
||||||
|
if (tmp->exclude_flag)
|
||||||
|
out << " exclude ";
|
||||||
|
else
|
||||||
|
out << " from ";
|
||||||
|
if (tmp->low_open_flag)
|
||||||
|
out << "(";
|
||||||
|
else
|
||||||
|
out << "[";
|
||||||
|
if (tmp->low_expr)
|
||||||
|
out << *(tmp->low_expr);
|
||||||
|
else if (tmp->low_open_flag==false)
|
||||||
|
out << "-inf";
|
||||||
|
else
|
||||||
|
out << "<nil>";
|
||||||
|
out << ":";
|
||||||
|
if (tmp->high_expr)
|
||||||
|
out << *(tmp->high_expr);
|
||||||
|
else if (tmp->high_open_flag==false)
|
||||||
|
out << "inf";
|
||||||
|
else
|
||||||
|
out << "<nil>";
|
||||||
|
if (tmp->high_open_flag)
|
||||||
|
out << ")";
|
||||||
|
else
|
||||||
|
out << "]";
|
||||||
|
}
|
||||||
|
out << ";" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LexicalScope::dump_localparams_(ostream&out, unsigned indent) const
|
||||||
|
{
|
||||||
|
typedef map<perm_string,param_expr_t>::const_iterator parm_iter_t;
|
||||||
|
for (parm_iter_t cur = localparams.begin()
|
||||||
|
; cur != localparams.end() ; cur ++) {
|
||||||
|
out << setw(indent) << "" << "localparam ";
|
||||||
|
if ((*cur).second.msb)
|
||||||
|
out << "[" << *(*cur).second.msb << ":"
|
||||||
|
<< *(*cur).second.lsb << "] ";
|
||||||
|
out << (*cur).first << " = ";
|
||||||
|
if ((*cur).second.expr)
|
||||||
|
out << *(*cur).second.expr << ";" << endl;
|
||||||
|
else
|
||||||
|
out << "/* ERROR */;" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LexicalScope::dump_events_(ostream&out, unsigned indent) const
|
||||||
|
{
|
||||||
|
for (map<perm_string,PEvent*>::const_iterator cur = events.begin()
|
||||||
|
; cur != events.end() ; cur ++ ) {
|
||||||
|
PEvent*ev = (*cur).second;
|
||||||
|
out << setw(indent) << "" << "event " << ev->name() << "; // "
|
||||||
|
<< ev->get_fileline() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LexicalScope::dump_wires_(ostream&out, unsigned indent) const
|
||||||
{
|
{
|
||||||
// Iterate through and display all the wires.
|
// Iterate through and display all the wires.
|
||||||
for (map<perm_string,PWire*>::const_iterator wire = wires.begin()
|
for (map<perm_string,PWire*>::const_iterator wire = wires.begin()
|
||||||
|
|
@ -1070,63 +1165,9 @@ void Module::dump(ostream&out) const
|
||||||
out << ")" << endl;
|
out << ")" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef map<perm_string,param_expr_t>::const_iterator parm_iter_t;
|
dump_parameters_(out, 4);
|
||||||
for (parm_iter_t cur = parameters.begin()
|
|
||||||
; cur != parameters.end() ; cur ++) {
|
|
||||||
out << " parameter " << (*cur).second.type << " ";
|
|
||||||
if ((*cur).second.signed_flag)
|
|
||||||
out << "signed ";
|
|
||||||
if ((*cur).second.msb)
|
|
||||||
out << "[" << *(*cur).second.msb << ":"
|
|
||||||
<< *(*cur).second.lsb << "] ";
|
|
||||||
out << (*cur).first << " = ";
|
|
||||||
if ((*cur).second.expr)
|
|
||||||
out << *(*cur).second.expr;
|
|
||||||
else
|
|
||||||
out << "/* ERROR */";
|
|
||||||
for (Module::range_t*tmp = (*cur).second.range
|
|
||||||
; tmp ; tmp = tmp->next) {
|
|
||||||
if (tmp->exclude_flag)
|
|
||||||
out << " exclude ";
|
|
||||||
else
|
|
||||||
out << " from ";
|
|
||||||
if (tmp->low_open_flag)
|
|
||||||
out << "(";
|
|
||||||
else
|
|
||||||
out << "[";
|
|
||||||
if (tmp->low_expr)
|
|
||||||
out << *(tmp->low_expr);
|
|
||||||
else if (tmp->low_open_flag==false)
|
|
||||||
out << "-inf";
|
|
||||||
else
|
|
||||||
out << "<nil>";
|
|
||||||
out << ":";
|
|
||||||
if (tmp->high_expr)
|
|
||||||
out << *(tmp->high_expr);
|
|
||||||
else if (tmp->high_open_flag==false)
|
|
||||||
out << "inf";
|
|
||||||
else
|
|
||||||
out << "<nil>";
|
|
||||||
if (tmp->high_open_flag)
|
|
||||||
out << ")";
|
|
||||||
else
|
|
||||||
out << "]";
|
|
||||||
}
|
|
||||||
out << ";" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (parm_iter_t cur = localparams.begin()
|
dump_localparams_(out, 4);
|
||||||
; cur != localparams.end() ; cur ++) {
|
|
||||||
out << " localparam ";
|
|
||||||
if ((*cur).second.msb)
|
|
||||||
out << "[" << *(*cur).second.msb << ":"
|
|
||||||
<< *(*cur).second.lsb << "] ";
|
|
||||||
out << (*cur).first << " = ";
|
|
||||||
if ((*cur).second.expr)
|
|
||||||
out << *(*cur).second.expr << ";" << endl;
|
|
||||||
else
|
|
||||||
out << "/* ERROR */;" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef map<perm_string,LineInfo*>::const_iterator genvar_iter_t;
|
typedef map<perm_string,LineInfo*>::const_iterator genvar_iter_t;
|
||||||
for (genvar_iter_t cur = genvars.begin()
|
for (genvar_iter_t cur = genvars.begin()
|
||||||
|
|
@ -1157,12 +1198,7 @@ void Module::dump(ostream&out) const
|
||||||
out << "/* ERROR */;" << endl;
|
out << "/* ERROR */;" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (map<perm_string,PEvent*>::const_iterator cur = events.begin()
|
dump_events_(out, 4);
|
||||||
; cur != events.end() ; cur ++ ) {
|
|
||||||
PEvent*ev = (*cur).second;
|
|
||||||
out << " event " << ev->name() << "; // "
|
|
||||||
<< ev->get_fileline() << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Iterate through and display all the wires.
|
// Iterate through and display all the wires.
|
||||||
dump_wires_(out, 4);
|
dump_wires_(out, 4);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue