Skip to content

Commit

Permalink
Fix UDP binding rules
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Jul 16, 2018
1 parent 7ed0da0 commit e16264f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
5 changes: 3 additions & 2 deletions systemrdl/core/ComponentVisitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,9 @@ def visitNormal_prop_assign(self, ctx:SystemRDLParser.Normal_prop_assignContext)
if ctx.prop_assignment_rhs() is not None:
rhs = self.visit(ctx.prop_assignment_rhs())
else:
# No RHS implies "true" assignment
rhs = True
# No explicit RHS
# What this implies is resolved later
rhs = None

return SourceRef.from_antlr(prop_token), prop_name, rhs

Expand Down
22 changes: 22 additions & 0 deletions systemrdl/core/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ def assign_value(self, comp_def, value, src_ref):
src_ref
)

# Property assignments with no rhs show up as None here
# For built-in properties, this implies a True value
if value is None:
value = True

# unpack true type of value
# Contents of value can be:
# - implied "true" assignment (bool literal, True)
Expand Down Expand Up @@ -1109,7 +1114,24 @@ def __init__(self, env, name, bindable_to, valid_types, default = None, constr_c

def get_name(self):
return self.name


def assign_value(self, comp_def, value, src_ref):
# Property assignments with no rhs show up as None here
# For user-defined properties, this implies the default value
# (15.2.2)
if value is None:
value = self.default

super().assign_value(comp_def, value, src_ref)

def get_default(self, node):
# pylint: disable=unused-argument

# If a user-defined property is not explicitly assigned, then it
# does not get bound with its default value
return None

def validate(self, node, value):
if self.constr_componentwidth:
# 15.1.1-g: If constraint is set to componentwidth, the assigned
Expand Down

0 comments on commit e16264f

Please sign in to comment.