diff --git a/GDStoSVG/GDSReader.cs b/GDStoSVG/GDSReader.cs index 66ead17..a71ac68 100644 --- a/GDStoSVG/GDSReader.cs +++ b/GDStoSVG/GDSReader.cs @@ -343,7 +343,7 @@ private bool ReadRecord(RecordType type, byte[]? data) if (this.CurrentElement == null) { throw new InvalidDataException("Element ending before starting."); } this.CurrentStructure.Elements ??= new(); if (!this.CurrentElement.Check()) { Console.WriteLine("Element does not have all required data present."); } - this.CurrentStructure.Elements.Add(this.CurrentElement); + if (this.CurrentElement is not Text || !Program.IgnoreAllText) { this.CurrentStructure.Elements.Add(this.CurrentElement); } this.CurrentElement = null; break; } diff --git a/GDStoSVG/Program.cs b/GDStoSVG/Program.cs index f15e2bc..f2112ae 100644 --- a/GDStoSVG/Program.cs +++ b/GDStoSVG/Program.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Threading.Tasks; @@ -16,9 +17,12 @@ public class Program public static bool Debug { get; private set; } = false; public static bool Info { get; private set; } = false; public static bool DoOptimization { get; private set; } = false; + public static bool IgnoreAllText { get; private set; } = false; static void Main(string[] args) { + Stopwatch Stopwatch = new(); + Stopwatch.Restart(); if(args.Length < 1) { PrintHelp(); return; } string? GDSFile = null; @@ -36,6 +40,7 @@ static void Main(string[] args) else if (args[i].Equals("-info", StringComparison.OrdinalIgnoreCase)) { Info = true; } else if (args[i].Equals("-debug", StringComparison.OrdinalIgnoreCase)) { Debug = true; } else if (args[i].Equals("-optimize", StringComparison.OrdinalIgnoreCase)) { DoOptimization = true; } + else if (args[i].Equals("-ignoretext", StringComparison.OrdinalIgnoreCase)) { IgnoreAllText = true; } } if (GDSFile == null) { PrintHelp(); return; } @@ -71,7 +76,8 @@ static void Main(string[] args) SVGWriter SVG = new(SVGFile); SVG.WriteRoot(GDSData.Structures[TopUnit]); SVG.Finish(); - Console.WriteLine("Done!"); + Stopwatch.Stop(); + Console.WriteLine("Done! Time taken: {0}", Stopwatch.Elapsed); } /// Outputs basic usage information to the console. @@ -89,6 +95,7 @@ private static void PrintHelp() Console.WriteLine(" [-unit NAME]: Name of the top-level design unit to output, including all child elements."); Console.WriteLine(" [-info]: Outputs extra info about layers and units to help you in setting up output."); Console.WriteLine(" [-debug]: Use this if the program is misbehaving and you need to ask the developer."); + Console.WriteLine(" [-ignoretext]: Ignores all text elements, preventing them from being output to the SVG."); Console.WriteLine(" [-optimize]: Attempt to simplify all geometry to produce a more optimized CSV file."); Console.WriteLine(" Warning: this could make processing take much longer!"); } diff --git a/README.md b/README.md index c622919..16d96dc 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ Should work on Windows, Linux, and Mac. Theoretically big-endian platforms are a 7) The CSV can be reused for any further exports using the same PDK. In the future, simply run `GDStoSVG.exe -csv [-svg output.svg]` 8) You can optionally export with `-optimize` to attempt to simplify the resulting geometry into as few shapes as possible. This will make the process take much longer, but is still several orders of magnitude faster than a union operation in Inkscape +There are some additional options available as well. Check `GDStoSVG.exe -help` for explanations. + ## Exporting from Cadence Virtuoso 6.1.6 1) From the main Virtuoso window, go to File -> Export -> Stream 2) Type in a file name, and select your library and top-level cell @@ -31,4 +33,19 @@ Should work on Windows, Linux, and Mac. Theoretically big-endian platforms are a ## Notes - This is still unfinished. Expect bugs. - Text is not fully working yet. -- Arrays are not yet implemented. \ No newline at end of file +- Arrays are not yet implemented. + +## Performance Tests +The below tests were conducted on v0.2.0.13, on a 5800X3D system with 32GB of 3600MHz DDR4: +| Design | GDS Size | Mode | Time Taken | SVG Size | +|---|---|---|---|---| +| 13x16b Custom-designed register file (hierarchical) | 174 KB | (default) | 180ms | 5.75 MB | +| 13x16b Custom-designed register file (hierarchical) | 174 KB | `-ignoretext` | 150ms | 5.05 MB | +| 13x16b Custom-designed register file (hierarchical) | 174 KB | `-optimize` | 520ms | 3.51 MB | +| 13x16b Custom-designed register file (hierarchical) | 174 KB | `-ignoretext` `-optimize` | 510ms | 2.81 MB | +| Medium-size SAPRed DSP system (mostly flat) | 151 MB | (default) | 65s | 3.50 GB | +| Medium-size SAPRed DSP system (mostly flat) | 151 MB | `-ignoretext`| 43s | 2.23 GB | +| Medium-size SAPRed DSP system (mostly flat) | 151 MB | `-optimize` | 40m 21s | 2.75 GB | +| Medium-size SAPRed DSP system (mostly flat) | 151 MB | `-ignoretext` `-optimize` | 38m 55s | 1.48 GB | + +There are still significant optimizations that could be done, I'd estimate runtime could be reduced by an order of magnitude. Maybe one day :) \ No newline at end of file