Closed kasbah closed 6 years ago
We don't need a python implementation. We can export json and modify netlistsvg to render it inside the viewer. We can probably add a export to svg or png feature inside the viewer. Or something along those lines. Thank you for the link!
I'm not set on any single programming language, python / node and probably at some point rust for performance critical parts - this is a playground so we can use whatever gives the quickest results, and there is something generally useful it can be moved to it's own repo later.
Yes, looking over it, outputting the subset of the Yosys netlist that Netlistsvg supports and adding some SVG "skins" for analog components could be a good way to go for a proof of concept. What do you mean by "the viewer" though?
An interactive viewer that lets you "zoom" into sub-circuits would be really cool. Worth noting from the Netlistsvg readme:
Yosysjs and klayjs are both capable of handling sub circuits and subgraphs. It might be interesting to see what kind of images I can produce from a hierarchal design.
What do you mean by "the viewer" though
There is kind of a prototype in the viewer subfolder. You can start it with node viewer/app.js net.svg pcb.svg
it's not very user friendly yet... pcb.svg doesn't have any styling built in it's in viewer/css/pcb.svg.css
, the net highlighting is currently broken...
Ah, completely missed that. Very cool! The style of the Graphviz output makes more sense now.
I have started working on this as https://github.com/nturley/netlistsvg/pull/6/.
Started work on this, like the results so far. this depends on #4, since port directions need to be specified and checked for consistency. This also allows removing the component labels, since they are no longer needed, new Inst('R', '10K')
and SubInst(joule_thief())
.
Still pretty awful, using netlistsvg master. Correctly and consistently setting input and output information should make them look much better.
Power to signal or power to power nets should use vertical components, while signal to signal nets should use horizontal components. (analysis mostly implemented)
Port swapping and better skins should also make it look much better.
The generic component should allow connecting nets at the top and bottom too so that power flows from top to bottom and signal flows from left to right.
You should add these examples to netlistsvg and open issues for features you mentioned that haven't been opened yet.
Hi, @dvc94ch . You raise some good points.
Port swapping and better skins should also make it look much better.
Port swapping is definitely a problem. I'm still trying to figure out the rules for when to port swap. Better skins meaning more components?
Power to signal or power to power nets should use vertical components, while signal to signal nets should use horizontal components
Right now I've been using a vertical flow for the analog skin, which does a bad job with horizontal ports so I've been just trying to use as many vertical components as possible, but presumably a typical circuit has more signal nets than power/gnd nets so maybe we should switch to a horizontal flow. Now that I have the lateral edge thing figured out, I might be able to make it look good. I'll try some experiments and see how it looks.
The generic component should allow connecting nets at the top and bottom too
A simple fix would be to add some special info in the netlist for generic components, but I just tagged all the lateral ports in the skin, so maybe I should just start tagging all of the port directions in the netlist and use that to determine which ports are lateral.
Laterals branch fixed this problem. It just merged to master. Wires to horizontal ports were always messy until that merged.
This needs a port swap. The resistor is connected from a southward port to a lateral port so we should be able to determine the optimal direction. The fact that the southward port is VCC should be an even bigger hint about the correct resistor orientation.
Laterals branch does a better job with this one as well.
Laterals branch fixed this
Turn off LONGEST_PATH. I think I turned it back off on master. I still think that NETWORK_SIMPLEX is better for analog.
port swap, port swap, port swap.
So I think the issues for these layouts
Progress so far: Things that can still be done from the pycircuit side are the following:
I just came across Netlistsvg which uses Klayjs for rendering Yosys netlists as schematics. Looks like Elkjs is supposed to replace Klayjs. It's a JS port of the Eclipse Layout Kernel. I haven't found any Python implementations yet.