From 6708c0f6dfd02599898c8098dda3b2dfce763e89 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sat, 22 Jan 2022 09:56:07 +0100 Subject: [PATCH] pform_makewire(): Allow to specify attributes There are a few places where pform_makewire() is used and attributes can be attached to the created net or variable. At the moment pform_makewire() doesn't allow to specify the attributes, and they either get dropped silently or with a warning. Add support for passing the attributes to pform_makewire() which will then pass it on to pform_set_data_type() to attach it to the declared net or variable. Signed-off-by: Lars-Peter Clausen --- parse.y | 26 +++++++------------------- pform.cc | 5 +++-- pform.h | 3 ++- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/parse.y b/parse.y index 2294860a9..3ab049f4f 100644 --- a/parse.y +++ b/parse.y @@ -1182,7 +1182,7 @@ data_declaration /* IEEE1800-2005: A.2.1.3 */ data_type = new vector_type_t(IVL_VT_LOGIC, false, 0); FILE_NAME(data_type, @2); } - pform_makewire(@2, 0, str_strength, $3, NetNet::IMPLICIT_REG, data_type); + pform_makewire(@2, 0, str_strength, $3, NetNet::IMPLICIT_REG, data_type, $1); } | attribute_list_opt K_event event_variable_list ';' { if ($3) pform_make_events($3, @2.text, @2.first_line); @@ -4987,12 +4987,8 @@ module_item data_type = new vector_type_t(IVL_VT_LOGIC, false, 0); FILE_NAME(data_type, @2); } - pform_makewire(@2, $4, str_strength, $5, $2, data_type); - if ($1) { - yywarn(@2, "Attributes are not supported on net declaration " - "assignments and will be discarded."); - delete $1; - } + pform_makewire(@2, $4, str_strength, $5, $2, data_type, $1); + delete $1; } /* This form doesn't have the range, but does have strengths. This @@ -5004,22 +5000,14 @@ module_item data_type = new vector_type_t(IVL_VT_LOGIC, false, 0); FILE_NAME(data_type, @2); } - pform_makewire(@2, 0, $4, $5, $2, data_type); - if ($1) { - yywarn(@2, "Attributes are not supported on net declaration " - "assignments and will be discarded."); - delete $1; - } + pform_makewire(@2, 0, $4, $5, $2, data_type, $1); + delete $1; } | attribute_list_opt K_wreal net_decl_assigns ';' { real_type_t*data_type = new real_type_t(real_type_t::REAL); - pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type); - if ($1) { - yywarn(@2, "Attributes are not supported on net declaration " - "assignments and will be discarded."); - delete $1; - } + pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type, $1); + delete $1; } | K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' diff --git a/pform.cc b/pform.cc index fe2cb3d03..560ec7a83 100644 --- a/pform.cc +++ b/pform.cc @@ -2828,7 +2828,8 @@ void pform_makewire(const struct vlltype&li, str_pair_t str, std::list*assign_list, NetNet::Type type, - data_type_t*data_type) + data_type_t*data_type, + list*attr) { if (is_compilation_unit(lexical_scope) && !gn_system_verilog()) { VLerror(li, "error: variable declarations must be contained within a module."); @@ -2845,7 +2846,7 @@ void pform_makewire(const struct vlltype&li, names->push_back(curp->name); } - pform_set_data_type(li, data_type, names, type, 0); + pform_set_data_type(li, data_type, names, type, attr); while (! assign_list->empty()) { decl_assignment_t*first = assign_list->front(); diff --git a/pform.h b/pform.h index d61b18ae5..5433f4762 100644 --- a/pform.h +++ b/pform.h @@ -360,7 +360,8 @@ extern void pform_makewire(const struct vlltype&li, str_pair_t str, std::list*assign_list, NetNet::Type type, - data_type_t*data_type); + data_type_t*data_type, + std::list*attr = 0); extern void pform_make_var_init(const struct vlltype&li, perm_string name, PExpr*expr);