I cannot figure out how to get separate synthesis of modules to work in Yosys. Consider this simple two-module example:
bottom.v
module bottom(x, out);
input [0:7] x;
output [0:7] out;
assign out = x+1;
endmodule
top.v
module top(x, out);
input [0:7] x;
output [0:7] out;
bottom b(.x(x), .out(out));
endmodule
Now, synthesizing these together works as intended:
$ yosys -q -o top.blif -S top.v bottom.v
$
But if I first synthesize bottom.blif from bottom.v, I get an error message saying that there is no port out in the module bottom:
$ yosys -q -o bottom.blif -S bottom.v
$ yosys -q -o top.blif -S top.v bottom.blif
ERROR: Module `bottom' referenced in module `top' in cell `b' does not have a port named 'out'.
$
Why does this happen? Googling for issues, I have found references to the hierarchy command in contexts that I do not fully understand. I have tried running that command before synth, but it does not affect the result.