Handle assignment to static class properties in class methods
Assigning a value to a static class property in a class task or function
will currently not write to the static signal, but instead to an otherwise
invisible per instance property. E.g. the example below will print 0 when
the task `t` is called.
```
class C;
static int i;
task t;
i = 10;
$display(i);
end
endclass
```
Since static class properties are implemented as normal signals just
fallback to the default signal handling when an assignment to a static
class property is detected.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
f3c4967085
commit
f95f9955c8
|
|
@ -393,6 +393,13 @@ NetAssign_* PEIdent::elaborate_lval_method_class_member_(Design*des,
|
|||
if (pidx < 0)
|
||||
return 0;
|
||||
|
||||
property_qualifier_t qual = class_type->get_prop_qual(pidx);
|
||||
|
||||
// Static properties are handled as normal signals. Regular symbol
|
||||
// search will find it.
|
||||
if (qual.test_static())
|
||||
return 0;
|
||||
|
||||
NetScope*scope_method = find_method_containing_scope(*this, scope);
|
||||
ivl_assert(*this, scope_method);
|
||||
|
||||
|
|
@ -428,7 +435,6 @@ NetAssign_* PEIdent::elaborate_lval_method_class_member_(Design*des,
|
|||
// Detect assignment to constant properties. Note that the
|
||||
// initializer constructor MAY assign to constant properties,
|
||||
// as this is how the property gets its value.
|
||||
property_qualifier_t qual = class_type->get_prop_qual(pidx);
|
||||
if (qual.test_const()) {
|
||||
if (class_type->get_prop_initialized(pidx)) {
|
||||
cerr << get_fileline() << ": error: "
|
||||
|
|
|
|||
Loading…
Reference in New Issue