Skip to content

Commit

Permalink
Adding -ignoretext and time output, updating docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiB committed Sep 3, 2022
1 parent 34c8efc commit f87c5c5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GDStoSVG/GDSReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
9 changes: 8 additions & 1 deletion GDStoSVG/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;

Expand All @@ -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;
Expand All @@ -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; }
Expand Down Expand Up @@ -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);
}

/// <summary> Outputs basic usage information to the console. </summary>
Expand All @@ -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!");
}
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <myfile.gds> -csv <layer.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
Expand All @@ -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.
- 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 :)

0 comments on commit f87c5c5

Please sign in to comment.