Skip to content

Commit

Permalink
Added canal demo
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-melchert committed Oct 19, 2024
1 parent bea5241 commit 6bfc822
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions canal_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from canal.cyclone import *

num_tracks = 5

input_nodes = {}
for side in SwitchBoxSide:
input_nodes[side] = []
for track in range(num_tracks):
input_nodes[side].append(SwitchBoxNode(0, 0, track, 16, side, SwitchBoxIO.SB_IN))

output_nodes = {}
for side in SwitchBoxSide:
output_nodes[side] = []
for track in range(num_tracks):
output_nodes[side].append(SwitchBoxNode(0, 0, track, 16, side, SwitchBoxIO.SB_OUT))

for track in range(num_tracks):
for side_from in SwitchBoxSide:
for side_to in SwitchBoxSide:
if side_from == side_to:
continue
input_node = input_nodes[side_from][track]
output_node = output_nodes[side_to][track]
print(f"Wire {input_node} -> {output_node}")
input_node.add_edge(output_node)

0 comments on commit 6bfc822

Please sign in to comment.