+# colour assignment:
+# 0: black, empty
+# 1: blue, metal
+# 2: cyan, channel
+# 3: green, poly
+# 4: red, diff
+# 5: magenta, blocks + pads
+# 6: yellow, buried
+# 7: white, vias
+COLOURS=0,0,5,1,2,4,6,3,7
+
all: \
channels.txt \
sizes.txt \
#vias2.png
channels.txt: nets.txt
- ../scripts/net_channels.py nets.txt 3,4,5,6 >$@
+ ../scripts/net_channels.py nets.txt 4,5,6,7 >$@
sizes.txt: nets.txt
../scripts/net_sizes.py nets.txt >$@
net_gnd.png: nets.txt
- ../scripts/net_image.py --adjacency nets.txt 4036 $@ 0,5,1,2,4,6,3,7
+ ../scripts/net_image.py --adjacency nets.txt 4036 $@ ${COLOURS}
net_vcc.png: nets.txt
- ../scripts/net_image.py --adjacency nets.txt 5091 $@ 0,5,1,2,4,6,3,7
+ ../scripts/net_image.py --adjacency nets.txt 5091 $@ ${COLOURS}
net_phi0.png: nets.txt
- ../scripts/net_image.py --adjacency nets.txt 23254 $@ 0,5,1,2,4,6,3,7
+ ../scripts/net_image.py --adjacency nets.txt 109896 $@ ${COLOURS}
net_phi1.png: nets.txt
- ../scripts/net_image.py --adjacency nets.txt 17568 $@ 0,5,1,2,4,6,3,7
+ ../scripts/net_image.py --adjacency nets.txt 104210 $@ ${COLOURS}
nets.txt: \
pads.png \
+blocks.png \
metal.png \
poly.png \
split_diff.png \
vias.png \
conn_matrix.txt
- ../scripts/image_nets.py pads.png,metal.png,poly.png,split_diff.png,vias.png conn_matrix.txt $@
+ ../scripts/image_nets.py pads.png,blocks.png,metal.png,poly.png,split_diff.png,vias.png conn_matrix.txt $@
# this one follows same layering as nets.txt and we can't see pads layer
layers.png: \
pads.png \
+blocks.png \
metal.png \
poly.png \
split_diff.png \
vias.png
- ../scripts/image_layers.py pads.png,metal.png,poly.png,split_diff.png,vias.png $@ 0,5,1,2,4,6,3,7
+ ../scripts/image_layers.py pads.png,blocks.png,metal.png,poly.png,split_diff.png,vias.png $@ ${COLOURS}
-# this one has alternative layering and allows us to see pads layer
+# this one has alternative layering and allows us to see pads and metal layers
layers_rev.png: \
+blocks.png \
poly.png \
split_diff.png \
metal.png \
vias.png \
pads.png
- ../scripts/image_layers.py poly.png,split_diff.png,metal.png,vias.png,pads.png $@ 0,2,4,6,3,1,7,5
+ ../scripts/image_layers.py blocks.png,poly.png,split_diff.png,metal.png,vias.png,pads.png $@ 0,5,2,4,6,3,1,7,5
split_diff.png: diff.png poly.png buried.png
../scripts/image_stack.py diff.png,poly.png,buried.png $@ 0,1,0,3,0,1,0,2
../scripts/boolean.py 'vias.png^vias1.png' $@
clean:
- rm -f *.png channels.txt sizes.txt nets.txt
+ rm -f \
+buried.png \
+diff.png \
+layers.png \
+layers_rev.png \
+metal.png \
+net_gnd.png \
+net_phi0.png \
+net_phi1.png \
+net_vcc.png \
+pads.png \
+poly.png \
+split_diff.png \
+vias.png \
+channels.txt \
+sizes.txt \
+nets.txt
# 0: empty
# 1: pads -- merge if touches metal
-# 2: metal -- merge if touches vias
-# 3: poly -- merge if touches vias or buried, report if touches channel
-# 4: diff -- merge if touches vias or buried, report if touches channel
-# 5: buried (diff) -- report if touches channel, cannot touch vias
-# 6: channel (diff) -- cannot touch vias
-# 7: vias
+# 2: blocks -- report if touches channel
+# 3: metal -- merge if touches vias
+# 4: poly -- merge if touches vias or buried, report if touches channel
+# 5: diff -- merge if touches vias or buried, report if touches channel
+# 6: buried (diff) -- report if touches channel, cannot touch vias
+# 7: channel (diff) -- cannot touch vias
+# 8: vias
1
0 1
-0 1 1
-0 0 0 1
+0 0 1
+0 1 0 1
0 0 0 0 1
-0 0 0 1 1 1
-0 0 0 2 2 2 1
-0 0 1 1 1 3 3 1
+0 0 0 0 0 1
+0 0 0 0 1 1 1
+0 0 2 0 2 2 2 1
+0 0 0 1 1 1 3 3 1
--- /dev/null
+#!/usr/bin/env python3
+
+import PIL.Image
+import numpy
+import sys
+
+PIL.Image.warnings.simplefilter('ignore', PIL.Image.DecompressionBombWarning)
+
+if len(sys.argv) < 4:
+ print(
+ f'usage: {sys.argv[0]:s} colour image_in image_out'
+ )
+ sys.exit(1)
+colour = int(sys.argv[1])
+image_in = sys.argv[2]
+image_out = sys.argv[3]
+
+image = PIL.Image.open(image_in)
+image.load()
+#print('mode', image.mode)
+#print('palette', image.palette)
+#print('width', image.width)
+#print('height', image.height)
+image = numpy.array(image)
+#print('shape', image.shape)
+#print('dtype', image.dtype)
+assert len(image.shape) == 2 and image.dtype == numpy.uint8
+
+PIL.Image.fromarray(image == colour).save(image_out)