This helps improve the reproducibility of misoc builds.
See https://reproducible-builds.org/howto/

Previously the order could depend on many aspects including;
 * The order on the file system (which is the default order returned by things
   like os.listdir and os.walk)

 * The python hash ordering
   (https://docs.python.org/3/reference/datamodel.html#object.__hash__)

 * The order things are defined / included.
---
 mibuild/xilinx/ise.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mibuild/xilinx/ise.py b/mibuild/xilinx/ise.py
index 92f3751..00b9363 100644
--- a/mibuild/xilinx/ise.py
+++ b/mibuild/xilinx/ise.py
@@ -35,9 +35,9 @@ def _format_ucf(signame, pin, others, resname):
 
 def _build_ucf(named_sc, named_pc):
     r = ""
-    for sig, pins, others, resname in named_sc:
+    for sig, pins, others, resname in sorted(named_sc):
         if len(pins) > 1:
-            for i, p in enumerate(pins):
+            for i, p in enumerate(sorted(pins)):
                 r += _format_ucf(sig + "(" + str(i) + ")", p, others, resname)
         else:
             r += _format_ucf(sig, pins[0], others, resname)
@@ -48,7 +48,7 @@ def _build_ucf(named_sc, named_pc):
 
 def _build_xst_files(device, sources, vincpaths, build_name, xst_opt):
     prj_contents = ""
-    for filename, language, library in sources:
+    for filename, language, library in sorted(sources):
         prj_contents += language + " " + library + " " + filename + "\n"
     tools.write_to_file(build_name + ".prj", prj_contents)
 
@@ -59,7 +59,7 @@ def _build_xst_files(device, sources, vincpaths, build_name, 
xst_opt):
 -ofn {build_name}.ngc
 -p {device}
 """.format(build_name=build_name, xst_opt=xst_opt, device=device)
-    for path in vincpaths:
+    for path in sorted(vincpaths):
         xst_contents += "-vlgincdir " + path + "\n"
     tools.write_to_file(build_name + ".xst", xst_contents)
 
@@ -67,9 +67,9 @@ def _build_xst_files(device, sources, vincpaths, build_name, 
xst_opt):
 def _run_yosys(device, sources, vincpaths, build_name):
     ys_contents = ""
     incflags = ""
-    for path in vincpaths:
+    for path in sorted(vincpaths):
         incflags += " -I" + path
-    for filename, language, library in sources:
+    for filename, language, library in sorted(sources):
         ys_contents += "read_{}{} {}\n".format(language, incflags, filename)
 
     ys_contents += """hierarchy -check -top top
-- 
2.6.0.rc2.230.g3dd15c0

_______________________________________________
M-Labs devel mailing list
https://ssl.serverraum.org/lists/listinfo/devel

Reply via email to