Question:
Why does yosys mark used sub-modules as unused?
Background:
I am trying to find a rough estimate of the area of a circuit. Some years ago, during my bachelor's, I have used a synthesis tool. IIRC, it was Synopsys. I don't have access to it anymore, so I am using an open source alternative, qflow. This is the first time I have ever used it, or any of its sub-tools, so I do not know its intrinsics. Note, though, that I am open to using other open source tools.
Ultimate Goal:
Compare the area of two modules, A and B. A is composed of 7 (slightly different) instances of module C, and an instance of (an extremely simple) module D. B is composed of 16 (slightly different) instances of module C. It is expected that A is smaller than B.
Detailed description of the problem
I have tried building (synthesizing+placing+routing) A and B, as described in qflow's documentation: qflow build A
and qflow build B
. Each module was built in its own complete project - i.e., C's source code has been explicitly duplicated. I have located an area dump similar to the one in this question (in place.log
); however, the results did not make sense: A had roughly the same "total cell area" as B.
I had my suspicions that the sub-modules were not present in the final synthesis of the top modules; thus, I have built module C by itself (qflow build C
). C was an order of magnitude larger than A and B, which confirmed my suspicions that A and B were being built without C. Parsing synth.log
confirmed that the instances of C have been removed during the synthesis step (yosys) (for each C* variation of C there was a "Removing unused module C*"). Nonetheless, D had not been removed from A (i.e., it is used). I have no idea why: my testbench files confirm that both modules A and B make use of C to correctly generate output (tested using iverilog).