summaryrefslogtreecommitdiff
path: root/misc/mux32x32.script
blob: e84566adaca366534672c482573b1fa7d074bd3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)