From 0de2dcb211efece6f78ba279827cdc5957367b0a Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sun, 17 Aug 2008 08:22:42 -0700 Subject: [PATCH] Allow elaborate_expr to handle implicit nets. When the elaborate_expr code is used for expressions of continuous assignments, it needs to be able to create implicit nets. --- elab_expr.cc | 16 ++++++++++++++++ elaborate.cc | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index fd033ab33..76d966130 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1078,6 +1078,22 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope, } } + if (error_implicit==false + && sys_task_arg==false + && path_.size()==1 + && scope->default_nettype() != NetNet::NONE) { + NetNet::Type nettype = scope->default_nettype(); + net = new NetNet(scope, peek_tail_name(path_), nettype, 1); + net->data_type(IVL_VT_LOGIC); + net->set_line(*this); + if (warn_implicit) { + cerr << get_fileline() << ": warning: implicit " + "definition of wire " << scope_path(scope) + << "." << peek_tail_name(path_) << "." << endl; + } + return elaborate_expr_net(des, scope, net, scope, sys_task_arg); + } + // At this point we've exhausted all the possibilities that // are not scopes. If this is not a system task argument, then // it cannot be a scope name, so give up. diff --git a/elaborate.cc b/elaborate.cc index 9254a889c..213f66443 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -3494,6 +3494,7 @@ static void elaborate_tasks(Design*des, NetScope*scope, bool Module::elaborate(Design*des, NetScope*scope) const { bool result_flag = true; + error_implicit = true; if (gn_specify_blocks_flag) { // Elaborate specparams @@ -3558,6 +3559,7 @@ bool Module::elaborate(Design*des, NetScope*scope) const // complex. const list&gl = get_gates(); + error_implicit = false; for (list::const_iterator gt = gl.begin() ; gt != gl.end() ; gt ++ ) { @@ -3565,6 +3567,8 @@ bool Module::elaborate(Design*des, NetScope*scope) const (*gt)->elaborate(des, scope); } + error_implicit = true; + // Elaborate the behaviors, making processes out of them. This // involves scanning the PProcess* list, creating a NetProcTop // for each process.