-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTL Schematic View #41
Comments
netlistsvg is the great step into right direction. We need more of such projects. |
@nturley (the author of netlistsvg) has signed up to be a Google Summer of Code mentor for SymbiFlow. |
We need more students now! |
@drom I think I can help you with that. I'd love to work on something related to netlist visualization for GSoC. Here's some ideas I want to bounce off of you before writing a formal proposal. -An RTL schematic view (this issue) -A potential visual simulation in RTL view (so one can see which wires are on/off & step through clock cycles.) There's a LOT of potential for visualizing testbenches or failure traces. -Would this be an extension of netlistsvg, icedrom, or its own project? -Issue #42 (Render LUTs as gates) would probably be a part of this -Algorithms, perhaps in Yosys to make a netlist more human-readable before displaying (I'm thinking of possible use in reverse-engineering cases, but how helpful would it be for development?) -Could also work on #45 (Improve Wavedrom) I was looking for Symbiflow GSoC ideas and came across this the other day. I've already been working on things within the same vein in my obsolete IC emulation project (I gave a talk about this at LatchUp 2019) (RIP LatchUp 2020 ;'/ ) and would love to finally contribute to SymbiFlow. Much of your existing code is in JavaScript, which I've got experience in. I also have a little experience in C-based WASM, which is a language option if we create a new project. |
@TheProgrammerIncarnate great to hear from you. I was super impressed with your work and presentation at LatchUp 2019. I would be glad to be your GSoC mentor for any of the ideas you have mentioned above. I am sure @nturley would love your participation too. Have you registered for GSoC? |
Python or Javascript would both be acceptable for a new project. I'm sure that @drom would prefer you write it in Javascript and I would prefer you write it in Python -- ultimately it is up to what you are more comfortable in. |
I'm not too afraid of a rewrite of netlistsvg especially if you abandon the idea of using it for board level schematics because that made a mess of the code. It was hard to write because I didn't know what I was doing more than it being a lot of code, so with the benefit of hindsight and clear objectives it would be pretty straightforward to write. Of course you are welcome to steal pieces of it or refer to it for inspiration. Hierarchical designs practically necessitate a complete rewrite anyway. The key elements that I believe make netlistsvg successful are using a separate library to solve for layout and the concept of using an SVG skin template file. Many similar projects get bogged down fiddling with poor layout algorithms or drawing all of the symbols in code. There are some pieces of diagram layout that it is much easier to find JS libraries for and some parts that are much easier to find python libraries for. For instance, ELKjs was very useful and I don't know of any python libraries that are as powerful as ELK for layout. Ive been doing experiments for months on trying to use constraint solver based layout and python has dozens of easy to use libraries for constraint solvers whereas the JS landscape is a bit more sparse in that area. My python skills are a little stronger than my JS skills but I've worked with both in commercial code bases at this point so I'm fine with either one. Demoing via web browser is a little flashier than trying to teach someone how to use pip, but theres a lot of advantages to python as well. So if you are doing netlist visualization, the TLDR is
|
I want to add a few points here: Good automatic rendering of big schematic sheets is pretty hard technically and useless.
In order to make a schematic view useful, it must be interactive. The user must be able to select and filter a subset of the schematic. With multiple ways of filtering, tracing towards source/destination, to the driver, showing/hiding details, highlighting wires and gates. The User must be able to jump between schematic, waveform, and source code views. A good tool would provide smart filters, to present relevant pieces of the schematic. Like a critical path, test case failure, etc. Interactive, responsive, Web-based view is a key to success. IMHO |
Exactly what I was thinking. I put a design equivalent to a few hundred LUTs into netlistsvg a while back and had these exact issues. Filtering, netlist formatting (basically anti-flatten), integration of waveform viewer & source code, etc would all very useful to help mitigate apparent complexity. On language, I'm leaning towards some form of WebAssembly (compiled to that is, I'm not writing an application in WASM bytecode.) It should run everywhere JS does, but be much faster. Speed hasn't been much of a bottleneck so far, but it could become one if someone tries to debug an entire core or IP block. There should be a few weeks before we have to decide on one though. |
For the language. I would start with JavaScript. |
On pattern recognition for visualization topic: https://groups.google.com/d/msg/chisel-users/eZy2zQyvojE/FN6dc9k9AgAJ
|
Hierarchical designs seem to start getting usable with the repo I mentioned above (hierarchy branch). One of the main things that I'm seeing for improvement could be the routing of wires, these seem to take lots of detours once you get a larger design which makes tracing them quite a big problem. This hierarchical view currently uses a JSON config file to select which modules to expand, here's an example of what it can currently generate: |
@rjordans looks very good. How can we improve the routing of the wires? is it done by ELKjs? |
This is done using ELKjs hierarchical drawing, for the wires I have no clue on how to get them better yet. There's a few examples in the above picture where a mux select input goes closely past the target, takes a big detour downwards, and then finally ends up at the correct point. This seems a bit silly to me but I have no clue how this works internally. The linked project is of a student that I'm supervising so I'm not completely up to date on the internals. |
This is a great project. I would love open source tools to support RTL schematics. I want to add a few points to this discussion:
|
My theory for the vertical detours are because it's attempting to align the components in rows. So when there is a large variance in node height then it can shove things further down than necessary. There was an ELK option for post compaction that is supposed to address issues like this but it didn't seem very effective when I tried it. Avoiding tall components can help but for many designs there isn't really any easy way around it. Some layout issues can be fixed either in post layout processing or by fiddling with the configuration options but really digging into the layout algorithm requires digging into the original Java implementation. The maintainers are quite active and very helpful but many issues filed about layout get responses like "making complex changes like this could degrade other cases that have been highly optimized" |
OK, sounds like it may be worth checking if there's some low hanging fruit we can catch with the ELK configuration options first then. That will probably take some effort in visually inspecting the results for some larger set of test cases though so it'll be difficult to evaluate what the 'best' settings would be. |
@Raamakrishnan maybe to get back to your comment above. For your second point you mention that Verilog always blocks may remain black boxes. Currently with Yosys + netlistsvg, you can run the 'proc' task in Yosys to translate the always blocks into actual processes. As a result these blocks will translate into their RTL structure, either gates for combinational logic, or registers plus gates for clocked blocks. The example output I posted previously is generated from Verilog code where this was done. Once you have things in the RTL structure you can decide how many of the Yosys steps to run to either get a generic listing, or something else like LUTs in FPGA or mapped gates in ASIC designs. |
FYI: There is now a pull request to netlistsvg for merging the hierarchical view nturley/netlistsvg#92 |
One could think about the "schematic viewer" rendering some "visual netlist", that was synthesized for visualization purposes only. Like any other synthesis target (ASIC, FPGA) it has own "standard cell library", own limitation, own optimization criteria, own complexity criteria. |
FTR, see On the Automatic Layout of Data Flow Diagrams by Miro Spönemann, referenced in ghdl/ghdl#111:363395770 by @Nic30 (see Nic30/d3-hwschematic). See also Nic30/d3-wave and (RTL) Schematic view. EDIT umarcor/hwstudio contains the plumbing for a 3D RTL schematic viewer based on three.js and vuetify, with backends in either Python (Flas) or Electron. However, the visualization is a module, hence it can be used as a wrapper for netlistsvg, logidrom or any other library. |
@eine thank you for sharing. Very interesting work, indeed. |
@drom there is whole team of people working on Layered graphs on Keil (search for people from previously mentioned thesis on researchgate) I also used Ariane as a testing design for d3-hwschematic and I found out some serious problem which you probably do not know about yet.
|
@Nic30 all good points!
The goals I see are:
We need to find a better forum to prototype and discuss all these ideas. |
By MAGIC do you mean https://github.com/RTimothyEdwards/magic ? Also note that d3-hwschematic has everything you mentioned
process body not expanded by default (note that this context process may not necessary means verilog always statement but the collection of the drivers for named signal)
all object styles are customizable from json, "visual language" is d3.js library query which is used for all manipulations with svg
"process nodes" previously mentioned (excluding generators, because it is very complicated to visualize non elaborated design)
Done during generation of json, not part of d3-hwschematic
d3.js zoom, move etc. I am saying this because I believe that d3-hwschematic may be exactly what you are trying to write. I am just a single programmer you guys seems to have quite lot of followers, I would gladly transfer ownership of d3-hwschematic in to some github organisation, if required. I really do not see any reason why to do the same thing again. Also think about this message as my personal opinion after reading previous messages, I do have only rough idea about your requirements.
|
@Nic30 no MAGIC was a code name of the imaginary layout engine that is 10x faster than ELK |
@Nic30 thank you for sharing. Great work with I still don't see how final system should look. That is why I am looking for a platform for fast prototyping of ideas, rather than final implementation. |
Let me share one more idea. I think that there are actually 2 use-cases for RTL viewer.
The doc use-case is "simple", it is only required to render the graph and have possibility to filter/search in nodes. However the expectations from RTL viewer during prototyping are much higher. I was experimenting with online GUIs but I always find out that there is some feature which I would like to have as a user but I need to add it in to GUI itself as a GUI developer. I think that this is a common case, e. g. I would like to add a picture for the component body . But even if GUI allows a arbitrary html for the component body there is a problem where to store the image etc. (and this is just a simple example which comes to my mind) Rather than developing IDE like GUI I think it would be better to have widget for interaction with the user. I think that widget would support user creativity better than IDE like web GUI. |
@Nic30 yes, that would be super cool to create some widget library, that user can use to quickly describe some component visualization. |
FYI - I'm mostly interested in schematic view for documentation. |
|
You might be interested in the following too;
The interesting thing is the "river routing";
It feels like this could be directly suitable for schematics diagrams and even place and route too. |
Agree. Schematics in 2.5D would be nice. @Nic30, any thought about multilayer algorithms vs the one used in d3-hwschematic? |
@umarcor right now I think that the the multi-layer algs. are required for PCB as wires can not cross otherwise but in scheme wires can cross and having more degrees of freedom may require longer layout time. about cuflow I am not sure how much actually is automatic and how much is done manually. If you do have buses then you usually do not need river routing (now I do ignore the fact that you do not have an explicit info about buses in Verilog..). |
Hi, I came up with this thread while searching for a way to have a interactive diagram for analyzing the clock tree from RTL. Thanks in advance. |
@pka88 I am using verilog -> yosys -> json and then I am viewing it in d3-hwschematic (there is also netlistsvg which can do the same thing without aggregations) I am using it often to visualize combinational loops and pipelines discovered by a simple script.
You could try this in RTL and it will be doable for most of the cases but in general it is not doable and it requires conversion to netlist. |
There is a library to visualize set of small, but manageable logical tree structures without large graph rendering. This page renders random circuit: https://drom.io/firrtl/ |
@Nic30 : Yes, I am looking for an interactive diagram with limited scope of analysis as the design is too big for getting any useful information if analyzed as a whole. Mainly the clock tree portion which is only connectivity across hierarchies in the RTL (much similar to the netlist). @drom : Is the drom.io interactive ? are there any tools to parse an RTL to generate the GraphVIZ kind of representation needed for this ? |
@pka88 the demo above is just a random circuit. It can be made interactive, with left and right side path expansion. |
Link seems to be broken |
Thank you for reporting. Should be fixed now. |
Brief explanation
A good RTL schematic view is very useful.
Detailed Explanation
Further reading
The text was updated successfully, but these errors were encountered: