Apache License 2.0

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

技术分析:antonblanchard/vlsiffra 项目深入解读

项目背景与痛点

在现代集成电路设计中,高性能的算术逻辑单元(ALU)是处理器性能的关键所在。传统的设计方法往往需要复杂的IP核和大量的验证工作。antonblanchard/vlsiffra项目通过自动生成高效的加法器、乘法器和乘加器,为集成电路设计者提供了一个快速开发和优化标准单元逻辑电路的解决方案。它解决了传统设计方法繁琐的问题,允许设计者专注于硬件架构,而不是具体逻辑的实现细节。

核心技术揭秘

vlsiffra 使用了一种生成高效算数逻辑单元的方法,通过优化标准单元库的组合逻辑,构建高性能的算术运算模块。以下摘录了核心设计理念和技术栈的详细分析:

技术架构

  1. 生成算法: vlsiffra 通过高效的算法自动生成标准单元库,实现快速的加法、乘法和乘加运算。具体算法细节并未完全公开,但从实现效果来看,这是一个深度优化的标准单元库生成器。

  2. 数据流: 以下 Mermaid 图显示了数据流的基本流程:

graph TD A[输入参数] --> B[初始化] B --> C[逻辑单元分解] C --> D{"模块选择?"} D -->|"加法模块"| E[加法器生成] D -->|"乘法模块"| F[乘法器生成] D -->|"乘加模块"| G[乘加器生成] E --> H[验证] F --> H[验证] G --> H[验证] H --> I[输出]
  1. 关键技术栈:
    • 使用标准单元库进行逻辑合成,支持各种常见的标准单元库格式。
    • 引入功能强大的算法优化逻辑单元,提高生成的逻辑模块的可靠性和性能。
    • 支持多种运算操作,满足设计者对不同算术逻辑的需求。

功能亮点与差异

与同类竞品相比,vlsiffra 提供了更加灵活和高效的生成算法,速度和效率上更具优势。另一方面,它不仅支持基本的加法器和乘法器,还特别针对乘加器进行了优化,大大提高了复杂运算的执行效率。灵活性和功能强大是 vlsiffra 的核心亮点。

应用场景与落地建议

在具体生产环境中使用 vlsiffra 时,需要注意一些事项:

  • 性能优化:针对具体业务场景和硬件平台进行详细的性能优化。
  • 环境依赖:确保开发环境满足项目依赖的需求。
  • 算法合理性:理解 vlsiffra 的生成算法,确保生成的逻辑模块符合设计目标。

适合的应用场景包括高性能嵌入式系统、定制化的大规模集成电路设计等,特别是一些对算术运算有高要求的应用场景。

综合评价

antonblanchard/vlsiffra 通过对标准单元库生成算法的优化,大幅提升了加法器、乘法器以及乘加器的设计效率。项目的设计兼顾了性能和灵活性,为集成电路设计者提供了很好的支持工具。当然,项目的核心亮点归功于其独特的技术实现方案。总体来说,vlsiffra 是一款强大且实用的工具,具有很高的开发价值。

关于

GitHub 原始描述(英文)

Create fast and efficient standard cell based adders, multipliers and multiply-adders.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
150
价值分
76
活跃状态
活跃

语言占比

C++
Makefile
Python
Shell
Tcl
Verilog

README

vlsiffra logo

Create fast and efficient standard cell based adders, multipliers and multiply-adders.

CI status GitHub tag License PRs Welcome

Features

Fast

A 2 cycle 64 bit multiply-adder (64bit * 64bit + 128bit -> 128bit) built with the OpenROAD RTL to GDSII flow and the ASAP7 7nm academic PDK makes timing at 1.85 GHz [^1]. It takes up 3600um of area:

2 cycle 64 bit ASAP7 multiplier

A 4 cycle 32 bit multiplier (32bit * 32bit -> 64bit), also using OpenROAD and ASAP7 makes timing at 2.7 GHz [^1]. Both cases are likely to improve as OpenROAD improves (including better timing aware global placement and global routing, improvements to the resizer, improvements to clock tree synthesis and the use of LVT cells).

vlsiffra achieves this by using many well established techniques including Booth encoding, Dadda reduction and a choice of fast adders like Kogge-Stone.

For more details about these algorithms, check out this Twitter thread which details the implementation of the multiplier in the Bluegene Q supercomputer.

Configurable

vlsiffra is written in the Amaranth HDL language which allows it to be very configurable, including:

  • Configurable number of bits

    Any power of two likely works, although Amaranth does start to slow down when building 64 bit multipliers due to a polynomial time complexity issue when adding signals. An issue has been opened to track this and once fixed larger multipliers should be possible.

  • Choice of algorithms

    Various addition algorithms are supported:

    • Brent-Kung (less area, lower performance)
    • Kogge-Stone (more area, higher performance)
    • Han-Carlson (a balance of area and performance)
    • Ripple (lowest area, lowest performance)
  • Configurable number of stages

    Configurable number of stages, from purely combinational, to 4 register stages. All configurations are fully pipelined. Trade latency for frequency.

Formally verified

Yosys is used to formally verify the standard cell implementation matches gold behavioural models. Amaranth unit tests and Verilator based tests are also used to further verify the design.

Support for many technologies.

vlsiffra currently supports the SkyWater sky130hd, GlobalFoundries GF180MCU and ASAP7 PDKs and standard cell libraries.

Easy to add support for new technologies

vlsiffra only requires a few standard cells (full and half adders, 2 input xor, 2 input and, inverter as well as a couple of more complicated cells (ao21, ao22, ao33)

Installation

vlsiffra is a python package, so this will install it and any dependencies:

pip3 install git+https://github.com/antonblanchard/vlsiffra

Another option is to install it from a checked out source tree:

pip3 install .

Amaranth requires Yosys. If you don’t have a version installed, you can use the amaranth-yosys package:

pip3 install amaranth-yosys

Example usage

Create a GF180MCU 64 bit Kogge-Stone adder:

vlsi-adder --bits=64 --algorithm=koggestone --tech=gf180mcu --output=adder.v

Create an ASAP7 32 bit multiplier, using a Brent-Kung adder:

vlsi-multiplier --bits=32 --algorithm=brentkung --tech=asap7 --output=multiplier.v

Create a sky130hd 2 cycle 64 bit multiply-adder, which was taped out in the OpenPOWER Microwatt core for the Google/Efabless/SkyWater MPW7 shuttle (one for the fixed point multiplier and another for the floating point multiplier):

vlsi-multiplier --bits=64 --multiply-add --algorithm=hancarlson --tech=sky130hd --register-post-ppg --output=multiply_adder_pipelined.v

The two multipliers on the Microwatt MPW7 tape out can be seen on the left side of the die:

Microwatt MPW7 Multipliers

Testing

Local testing requires an installation of both yosys and verilator. Run make check. Submitting a pull request will kick off the same set of tests.

Adding a new technology

Using ASAP7 as an example:

  • A technology file that contains code to instantiate the standard cells required. Use one of the existing ones as a starting point.

    When creating instances, Amaranth uses the i_* prefix for inputs and the o_* prefix for outputs, ie i_VDD means the instance has an input called VDD. As an example, this instantiates the XOR2x1_ASAP7_75t_R xor cell that has A and B inputs and a Y output.

    Also note that ASAP7 inverts the outputs of the full and half adders, so you will see inverters in this file to undo this. Remove them if your technology has non inverting outputs.

    eg Adding the xor definition:

      def _generate_xor(self, a, b, o):
        xorgate = self._PoweredInstance(
            "XOR2x1_ASAP7_75t_R",
            i_A=a,
            i_B=b,
            o_Y=o
        )

        self.m.submodules += xorgate

Issues

  • No support for signed multipliers. Planning to add this.

  • No support for carry in or carry out of adders. Planning to add this.

  • No support for clock gating yet.

  • Formal verification of multipliers is slow, and gets unbearably slow as the multiplier reaches 64 bits. As a result, we formally verify smaller configurations only. We should check if we there are faster equivalence checking methods in Yosys. Another idea might be to verify each output bit in a different Yosys process, parallelising things.

  • Adding more optional register stages. Splitting Dadda reduction into two cycles and perhaps final addition into two cycles would improve the multiplier frequency.

  • We use OpenROAD for cell placement. We might be able to improve the area of the design by doing manual placement, but it’s not clear the effort is worth it. We currently use Yosys to instantiate FFs, so we’d need to do this before attempting manual placement.

  • Support for 4:2 compressors (basically 2 full adders). This is what Bluegene Q uses and might help to improve area and frequency a bit. We’d need to create a 4:2 compressor cell since none of the standard cell

Why vlsiffra?

My last attempt to name an Open Source project resulted in the impossible to Google for “Microwatt” OpenPOWER VHDL core. vlsiffra is a portmanteau of VLSI and siffra, the Swedish word for number. Thanks to @ruscur for the idea. Hello to all our Swedish readers.

[^1]: ASAP7 RVT cells, STA at best corner, 50 ps reserved in the first and second cycles for input and output logic/routing outside the macro.

评论

暂无评论