当模块是BLIF时,如何让Yosys中的多位端口工作?

时间:2017-02-04 19:41:14

标签: verilog yosys

我无法弄清楚如何在Yosys中单独合成模块。考虑这个简单的双模块示例:

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

现在,将这些合成在一起按预期工作:

$ yosys -q -o top.blif -S top.v bottom.v
$

但如果我首先从 bottom.v 合成 bottom.blif ,我会收到一条错误消息,指出没有端口 out in模块 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'.
$

为什么会这样?谷歌搜索问题,我在上下文中找到了对层次结构命令的引用,我并不完全理解。我已经尝试在 synth 之前运行该命令,但它不会影响结果。

1 个答案:

答案 0 :(得分:1)

BLIF文件格式不支持多位端口。这与Yosys无关,它只是文件格式的限制。因此,在将具有多位端口的设计写入BLIF文件时,所有端口都会自动拆分为单个位端口。因此在BLIF文件中没有8位宽端口out,有8个单位端口out[7]out[6]out[5]out[4]out[3]out[2]out[1]out[0]

因此,当您尝试混合Verilog和BLIF文件时,bottom模块将再次与top.b单元格的界面不匹配。

编辑:我现在已经在git commit 7e0b776中添加了read_blif -wideports。这允许您在将BLIF文件读回Yosys时再次合并各个单位端口。这样你可以使用BLIF作为Yosys和ABC之间的交换格式,而不会破坏多位端口的模块接口。