合成网表中多余 buffers/inverters

Superfluous buffers/inverters in synthesised netlist

这是 的另一个后续问题。

这是我的 Yosys TCL 控制脚本:

yosys -import
set libfile osu018_stdcells.lib
read_liberty -lib  $libfile
read_verilog test.v
hierarchy; 
procs; opt
memory; opt
fsm -norecode; opt -full
techmap; opt -full
dfflibmap -liberty $libfile
abc -liberty $libfile \
    -script {+strash;ifraig;scorr;dc2;dretime;strash;&get,-n;&dch,-f;&nf,{D};&put}
clean
write_verilog test_synth.v

使用的 osu018_stdcells.lib 文件是 Qflow version 1.1 package.

的一部分

这是 test.v 文件:

module test (
    input rx_clk,
    input rxena,
    input rstn,
    input [2:0] d,
    output reg [2:0] q
  );
  wire rx_rstn = rstn & rxena;
  always @ (negedge rx_clk or negedge rx_rstn) begin
    if (!rx_rstn) begin
      q <= 0;
    end else begin
      q <= d;
    end
  end
endmodule

Yosys(版本 0.5+ (git sha1 f13e387, gcc 5.3.1-8ubuntu2 -O2 -fstack-protector-strong -fPIC -Os))生成以下 test_synth.v 输出网表:

/* Generated by Yosys 0.5+ (git sha1 f13e387, gcc 5.3.1-8ubuntu2 -O2 -fstack-protector-strong -fPIC -Os) */

(* src = "test.v:1" *)
module test(rx_clk, rxena, rstn, d, q);
  wire _0_;
  wire _1_;
  wire _2_;
  (* src = "test.v:5" *)
  input [2:0] d;
  (* src = "test.v:6" *)
  output [2:0] q;
  (* src = "test.v:4" *)
  input rstn;
  (* src = "test.v:2" *)
  input rx_clk;
  (* src = "test.v:8" *)
  wire rx_rstn;
  (* src = "test.v:3" *)
  input rxena;
  INVX1 _3_ (
    .A(rx_clk),
    .Y(_0_)
  );
  AND2X1 _4_ (
    .A(rstn),
    .B(rxena),
    .Y(rx_rstn)
  );
  INVX1 _5_ (
    .A(rx_clk),
    .Y(_1_)
  );
  INVX1 _6_ (
    .A(rx_clk),
    .Y(_2_)
  );
  DFFSR _7_ (
    .CLK(_1_),
    .D(d[0]),
    .Q(q[0]),
    .R(rx_rstn),
    .S(1'b1)
  );
  DFFSR _8_ (
    .CLK(_2_),
    .D(d[1]),
    .Q(q[1]),
    .R(rx_rstn),
    .S(1'b1)
  );
  DFFSR _9_ (
    .CLK(_0_),
    .D(d[2]),
    .Q(q[2]),
    .R(rx_rstn),
    .S(1'b1)
  );
endmodule

显然,INVX1 单元有 3 个实例,本设计中的三个触发器各一个。我原以为这些反相器中只有一个及其驱动网络在触发器 CLK 输入之间共享。

在另一种设计中(大约有 30 个寄存器在时钟下降沿触发),我只看到一个反相器,但它的输出通过每个触发器的一个缓冲器,这也不理想。

有没有办法让 Yosys combine/share 寄存器中的这些资源?

Is there a way to get Yosys to combine/share these resources among the registers?

运行 opt_merge 在 运行 宁 dfflibmap.

之后