0

在 Yosys 中可以与 pass 一起使用的最有用的属性是什么?

另外,我想知道你是否可以给我一个例子来使用“setattr”为特定模块(即“计数器”)设置“keep_hierarchy”。

4

1 回答 1

1

自述文件包含最突出的属性列表。(“Verilog 属性和非标准特性”一节。)

关于keep_hierarchyand setattr:考虑以下示例代码。

module test(input A, B, output X, Y);
  test_and and_inst (.A(A), .B(B), .O(X));
  test_xor xor_inst (.A(A), .B(B), .O(Y));
endmodule

module test_and(input A, B, output O);
  assign O = A & B;
endmodule

module test_xor(input A, B, output O);
  assign O = A ^ B;
endmodule

显然,下面只会显示带有 a$and$xor门的示意图:

yosys -p 'prep; flatten; opt -purge; show test' test.v

and_inst现在我们可以通过在单元格上设置keep_hierarchy属性来防止 flatten 变平:

yosys -p 'prep; setattr -set keep_hierarchy 1 test/and_inst; flatten; opt -purge; show test' test.v

test_and或者,我们可以通过简单地设置模块本身的属性来防止所有实例被展平:

yosys -p 'prep; setattr -mod -set keep_hierarchy 1 test_and; flatten; opt -purge; show test' test.v
于 2016-05-27T12:50:40.393 回答