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 <lars@metafoo.de>
This commit is contained in:
parent
a5e9358d42
commit
6708c0f6df
26
parse.y
26
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);
|
data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
|
||||||
FILE_NAME(data_type, @2);
|
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 ';'
|
| attribute_list_opt K_event event_variable_list ';'
|
||||||
{ if ($3) pform_make_events($3, @2.text, @2.first_line);
|
{ 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);
|
data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
|
||||||
FILE_NAME(data_type, @2);
|
FILE_NAME(data_type, @2);
|
||||||
}
|
}
|
||||||
pform_makewire(@2, $4, str_strength, $5, $2, data_type);
|
pform_makewire(@2, $4, str_strength, $5, $2, data_type, $1);
|
||||||
if ($1) {
|
delete $1;
|
||||||
yywarn(@2, "Attributes are not supported on net declaration "
|
|
||||||
"assignments and will be discarded.");
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This form doesn't have the range, but does have strengths. This
|
/* 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);
|
data_type = new vector_type_t(IVL_VT_LOGIC, false, 0);
|
||||||
FILE_NAME(data_type, @2);
|
FILE_NAME(data_type, @2);
|
||||||
}
|
}
|
||||||
pform_makewire(@2, 0, $4, $5, $2, data_type);
|
pform_makewire(@2, 0, $4, $5, $2, data_type, $1);
|
||||||
if ($1) {
|
delete $1;
|
||||||
yywarn(@2, "Attributes are not supported on net declaration "
|
|
||||||
"assignments and will be discarded.");
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
| attribute_list_opt K_wreal net_decl_assigns ';'
|
| attribute_list_opt K_wreal net_decl_assigns ';'
|
||||||
{ real_type_t*data_type = new real_type_t(real_type_t::REAL);
|
{ real_type_t*data_type = new real_type_t(real_type_t::REAL);
|
||||||
pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type);
|
pform_makewire(@2, 0, str_strength, $3, NetNet::WIRE, data_type, $1);
|
||||||
if ($1) {
|
delete $1;
|
||||||
yywarn(@2, "Attributes are not supported on net declaration "
|
|
||||||
"assignments and will be discarded.");
|
|
||||||
delete $1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
| K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';'
|
| K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';'
|
||||||
|
|
|
||||||
5
pform.cc
5
pform.cc
|
|
@ -2828,7 +2828,8 @@ void pform_makewire(const struct vlltype&li,
|
||||||
str_pair_t str,
|
str_pair_t str,
|
||||||
std::list<decl_assignment_t*>*assign_list,
|
std::list<decl_assignment_t*>*assign_list,
|
||||||
NetNet::Type type,
|
NetNet::Type type,
|
||||||
data_type_t*data_type)
|
data_type_t*data_type,
|
||||||
|
list<named_pexpr_t>*attr)
|
||||||
{
|
{
|
||||||
if (is_compilation_unit(lexical_scope) && !gn_system_verilog()) {
|
if (is_compilation_unit(lexical_scope) && !gn_system_verilog()) {
|
||||||
VLerror(li, "error: variable declarations must be contained within a module.");
|
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);
|
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()) {
|
while (! assign_list->empty()) {
|
||||||
decl_assignment_t*first = assign_list->front();
|
decl_assignment_t*first = assign_list->front();
|
||||||
|
|
|
||||||
3
pform.h
3
pform.h
|
|
@ -360,7 +360,8 @@ extern void pform_makewire(const struct vlltype&li,
|
||||||
str_pair_t str,
|
str_pair_t str,
|
||||||
std::list<decl_assignment_t*>*assign_list,
|
std::list<decl_assignment_t*>*assign_list,
|
||||||
NetNet::Type type,
|
NetNet::Type type,
|
||||||
data_type_t*data_type);
|
data_type_t*data_type,
|
||||||
|
std::list<named_pexpr_t>*attr = 0);
|
||||||
|
|
||||||
extern void pform_make_var_init(const struct vlltype&li,
|
extern void pform_make_var_init(const struct vlltype&li,
|
||||||
perm_string name, PExpr*expr);
|
perm_string name, PExpr*expr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue