summaryrefslogtreecommitdiff
path: root/misc/mux32x32.script
diff options
context:
space:
mode:
Diffstat (limited to 'misc/mux32x32.script')
-rw-r--r--misc/mux32x32.script34
1 files changed, 34 insertions, 0 deletions
diff --git a/misc/mux32x32.script b/misc/mux32x32.script
new file mode 100644
index 0000000..e84566a
--- /dev/null
+++ b/misc/mux32x32.script
@@ -0,0 +1,34 @@
+mux_cls = builder.get_component_class("mux32")
+input_cls = builder.get_component_class("Input")
+output_cls = builder.get_component_class("Output")
+input_y = builder.part_size / 2
+muxers_x_offset = builder.part_size / 2
+x_offset = 3 * builder.part_size
+mux_y = 2 * builder.part_size
+output_y = 3.5 * builder.part_size / 2
+muxes = {}
+for i in range(32):
+ mux = mux_cls(id = "mux%d" % (i + 1))
+ mux.x = x_offset + 2 * builder.part_size * i
+ mux.y = mux_y
+ muxes[i] = mux
+ output = output_cls(output_id = i + 1, id = "out%d" % (i + 1))
+ output.x = mux.x
+ output.y = output_y
+ builder.add_components(mux, output)
+ builder.add_link(mux, 1, output, 1)
+for i in range(5):
+ input = input_cls(input_id = i + 1, id = "in%d" % (i + 1))
+ builder.add_components(input)
+ input.x = muxers_x_offset
+ input.y = (2 + i) * builder.part_size
+ for j in range(32):
+ builder.add_link(input, 1, muxes[j], i + 1)
+for i in range(32):
+ for j in range(32):
+ input_id = 5 + i * 32 + j + 1
+ input = input_cls(input_id = input_id, id = "in%d" % input_id)
+ builder.add_components(input)
+ input.x = x_offset + 2 * builder.part_size * (input_id - 5)
+ input.y = input_y
+ builder.add_link(input, 1, muxes[j], 5 + i + 1)