From 5f71307ab48cecc795abeea6f86a80363c09f712 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 9 Jan 2022 21:04:06 +0100 Subject: [PATCH] Use data_type_t to pass `string` type information to signal elaboration For signals that are declared in a block string_type_t is already used to pass the type information to the signal elaboration. But for task ports it is passed as IVL_VT_STRING. Switch this over to also passing the type information as a data_type_t. This allows to remove the special handling for IVL_VT_STRING in the signal elaboration. Signed-off-by: Lars-Peter Clausen --- elab_sig.cc | 19 ++++--------------- pform.cc | 3 +-- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/elab_sig.cc b/elab_sig.cc index d0cb720b4..ceb4256c4 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -1254,21 +1254,6 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const sig = new NetNet(scope, name_, wtype, unpacked_dimensions, &netstring_t::type_string); - } else if (set_data_type_==0 && data_type_==IVL_VT_STRING) { - - // Signal declared as: string foo; - if (debug_elaborate) { - cerr << get_fileline() << ": PWire::elaborate_sig: " - << "Create signal " << wtype - << " string " - << name_ << " in scope " << scope_path(scope) - << " without set_data_type_" - << endl; - } - - sig = new NetNet(scope, name_, wtype, unpacked_dimensions, - &netstring_t::type_string); - } else if (parray_type_t*parray_type = dynamic_cast(set_data_type_)) { // The pform gives us a parray_type_t for packed arrays // that show up in type definitions. This can be handled @@ -1315,6 +1300,10 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) const } } + ivl_assert(*this, use_data_type == IVL_VT_LOGIC || + use_data_type == IVL_VT_BOOL || + use_data_type == IVL_VT_REAL); + netvector_t*vec = new netvector_t(packed_dimensions, use_data_type); vec->set_signed(get_signed()); vec->set_isint(get_isint()); diff --git a/pform.cc b/pform.cc index e81efd3ca..cac63013f 100644 --- a/pform.cc +++ b/pform.cc @@ -3044,8 +3044,7 @@ vector*pform_make_task_ports(const struct vlltype&loc, } if (dynamic_cast (vtype)) { - ret = pform_make_task_ports(loc, pt, IVL_VT_STRING, - false, 0, ports); + ret = do_make_task_ports(loc, pt, IVL_VT_STRING, vtype, ports); } if (class_type_t*class_type = dynamic_cast (vtype)) {