0

这是组合综合的另一个后续问题:更好的技术映射结果

这是我的 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版本 1.1的一部分。

这是 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 (version 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

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

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

有没有办法让 Yosys 在寄存器之间组合/共享这些资源?

4

1 回答 1

2

有没有办法让 Yosys 在寄存器之间组合/共享这些资源?

opt_merge运行后简单运行dfflibmap

于 2017-03-29T09:19:02.353 回答