Fix elaborations_sig of string types.

String variables are "string" and not "netvector_t:string".
Why did this ever work?
This commit is contained in:
Stephen Williams 2020-12-30 10:39:51 -08:00
parent 852d627de4
commit c943484b39
2 changed files with 36 additions and 8 deletions

View File

@ -222,13 +222,23 @@ NetAssign_* PEIdent::elaborate_lval(Design*des,
ivl_assert(*this, reg); ivl_assert(*this, reg);
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": PEIdent::elaborate_lval: " cerr << get_fileline() << ": " << __func__ << ": "
<< "Found l-value path_=" << path_ << "Found l-value path_=" << path_
<< " as reg=" << reg->name() << " as reg=" << reg->name() << endl;
<< ", reg->type()=" << reg->type() cerr << get_fileline() << ": " << __func__ << ": "
<< "reg->type()=" << reg->type()
<< ", reg->unpacked_dimensions()=" << reg->unpacked_dimensions()
<< endl;
if (reg->net_type())
cerr << get_fileline() << ": " << __func__ << ": "
<< "reg->net_type()=" << *reg->net_type() << endl;
else
cerr << get_fileline() << ": " << __func__ << ": "
<< "reg->net_type()=<nil>" << endl;
cerr << get_fileline() << ": " << __func__ << ": "
<< " base_path=" << base_path << " base_path=" << base_path
<< ", member_path=" << member_path << ", member_path=" << member_path
<< " unpacked_dimensions()=" << reg->unpacked_dimensions() << endl; << endl;
} }
// We are processing the tail of a string of names. For // We are processing the tail of a string of names. For

View File

@ -42,6 +42,7 @@
# include "netdarray.h" # include "netdarray.h"
# include "netparray.h" # include "netparray.h"
# include "netqueue.h" # include "netqueue.h"
# include "netscalar.h"
# include "util.h" # include "util.h"
# include "ivl_assert.h" # include "ivl_assert.h"
@ -1231,7 +1232,8 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
const netenum_t*use_enum = base_type_scope->find_enumeration_for_name(des, sample_name->name); const netenum_t*use_enum = base_type_scope->find_enumeration_for_name(des, sample_name->name);
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": debug: Create signal " << wtype cerr << get_fileline() << ": " << __func__ << ": "
<< "Create signal " << wtype
<< " enumeration " << " enumeration "
<< name_ << " in scope " << scope_path(scope) << name_ << " in scope " << scope_path(scope)
<< " with packed_dimensions=" << packed_dimensions << " with packed_dimensions=" << packed_dimensions
@ -1245,7 +1247,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
} else if (netdarray) { } else if (netdarray) {
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": PWire::elaborate_sig: " cerr << get_fileline() << ": " << __func__ << ": "
<< "Create signal " << wtype << "Create signal " << wtype
<< " dynamic array " << name_ << " dynamic array " << name_
<< " in scope " << scope_path(scope) << endl; << " in scope " << scope_path(scope) << endl;
@ -1255,6 +1257,20 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
ivl_assert(*this, unpacked_dimensions.empty()); ivl_assert(*this, unpacked_dimensions.empty());
sig = new NetNet(scope, name_, wtype, netdarray); sig = new NetNet(scope, name_, wtype, netdarray);
} else if (dynamic_cast<string_type_t*>(set_data_type_)) {
// Signal declared as: string foo;
if (debug_elaborate) {
cerr << get_fileline() << ": " << __func__ << ": "
<< "Create signal " << wtype
<< " string "
<< name_ << " in scope " << scope_path(scope)
<< endl;
}
sig = new NetNet(scope, name_, wtype, unpacked_dimensions,
&netstring_t::type_string);
} else if (parray_type_t*parray_type = dynamic_cast<parray_type_t*>(set_data_type_)) { } else if (parray_type_t*parray_type = dynamic_cast<parray_type_t*>(set_data_type_)) {
// The pform gives us a parray_type_t for packed arrays // The pform gives us a parray_type_t for packed arrays
// that show up in type definitions. This can be handled // that show up in type definitions. This can be handled
@ -1279,7 +1295,9 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
} else { } else {
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": debug: Create signal " << wtype; cerr << get_fileline() << ": " << __func__ << ": "
<< "Create signal " << wtype
<< " data_type=" << data_type_;
if (!get_scalar()) { if (!get_scalar()) {
cerr << " " << packed_dimensions; cerr << " " << packed_dimensions;
} }
@ -1291,7 +1309,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const
if (use_data_type == IVL_VT_NO_TYPE) { if (use_data_type == IVL_VT_NO_TYPE) {
use_data_type = IVL_VT_LOGIC; use_data_type = IVL_VT_LOGIC;
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": debug: " cerr << get_fileline() << ": " << __func__ << ": "
<< "Signal " << name_ << "Signal " << name_
<< " in scope " << scope_path(scope) << " in scope " << scope_path(scope)
<< " defaults to data type " << use_data_type << endl; << " defaults to data type " << use_data_type << endl;