Sort constants in csr generation.
authorTim 'mithro' Ansell <mithro@mithis.com>
Sat, 26 Sep 2015 07:57:43 +0000 (17:57 +1000)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Sun, 27 Sep 2015 03:05:54 +0000 (11:05 +0800)
Previously the order of constant output depended on Python's hashing order
which changes every run. This caused the file to change every run.

With this change the csr.h file will always be the same. This can be verified
this with the following;
```bash
 CSR=software/include/generated/csr.h
 for i in 1 2 3 4 5 6; do
   rm -f $CSR; python make.py build-headers
   cp $CSR $CSR.$i
 done
 md5sum $CSR.*
```

make.py

diff --git a/make.py b/make.py
index 2d820aa9370f36151a08ee0d6c75c95dbae96bbf..206ac0957bb87b17943a04439abc8d265bd3c4fd 100755 (executable)
--- a/make.py
+++ b/make.py
@@ -167,7 +167,7 @@ CPU type:  {}
                     write_to_file(os.path.join(genhdir, "sdram_phy.h"), boilerplate + sdram_phy_header)
         mem_header = cpu_interface.get_mem_header(memory_regions, getattr(soc, "flash_boot_address", None))
         write_to_file(os.path.join(genhdir, "mem.h"), boilerplate + mem_header)
-        csr_header = cpu_interface.get_csr_header(csr_regions, soc.get_constants())
+        csr_header = cpu_interface.get_csr_header(csr_regions, sorted(soc.get_constants()))
         write_to_file(os.path.join(genhdir, "csr.h"), boilerplate + csr_header)
 
     if actions["build-csr-csv"]: