In this article , we delve into several key topics. First, we provide an introduction to both NetlistSVG and GraphViz, outlining their features and uses. We then demonstrate how to create a JSON file for NetlistSVG and render the output, offering step-by-step guidance through the process. Similarly, we explain how to generate a DOT file for GraphViz and render its output, ensuring a clear understanding of the procedures involved. Finally, we conduct a detailed side-by-side comparison of the outputs from NetlistSVG and GraphViz, highlighting their differences and similarities to give you a comprehensive view of both tools.
In the previous episodes, we explored how to install and run Yosys. In today’s episode, we’ll delve into generating graphical representations of synthesized netlists using Graphviz and netlist SVG. These visual outputs can help in post-synthesis verification, debugging, and even professional presentations, such as in thesis documents or PowerPoint slides. Let’s break down the process step by step.
Overview of Graphical Outputs
We will create two types of visual outputs:
1. Netlist SVG: A digital circuit-style representation, generated from a JSON (JavaScript Object Notation) file.
2. Graphviz Output: A graph-style visualization from a DOT file.
Both formats offer unique insights into the synthesized netlist, making them invaluable for documentation and debugging.
Getting Started:
First, ensure you’re working in your project directory and launch the Yosys tool from the terminal. Begin by loading the test case files and following the synthesis process:
Synthesis Steps:
1. Read the Verilog file: read_verilog counter.v
2. Run the hierarchy command: hierarchy -check
3. Load the library and synthesize:
read_liberty -lib my_lib.lib
synth -top top_module
4. Write the synthesized netlist: write_verilog synth.v
Once synthesis is complete, we proceed to generate the graphical outputs.
Step 1: Generating the JSON File
To create a JSON representation of the netlist:
1. Use the write_json command: write_json synth.json
2. Open the JSON file to verify its structure. It includes details such as modules, ports, cells, and interconnections. This standardized format is essential for converting the netlist into a visual format.
Generating Graphical O/P:
help write_json #JSON Format
write_json synth.json #JSON File Creation for Netlist-SVG
help show # open synth.json & copy+paste data in the website (https://neilturley.dev/netlistsvg/)
Step 2: Visualizing JSON:
- Copy the JSON content and paste it into a Netlist SVG web interface (URL provided in the description).
- Choose the default settings and click "Render" to generate the visual.
- Save the output as an SVG file for use in documentation or presentations.
Step 3: Generating the Graphviz DOT File
2. The command generates a `graph.dot` file. This file can be opened using the xdot viewer:
xdot graph.dot &
The graphical output will display the netlist in a connected graph format, complete with nodes and directed edges.
4. Comparing Outputs
The two outputs serve distinct purposes:
- Netlist SVG provides a more circuit-like representation, ideal for digital circuit diagrams.
- Graphviz Graph offers a broader network-style visualization, useful for analyzing connections and dependencies.
Applications of Visual Outputs:
1. Debugging: Identify connections, ports, and interconnects visually to spot issues quickly.
2. Documentation: Enhance the quality of your thesis, reports, or presentations with professional visuals.
3. Verification: Confirm synthesized netlists by visually comparing the outputs with your design expectations.
Conclusion:
Visualizing synthesized netlists using JSON and Graphviz outputs is a powerful way to validate and present your work. Whether for debugging or professional documentation, these tools streamline the process and make your designs more accessible. Watch the Video lecture Here:
Courtesy: Image by www.pngegg.com