Add /8085/blocks.png which manually separates the chip into any obvious blocks, chang...
authorNick Downing <nick@ndcode.org>
Sat, 19 Jul 2025 02:05:51 +0000 (12:05 +1000)
committerNick Downing <nick@ndcode.org>
Sat, 19 Jul 2025 06:28:47 +0000 (16:28 +1000)
.gitignore
8085/Makefile
8085/blocks.png [new file with mode: 0644]
8085/conn_matrix.txt
scripts/is_colour.py [new file with mode: 0755]
scripts/to_mono.py

index 65ab88e..8d92249 100644 (file)
 /8080/channels.txt
 /8080/nets.txt
 /8080/sizes.txt
-/8085/*.png
+/8085/buried.png
+/8085/diff.png
+/8085/layers.png
+/8085/layers_rev.png
+/8085/metal.png
+/8085/net_gnd.png
+/8085/net_phi0.png
+/8085/net_phi1.png
+/8085/net_vcc.png
+/8085/pads.png
+/8085/poly.png
+/8085/split_diff.png
+/8085/vias.png
 /8085/channels.txt
 /8085/nets.txt
 /8085/sizes.txt
index 02af468..7273d05 100644 (file)
@@ -1,3 +1,14 @@
+# 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 \
@@ -15,49 +26,52 @@ layers_rev.png
 #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
@@ -117,4 +131,20 @@ vias2.png: vias1.png
        ../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
diff --git a/8085/blocks.png b/8085/blocks.png
new file mode 100644 (file)
index 0000000..ae6902e
Binary files /dev/null and b/8085/blocks.png differ
index c1dcf1f..7b542c7 100644 (file)
@@ -1,16 +1,18 @@
 # 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
diff --git a/scripts/is_colour.py b/scripts/is_colour.py
new file mode 100755 (executable)
index 0000000..4592526
--- /dev/null
@@ -0,0 +1,29 @@
+#!/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)
index 4867abc..abe157e 100755 (executable)
@@ -23,6 +23,8 @@ image.load()
 image = numpy.array(image)
 #print('shape', image.shape)
 #print('dtype', image.dtype)
+if len(image.shape) == 2:
+  image = image[:, :, numpy.newaxis]
 assert len(image.shape) == 3 and image.dtype == numpy.uint8
 
 image = image >= 0x80