antonblanchard / vlsiffra

Create fast and efficient standard cell based adders, multipliers and multiply-adders.
Apache License 2.0
107 stars 9 forks source link
adder amaranth-hdl booth dadda multiplier physical-design verilog vlsi

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:

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:

      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

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.