Skip to content

Allow port redefinition from an empty port only #442

@ducky64

Description

@ducky64

To unify the syntax with how ports are usually defined (self.io = self.Port(DigitalBidir(models))) with when a base class defines an io (self.io = self.Port(DigitalBidir.empty())), instead of using .init_from, support an implicit .init_from using redeclaration syntax.

It is still an error to redeclare a port in any other context, including a partially-initialized port.

Related: to better support IO re-exporting, perhaps there needs to be a Block.export_ios_from, which (asserting the IOs exist in the block already) connects the internal to the external, matching by name.

  • It is an error if there is an internal IO that does not have an external counterpart, but it is not an error if there are extra external IOs
  • IOs still must be explicitly instantiated, to allow for static checking. One pattern might be to define an MyClassIo(Block) base class that only instantiates empty IOs of the right type.
  • for Connector-pairs for daughterboards #367, similar construct for WrapperBlock.export_tap_ios_from for the export_tap variant.

Related: #114 compositional passive

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions