Elaborate implicit signals that are arguments to module instances.

Module instances are like gates, so the expressions pass in need
to be checked for implicit nets.
This commit is contained in:
Stephen Williams 2008-03-18 21:25:13 -07:00
parent d26ae866f8
commit 13d4a7352c
2 changed files with 26 additions and 17 deletions

View File

@ -2334,25 +2334,18 @@ NetNet* PEFNumber::elaborate_net(Design*des, NetScope*scope,
NetNet* PEIdent::make_implicit_net_(Design*des, NetScope*scope) const
{
NetNet::Type nettype = scope->default_nettype();
NetNet*sig = 0;
assert(nettype != NetNet::NONE);
if (!error_implicit && nettype!=NetNet::NONE) {
sig = new NetNet(scope, peek_tail_name(path_),
NetNet::IMPLICIT, 1);
/* Implicit nets are always scalar logic. */
sig->data_type(IVL_VT_LOGIC);
NetNet*sig = new NetNet(scope, peek_tail_name(path_),
NetNet::IMPLICIT, 1);
sig->set_line(*this);
/* Implicit nets are always scalar logic. */
sig->data_type(IVL_VT_LOGIC);
if (warn_implicit) {
cerr << get_fileline() << ": warning: implicit "
"definition of wire logic " << scope_path(scope)
<< "." << peek_tail_name(path_) << "." << endl;
}
} else {
cerr << get_fileline() << ": error: Net " << path_
<< " is not defined in this context." << endl;
des->errors += 1;
return 0;
if (warn_implicit) {
cerr << get_fileline() << ": warning: implicit "
"definition of wire logic " << scope_path(scope)
<< "." << peek_tail_name(path_) << "." << endl;
}
return sig;

View File

@ -250,6 +250,12 @@ bool PEIdent::elaborate_sig(Design*des, NetScope*scope) const
const NetExpr*par = 0;
NetEvent* eve = 0;
// If implicit net creation is turned off, then stop now.
if (scope->default_nettype() == NetNet::NONE)
return true;
if (error_implicit)
return true;
symbol_search(des, scope, path_, sig, par, eve);
if (eve != 0)
@ -293,6 +299,16 @@ bool PGModule::elaborate_sig_mod_(Design*des, NetScope*scope,
{
bool flag = true;
// First, elaborate the signals that may be created implicitly
// by ports to this module instantiation.
for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) {
const PExpr*tmp = pin(idx);
if (tmp == 0)
continue;
flag = tmp->elaborate_sig(des, scope) && flag;
}
NetScope::scope_vec_t instance = scope->instance_arrays[get_name()];
for (unsigned idx = 0 ; idx < instance.count() ; idx += 1) {