build.plat, hdl.ir: coordinate missing domain creation.
authorwhitequark <cz@m-labs.hk>
Mon, 19 Aug 2019 22:32:50 +0000 (22:32 +0000)
committerwhitequark <cz@m-labs.hk>
Mon, 19 Aug 2019 22:52:01 +0000 (22:52 +0000)
commit221d1087b6cdda56556841c1ac538b2461362fe7
tree6a8602fe1d6394b7ac403a4c482ee80c19a4e3a9
parent1cfea219802c2418a99487acf5a475bdd61a53e9
build.plat, hdl.ir: coordinate missing domain creation.

Platform.prepare() was completely broken after addition of local
clock domains, and only really worked before by a series of
accidents because there was a circular dependency between creation
of missing domains, fragment preparation, and insertion of pin
subfragments.

This commit untangles the dependency by adding a separate public
method Fragment.create_missing_domains(), used in build.plat.

It also makes DomainCollector consider both used and defined domains,
such that it will work on fragments before domain propagation, since
create_missing_domains() can be called by user code before prepare().

The fragment driving missing clock domain is not flattened anymore,
because flattening does not work well combined with local domains.
nmigen/build/plat.py
nmigen/hdl/ir.py
nmigen/hdl/xfrm.py
nmigen/test/test_hdl_ir.py
nmigen/test/test_sim.py