如何编写库文件

问题描述 投票:0回答:2

我正在尝试使用 yosys 学习合成。我现在正在使用 verilog。
我知道我们需要一个库文件,我已经为它编写了一个 .v 文件。如何将其转换为 .lib 文件?换句话说,我如何为我的综合编写一个库?

我写了一个.v文件,但我不知道如何将其转换为.lib。
这是其中的一个简单部分:

module NOR(A, B, Y);
input A, B;
output Y;
assign #5 Y = ~(A | B);
endmodule

module DFF(C, D, Q);
input C, D;
output reg Q;
always @(posedge C)
    Q <= D;
endmodule

module DFF_PP0 (D, C, R, Q);
input D, C, R;
output reg Q;
always @(posedge C or posedge R) begin
    if (R == 1)
        Q <= 0;
    else
        Q <= D;
end
endmodule

module DFF_PP1 (D, C, R, Q);
input D, C, R;
output reg Q;
always @(posedge C or posedge R) begin
    if (R == 1)
        Q <= 1;
    else
        Q <= D;
end
endmodule
verilog system-verilog synthesis yosys
2个回答
0
投票

看起来您正在寻找的称为自由库格式。这里有一个 yosis 的例子,看起来像这样。

// test comment
/* test comment */
library(demo) {
  cell(BUF) {
    area: 6;
    pin(A) { direction: input; }
    pin(Y) { direction: output;
              function: "A"; }
  }
  cell(NOT) {
    area: 3;
    pin(A) { direction: input; }
    pin(Y) { direction: output;
              function: "A'"; }
  }
  cell(NAND) {
    area: 4;
    pin(A) { direction: input; }
    pin(B) { direction: input; }
    pin(Y) { direction: output;
             function: "(A*B)'"; }
  }
  cell(NOR) {
    area: 4;
    pin(A) { direction: input; }
    pin(B) { direction: input; }
    pin(Y) { direction: output;
             function: "(A+B)'"; }
  }
  cell(DFF) {
    area: 18;
    ff(IQ, IQN) { clocked_on: C;
                  next_state: D; }
    pin(C) { direction: input;
                 clock: true; }
    pin(D) { direction: input; }
    pin(Q) { direction: output;
              function: "IQ"; }
  }
  cell(DFFSR) {
    area: 18;
    ff("IQ", "IQN") { clocked_on: C;
                  next_state: D;
                      preset: S;
                       clear: R; }
    pin(C) { direction: input;
                 clock: true; }
    pin(D) { direction: input; }
    pin(Q) { direction: output;
              function: "IQ"; }
    pin(S) { direction: input; }
    pin(R) { direction: input; }
    ; // empty statement
  }
}

You could used this as a template if you are for some reason tasked with creating a Liberty library format file.  

这不是 Verilog 或 SystemVerilog。

Synopsys 拥有可为标准单元晶体管级模型生成此格式的工具。
以下是他们的概要对格式的看法 Synopsys liberty 自由

Liberty 格式是一种 ASCII 文件,以标准方式描述单元格的特征数据。该文件由综合工具和布局布线工具使用。它只是描述了文件的整体结构。 Liberty 文件格式非常复杂,具有大量特殊语句,这些语句可以描述与使用此格式获取有关库中标准单元信息的不同 CAD 工具相关的各种参数。

Liberty模型由延迟、过渡时间、三态、输入电容、隐藏功率、动态功率、泄漏功率、建立时间、保持时间、恢复时间、去除、最小脉冲宽度、输出电流波形、输入接收器电容、电源组成波形、接地波形、漏电流、栅极漏电流、CCB 输出电压波形、CCB 输入米勒电容、CCB 噪声传播模型、统计模型和力矩模型。

这不是 Verilog,它是与晶体管级标准单元设计相关的参数/元数据。

如果您关心的是 Verilog,那么我认为您应该尝试查找 ASIC 供应商使用 Synopsys 工具编写的这些文件,而不是创建您自己的文件。

如果您关心使用 Synopsys 或类似工具创建晶体管级库,那么这是用于提供这些模型参数化的方法。

yosis 中的示例似乎是该格式的简化示例。

这个问题与extending-existing-cell-libraries

密切相关

-1
投票

verilog中没有库的概念。 Verilog 头文件允许您存储可在 Verilog 文件中使用的常用模块和组件。虽然 Verilog 本身没有像其他一些硬件描述语言 (HDL) 那样的正式库格式,例如带有 .lib 文件的 VHDL,但 Verilog 设计仍然可以以类似的方式组织到库中,通常通过文件组织和目录结构。

© www.soinside.com 2019 - 2024. All rights reserved.