---
name: "DPGEN_ADSB2F"
section: "3"
platform: "linux"
package: "alliance"
version: "5.1.1-3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/DPGEN_ADSB2F"
---

# DPGEN\_ADSB2F(3)

Adder/Substractor Macro-Generator

## NAME

DPGEN\_ADSB2F - Adder/Substractor Macro-Generator

## SYNOPSIS

**#include  \<genlib.h\>**

**void GENLIB\_MACRO (DPGEN\_ADSB2F, char \****modelname***, long** *flags***, long** *N***);**

## DESCRIPTION

Generate a *N* bits adder/substractor named *modelname*.

How it works :

- •

  if the add\_sub signal is set to '0' an addition is performed, otherwise it's a substraction.

- •

  Operation can be either signed or unsigned. In unsigned mode c31 is the overflow, in unsigned mode you have to compute overflow by **XORing** c31 and c30.

### TERMINAL NAMES

- 1\.

  add\_sub : select addition or substraction (input, 1 bit).

- 2\.

  c31 : carry out. In unsigned mode, this is the overflow (output, 1 bits).

- 3\.

  c30 : used to compute overflow in signed mode : overflow := c31 xor c30 (output, 1 bits).

- 4\.

  i1 : first operand (input, *N* bits).

- 5\.

  i0 : second operand (input, *N* bits).

- 6\.

  q : output (*N* bits).

- 7\.

  vdd : power.

- 8\.

  vss : ground.

## EXAMPLE

```
GENLIB_MACRO(DPGEN_ADSB2F, "model_adsb2f_32"
                            , F_BEHAV|F_PLACE
                            , 32
                            );
GENLIB_LOINS( "model_adsb2f_32"
            , "instance1_adsb2f_32"
            , "add_sub"
            , "c32"
            , "c31"
            , "i1[31:0]"
            , "i0[31:0]"
            ,  "q[31:0]"
            , "vdd", "vss", NULL
            );
```

## SEE ALSO

[**GENLIB\_MACRO**(3)](/GENLIB_MACRO/3.md), [**genlib**(1)](/genlib/1.md)
