Merge pull request #7 from ElectricPotato/zigzag-scan-chain

change scan chain instantiation order
diff --git a/configure.py b/configure.py
index 8dcc6f2..5892284 100755
--- a/configure.py
+++ b/configure.py
@@ -238,14 +238,23 @@
         with open("openlane/user_project_wrapper/macro.cfg", 'w') as fh:
             fh.write("scan_controller 80 80 N\n")
             for row in range(rows):
-                for col in range(cols):
+                if(row%2 == 0):
+                    col_order = range(cols)
+                    orientation = 'N'
+                else:
+                    #reverse odd rows to place instances in a zig zag pattern, shortening the scan chain wires
+                    col_order = range(cols-1, -1, -1)
+                    orientation = 'S'
+                for col in col_order:
                     # skip the space where the scan controller goes on the first row
                     if row == 0 and col <= 1:
                         continue
 
                     if num_macros_placed < self.num_projects:
                         macro_instance = self.projects.get_macro_instance(num_macros_placed)
-                        instance = "{} {:<4} {:<4} N\n".format(macro_instance, start_x + col * step_x, start_y + row * step_y)
+                        instance = "{} {:<4} {:<4} {}\n".format(
+                            macro_instance, start_x + col * step_x, start_y + row * step_y, orientation
+                        )
                         fh.write(instance)
 
                     num_macros_placed += 1