From 6bfc8220f800417e697d10c3b7bcb3d3df7dfa52 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 19 Oct 2024 16:06:02 -0700 Subject: [PATCH] Added canal demo --- canal_demo.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 canal_demo.py diff --git a/canal_demo.py b/canal_demo.py new file mode 100644 index 00000000..77a29b45 --- /dev/null +++ b/canal_demo.py @@ -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) \ No newline at end of file