Matthew Beckler's Home Page

Home :: Blog :: General :: Software :: Hardware :: Microcontrollers :: Artsy


How To: Convert a Cadence Virtuoso Layout to an SVG / PDF / PNG image file.

Contents: Introduction :: Solution :: Preview :: Cadence Export :: Running the Script :: Post Processing :: Issues With Inkscape :: Results :: Download

Intro: During my schoolwork at CMU, I took a class on the analysis and design of digital circuits, and we ended up making a large layout of the register file and datapath of a small microprocessor. I wanted to print out the final layout and hang it on my wall at home, but I couldn't find any way to save an image file, other than taking a screenshot, which would be very poor quality for printing. There had to be another way.

Solution: I figured out how to export raw geometry data from Cadence, and wrote a small script to convert the data into a Scalable Vector Graphics (SVG) file. Using the free and open source vector graphics editing program Inkscape (download), you can then save the image to almost any image format, including GIF, PNG, and PDF.

Preview: Here is a comparison between the original circuit in Cadence and the output of the script, for a dual flip-flop cell:
Flip Flop cell in Cadence                    Flip Flop cell in SVG

Exporting From Cadence: In order to access the raw geometry data of the layout, we first need to export it from Cadence in a usable format. From the main ICFB window, go to "File" -> "Export" -> "Stream".
Cadence: Open Export Window
Enter in the library, cell, and view name. Click the box next to "ASCII Dump", enter a filename for output, then click on "Options" near the top.
Cadence: Setting Export Options
In the options window, be sure to check the following options:

Cadence: Setting Stream Options
Click "OK" in the options window, and click "OK" in the Stream Out window. Check to make sure that your file was created on disk. Let's assume that the stream dump filename was "dump.txt".

Running the conversion script: Next, we need to run the conversion script as:

./convert.py dump.txt output.svg

This will output the entire file, but if you only want to output a sub-cell of the total layout, then you should add the desired sub-cell's name as the final argument to the script:

./convert.py dump.txt output.svg subcellname

Post-processing with Inkscape: Once the SVG file has been created on disk, you should open it in Inkscape and hit "Control + Shift + D" to open the Document Properties dialog. Since the document's bounding box is not set by the script, you should hit the Fit page to selection button to fix the document's borders. You should also change the document background from 100% transparent to 100% opaque:
Inkscape Settings
After you fix the document bounding box and background transparency, you can save as a PDF, or use the Export Dialog (Control + Shift + E) to export to a bitmap format such as GIF or PNG. JPG doesn't really work very well for these type of images. If you want to print in a large format (like a poster-size print), saving as a PDF will result in a much better quality, since PDF is a vector image format.

Inkscape's Issues With Large SVG Files: Be warned that Inkscape (specifically the garbage collector it uses) might have issues if you are trying to work with a very large SVG file. You'll have better luck if you only look at a small section of the image at one time, and don't try to zoom-out all the way to display the entire document at once. In my experience, these issues were not due to running out of RAM or swap, but due to a limitation in the GC system. You can still save as PDF/PNG without viewing the entire image at once. For reference, it took about 10 minutes to save as PDF for my final layout, which had 132889 polygons (a 40 MB SVG file), using a Core 2 Duo 2.4 GHz with 2 GB RAM. I had no issues on OSX (Core 2 Duo 2.4 GHz - 2 GB RAM), but I did have problems with the Inkscape GC system on Linux (Quad-core Phenom 2.3 GHz - 4 GB RAM). Your mileage may vary.

Inkscape Alternative for PDF Export: Batik I have run into some trouble trying to view and print very large PDF files generated using the Cairo engine, which is used by Inkscape for its PDF exports. An alternative that I found, that works well converting large SVG files to PDF, that can still be read by Adobe Reader on Windows, is called Batik, and was created by the Apache project. It requires a Java Runtime Environment, and is fairly easy to use to convert your SVG to PDF. You can download it from their website.
UPDATE: After filing a bug report with Adobe, it was determined that the Smooth Images feature is the culprit. Adobe expects to fix this issue with the next major release of Reader. Most other PDF viewers don't do this sort of smoothing, and so they didn't have trouble with these sorts of large PDF images. To turn off the smooth images feature, in Adobe Reader go to "Edit", "Preferences", "Page Display" and un-check "Smooth Images".

Final Results: Here is a screenshot of our final layout. The PDF (2.6 MB) is available for download, as well as the SVG file (40 MB).
Final Layout

Download: Click below to download the zip package. The package contains the script file and your very own copy of the GPL. If you find this script to be useful, please send me an email. I'm always interested to know who's using my software.


Homepage Made with Vim! Validate HTML Email Me! Made with Inkscape! Validate CSS

Copyright © 2004 - 2024, Matthew L. Beckler, CC BY-SA 3.0
Last modified: 2011-06-01 11:39:01 AM (EDT)