Detect automatic terms in assignment patterns
Assignment patterns contain child expressions, but currently inherit `PExpr::has_aa_term()` which always returns false. This means automatic variables inside a pattern are not caught by checks for procedural `force` and procedural continuous assignment statements. Implement `has_aa_term()` for `PEAssignPattern` and recurse into all pattern elements. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
a1c333ea6e
commit
9bff2399df
10
PExpr.cc
10
PExpr.cc
|
|
@ -108,6 +108,16 @@ PEAssignPattern::~PEAssignPattern()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PEAssignPattern::has_aa_term(Design*des, NetScope*scope) const
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
for (const auto *parm : parms_) {
|
||||||
|
if (parm)
|
||||||
|
flag = parm->has_aa_term(des, scope) || flag;
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
PEBinary::PEBinary(char op, PExpr*l, PExpr*r)
|
PEBinary::PEBinary(char op, PExpr*l, PExpr*r)
|
||||||
: op_(op), left_(l), right_(r)
|
: op_(op), left_(l), right_(r)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
2
PExpr.h
2
PExpr.h
|
|
@ -208,6 +208,8 @@ class PEAssignPattern : public PExpr {
|
||||||
|
|
||||||
void dump(std::ostream&) const override;
|
void dump(std::ostream&) const override;
|
||||||
|
|
||||||
|
virtual bool has_aa_term(Design*des, NetScope*scope) const override;
|
||||||
|
|
||||||
virtual unsigned test_width(Design*des, NetScope*scope, width_mode_t&mode) override;
|
virtual unsigned test_width(Design*des, NetScope*scope, width_mode_t&mode) override;
|
||||||
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
|
virtual NetExpr*elaborate_expr(Design*des, NetScope*scope,
|
||||||
ivl_type_t type, unsigned flags) const override;
|
ivl_type_t type, unsigned flags) const override;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue