Giter Site home page Giter Site logo

Comments (3)

flandreas avatar flandreas commented on September 27, 2024

@fpw The reason why this happens is that Antares doesn't store the port names when connecting wires to subcircuit pins. This is because it would break when renaming pins. Instead, it uses the internal index of the port, such as 1, 2, 3 and so forth.

Now, until a couple of releases ago, this principle worked fine even when adding additional ports to a subcircuit. Because the user had to manually add these ports to the symbol, the additional ports received higher port numbers, and the existing one were untouched.

This changed when we introduced the "Generate Symbol" feature. A symbol is automatically laid-out again whenever a port is added or removed. The algorithm first removes all ports, then adds all inputs to the left side and all outputs to the right side of the symbol, leading to new port IDs. This is why in your example, the LED, which was previously connected with former port 2 (the O1 output), is now connected to I2, because that is now the port 2 (because it is the second port after the relayout.

I have to think about how to change the layout algorithms to make the port assignments more robust with these use cases.

from antares.

fpw avatar fpw commented on September 27, 2024

Thanks for the explanation of the internals! Not sure if it helps, but my first idea would be this:

  • modify the "Generate Symbol" algorithm to optionally get a mapping from name to id as input
  • when a port is added to a "Generate Symbol" circuit, retrieve the name-to-id mapping of the current symbol
  • delete all ports (like now)
  • call the "Generate Symbol" algorithm with the mapping retrieved in step 2
  • now the algorithm can assign old IDs to old names and use new IDs for ports that aren't in the old mapping (i.e. the new ports that were just added)
  • create only those ports that appear in the new assignment, using the former port IDs from the table

from antares.

flandreas avatar flandreas commented on September 27, 2024

@fpw Yes that helps, I'll do it along these lines.

from antares.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.