Closed mithro closed 8 years ago
I have fixed this one problem in m-labs/migen@6f5bf0292e2886f00ccf6c09a64a1b198ed33383. Have you seen others?
@sbourdeauducq, why not just disable hash randomization? Migen does not handle untrusted input.
Yes, but it's enabled by default and requiring it to be disabled makes Migen harder to use. I wish Python would make all sets and dicts behave like OrderedDict ...
@mithro Are you still seeing this?
For the HDMI2USB-misoc-firmware, we have hard coded PYTHONHASHSEED in our Makefile and still use the legacy branches, so haven't tested recently.
I think if the following script pass, then it should be fine to close until we have more proof otherwise;
cd migen/examples/basic
rm -rf 1 2; mkdir 1; mkdir 2; for p in $(grep -l "verilog.convert(" *.py); do for i in 1 2; do export PYTHONHASHSEED=$i; python $p > $i/$p.v; done; done; diff -s -u -r 1 2
The problem is caused by using set() objects and then looping over them.
One example is the following;
Which will create the clock domain objects in random order.
The use of set() seems to be mostly in-conjunction with the
_Fragment.specials
inmigen/fhdl/structure.py
Here is some examples of the differences;
Sadly python doesn't have a "drop in OrderedSet()" object. See http://stackoverflow.com/questions/1653970/does-python-have-an-ordered-set for more information