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

# DPGEN\_SHIFT(3)

Shifter Macro-Generator

## NAME

DPGEN\_SHIFT - Shifter Macro-Generator

## SYNOPSIS

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

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

## DESCRIPTION

Generate a *N* bits shifter with name *modelname*.

How it works :

- •

  if the op\[0\] signal is set to '1' performs a right shift, performs a left shift otherwise.

- •

  if the op\[1\] signal is set to '1' performs an arithmetic shift (only meaningful in case of a right shift).

- •

  shamt : specifies the shift amount. The width of this signal (*Y*) is computed from the operator's width : Y = ceil(log2(N)) - 1.

### TERMINAL NAMES

- 1\.

  op : select the kind of shift (input, 2 bit).

- 2\.

  shamt : the shift amount (input, *Y* bits).

- 3\.

  i : value to shift (input, *N* bits).

- 4\.

  o : output (*N* bits).

- 5\.

  vdd : power.

- 6\.

  vss : ground.

## EXAMPLE

```
GENLIB_MACRO(DPGEN_SHIFT, "model_shift_32",
                          F_BEHAV|F_PLACE,
                          32);
GENLIB_LOINS("model_shift_32",
             "instance1_shift_32",
             "op[1:0]",
             "shamt[4:0]",
             "x[31:0]",
             "y[31:0]",
             "vdd", "vss", NULL);
```

## SEE ALSO

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