diff --git a/elab_lval.cc b/elab_lval.cc index 02541c61c..14f0aa227 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -359,7 +359,7 @@ NetAssign_* PEIdent::elaborate_lval_method_class_member_(Design*des, { if (!gn_system_verilog()) return 0; - if (scope->parent() == 0) + if (scope->parent() == 0 || scope->type() == NetScope::CLASS) return 0; if (path_.size() != 1) return 0; diff --git a/elab_scope.cc b/elab_scope.cc index b3b008b92..54f04bceb 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -482,10 +482,7 @@ static void elaborate_scope_class(Design*des, NetScope*scope, PClass*pclass) ivl_assert(*pclass, use_type->save_elaborated_type == 0); use_type->save_elaborated_type = use_class; - // Class scopes have no parent scope, because references are - // not allowed to escape a class method. But they are allowed - // to reference the compilation unit scope. - NetScope*class_scope = new NetScope(0, hname_t(pclass->pscope_name()), + NetScope*class_scope = new NetScope(scope, hname_t(pclass->pscope_name()), NetScope::CLASS, scope->unit()); class_scope->set_line(pclass); class_scope->set_class_def(use_class); diff --git a/ivl_target_priv.h b/ivl_target_priv.h index 3ae882b63..fc40c0cf7 100644 --- a/ivl_target_priv.h +++ b/ivl_target_priv.h @@ -1,7 +1,7 @@ #ifndef IVL_ivl_target_priv_H #define IVL_ivl_target_priv_H /* - * Copyright (c) 2008-2017 Stephen Williams (steve@icarus.com) + * Copyright (c) 2008-2019 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -51,7 +51,6 @@ struct ivl_design_s { ivl_process_t threads_; // Keep arrays of root scopes. - std::map classes; std::vector packages; std::vector roots; diff --git a/net_scope.cc b/net_scope.cc index 480edf3b4..986bb3c5f 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -130,7 +130,6 @@ NetScope::NetScope(NetScope*up, const hname_t&n, NetScope::TYPE t, NetScope*in_u unit_ = this; if (up) { - assert(t!=CLASS); need_const_func_ = up->need_const_func_; is_const_func_ = up->is_const_func_; time_unit_ = up->time_unit(); diff --git a/t-dll-api.cc b/t-dll-api.cc index 12b829cca..9c69214da 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2019 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch) * @@ -93,11 +93,7 @@ extern "C" void ivl_design_roots(ivl_design_t des, ivl_scope_t **scopes, assert (nscopes && scopes); if (des->root_scope_list.size() == 0) { size_t fill = 0; - des->root_scope_list.resize(des->packages.size() + des->roots.size() + des->classes.size()); - - for (map::iterator idx = des->classes.begin() - ; idx != des->classes.end() ; ++ idx) - des->root_scope_list[fill++] = idx->second; + des->root_scope_list.resize(des->packages.size() + des->roots.size()); for (size_t idx = 0 ; idx < des->packages.size() ; idx += 1) des->root_scope_list[fill++] = des->packages[idx]; diff --git a/t-dll.cc b/t-dll.cc index 3334abd14..1b937b2b7 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2018 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2019 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it @@ -256,11 +256,6 @@ ivl_scope_t dll_target::find_scope(ivl_design_s &des, const NetScope*cur) return 0; } - if (cur->type() == NetScope::CLASS) { - ivl_scope_t tmp = des.classes[cur]; - return tmp; - } - for (unsigned idx = 0; idx < des.roots.size(); idx += 1) { assert(des.roots[idx]); ivl_scope_t scope = find_scope_from_root(des.roots[idx], cur); @@ -275,13 +270,6 @@ ivl_scope_t dll_target::find_scope(ivl_design_s &des, const NetScope*cur) return scope; } - for (map::iterator idx = des.classes.begin() - ; idx != des.classes.end() ; ++ idx) { - ivl_scope_t scope = find_scope_from_root(idx->second, cur); - if (scope) - return scope; - } - return 0; } @@ -667,11 +655,6 @@ void dll_target::add_root(const NetScope *s) des_.packages.push_back(root_); break; - case NetScope::CLASS: - root_->ports = 0; - des_.classes[s] = root_; - break; - default: assert(0); break; @@ -2478,16 +2461,7 @@ void dll_target::net_probe(const NetEvProbe*) void dll_target::scope(const NetScope*net) { - if (net->parent()==0 && net->type()==NetScope::CLASS) { - - if (debug_emit) { - cerr << "dll_target::scope: " - << "Add class " << scope_path(net) - << " as a root scope." << endl; - } - add_root(net); - - } if (net->parent() == 0) { + if (net->parent() == 0) { // Root scopes are already created... @@ -2561,7 +2535,8 @@ void dll_target::scope(const NetScope*net) scop->tname_ = scop->name_; break; case NetScope::CLASS: - assert(0); + scop->type_ = IVL_SCT_CLASS; + scop->tname_ = scop->name_; break; } }