Skip to content

Commit f87c5c5

Browse files
committed
Adding -ignoretext and time output, updating docs
1 parent 34c8efc commit f87c5c5

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

GDStoSVG/GDSReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ private bool ReadRecord(RecordType type, byte[]? data)
343343
if (this.CurrentElement == null) { throw new InvalidDataException("Element ending before starting."); }
344344
this.CurrentStructure.Elements ??= new();
345345
if (!this.CurrentElement.Check()) { Console.WriteLine("Element does not have all required data present."); }
346-
this.CurrentStructure.Elements.Add(this.CurrentElement);
346+
if (this.CurrentElement is not Text || !Program.IgnoreAllText) { this.CurrentStructure.Elements.Add(this.CurrentElement); }
347347
this.CurrentElement = null;
348348
break;
349349
}

GDStoSVG/Program.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.IO;
45
using System.Threading.Tasks;
56

@@ -16,9 +17,12 @@ public class Program
1617
public static bool Debug { get; private set; } = false;
1718
public static bool Info { get; private set; } = false;
1819
public static bool DoOptimization { get; private set; } = false;
20+
public static bool IgnoreAllText { get; private set; } = false;
1921

2022
static void Main(string[] args)
2123
{
24+
Stopwatch Stopwatch = new();
25+
Stopwatch.Restart();
2226
if(args.Length < 1) { PrintHelp(); return; }
2327

2428
string? GDSFile = null;
@@ -36,6 +40,7 @@ static void Main(string[] args)
3640
else if (args[i].Equals("-info", StringComparison.OrdinalIgnoreCase)) { Info = true; }
3741
else if (args[i].Equals("-debug", StringComparison.OrdinalIgnoreCase)) { Debug = true; }
3842
else if (args[i].Equals("-optimize", StringComparison.OrdinalIgnoreCase)) { DoOptimization = true; }
43+
else if (args[i].Equals("-ignoretext", StringComparison.OrdinalIgnoreCase)) { IgnoreAllText = true; }
3944
}
4045

4146
if (GDSFile == null) { PrintHelp(); return; }
@@ -71,7 +76,8 @@ static void Main(string[] args)
7176
SVGWriter SVG = new(SVGFile);
7277
SVG.WriteRoot(GDSData.Structures[TopUnit]);
7378
SVG.Finish();
74-
Console.WriteLine("Done!");
79+
Stopwatch.Stop();
80+
Console.WriteLine("Done! Time taken: {0}", Stopwatch.Elapsed);
7581
}
7682

7783
/// <summary> Outputs basic usage information to the console. </summary>
@@ -89,6 +95,7 @@ private static void PrintHelp()
8995
Console.WriteLine(" [-unit NAME]: Name of the top-level design unit to output, including all child elements.");
9096
Console.WriteLine(" [-info]: Outputs extra info about layers and units to help you in setting up output.");
9197
Console.WriteLine(" [-debug]: Use this if the program is misbehaving and you need to ask the developer.");
98+
Console.WriteLine(" [-ignoretext]: Ignores all text elements, preventing them from being output to the SVG.");
9299
Console.WriteLine(" [-optimize]: Attempt to simplify all geometry to produce a more optimized CSV file.");
93100
Console.WriteLine(" Warning: this could make processing take much longer!");
94101
}

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Should work on Windows, Linux, and Mac. Theoretically big-endian platforms are a
2121
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]`
2222
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
2323

24+
There are some additional options available as well. Check `GDStoSVG.exe -help` for explanations.
25+
2426
## Exporting from Cadence Virtuoso 6.1.6
2527
1) From the main Virtuoso window, go to File -> Export -> Stream
2628
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
3133
## Notes
3234
- This is still unfinished. Expect bugs.
3335
- Text is not fully working yet.
34-
- Arrays are not yet implemented.
36+
- Arrays are not yet implemented.
37+
38+
## Performance Tests
39+
The below tests were conducted on v0.2.0.13, on a 5800X3D system with 32GB of 3600MHz DDR4:
40+
| Design | GDS Size | Mode | Time Taken | SVG Size |
41+
|---|---|---|---|---|
42+
| 13x16b Custom-designed register file (hierarchical) | 174 KB | (default) | 180ms | 5.75 MB |
43+
| 13x16b Custom-designed register file (hierarchical) | 174 KB | `-ignoretext` | 150ms | 5.05 MB |
44+
| 13x16b Custom-designed register file (hierarchical) | 174 KB | `-optimize` | 520ms | 3.51 MB |
45+
| 13x16b Custom-designed register file (hierarchical) | 174 KB | `-ignoretext` `-optimize` | 510ms | 2.81 MB |
46+
| Medium-size SAPRed DSP system (mostly flat) | 151 MB | (default) | 65s | 3.50 GB |
47+
| Medium-size SAPRed DSP system (mostly flat) | 151 MB | `-ignoretext`| 43s | 2.23 GB |
48+
| Medium-size SAPRed DSP system (mostly flat) | 151 MB | `-optimize` | 40m 21s | 2.75 GB |
49+
| Medium-size SAPRed DSP system (mostly flat) | 151 MB | `-ignoretext` `-optimize` | 38m 55s | 1.48 GB |
50+
51+
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 commit comments

Comments
 (0)