Skip to content

Commit

Permalink
fix: order layers correctly in 2d render
Browse files Browse the repository at this point in the history
  • Loading branch information
htfab committed Oct 1, 2024
1 parent 30dbb0c commit 7af6b09
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions ihp/layers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[[40, 0], [40, 25], [1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 19], [1, 20], [1, 22], [1, 23], [1, 26], [1, 27], [1, 28], [5, 0], [5, 1], [5, 2], [5, 3], [5, 4], [5, 22], [5, 23], [5, 26], [5, 27], [5, 28], [128, 0], [128, 1], [128, 2], [128, 3], [128, 4], [31, 0], [31, 1], [31, 2], [31, 3], [31, 4], [32, 0], [32, 1], [32, 2], [32, 3], [32, 4], [32, 21], [46, 21], [14, 0], [7, 0], [7, 21], [28, 0], [44, 0], [6, 0], [6, 3], [6, 4], [6, 26], [8, 0], [8, 1], [8, 2], [8, 3], [8, 4], [8, 20], [8, 22], [8, 23], [8, 24], [8, 25], [8, 26], [8, 28], [8, 29], [8, 33], [8, 34], [19, 0], [19, 3], [19, 4], [10, 0], [10, 1], [10, 2], [10, 3], [10, 4], [10, 20], [10, 22], [10, 23], [10, 24], [10, 25], [10, 26], [10, 28], [10, 29], [10, 33], [10, 34], [29, 0], [29, 3], [29, 4], [30, 0], [30, 1], [30, 2], [30, 3], [30, 4], [30, 20], [30, 22], [30, 23], [30, 24], [30, 25], [30, 26], [30, 28], [30, 29], [30, 33], [30, 34], [36, 0], [36, 3], [36, 4], [129, 0], [49, 0], [49, 3], [49, 4], [50, 0], [50, 1], [50, 2], [50, 3], [50, 4], [50, 20], [50, 22], [50, 23], [50, 24], [50, 25], [50, 26], [50, 28], [50, 29], [50, 33], [50, 34], [66, 0], [66, 3], [66, 4], [67, 0], [67, 1], [67, 2], [67, 3], [67, 4], [67, 20], [67, 22], [67, 23], [67, 24], [67, 25], [67, 26], [67, 28], [67, 29], [67, 33], [67, 34], [125, 0], [125, 3], [125, 4], [126, 0], [126, 1], [126, 2], [126, 3], [126, 4], [126, 20], [126, 22], [126, 23], [126, 24], [126, 25], [126, 28], [126, 29], [126, 33], [126, 34], [133, 0], [133, 3], [133, 4], [134, 0], [134, 1], [134, 2], [134, 3], [134, 4], [134, 20], [134, 22], [134, 23], [134, 24], [134, 25], [134, 28], [134, 29], [134, 33], [134, 34], [9, 0], [9, 1], [9, 2], [9, 3], [9, 4], [9, 35], [9, 36], [9, 40], [160, 0], [146, 0], [27, 0], [27, 2], [27, 4], [27, 25], [39, 0], [39, 4], [41, 0], [41, 35], [41, 36], [63, 0], [99, 0], [99, 2], [99, 30], [99, 31], [99, 32], [99, 33], [99, 34], [99, 35], [99, 36], [99, 37], [99, 38], [99, 39], [99, 100], [16, 0], [16, 10], [24, 0], [24, 1], [25, 0], [25, 1], [25, 4], [26, 0], [60, 0], [51, 0], [52, 0], [148, 0], [148, 41], [148, 42], [148, 43], [148, 44], [148, 45], [148, 46], [148, 47], [148, 48], [148, 49], [148, 50], [148, 51], [148, 52], [148, 53], [148, 54], [148, 55], [148, 123], [148, 124], [148, 125], [148, 126], [148, 127], [148, 300], [148, 301], [3, 0], [3, 26], [13, 0], [13, 1], [13, 2], [13, 3], [13, 4], [33, 0], [33, 26], [35, 0], [55, 0], [70, 0], [90, 0], [91, 0], [101, 0], [139, 0], [156, 0], [152, 0], [157, 0], [20, 0], [20, 1], [20, 2], [20, 3], [20, 4], [20, 20], [20, 22], [20, 23], [20, 24], [20, 25], [20, 26], [20, 28], [20, 29], [20, 33], [20, 34], [23, 0], [72, 0], [73, 0], [74, 0], [75, 0], [76, 0], [77, 0], [54, 0], [83, 0], [84, 0], [132, 0], [142, 0], [135, 0], [136, 0], [137, 0], [138, 0], [149, 0], [151, 0], [15, 0], [45, 0], [92, 0], [112, 0], [113, 0], [114, 0], [115, 0], [127, 0], [131, 0], [78, 0], [79, 0], [85, 0], [86, 0], [86, 22], [86, 23], [87, 0], [88, 0], [89, 0], [97, 0], [109, 0], [109, 22], [109, 23], [109, 24], [109, 26], [110, 0], [110, 22], [110, 23], [110, 24], [110, 26], [118, 0], [119, 0], [119, 22], [119, 23], [46, 0], [46, 1], [46, 2], [46, 3], [46, 4], [48, 0], [62, 0], [68, 0], [69, 0], [93, 0], [98, 0], [98, 1], [98, 2], [98, 3], [111, 0], [116, 0], [117, 0], [124, 0], [143, 0], [145, 0], [147, 0], [153, 0], [154, 0], [155, 0], [159, 0], [189, 0], [189, 1], [189, 4], [190, 0], [190, 1], [190, 2], [190, 25], [191, 0], [191, 1], [191, 2], [191, 25], [192, 0], [192, 1], [192, 2], [192, 25], [193, 0], [193, 1], [193, 2], [193, 25], [194, 0], [194, 1], [194, 2], [194, 25], [257, 0]]
1 change: 1 addition & 0 deletions layers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[[235, 4], [64, 44], [122, 16], [64, 59], [64, 13], [64, 14], [44, 16], [44, 5], [64, 20], [84, 23], [64, 16], [64, 5], [64, 18], [74, 21], [65, 20], [65, 13], [65, 14], [65, 16], [65, 6], [65, 23], [65, 4], [65, 8], [65, 44], [65, 48], [65, 41], [65, 60], [65, 5], [94, 20], [93, 44], [66, 20], [66, 16], [66, 13], [66, 14], [66, 9], [66, 5], [66, 4], [66, 25], [66, 15], [66, 23], [66, 83], [11, 44], [125, 44], [78, 44], [18, 20], [80, 20], [66, 44], [66, 60], [66, 58], [66, 41], [95, 20], [67, 20], [67, 16], [67, 13], [67, 14], [67, 5], [67, 23], [67, 4], [67, 10], [67, 15], [67, 25], [67, 44], [67, 60], [67, 48], [67, 41], [68, 20], [68, 13], [68, 14], [68, 16], [68, 5], [68, 23], [68, 4], [68, 10], [68, 15], [68, 25], [68, 32], [68, 33], [68, 34], [68, 35], [68, 36], [68, 37], [68, 38], [68, 39], [68, 44], [68, 60], [68, 41], [68, 58], [69, 20], [69, 13], [69, 14], [69, 16], [69, 5], [69, 23], [69, 4], [69, 10], [69, 15], [69, 25], [69, 32], [69, 33], [69, 34], [69, 35], [69, 36], [69, 37], [69, 38], [69, 39], [69, 44], [69, 60], [69, 58], [69, 41], [70, 20], [70, 13], [70, 14], [70, 16], [70, 5], [70, 23], [70, 4], [70, 10], [70, 15], [70, 17], [70, 25], [70, 32], [70, 33], [70, 34], [70, 35], [70, 36], [70, 37], [70, 38], [70, 39], [70, 44], [70, 60], [70, 48], [70, 41], [71, 20], [71, 13], [71, 14], [71, 16], [71, 5], [71, 23], [71, 4], [71, 10], [71, 15], [71, 17], [71, 25], [71, 32], [71, 33], [71, 34], [71, 35], [71, 36], [71, 37], [71, 38], [71, 39], [71, 44], [71, 60], [71, 48], [71, 41], [72, 20], [72, 13], [72, 14], [72, 16], [72, 5], [72, 23], [72, 4], [72, 10], [72, 15], [72, 17], [72, 25], [72, 32], [72, 33], [72, 34], [72, 35], [72, 36], [72, 37], [72, 38], [72, 39], [61, 20], [76, 20], [76, 5], [76, 16], [82, 44], [82, 59], [82, 20], [82, 5], [86, 20], [75, 20], [82, 64], [92, 44], [96, 44], [17, 0], [85, 44], [77, 20], [74, 20], [74, 16], [74, 5], [74, 13], [74, 14], [74, 15], [89, 32], [89, 33], [89, 34], [89, 35], [89, 36], [89, 37], [89, 38], [89, 39], [127, 21], [127, 22], [82, 24], [82, 25], [82, 26], [82, 27], [82, 28], [89, 44], [97, 44], [22, 20], [23, 0], [22, 21], [22, 22], [22, 24], [22, 23], [109, 44], [21, 0], [109, 43], [109, 42], [110, 20], [48, 0], [110, 21], [110, 22], [25, 44], [25, 0], [25, 43], [25, 42], [88, 44], [97, 0], [97, 43], [97, 42], [98, 44], [98, 0], [98, 43], [98, 42], [96, 20], [20, 0], [96, 21], [96, 22], [87, 44], [88, 0], [87, 43], [87, 42], [29, 20], [30, 0], [29, 21], [29, 22], [31, 20], [32, 0], [31, 21], [31, 22], [26, 20], [27, 0], [26, 21], [26, 22], [125, 20], [38, 20], [39, 0], [38, 21], [38, 22], [11, 20], [11, 0], [45, 20], [46, 0], [45, 21], [45, 22], [33, 44], [28, 0], [33, 43], [33, 24], [33, 42], [115, 44], [56, 0], [115, 43], [115, 42], [106, 44], [43, 0], [106, 43], [106, 42], [62, 20], [36, 0], [62, 21], [62, 22], [62, 24], [105, 20], [40, 0], [105, 21], [105, 22], [105, 44], [41, 0], [105, 43], [105, 42], [105, 52], [108, 20], [44, 0], [108, 21], [108, 22], [107, 20], [34, 0], [107, 21], [107, 22], [107, 24], [44, 20], [49, 0], [44, 43], [44, 42], [112, 20], [50, 0], [112, 21], [112, 22], [22, 0], [104, 44], [37, 0], [104, 43], [104, 42], [91, 44], [99, 0], [51, 0], [112, 43], [112, 42], [112, 4], [117, 20], [58, 0], [117, 21], [117, 22], [59, 0], [117, 4], [76, 44], [101, 44], [35, 0], [101, 43], [101, 42], [53, 44], [96, 0], [53, 43], [53, 42], [93, 0], [94, 0], [100, 0], [101, 0], [90, 20], [90, 4], [81, 14], [81, 15], [81, 17], [81, 125], [81, 1], [81, 2], [81, 3], [81, 19], [81, 11], [81, 10], [81, 12], [81, 53], [81, 23], [81, 4], [81, 50], [81, 51], [81, 52], [81, 54], [81, 13], [81, 57], [81, 60], [81, 81], [81, 101], [81, 63], [81, 27], [81, 6], [81, 7], [81, 8], [81, 79], [84, 44], [81, 20], [68, 88], [69, 88], [70, 88], [71, 88], [72, 88], [68, 89], [69, 89], [70, 89], [71, 89], [72, 89], [68, 90], [69, 90], [70, 90], [71, 90], [72, 90], [68, 91], [69, 91], [70, 91], [71, 91], [72, 91], [68, 92], [69, 92], [70, 92], [71, 92], [72, 92], [68, 93], [69, 93], [70, 93], [71, 93], [72, 93], [74, 88], [74, 89], [74, 90], [74, 91], [74, 92], [74, 93], [124, 40]]
12 changes: 11 additions & 1 deletion project.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,15 +855,25 @@ def create_png(self):
]
if self.args.orfs:
label_layers = ihp_label_layers
layers_file = os.path.join(SCRIPT_DIR, "layers.json")
else:
label_layers = sky130_label_layers
layers_file = os.path.join(SCRIPT_DIR, "ihp/layers.json")

layer_order = json.load(open(layers_file))
layer_map = {tuple(l): i for i, l in enumerate(layer_order)}

def layer_cmp(p1, p2):
l1 = layer_map.get((p1.layer, p1.datatype), -1)
l2 = layer_map.get((p2.layer, p2.datatype), -1)
return l1 < l2

top_cells.filter(label_layers)
for subcell in top_cells.dependencies(True):
subcell.filter(label_layers)
svg = "gds_render_preview.svg"
logging.info("Rendering SVG without text label layers: {}".format(svg))
top_cells.write_svg(svg, pad=0)
top_cells.write_svg(svg, pad=0, sort_function=layer_cmp)
# We should now have gds_render_preview.svg

# Try converting using 'rsvg-convert' command-line utility.
Expand Down

0 comments on commit 7af6b09

Please sign in to comment.