[go: up one dir, main page]

Skip to content

Commit

Permalink
Fix bug in custom field with internals
Browse files Browse the repository at this point in the history
  • Loading branch information
jvanstraten committed Sep 5, 2019
1 parent ceb290c commit fd6e1a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 5 additions & 5 deletions vhdmmio/core/behavior/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ def __init__(self, resources, field_descriptor,
internal = resources.internals.drive(
field_descriptor, name, internal_shape)
internal_interfaces.append((
internal, internal.drive_name + internal_suffix))
internal, True, internal_suffix))
elif kind == 'strobe':
assert vhdl_type is None
internal = resources.internals.strobe(
field_descriptor, name, internal_shape)
internal_interfaces.append((
internal, internal.drive_name + internal_suffix))
internal, True, internal_suffix))
elif kind == 'monitor':
assert vhdl_type is None
internal = resources.internals.use(
field_descriptor, name, internal_shape)
internal_interfaces.append((
internal, internal.use_name + internal_suffix))
internal, False, internal_suffix))
elif kind == 'state':
assert vhdl_type is None
state.append((name, shape))
Expand Down Expand Up @@ -203,8 +203,8 @@ def external_interfaces(self):

@property
def internal_interfaces(self):
"""A tuple consisting of `(Internal, identifier)` tuples, representing
the internal interfaces for this behavior."""
"""A tuple consisting of `(Internal, direction, suffix)` tuples,
representing the internal interfaces for this behavior."""
return self._internal_interfaces

@property
Expand Down
6 changes: 5 additions & 1 deletion vhdmmio/vhdl/behavior/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ def __getattr__(self, attr):
setattr(identifiers, name, self.add_interface(mode, name, count, typ)['$i$'])

# Register the internal interfaces.
for internal, identifier in self.behavior.internal_interfaces:
for internal, direction, suffix in self.behavior.internal_interfaces:
if direction:
identifier = internal.drive_name + suffix
else:
identifier = internal.use_name + suffix
setattr(identifiers, internal.name, identifier)

# Construct the state record, if the behavior is stateful.
Expand Down

0 comments on commit fd6e1a0

Please sign in to comment.